Sentiment analysis method, device, storage medium and computer equipment for comment sentences

By preprocessing the comment sentences and screening the multi-level classification model, specific emotional factors in the comment sentences are identified, which solves the problem of not being able to identify the emotional factors within the sentences in the prior art, and realizes efficient emotional analysis of the comment sentences.

CN115934949BActive Publication Date: 2025-08-12VIPSHOP (GUANGZHOU) SOFTWARE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211698922.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2025-08-12
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

Existing comment sentiment analysis methods cannot identify the specific emotional factors within the sentence, and can only identify the overall emotional tendency of the comment.

Method used

By preprocessing the target comment statement, multiple statement fragments are obtained, and the first confidence of each statement fragment is obtained using the pre-trained fragment classification model, the first confidence of each statement fragment is obtained, and the emotional description candidate set and the initial evaluation dimension candidate set are filtered. The second confidence of the statement fragment pair is obtained by combining the fragment pair classification model, and the specific emotional factors of the comment statement are finally identified.

Benefits of technology

It can accurately identify each specific emotional factor in the comment sentence, including evaluation dimensions, emotional descriptions and emotional polarity, improving the accuracy of emotional factors recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115934949B_ABST
    Figure CN115934949B_ABST
Patent Text Reader

Abstract

The present application provides a sentiment analysis method for comment sentences, including obtaining and preprocessing target comment sentences, obtaining sentence fragments and inputting them into a fragment classification model, obtaining the first confidence of the sentence fragments corresponding to each fragment type, and the fragment types include evaluation dimension, sentiment description and first default; screening each sentence fragment to form a sentiment description candidate set and an initial evaluation dimension candidate set; obtaining an evaluation dimension candidate set based on the initial evaluation dimension candidate set; obtaining sentence fragment pairs in the sentiment description candidate set and the evaluation dimension candidate set and inputting them into a fragment pair classification model, obtaining the second confidence of the sentence fragment pairs corresponding to each fragment pair type, and the fragment pair types include sentiment polarity and second default; screening each sentence fragment pair to obtain a target sentence fragment pair; obtaining the sentiment factor of the target comment sentence based on the target sentence fragment pair. Applying the method provided by the present application, it is possible to identify each specific sentiment factor contained in the comment sentence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, storage medium, and computer equipment for sentiment analysis of comment statements. Background Art

[0002] With the gradual development of e-commerce platforms, more and more users are posting product reviews on these platforms. These user reviews often include sentiment. Generally speaking, sentiment factors consist of three elements: evaluation dimension, sentiment description, and sentiment polarity. The evaluation dimension represents the subject being evaluated in the review, the sentiment description represents the emotional expression of the evaluating subject in the review, and the sentiment polarity represents the tendency of a single emotion, which can be positive, neutral, or negative. A sentiment factor must contain both sentiment description and sentiment polarity, but in some cases, the evaluation dimension can be empty.

[0003] In existing comment sentiment analysis methods, only the whole sentence classification model can be used to simply identify the overall emotional tendency of the comment, but it is impossible to identify the specific emotional factors within the sentence. Summary of the Invention

[0004] The purpose of this application is to solve at least one of the above-mentioned technical deficiencies, especially the technical deficiency in the prior art that the specific emotional factors within a sentence cannot be identified.

[0005] In a first aspect, the present application provides a method for sentiment analysis of comment sentences, the method comprising:

[0006] Get the target comment sentence;

[0007] Preprocessing the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence;

[0008] Inputting each of the sentence fragments into a pre-trained fragment classification model to obtain a first confidence level corresponding to each of the sentence fragments in each preset fragment type, wherein the preset fragment types include an evaluation dimension type, an emotion description type, and a first default type;

[0009] Screening each of the sentence fragments based on a preset ratio, each of the first confidence levels, and the length of the target comment sentence to form a candidate set of sentiment descriptions and a candidate set of initial evaluation dimensions;

[0010] Adding preset segments to the initial evaluation dimension candidate set to obtain an evaluation dimension candidate set;

[0011] Obtaining, from the emotion description candidate set and the evaluation dimension candidate set, a plurality of sentence fragment pairs corresponding to the target comment sentence according to a preset rule;

[0012] Inputting each of the sentence segment pairs into a pre-trained segment pair classification model to obtain a second confidence score corresponding to each of the sentence segment pairs in each preset segment pair type, wherein the preset segment pair types include a sentiment polarity type and a second default type;

[0013] Screening each of the sentence segment pairs according to each of the second confidences, and using the screened sentence segment pairs as target sentence segment pairs of the target comment sentence, wherein the segment pair type of the target sentence segment pairs is the sentiment polarity type;

[0014] The evaluation dimension type, the emotion description type, and the emotion polarity type contained in the target sentence segment form the emotion factor of the target review sentence.

[0015] In one embodiment, the step of preprocessing the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence includes:

[0016] Establishing multiple windows sliding along the sentence, wherein the length of each window is greater than zero and less than or equal to a preset length, and the lengths of each two windows are not equal;

[0017] The target comment sentence is processed through each of the windows to obtain the multiple sentence fragments, wherein each of the windows moves a fixed length each time, and the sentence content contained in each of the windows is a sentence fragment.

[0018] In one embodiment, the step of screening each of the sentence fragments based on a preset ratio, each of the first confidences, and the length of the target comment sentence to form a candidate set of sentiment descriptions and a candidate set of initial evaluation dimensions includes:

