A semantic sentiment recognition method
Through a semantic emotion recognition method, combining emotion dictionary and semantic segmentation technology, the emotional intensity score of clauses is calculated and weight adjustment is made, which solves the problems of field limitations and insufficient coverage in the existing technology, and achieves the improvement Accurate emotional classification and higher coverage.
Patent Information
- Application Number
- CN202011421315.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-08
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-12-08
AI Technical Summary
The existing emotion classification method based on emotion dictionary has problems such as the domain limitations of emotion dictionary, insufficient coverage rate, and poor effectiveness in judging emotional tendencies based on emotional vocabulary alone.
A semantic emotion recognition method is proposed, by creating an emotion dictionary, a degree adverb dictionary and a negative word dictionary, combining semantic segmentation and vocabulary matching, the emotional intensity score of the clause is calculated, and the final emotion classification is calculated through weight adjustment and evaluation functions.
It improves the accuracy of emotion classification based on emotion dictionary, reduces the number of misjudgments, enhances the coverage of emotional vocabulary, and improves the effect of judging emotional tendencies by relying solely on emotional vocabulary.
Smart Images

Figure CN112417892B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of emotion recognition, and in particular to a semantic emotion recognition method. Background Art
[0002] At present, there are two main methods of sentiment analysis (or emotion analysis): the analysis method based on sentiment dictionary and the analysis method based on machine learning (or deep learning). Both methods have their own advantages and disadvantages. The analysis method based on sentiment dictionary is relatively basic and is also commonly used because it is more flexible and convenient to update and adjust. However, its disadvantages are as follows:
[0003] 1. Sentiment dictionaries are usually domain-specific. The coverage of the dictionary determines the effect of sentiment classification to a certain extent. If the scale is small, many sentiment words will be missed. If the scope is too large, the distinction is not strong, which will cause errors in the analysis results.
[0004] 2. There is no universal and complete sentiment dictionary. The more mature open source dictionaries include HowNet Chinese-English Dictionary, National Taiwan University's Chinese Sentiment Polarity Dictionary, LIWC, Dalian University of Technology's Chinese Sentiment Vocabulary Ontology, Tsinghua University's Li Jun Chinese Positive and Negative Dictionary, etc. Their dictionary annotation methods are different, which makes them more troublesome to use.
[0005] Sentiment tendency is not only related to sentiment words, but also has an important relationship with the expression method or syntactic rules of sentiment words. Sentiment classification cannot be completed well by relying solely on sentiment dictionaries. Summary of the invention
[0006] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a semantic emotion recognition method to improve the accuracy of emotion classification based on emotion dictionaries, reduce the number of misjudgments, and solve the problem that the effect of judging emotion tendency by relying solely on emotion vocabulary is poor.
[0007] An embodiment of the present invention solves the technical problem by adopting a technical solution: a semantic emotion recognition method, comprising the following steps:
[0008] Step S1, creating a sentiment dictionary, a degree adverb dictionary and a negation word dictionary;
[0009] Step S2, dividing the text to be classified into a number of clauses by sentence, and then dividing the clauses into a number of words by semantics;
[0010] Step S3, finding the vocabulary matching each clause by comparing the emotion dictionary, degree adverb dictionary and negation dictionary, and obtaining the intensity score or level score marked by the dictionary;
[0011] Step S4: Denote the basic intensity score of the current emotion word as Si. If a negation word appears within the previous n positions before the position where this emotion word is located, for a positive emotion word, the emotional polarity intensity shifts left by L units, and Si = ∑(Si - L); for a negative emotion word, the emotional polarity intensity shifts right by R units, and Si = ∑(Si + R). If an adverb of degree appears within the previous n positions before the position where this emotion word is located, denote the intensity score of this adverb as Wi. According to the degree of the adverb of degree, the emotional polarity intensity score at this position is multiplied by the coefficient marked in the corresponding dictionary, and Si = ∑(Wi×Si).汇总整句的情感强度分数得到总分WS,WS = ∑Si,WS represents the total emotional score obtained after traversing and calculating all the emotion words, adverbs of degree, and negation words in this clause.
[0012] Step S5:汇总各个子句的分析结果,包括正面子句总句数Pos、中立子句总句数Mid、负面子句总句数Neg、总句数N = Pos + Mid + Neg、正面子句总分数PWS、负面子句总分数NWS、总分数TWS = PWS + NWS,字符总数Char。Summarize the analysis results of each clause, including the total number of positive clauses Pos, the total number of neutral clauses Mid, the total number of negative clauses Neg, the total number of clauses N = Pos + Mid + Neg, the total score of positive clauses PWS, the total score of negative clauses NWS, the total score TWS = PWS + NWS, and the total number of characters Char.
[0013] The described semantic emotion recognition method further includes step S6:
[0014] Adjust the weight coefficient of NWS in TWS. The weight coefficient of NWS is set as α, then TWS = PWS + α×NWS, where the value of α is set as 1.5.
[0015] The described semantic emotion recognition method further includes step S7:
[0016] 利用评估函数Score=(TWS / N +σ×TWS / Char) / 2计算得到全文情绪评估分数Score,将评估分数Score代入判别函数Fun=Score / (Score×Score+β)½计算得到最终的整体情感分类,若Fun>= 0.5,则最终待分析文本判为正面;若Fun<= -0.5,则最终待分析文本判为负面;若-0.5<Fun<0.5,则最终待分析文本判为中立,其中,σ和β为系数。Calculate the full-text emotion evaluation score Score using the evaluation function Score = (TWS / N + σ×TWS / Char) / 2. Substitute the evaluation score Score into the discrimination function Fun = Score / √(Score×Score + β) to calculate the final overall emotion classification. If Fun >= 0.5, the text to be analyzed finally is judged as positive; if Fun <= -0.5, the text to be analyzed finally is judged as negative; if -0.5 < Fun < 0.5, the text to be analyzed finally is judged as neutral, where σ and β are coefficients.
[0017] Preferably, the value of the coefficient σ is set as 30.
[0018] Preferably, the value of the coefficient β is set as 7.
[0019] In step S4:
[0020] If it is a long text, the total emotion of the specified number of clauses at the beginning and the end will be given importance, and the priority weighting will be multiplied by the corresponding weighting coefficient θ, then the adjusted total emotion score of the clause WS = WS×θ; if the total score WS of the clause is > 0, the emotional tendency of the clause is judged to be positive; if the total score WS of the clause is < 0, the emotional tendency of the clause is judged to be negative; if the total score WS of the clause is 0, the emotional tendency of the clause is judged to be neutral.
[0021] Preferably, the number of clauses in the long article is not less than 10.
[0022] Preferably, the first and last two sentences are weighted first.
[0023] Preferably, the value of the weighting coefficient θ is set to 1.5.
[0024] The beneficial effects of the present invention are as follows: through the semantic emotion recognition method disclosed by the present invention, the accuracy of emotion classification based on emotion dictionary can be improved, the number of misjudgments can be reduced, the limitations of the emotion dictionary field can be solved, the coverage of emotion vocabulary can be improved, and the problem of poor effect of solely relying on emotion vocabulary to judge emotion tendency can be solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0026] Figure 1 This is a table of some words in the emotion dictionary and their corresponding intensity scores;
[0027] Figure 2 This is a table of some words in the dictionary of degree adverbs and their corresponding intensity scores;
[0028] Figure 3 A partial list of words in a negation dictionary. DETAILED DESCRIPTION
[0029] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.
[0030] In the description of the present invention, the meaning of "above", "below", "exceed", etc. is not inclusive of the number itself, and the meaning of "above", "below", "within", etc. is inclusive of the number itself. If there is a description of "first" or "second", it is only used to distinguish the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0031] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0032] In the present invention, unless otherwise clearly defined, the words "set", "install", "connect" and the like should be understood in a broad sense, for example, they can be directly connected or indirectly connected through an intermediate medium; they can be fixedly connected or detachably connected or integrally formed; they can be mechanically connected; they can be the internal connection of two elements or the interaction relationship between two elements. Those skilled in the art can reasonably determine the specific meanings of the above words in the present invention in combination with the specific content of the technical solution.
[0033] Reference Figures 1 to 3 , a semantic emotion recognition method, comprising the following steps:
[0034] Step S1, creating a sentiment dictionary, a degree adverb dictionary and a negation word dictionary;
[0035] Step S2, dividing the text to be classified into a number of clauses by sentence, and then dividing the clauses into a number of words by semantics;
[0036] Step S3, finding the vocabulary matching each clause by comparing the emotion dictionary, degree adverb dictionary and negation dictionary, and obtaining the intensity score or level score marked by the dictionary;
[0037] Step S4, the basic strength score of the current sentiment word is recorded as Si, if a negative word appears one or two positions before the position where the sentiment word is located, the sentiment polarity strength of the positive word is shifted to the left by 8 units, Si = ∑ (Si - 8), and the sentiment polarity strength of the negative word is shifted to the right by 8 units, Si = ∑ (Si + 8); if a degree adverb appears one or two positions before the position where the sentiment word is located, the strength score of the adverb is recorded as Wi, and according to the degree of the degree adverb, the sentiment polarity strength score at this position is multiplied by the coefficient marked in the corresponding dictionary, Si = ∑ (Wi × Si), and the sentiment strength scores of the whole sentence are summarized to obtain the total score WS, WS = ∑ Si, WS represents the total sentiment score obtained after traversing and calculating all the sentiment words, degree adverbs, and negative words in the clause;
[0038] Step S5: Summarize the analysis results of each clause, including the total number of positive clauses Pos, the total number of neutral clauses Mid, the total number of negative clauses Neg, the total number of clauses N = Pos + Mid + Neg, the total score of positive clauses PWS, the total score of negative clauses NWS, and the total score TWS = PWS + NWS.
[0039] In the present invention, popular and mature open-source dictionary resources are integrated, which are convenient to use and are used for real-time machine coding using an algorithm model to achieve automated sentiment classification, and can quickly and relatively accurately identify semantic sentiment.
[0040] The semantic emotion recognition method further includes step S6:
[0041] Adjust the weight coefficient of NWS in TWS. The weight coefficient of NWS is set to 1.5, then TWS = PWS + 1.5×NWS; this is because in the same situation, negative semantics usually have a more profound impact on people than positive semantics, so the weight coefficient of NWS is adjusted.
[0042] The semantic emotion recognition method further includes step S7:
[0043] Use the evaluation function Score = (TWS / N + 30×TWS / Char) / 2 to calculate the full-text emotion evaluation score Score, substitute the evaluation score Score into the judgment function Fun = Score / (Score×Score + 7)½ to calculate the final overall sentiment classification. If Fun >= 0.5, the text to be analyzed finally is judged as positive; if Fun <= -0.5, the text to be analyzed finally is judged as negative; if -0.5 < Fun < 0.5, the text to be analyzed finally is judged as neutral, where σ and β are coefficients; this is because the emotional tendency is not only directly related to semantics but also related to the length of the text. Usually, the longer the text, unless the polarity is particularly obvious, the more it tends to be neutral.
[0044] In step S4:
[0045] If it is a long text, pay attention to the total emotion of a specified number of clauses at the beginning and end, and give priority to multiplying by the corresponding weight coefficient θ. Then the adjusted sentiment total score WS of the clause is WS = WS×θ; if the total score WS of the clause > 0, the sentiment tendency of the clause is judged as positive; if the total score WS of the clause < 0, the sentiment tendency of the clause is judged as negative; if the total score WS of the clause = 0, the sentiment tendency of the clause is judged as neutral.
[0046] The number of clauses in the long text is not less than 10 sentences; the first and last 2 sentences are weighted first; the value of the weighting coefficient θ is set to 1.5; in the case of non-"long text", that is, when the number of clauses is less than 10 sentences, no adjustment is made, that is, the weighting coefficient θ=1.
[0047] Reference Figure 1 , is an emotion dictionary, which displays some words in the emotion dictionary and their corresponding emotion intensity levels and scores. 1, 3, 5, 7, and 9 are used to distinguish the emotion intensity. The higher the score, the greater the emotion intensity, and vice versa. The positive and negative signs are used to distinguish the direction of the emotion tendency. "+" (generally omitted) indicates a positive word and "-" indicates a negative word, that is, there are 10 marking values in total.
[0048] Reference Figure 2 , is a dictionary of degree adverbs, which displays some words in the emotion dictionary and their corresponding emotion intensity levels and scores. It uses 1.8, 1.4, 1.1, 0.6, and 0.2 to distinguish the intensity. The higher the score, the greater the impact on the modified emotion word, and vice versa.
[0049] Reference Figure 3 , which is a dictionary of negative words, including but not limited to "no", "won't", "no", "non", "no", "not necessarily", "not", and "without"; negative words are words that express negative meanings. Their appearance will change the emotional tendency of the modified words, but it is often not a polarity reversal. For example, "I don't particularly like..." does not mean "hate", but still has a certain degree of "like".
[0050] Of course, the present invention is not limited to the above-mentioned embodiments, and those skilled in the art may make equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications and substitutions are all included in the scope defined by the claims of this application.
Claims
1. A semantic emotion recognition method, characterized in that: The steps include: Step S1, creating a sentiment dictionary, a degree adverb dictionary and a negation word dictionary; Step S2, dividing the text to be classified into a number of clauses by sentence, and then dividing the clauses into a number of words by semantics; Step S3, finding the vocabulary matching each clause by comparing the emotion dictionary, degree adverb dictionary and negation dictionary, and obtaining the intensity score or level score marked by the dictionary; Step S4, the basic strength score of the current sentiment word is recorded as Si, if a negative word appears in the n positions before the position of the sentiment word, the sentiment polarity strength of the positive word is shifted to the left by L units, Si = ∑ (Si - L), and the sentiment polarity strength of the negative word is shifted to the right by R units, Si = ∑ (Si + R); if a degree adverb appears in the n positions before the position of the sentiment word, the strength score of the adverb is recorded as Wi, and according to the degree of the degree adverb, the sentiment polarity strength score at this position is multiplied by the coefficient marked in the corresponding dictionary, Si = ∑ (Wi × Si), and the sentiment strength scores of the whole sentence are summarized to obtain the total score WS, WS = ∑ Si, WS represents the total sentiment score obtained after traversing and calculating all the sentiment words, degree adverbs, and negative words in the clause; Step S5, summarizing the analysis results of each clause, including the total number of positive clauses Pos, the total number of neutral clauses Mid, the total number of negative clauses Neg, the total number of sentences N= Pos + Mid + Neg, the total score of positive clauses PWS, the total score of negative clauses NWS, the total score TWS= PWS + NWS, and the total number of characters Char; The step S6 is also included: Adjust the weight coefficient of NWS in TWS. The weight coefficient of NWS is set to α, then TWS = PWS + α × NWS, where α is set to 1.5; The step S7 is also included: The full-text sentiment evaluation score Score is calculated using the evaluation function Score=(TWS / N+σ×TWS / Char) / 2. The evaluation score Score is substituted into the discriminant function Fun=Score / (Score×Score+β)½ to obtain the final overall sentiment classification. If Fun>=0.5, the text to be analyzed is judged as positive; if Fun<=-0.5, the text to be analyzed is judged as negative; if -0.5<Fun<0.5, the text to be analyzed is judged as neutral, where σ and β are coefficients.
2. A semantic emotion recognition method according to claim 1, characterized in that: The value of the coefficient σ is set to 30, and the value of β is set to 7.
3. A semantic emotion recognition method according to claim 1, characterized in that: The values of the intensity translation unit numbers L and R are both set to 8.
4. A semantic emotion recognition method according to claim 1, characterized in that: The value of the number n of the preceding positions of the position where the emotion word is located is set to 2.
5. A semantic emotion recognition method according to claim 1, characterized in that: In step S4: If it is a long text, the total sentiment scores of the specified number of clauses at the beginning and the end will be given importance, and the priority weighting will be multiplied by the corresponding weighting coefficient θ, then the adjusted total sentiment score of the clause WS = WS×θ; if the total score WS of the clause > 0, the sentiment tendency of the clause is judged to be positive; if the total score WS of the clause < 0, the sentiment tendency of the clause is judged to be negative; if the total score WS of the clause = 0, the sentiment tendency of the clause is judged to be neutral.
6. A semantic emotion recognition method according to claim 5, characterized in that: The number of clauses in the long article is not less than 10.
7. A semantic emotion recognition method according to claim 5, characterized in that: Give priority to the first and last two sentences.
8. A semantic emotion recognition method according to claim 5, characterized in that: The value of the weighting coefficient θ is set to 1.5.
Citation Information
Patent Citations
Financial field comment sentiment classification method and system based on sentiment dictionary
CN110362679A