[0019] Determine the number of selected sentences based on the preset ratio and the length of the target comment sentence, where the number of selected sentences is the number of sentence fragments in the emotion description candidate set and the number of sentence fragments in the initial evaluation dimension candidate set, and the number of sentence fragments in the emotion description candidate set is equal to the number of sentence fragments in the initial evaluation dimension candidate set;

[0020] Sorting each of the sentence fragments according to the first confidence corresponding to the emotion description type to obtain a first sorting result, and sorting each of the sentence fragments according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result;

[0021] According to the selected number, the sentence fragments in the first sorting result are screened to obtain the emotion description candidate set, and the sentence fragments in the second sorting result are screened to obtain the initial evaluation dimension candidate set.

[0022] In one embodiment, the step of determining the number of selected comments based on the preset ratio and the length of the target comment sentence includes:

[0023] Determining an initial value, where the initial value is a product of the preset ratio and the length of the target comment sentence;

[0024] The initial value is rounded according to a preset rounding method, and the integer value obtained by rounding is determined as the selected number.

[0025] In one embodiment, the step of obtaining a plurality of sentence fragment pairs corresponding to the target comment sentence in the emotion description candidate set and the evaluation dimension candidate set according to a preset rule includes:

[0026] Each sentence fragment in the emotion description candidate set is combined with each sentence fragment in the evaluation dimension candidate set in pairs to obtain multiple sentence fragment pairs corresponding to the target comment sentence.

[0027] In one embodiment, the sentiment polarity types include positive, neutral, and negative types, and the step of screening each of the sentence segment pairs based on each of the second confidences and using the screened sentence segment pairs as target sentence segment pairs of the target comment sentence includes:

[0028] For each of the sentence fragment pairs, determining a maximum value among second confidences corresponding to the positive type, the neutral type, the negative type, and the second default type;

[0029] If the segment pair type corresponding to the maximum value belongs to the positive type, the neutral type or the negative type, the sentence segment pair is used as the target sentence segment pair of the target comment sentence.

[0030] In a second aspect, an embodiment of the present application further provides a device for sentiment analysis of comment statements, the device comprising:

[0031] A target comment sentence acquisition module is used to acquire the target comment sentence;

[0032] A target comment sentence preprocessing module, configured to preprocess the target comment sentence to obtain a plurality of sentence fragments corresponding to the target comment sentence;

[0033] a first confidence acquisition module, configured to input each of the sentence fragments into a pre-trained fragment classification model to obtain a first confidence corresponding to each of the sentence fragments in each preset fragment type, wherein the preset fragment types include an evaluation dimension type, an emotion description type, and a first default type;

[0034] A sentence fragment screening module, configured to screen each of the sentence fragments according to a preset ratio, each of the first confidence levels, and the length of the target comment sentence to form a candidate set of sentiment descriptions and a candidate set of initial evaluation dimensions;

[0035] An evaluation dimension candidate set acquisition module, configured to add preset segments to the initial evaluation dimension candidate set to obtain an evaluation dimension candidate set;

[0036] A sentence fragment pair acquisition module is used to obtain a plurality of sentence fragment pairs corresponding to the target comment sentence from the emotion description candidate set and the evaluation dimension candidate set according to preset rules;

[0037] a second confidence acquisition module, configured to input each of the sentence segment pairs into a pre-trained segment pair classification model to obtain a second confidence corresponding to each of the sentence segment pairs in each preset segment pair type, wherein the preset segment pair types include a sentiment polarity type and a second default type;

[0038] a sentence fragment pair screening module, configured to screen each of the sentence fragment pairs according to each of the second confidences, and use the screened sentence fragment pairs as target sentence fragment pairs of the target comment sentence, wherein the target sentence fragment pairs have the sentiment polarity type;

[0039] The emotional factor acquisition module is used to form the emotional factor of the target comment sentence based on the evaluation dimension type, the emotional description type and the emotional polarity type contained in the target sentence fragment.

[0040] In one embodiment, the target comment sentence preprocessing module includes:

[0041] a window establishing unit, configured to establish a plurality of windows sliding along the sentence, wherein the length of each window is greater than zero and less than or equal to a preset length, and the lengths of any two windows are not equal;

[0042] The sentence fragment acquisition unit is used to process the target comment sentence through each of the windows to obtain the multiple sentence fragments, wherein each of the windows moves a fixed length each time, and the sentence content contained in each of the windows is a sentence fragment.

[0043] In a third aspect, an embodiment of the present application provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the sentiment analysis method of the comment statement described in any of the above embodiments.

[0044] In a fourth aspect, an embodiment of the present application provides a computer device, comprising: one or more processors, and a memory:

[0045] The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the one or more processors, the steps of the method for sentiment analysis of comment statements described in any of the above embodiments are performed.

[0046] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages:

[0047] The present application provides a sentiment analysis method for comment sentences, including obtaining and preprocessing target comment sentences, obtaining sentence fragments and inputting them into a fragment classification model, obtaining the first confidence of the sentence fragments corresponding to each fragment type, and the fragment types include evaluation dimension, sentiment description and first default; screening each sentence fragment to form a sentiment description candidate set and an initial evaluation dimension candidate set; obtaining an evaluation dimension candidate set based on the initial evaluation dimension candidate set; obtaining sentence fragment pairs in the sentiment description candidate set and the evaluation dimension candidate set and inputting them into a fragment pair classification model, obtaining the second confidence of the sentence fragment pairs corresponding to each fragment pair type, and the fragment pair types include sentiment polarity and second default; screening each sentence fragment pair to obtain a target sentence fragment pair; obtaining the sentiment factor of the target comment sentence based on the target sentence fragment pair. Applying the method provided by the present application, it is possible to identify each specific sentiment factor contained in the comment sentence. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0049] Figure 1 A flowchart of a sentiment analysis method for comment sentences provided in an embodiment of the present application;

[0050] Figure 2 A schematic diagram of the structure of a sentiment analysis device for comment sentences provided in an embodiment of the present application;

[0051] Figure 3 A schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0053] In one embodiment, the present application provides a method for sentiment analysis of comment statements. The following embodiments are described using the method applied to a server as an example. It is understood that the server that executes the sentiment analysis method for comment statements can be a single server or a server cluster composed of multiple servers, and the present application does not impose any specific restrictions on this. Figure 1 Said method comprises the following steps:

[0054] S101: Obtain target comment sentence;

[0055] In this step, the target review sentence can be obtained from the product review sentence library within the e-commerce platform.

[0056] S102: Preprocessing the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence;

[0057] In this step, after obtaining the target comment sentence, the target comment sentence is preprocessed to obtain multiple sentence fragments corresponding to the target comment sentence. The sentence fragments contain characters of the target comment sentence, such as Chinese characters and English characters.

[0058] S103: Inputting each of the sentence fragments into a pre-trained fragment classification model to obtain a first confidence level corresponding to each of the sentence fragments in each preset fragment type, wherein the preset fragment types include an evaluation dimension type, an emotion description type, and a first default type;

[0059] In this step, after obtaining multiple sentence fragments corresponding to the target comment sentence, each sentence fragment is input into a pre-trained fragment classification model to obtain the first confidence corresponding to each sentence fragment in the evaluation dimension type, emotional description type and first default type.

[0060] Among them, the sentence fragments included in the first default type belong neither to the evaluation dimension type nor to the emotion description type, and the pre-trained fragment classification model may include a neural network-based fragment classification model.

[0061] Furthermore, the training process of the fragment classification model is to obtain a batch of comment sentences, pre-process each comment sentence to obtain multiple sentence fragments, identify the corresponding fragment type for each fragment, including the evaluation dimension type, the emotional description type and the first default type, and use all sentence fragments as training samples and the fragment types corresponding to the sentence fragments as sample labels to train a fragment classification model. For the fragment classification model, a new sentence fragment can be input into the fragment classification model, and the fragment classification model is used to predict the fragment type to which the new sentence fragment belongs, and output the first confidence corresponding to the new sentence fragment in each fragment type. For the same sentence fragment, the sum of the first confidence corresponding to each fragment type is 1.

[0062] For example, sentence fragment A is input into the fragment classification model, and the output is the first confidence of sentence fragment A in the evaluation dimension type is 0.1, the first confidence in the emotional description type is 0.7, and the first confidence in the first default type is 0.2, and the sum of the first confidence corresponding to the evaluation dimension type, the first confidence corresponding to the emotional description type, and the first confidence corresponding to the first default type is 1.

[0063] S104: Screening each of the sentence fragments according to a preset ratio, each of the first confidences, and the length of the target comment sentence to form a sentiment description candidate set and an initial evaluation dimension candidate set;

[0064] In this step, after obtaining the first confidence corresponding to each sentence fragment in each preset fragment type, each sentence fragment is screened according to the preset ratio, each first confidence and the length of the target comment, and multiple sentence fragments are selected from them according to the preset rules to form an initial evaluation dimension candidate set, and multiple sentence fragments are selected to form an emotional description candidate set.

[0065] S105: adding a preset segment to the initial evaluation dimension candidate set to obtain an evaluation dimension candidate set;

[0066] In this step, a preset segment, which may be an "empty" segment, is added to the initial evaluation dimension candidate set to obtain the evaluation dimension candidate set.

[0067] It is understandable that when users comment on products, they can omit the main body of the comment and add "empty" segments, which can improve the accuracy of the candidate set of evaluation dimensions.

[0068] For example, a user posts a comment "too expensive" in a product review area, where the main body of the comment is omitted, that is, the evaluation dimension in the comment statement is "empty".

[0069] S106: Obtaining, from the emotion description candidate set and the evaluation dimension candidate set, a plurality of sentence fragment pairs corresponding to the target comment sentence according to a preset rule;

[0070] In this step, after determining the emotion description candidate set and the evaluation dimension candidate set, the sentence fragments in the emotion description candidate set and the fragments in the evaluation dimension candidate set are combined according to preset rules to obtain multiple sentence fragment pairs corresponding to the target comment sentence.

[0071] The sentence fragment pair is composed of two sentence fragments of different types.

[0072] S107: Inputting each of the sentence segment pairs into a pre-trained segment pair classification model to obtain a second confidence score corresponding to each of the sentence segment pairs in each preset segment pair type, wherein the preset segment pair types include a sentiment polarity type and a second default type;

[0073] In this step, after obtaining a plurality of sentence fragment pairs, each sentence fragment pair is input into a pre-trained fragment pair classification model to obtain a second confidence level corresponding to the sentiment polarity type and the second default type for each sentence fragment pair.

[0074] Among them, the sentence fragment pairs included in the second default type do not belong to the emotional polarity type, the emotional polarity type includes positive type, neutral type and negative type, and the pre-trained fragment pair classification model may include a neural network-based fragment pair classification model.

[0075] Furthermore, the training process of the fragment pair classification model is to indicate the corresponding fragment pair type for each sentence fragment pair, including the sentiment polarity type and the second default type, and to perform a step of identifying the fragment pairs belonging to the sentiment polarity type, including the positive type, the neutral type, and the negative type. All sentence fragment pairs are used as training samples and the fragment pair types corresponding to the sentence fragment pairs are used as sample labels to train a fragment pair classification model. For the fragment pair classification model, a new sentence fragment pair can be input into the fragment pair classification model, and the fragment pair classification model is used to predict the fragment pair type to which the new sentence fragment pair belongs, and the second confidence corresponding to the new sentence fragment pair on each fragment pair type is output. For the same sentence fragment pair, the sum of the second confidence corresponding to each fragment type is 1.

[0076] For example, sentence segment pair B is input into the segment pair classification model, and the output is a second confidence of 1 for sentence segment pair B in the sentiment polarity type, a second confidence of 0 in the second default type, and the sum of the second confidence corresponding to the sentiment polarity type and the second confidence corresponding to the second default type is 1. Specifically, among the second confidences corresponding to the sentiment polarity types, the second confidence for the positive type is 0.3, the second confidence for the neutral type is 0.6, and the second confidence for the negative type is 0.1, and the sum of the second confidence for the positive type, the second confidence for the neutral type, and the second confidence for the negative type is equal to the second confidence for the sentiment polarity type.

[0077] S108: Screening each of the sentence segment pairs according to each of the second confidences, and using the screened sentence segment pairs as target sentence segment pairs of the target comment sentence, wherein the segment pair type of the target sentence segment pairs is the sentiment polarity type;

[0078] In this step, after determining the second confidence corresponding to each sentence segment in the sentiment polarity type and the second default type, sentence segments with a segment pair type of sentiment polarity type are screened out as target sentence segment pairs of the target comment sentence based on each second confidence.

[0079] S109: The evaluation dimension type, the emotion description type, and the emotion polarity type contained in the target sentence segment form the emotion factor of the target review sentence.

[0080] In this step, after determining the target sentence segment pair, the evaluation dimension, emotional description, and emotional polarity contained in the target segment pair form the emotional factors of the target review sentence.

[0081] Furthermore, a comment sentence may correspond to multiple emotional factors. If multiple target sentence fragment pairs are obtained, the evaluation dimensions, emotional descriptions, and emotional polarities contained in each target fragment pair form multiple emotional factors corresponding to the target comment sentence.

[0082] For example, if the comment sentence is "The quality is very good, but too expensive", the target segment contains the evaluation dimension "quality", the emotional description "very good" and the emotional polarity "positive" for "the quality is very good", which forms the first emotional factor of the comment sentence ("quality", "very good", "positive"), and the target segment contains the evaluation dimension "empty", the emotional description "too expensive" and the emotional polarity "negative" for "too expensive", which forms the second emotional factor of the comment sentence ("empty", "too expensive", "negative").

[0083] The present application provides a sentiment analysis method for comment sentences, including obtaining and preprocessing target comment sentences, obtaining sentence fragments and inputting them into a fragment classification model, obtaining the first confidence of the sentence fragments corresponding to each fragment type, and the fragment types include evaluation dimension, sentiment description and first default; screening each sentence fragment to form a sentiment description candidate set and an initial evaluation dimension candidate set; obtaining an evaluation dimension candidate set based on the initial evaluation dimension candidate set; obtaining sentence fragment pairs in the sentiment description candidate set and the evaluation dimension candidate set and inputting them into a fragment pair classification model, obtaining the second confidence of the sentence fragment pairs corresponding to each fragment pair type, and the fragment pair types include sentiment polarity and second default; screening each sentence fragment pair to obtain a target sentence fragment pair; obtaining the sentiment factor of the target comment sentence based on the target sentence fragment pair. Applying the method provided by the present application, it is possible to identify each specific sentiment factor contained in the comment sentence.

[0084] In one embodiment, the step of preprocessing the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence includes:

[0085] Establishing multiple windows sliding along the sentence, wherein the length of each window is greater than zero and less than or equal to a preset length, and the lengths of each two windows are not equal;

[0086] The target comment sentence is processed through each of the windows to obtain the multiple sentence fragments, wherein each of the windows moves a fixed length each time, and the sentence content contained in each of the windows is a sentence fragment.

[0087] Specifically, during the preprocessing of the target comment sentence, a preset length is selected and multiple windows sliding along the sentence are established. The length of each window is no greater than the preset length but greater than zero, and the lengths of each two windows are not equal. Each window slides along the target comment sentence, moving a fixed length in the same direction each time. The sentence content contained in each window is a sentence fragment, thereby obtaining multiple sentence fragments corresponding to the target comment sentence. Sentence fragments include but are not limited to text and punctuation marks.

[0088] For example, for the comment sentence "The quality is very good, but too expensive.", a preset length of 3 is selected, and multiple windows sliding along the sentence are established, with the lengths of each window being 1, 2, and 3 respectively. Then, for the comment sentence, the window with a length of 1 can be used to process the sentence fragments "quality", "quantity", "very", "good", "," "just", "is", "too", "expensive", and "."; the window with a length of 2 can be used to process the sentence fragments "quality", "quantity is very", "very good", "good," ","just", "just", "is too", "too expensive", and "expensive."; the window with a length of 3 can be used to process the sentence fragments "quality is very", "quantity is very good", "very good," "good, just", ","just", "is too", "is too expensive", and "too expensive."

[0089] It can be understood that the number of segment pairs can be controlled by presetting the length, thereby reducing the amount of calculation. By processing the target comment sentence through windows of different lengths, the content contained in the sentence segment can be increased, thereby improving the accuracy of identifying the emotional factors of the target comment sentence.

[0090] In one embodiment, the step of screening each of the sentence fragments based on a preset ratio, each of the first confidences, and the length of the target comment sentence to form a candidate set of sentiment descriptions and a candidate set of initial evaluation dimensions includes:

[0091] Determine the number of selected sentences based on the preset ratio and the length of the target comment sentence, where the number of selected sentences is the number of sentence fragments in the emotion description candidate set and the number of sentence fragments in the initial evaluation dimension candidate set, and the number of sentence fragments in the emotion description candidate set is equal to the number of sentence fragments in the initial evaluation dimension candidate set;

[0092] Sorting each of the sentence fragments according to the first confidence corresponding to the emotion description type to obtain a first sorting result, and sorting each of the sentence fragments according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result;

[0093] According to the selected number, the sentence fragments in the first sorting result are screened to obtain the emotion description candidate set, and the sentence fragments in the second sorting result are screened to obtain the initial evaluation dimension candidate set.

[0094] Specifically, based on the preset ratio and the length of the target comment sentence, the number of selections is determined, and each sentence fragment is sorted from large to small according to the first confidence corresponding to the emotional description type to obtain a first sorting result. In the first sorting result, sentence fragments are selected to form an emotional description candidate set. Each sentence fragment is sorted from large to small according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result. In the second sorting result, sentence fragments are selected to form an initial evaluation dimension candidate set.

[0095] For example, based on a preset ratio and the length of the target comment sentence, the number X to be selected is determined, and each sentence is sorted from large to small according to the first confidence corresponding to the emotional description type to obtain a first sorting result. In the first sorting result, the first X sentence fragments are selected to form an emotional description candidate set. Each sentence is sorted from large to small according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result. In the second sorting result, the first X sentence fragments are selected to form an initial evaluation dimension candidate set.

[0096] It can be understood that by filtering sentence fragments by the first confidence level, the recognition accuracy of the emotional factors of the target comment sentence can be improved, the number of selections is determined by the preset ratio and the length of the target comment sentence, and sentence fragments are selected according to the number of selections to form the emotional description candidate set and the initial evaluation dimension candidate set, which can reduce the amount of calculation.

[0097] In one embodiment, the step of determining the number of selected comments based on the preset ratio and the length of the target comment sentence includes:

[0098] Determining an initial value, where the initial value is a product of the preset ratio and the length of the target comment sentence;

[0099] The initial value is rounded according to a preset rounding method, and the integer value obtained by rounding is determined as the selected number.

[0100] Specifically, a preset ratio is selected, and the preset ratio is multiplied by the length of the target comment sentence. The resulting product value is determined as the initial value, and the initial value is rounded according to a preset rounding method to determine the number of selections.

[0101] For example, if the preset ratio z and the target comment sentence length n are selected, the initial value nz is determined to be an integer. If the initial value nz is an integer, the initial value nz is determined to be the selected number. If the initial value nz is a decimal, the initial value nz is rounded up and the rounded integer value is determined to be the selected number. The rounding method is rounding up. For example, if the initial value nz is 6.1, the initial value nz is rounded to 7. The value range of the preset ratio z is greater than 0 and less than 1, and the target comment sentence length n is the character length of the target comment sentence.

[0102] It can be understood that determining the number of selections by the product of a preset ratio and the length of the target comment sentence can reduce the amount of calculation, round the initial value, and ensure that the number of sentence fragments in the emotion description candidate set and the initial evaluation dimension candidate set is sufficient, thereby improving the accuracy of identifying the emotional factors of the target comment sentence.

[0103] In one embodiment, the step of obtaining a plurality of sentence fragment pairs corresponding to the target comment sentence in the emotion description candidate set and the evaluation dimension candidate set according to a preset rule includes:

[0104] Each sentence fragment in the emotion description candidate set is combined with each sentence fragment in the evaluation dimension candidate set in pairs to obtain multiple sentence fragment pairs corresponding to the target comment sentence.

[0105] Specifically, each sentence fragment in the emotion description candidate set is combined with each sentence fragment in the evaluation dimension candidate set, and the number of sentence fragment pairs obtained is the product of the number of sentence fragments in the emotion description candidate set and the number of sentence fragments in the evaluation dimension candidate set.

[0106] For example, if the emotion description candidate set contains sentence fragment 1 and sentence fragment 2, and the evaluation dimension candidate set contains sentence fragment 3, sentence fragment 4 and sentence fragment 5, then each sentence fragment in the emotion description candidate set is combined with each sentence fragment in the evaluation dimension candidate set in pairs to obtain (sentence fragment 1, sentence fragment 3), (sentence fragment 1, sentence fragment 4), (sentence fragment 1, sentence fragment 5), (sentence fragment 2, sentence fragment 3), (sentence fragment 2, sentence fragment 4) and (sentence fragment 2, sentence fragment 4), and obtain 6 sentence fragment pairs.

[0107] It can be understood that by combining each sentence fragment in the sentiment description candidate set with each sentence fragment in the evaluation dimension candidate set, various combinations of sentence fragment pairs can be obtained, thereby improving the recognition accuracy of the sentiment factors of the target comment sentence.

[0108] In one embodiment, the sentiment polarity types include positive, neutral, and negative types, and the step of screening each of the sentence segment pairs according to each of the second confidences and using the screened sentence segment pairs as the target sentence segment pairs of the target comment sentence includes:

[0109] For each of the sentence fragment pairs, determining a maximum value among second confidences corresponding to the positive type, the neutral type, the negative type, and the second default type;

[0110] If the segment pair type corresponding to the maximum value belongs to the positive type, the neutral type or the negative type, the sentence segment pair is used as the target sentence segment pair of the target comment sentence.

[0111] Specifically, in the process of determining the target sentence fragment pair, first determine the second confidence with the largest value among the second confidences corresponding to the positive type, neutral type, negative type and second default type for each sentence fragment pair, and then judge whether the segment pair type corresponding to the second confidence with the largest value belongs to the positive type, neutral type or negative type. If so, the sentence fragment pair is used as the target sentence fragment pair of the target comment sentence.

[0112] For example, if the second confidence of sentence fragment pair C on the positive type is 0.5, the second confidence on the neutral type is 0.1, the second confidence on the negative type is 0.1, and the second confidence on the second default type is 0.3, then the maximum value among each second confidence is 0.5, and the segment pair type corresponding to the maximum value 0.5 is the positive type, so it can be determined that sentence fragment pair A is the target sentence fragment pair of the target comment sentence; if the second confidence of sentence fragment pair B on the positive type is 0.2, the second confidence on the neutral type is 0.1, the second confidence on the negative type is 0.1, and the second confidence on the second default type is 0.6, then the maximum value among each second confidence is 0.6, and the segment pair type corresponding to the maximum value 0.6 is the second default type, so sentence fragment pair D cannot be used as the target sentence fragment pair of the target comment sentence.

[0113] It is understandable that there must be emotional polarity in an emotional factor. The second confidence level is used to determine whether a sentence segment pair has emotional polarity, and the sentence segment pair with emotional polarity is determined as the target sentence segment pair, thereby improving the recognition accuracy of the emotional factors of the target comment sentence.

[0114] The following describes the sentiment analysis device for comment sentences provided in an embodiment of the present application. The sentiment analysis device for comment sentences described below and the sentiment analysis method for comment sentences described above can be referenced to each other.

[0115] In one embodiment, the present application provides a sentiment analysis device for comment sentences. Figure 2 The device specifically includes a target comment sentence acquisition module 201, a target comment sentence preprocessing module 202, a first confidence acquisition module 203, a sentence fragment screening module 204, an evaluation dimension candidate set acquisition module 205, a sentence fragment pair acquisition module 206, a second confidence acquisition module 207, a sentence fragment pair screening module 208 and an emotional factor acquisition module 209, wherein:

[0116] Target comment sentence acquisition module 201, used to acquire target comment sentence;

[0117] A target comment sentence preprocessing module 202 is used to preprocess the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence;

[0118] A first confidence acquisition module 203 is configured to input each of the sentence segments into a pre-trained segment classification model to obtain a first confidence corresponding to each of the sentence segments in each preset segment type, wherein the preset segment types include an evaluation dimension type, an emotion description type, and a first default type;

[0119] A sentence fragment screening module 204 is configured to screen each of the sentence fragments based on a preset ratio, each of the first confidence levels, and the length of the target comment sentence to form a candidate set of sentiment descriptions and a candidate set of initial evaluation dimensions;

[0120] An evaluation dimension candidate set acquisition module 205 is configured to add a preset segment to the initial evaluation dimension candidate set to obtain an evaluation dimension candidate set;

[0121] A sentence fragment pair acquisition module 206 is configured to obtain, from the emotion description candidate set and the evaluation dimension candidate set, a plurality of sentence fragment pairs corresponding to the target review sentence according to a preset rule;

[0122] a second confidence obtaining module 207 for inputting each of the sentence segment pairs into a pre-trained segment pair classification model to obtain a second confidence corresponding to each of the sentence segment pairs in each preset segment pair type, wherein the preset segment pair types include a sentiment polarity type and a second default type;

[0123] a sentence fragment pair screening module 208 for screening each of the sentence fragment pairs according to each of the second confidences, and using the screened sentence fragment pairs as target sentence fragment pairs of the target comment sentence, wherein the target sentence fragment pairs have the sentiment polarity type;

[0124] The emotional factor acquisition module 209 is configured to form the emotional factor of the target review sentence based on the evaluation dimension type, the emotional description type, and the emotional polarity type contained in the target sentence segment.

[0125] In one embodiment, the target comment sentence pre-processing module 202 includes a window establishment unit and a sentence fragment acquisition unit, wherein:

[0126] a window establishing unit, configured to establish a plurality of windows sliding along the sentence, wherein the length of each window is greater than zero and less than or equal to a preset length, and the lengths of any two windows are not equal;

[0127] The sentence fragment acquisition unit is used to process the target comment sentence through each of the windows to obtain the multiple sentence fragments, wherein each of the windows moves a fixed length each time, and the sentence content contained in each of the windows is a sentence fragment.

[0128] In one embodiment, the sentence fragment screening module 204 includes a selection number determination unit, a sentence fragment sorting unit, and a sentence fragment screening unit, wherein:

[0129] A selection number determination unit is used to determine the selection number based on the preset ratio and the length of the target comment sentence, wherein the selection number is the number of sentence fragments in the emotion description candidate set and the number of sentence fragments in the initial evaluation dimension candidate set, and the number of sentence fragments in the emotion description candidate set is equal to the number of sentence fragments in the initial evaluation dimension candidate set;

[0130] a sentence fragment sorting unit, configured to sort each of the sentence fragments according to the first confidence corresponding to the emotion description type to obtain a first sorting result, and to sort each of the sentence fragments according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result;

[0131] A sentence fragment screening unit is used to screen the sentence fragments in the first sorting result according to the number of selections to obtain the emotion description candidate set, and to screen the sentence fragments in the second sorting result to obtain the initial evaluation dimension candidate set.

[0132] In one embodiment, the selected number determination unit includes an initial value determination subunit and a selected number determination subunit, wherein:

[0133] an initial value determination subunit, configured to determine an initial value, wherein the initial value is a product of the preset ratio and the length of the target comment sentence;

[0134] The selected number determination subunit is used to round the initial value according to a preset rounding method, and determine the integer value obtained by rounding as the selected number.

[0135] In one embodiment, the sentence fragment pair acquisition module 206 includes a sentence fragment pair acquisition unit, wherein:

[0136] The sentence fragment pair acquisition unit is used to combine each sentence fragment in the emotion description candidate set with each sentence fragment in the evaluation dimension candidate set in pairs to obtain multiple sentence fragment pairs corresponding to the target comment sentence.

[0137] In one embodiment, the sentiment polarity types include positive, neutral, and negative types, and the sentence fragment pair screening module 208 includes a maximum value determination unit and a sentence fragment pair screening unit, wherein:

[0138] a maximum value determining unit, configured to determine, for each pair of sentence fragments, a maximum value among the second confidences corresponding to the positive type, the neutral type, the negative type, and the second default type;

[0139] The sentence fragment pair screening unit uses the sentence fragment pair as the target sentence fragment pair of the target comment sentence if the segment pair type corresponding to the maximum value belongs to the positive type, the neutral type or the negative type.

[0140] In one embodiment, the present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the sentiment analysis method of the comment statement as described in any of the above embodiments.

[0141] In one embodiment, the present application also provides a computer device having computer-readable instructions stored therein. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the sentiment analysis method for comment statements as described in any of the above embodiments.

[0142] Schematically, as Figure 3 As shown, Figure 3 This is a schematic diagram of the internal structure of a computer device provided in an embodiment of the present application. The computer device 300 can be provided as a server. Figure 3 Computer device 300 includes a processing component 302, which further includes one or more processors, and a memory resource represented by memory 301 for storing instructions executable by processing component 302, such as an application. The application stored in memory 301 may include one or more modules, each corresponding to a set of instructions. In addition, processing component 302 is configured to execute the instructions to perform the method for sentiment analysis of comment sentences according to any of the above-mentioned embodiments.

[0143] The computer device 300 may further include a power supply component 303 configured to perform power management of the computer device 300, a wired or wireless network interface 304 configured to connect the computer device 300 to a network, and an input / output (I / O) interface 305. The computer device 300 may operate based on an operating system stored in the memory 301, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or the like.

[0144] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0145] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0146] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referenced to each other.

[0147] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A sentiment analysis method for comment sentences, characterized in that: The method comprises: Get the target comment sentence; Preprocessing the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence; Inputting each of the sentence fragments into a pre-trained fragment classification model to obtain a first confidence level corresponding to each of the sentence fragments in each preset fragment type, wherein the preset fragment types include an evaluation dimension type, an emotion description type, and a first default type; Determine the number of selected sentences based on a preset ratio and the length of the target comment sentence, where the number of selected sentences is the number of sentence fragments in the emotion description candidate set and the number of sentence fragments in the initial evaluation dimension candidate set, and the number of sentence fragments in the emotion description candidate set is equal to the number of sentence fragments in the initial evaluation dimension candidate set; Sorting each of the sentence fragments according to the first confidence corresponding to the emotion description type to obtain a first sorting result, and sorting each of the sentence fragments according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result; According to the selected number, the sentence fragments in the first sorting result are screened to obtain a candidate set of emotion descriptions, and the sentence fragments in the second sorting result are screened to obtain a candidate set of initial evaluation dimensions; Adding preset segments to the initial evaluation dimension candidate set to obtain an evaluation dimension candidate set; Obtaining, from the emotion description candidate set and the evaluation dimension candidate set, a plurality of sentence fragment pairs corresponding to the target comment sentence according to a preset rule; Inputting each of the sentence segment pairs into a pre-trained segment pair classification model to obtain a second confidence score corresponding to each of the sentence segment pairs in each preset segment pair type, wherein the preset segment pair types include a sentiment polarity type and a second default type; Screening each of the sentence segment pairs according to each of the second confidences, and using the screened sentence segment pairs as target sentence segment pairs of the target comment sentence, wherein the segment pair type of the target sentence segment pairs is the sentiment polarity type; The evaluation dimension type, the emotion description type, and the emotion polarity type contained in the target sentence segment form the emotion factor of the target review sentence.

2. The sentiment analysis method of comment sentences according to claim 1 is characterized in that The step of preprocessing the target comment sentence to obtain multiple sentence fragments corresponding to the target comment sentence includes: Establishing multiple windows sliding along the sentence, wherein the length of each window is greater than zero and less than or equal to a preset length, and the lengths of each two windows are not equal; The target comment sentence is processed through each of the windows to obtain the multiple sentence fragments, wherein each of the windows moves a fixed length each time, and the sentence content contained in each of the windows is a sentence fragment.

3. The sentiment analysis method of comment sentences according to claim 1, characterized in that The step of determining the number of selected comments based on the preset ratio and the length of the target comment sentence includes: Determining an initial value, where the initial value is a product of the preset ratio and the length of the target comment sentence; The initial value is rounded according to a preset rounding method, and the integer value obtained by rounding is determined as the selected number.

4. The sentiment analysis method of comment sentences according to claim 1, characterized in that The step of obtaining a plurality of sentence fragment pairs corresponding to the target comment sentence in the emotion description candidate set and the evaluation dimension candidate set according to a preset rule comprises: Each sentence fragment in the emotion description candidate set is combined with each sentence fragment in the evaluation dimension candidate set in pairs to obtain multiple sentence fragment pairs corresponding to the target comment sentence.

5. The sentiment analysis method of comment sentences according to claim 1 is characterized in that: The emotion polarity types include positive type, neutral type and negative type; The step of screening each of the sentence fragment pairs according to each of the second confidences and using the screened sentence fragment pairs as the target sentence fragment pairs of the target comment sentence includes: For each of the sentence fragment pairs, determining a maximum value among second confidences corresponding to the positive type, the neutral type, the negative type, and the second default type; If the segment pair type corresponding to the maximum value belongs to the positive type, the neutral type or the negative type, the sentence segment pair is used as the target sentence segment pair of the target comment sentence.

6. A sentiment analysis device for comment sentences, characterized in that: include: A target comment sentence acquisition module is used to acquire the target comment sentence; A target comment sentence preprocessing module, configured to preprocess the target comment sentence to obtain a plurality of sentence fragments corresponding to the target comment sentence; a first confidence acquisition module, configured to input each of the sentence fragments into a pre-trained fragment classification model to obtain a first confidence corresponding to each of the sentence fragments in each preset fragment type, wherein the preset fragment types include an evaluation dimension type, an emotion description type, and a first default type; A sentence fragment screening module is used to determine the number of selections based on a preset ratio and the length of the target comment sentence, the number of selections being the number of sentence fragments in the emotion description candidate set and the number of sentence fragments in the initial evaluation dimension candidate set, and the number of sentence fragments in the emotion description candidate set is equal to the number of sentence fragments in the initial evaluation dimension candidate set; sorting each of the sentence fragments according to the first confidence corresponding to the emotion description type to obtain a first sorting result, and sorting each of the sentence fragments according to the first confidence corresponding to the evaluation dimension type to obtain a second sorting result; screening the sentence fragments in the first sorting result according to the number of selections to obtain the emotion description candidate set, and screening the sentence fragments in the second sorting result to obtain the initial evaluation dimension candidate set; An evaluation dimension candidate set acquisition module, configured to add preset segments to the initial evaluation dimension candidate set to obtain an evaluation dimension candidate set; A sentence fragment pair acquisition module is used to obtain a plurality of sentence fragment pairs corresponding to the target comment sentence from the emotion description candidate set and the evaluation dimension candidate set according to preset rules; a second confidence acquisition module, configured to input each of the sentence segment pairs into a pre-trained segment pair classification model to obtain a second confidence corresponding to each of the sentence segment pairs in each preset segment pair type, wherein the preset segment pair types include a sentiment polarity type and a second default type; a sentence fragment pair screening module, configured to screen each of the sentence fragment pairs according to each of the second confidences, and use the screened sentence fragment pairs as target sentence fragment pairs of the target comment sentence, wherein the target sentence fragment pairs have the sentiment polarity type; The emotional factor acquisition module is used to form the emotional factor of the target comment sentence based on the evaluation dimension type, the emotional description type and the emotional polarity type contained in the target sentence fragment.

7. The device for sentiment analysis of comment sentences according to claim 6, characterized in that The target comment sentence preprocessing module includes: a window establishing unit, configured to establish a plurality of windows sliding along the sentence, wherein the length of each window is greater than zero and less than or equal to a preset length, and the lengths of any two windows are not equal; The sentence fragment acquisition unit is used to process the target comment sentence through each of the windows to obtain the multiple sentence fragments, wherein each of the windows moves a fixed length each time, and the sentence content contained in each of the windows is a sentence fragment.

8. A storage medium, characterized in that: The storage medium stores computer-readable instructions, which, when executed by one or more processors, enable the one or more processors to perform the steps of the method for sentiment analysis of comment statements as described in any one of claims 1 to 5.

9. A computer device, characterized in that: include: one or more processors, and memory; The memory stores computer-readable instructions, which, when executed by the one or more processors, perform the steps of the method for sentiment analysis of comment statements as claimed in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and device for determining sentence sentiment

    CN106855852A

  • User comment analyzing method and device

    CN108228563A