CN108241682B - Method and device for determining text emotion - Google Patents

Method and device for determining text emotion Download PDF

Info

Publication number
CN108241682B
CN108241682B CN201611219673.1A CN201611219673A CN108241682B CN 108241682 B CN108241682 B CN 108241682B CN 201611219673 A CN201611219673 A CN 201611219673A CN 108241682 B CN108241682 B CN 108241682B
Authority
CN
China
Prior art keywords
emotion
sentence
text
determining
keyword
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611219673.1A
Other languages
Chinese (zh)
Other versions
CN108241682A (en
Inventor
刘乙霖
陈晓敏
刘嘉
赵钰
王雪纯
栾睿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201611219673.1A priority Critical patent/CN108241682B/en
Publication of CN108241682A publication Critical patent/CN108241682A/en
Application granted granted Critical
Publication of CN108241682B publication Critical patent/CN108241682B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/38Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for determining text emotion. Wherein, the method comprises the following steps: acquiring keywords of a text and a plurality of sentences contained in the text, and labeling the emotion category and the emotion level of each sentence; performing word segmentation processing on each sentence, and extracting emotional words of each sentence; determining an emotion weight value of an emotion word in each sentence; determining the membership degree of the keywords in the sentences containing the keywords according to the emotion weight values; and determining the emotion category of the text according to the membership degree. The method solves the technical problem that the judgment is inaccurate due to the fact that the keywords are ignored in the conventional text emotion judgment mode.

Description

Method and device for determining text emotion
Technical Field
The invention relates to the field of text information analysis, in particular to a method and a device for determining text emotion.
Background
With the increasing abundance of the text information on the internet, the emotion analysis of the text information is particularly important, and by using the technology of emotion analysis, the public sentiment can be better fed back properly, and the technology can provide support for companies or organizations to adjust the market direction or improve products in time according to the emotion feedback of customers.
The existing article emotion judgment mode is calculated based on the positive-negative proportion of sentence emotion in sections. In the machine learning of emotion judgment, selecting some characteristic parameters, and judging the emotion of chapter level according to the sentence emotion ratio, wherein if the sentence ratio of positive emotion tendency is large, the article is judged to be positive emotion by the machine; if the proportion of the sentences with negative emotional tendency is large, the article is judged as negative emotion by the machine; if the proportion of sentences with neutral emotional tendency is large, the article is judged as neutral emotion by the machine. The judgment result of the article is basically determined by the proportion of sentences with certain emotion in the whole article, and the sentences are usually calculated according to the same weight without primary or secondary classification.
The existing method ignores a main body pointed by the emotion, namely ignores the emotion expressed by a sentence where the keyword is located, and causes the problem of inaccurate judgment of the text emotion.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a method and a device for determining text emotion, which are used for at least solving the technical problem of inaccurate judgment caused by neglecting keywords in the conventional text emotion judgment mode.
According to an aspect of the embodiments of the present invention, there is provided a method for determining text emotion, including: acquiring keywords of a text and a plurality of sentences contained in the text, and labeling the emotion category and the emotion level of each sentence; performing word segmentation processing on each sentence, and extracting emotional words of each sentence; determining an emotion weight value of an emotion word in each sentence; determining the membership degree of the keywords in the sentences containing the keywords according to the emotion weight values; and determining the emotion category of the text according to the membership degree.
According to another aspect of the embodiments of the present invention, there is also provided an apparatus for determining text emotion, including: the obtaining module is used for obtaining keywords of the text and a plurality of sentences contained in the text and marking the emotion category and the emotion level of each sentence; the processing module is used for carrying out word segmentation processing on each sentence and extracting emotional words of each sentence; the first calculation module is used for determining the emotion weight value of the emotion words in each sentence; the second calculation module is used for determining the membership degree of the keywords in the sentences containing the keywords according to the emotion weight values; and the judging module is used for determining the emotion type of the text according to the membership degree.
In the embodiment of the invention, a keyword-based weighting mode is adopted, the keywords of the text and a plurality of sentences contained in the text are obtained, the emotion category and the emotion level of each sentence are labeled, the word segmentation processing is carried out on each sentence, the emotion words of each sentence are extracted, the emotion weight value of the emotion words in each sentence is further determined, the membership degree of the keywords in the sentences containing the keywords is further determined according to the emotion weight value, and the emotion category of the text is further determined according to the membership degree. The purpose of effectively judging the text emotion is achieved, the technical effect of improving the text emotion judgment accuracy is achieved, and the technical problem that the judgment is inaccurate due to the fact that keywords are ignored in the existing text emotion judgment mode is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of a method for determining text emotion in accordance with an embodiment of the present invention;
FIG. 2 is a flow diagram of an alternative method for determining text emotion in accordance with an embodiment of the present invention;
FIG. 3 is a diagram of an apparatus for determining emotion of text according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating an alternative apparatus for determining emotion of text according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating an alternative apparatus for determining emotion of text according to an embodiment of the present invention; and
FIG. 6 is a diagram illustrating an alternative apparatus for determining emotion of text according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a method for determining text emotion, it is noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than that described herein.
Fig. 1 is a flowchart of a method for determining text emotion according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, obtaining keywords of the text and a plurality of sentences contained in the text, and labeling the emotion category and the emotion level of each sentence.
Specifically, in step S102, the keyword is a subject pointed by the text emotion, and the keyword may be, but not limited to, an event word and a brand word, for example, many text emotion judgments need to be based on a certain viewing angle, and a word mentioned in the viewing angle is a keyword for text emotion judgment.
The emotion categories can be divided according to emotional tendency, generally, the emotion categories can include positive emotion, negative emotion and neutral emotion, specifically, the emotion levels are used for representing the intensity of the expression emotion of the sentence, in an optional embodiment, the positive emotion and the negative emotion can be respectively set to five emotion levels, and the emotion levels can be set to one due to the particularity of the neutral emotion.
It should be noted that the web page text may be processed and the sentence may be labeled manually, or may be processed and labeled by a machine, and the processing is not limited in this respect.
The method comprises the steps of obtaining event words or brand words from a webpage text of a text emotion to be judged, dividing the webpage text into sentences, and marking the emotion category and emotion level of each sentence, so that a main body to which the text emotion points can be determined, and the pertinence of text emotion judgment is improved.
And step S104, performing word segmentation processing on each sentence, and extracting emotional words of each sentence.
Specifically, in the scheme defined in step S104, word segmentation is performed on each sentence in the text, and the emotion words of each sentence are extracted from the processing result, so that the emotion words included in the text can be determined, and the emotion ratio of each sentence including the emotion words can be determined.
For example, a word segmentation device may be used to perform word segmentation on each sentence in the text to obtain a word segmentation result, where the word segmentation result may include emotional words, and in a case that the word segmentation result includes emotional words, select an emotional word in each sentence from the word segmentation result.
And step S106, determining the emotion weight value of the emotion words in each sentence.
In step S106, an emotion weight value of the emotion word in each sentence can be determined by calculating a word frequency of the emotion word, and specifically, the emotion weight value of the emotion word in each sentence can be determined according to the number of the emotion words in each sentence and the total number of words in the sentence containing the emotion word.
In an optional embodiment, the calculation may be performed from three emotion categories of positive emotion, negative emotion, and neutral emotion, taking the emotion category as the positive emotion, as an example, the weight of each emotion word in a sentence with the positive emotion to the judgment that the sentence is the positive emotion may be calculated based on the word frequency of the emotion word, and in the case that the emotion category is the negative emotion and the neutral emotion, the method of calculating the emotion weight value of the emotion word in each sentence is the same as the method of calculating the emotion category as the positive emotion, which is not described here.
Through the step S106, the emotion judgment accuracy of the sentences in the text can be effectively improved, and the emotion judgment accuracy of the text can be further improved.
And S108, determining the membership degree of the keywords in the sentences containing the keywords according to the emotion weight values.
Specifically, in step S108, the membership degree of the keyword in the sentence including the keyword may be determined by a calculation method of weighting the emotion of the sentence including the keyword again.
In an alternative embodiment, if the keyword "sunshine" appears at the emotion level of each emotion category with a frequency of Vpos1, Vpos2, Vpos3, Vpos4, Vpos 5; vneu; vneg1, Vneg2, Vneg3, Vneg4, Vneg 5. The degree of membership of the keyword "sunshine" to the sentence emotion level pos1 containing "sunshine" is W1pos 1.
In the scheme defined in step S108, based on obtaining the emotion weight value of the emotion word in each sentence, the emotion of the sentence containing the keyword is weighted again according to the emotion weight value, so as to determine the membership degree of the keyword in the sentence containing the keyword, and through the above steps, the emotion intensity expressed by the sentence containing both the keyword and the emotion word and the sentence containing only the emotion word can be effectively distinguished. Under the condition that the keywords and the emotional words appear in one sentence at the same time, the emotional weight of the sentence is increased, and therefore the accuracy of text emotion judgment is improved.
And step S110, determining the emotion type of the text according to the membership degree.
Specifically, in step S110, the emotion classification of the whole text may be determined according to the membership degree of the keyword in the sentence containing the keyword.
The following is described by taking a text as an example, for example: the American-style vehicle has the characteristics of high horsepower, heavy self weight, good acceleration performance, safety and silence, wide and comfortable vehicle body. The solar car is thinner, so that the safety is sacrificed while the fuel is saved. "the obtained keywords are: the sun vehicle, the analysis of which shows: the proportion of sentences with positive emotions in the text is large, and if the sentences with positive emotions in the text are judged to be the positive emotions according to the existing emotion judgment mode, the sentences with the positive emotions are judged to be the positive emotions. However, the keyword of the text is "sunhost vehicle", and the emotion of the sentence in which the keyword "sunhost vehicle" is located is a negative emotion. Under the condition, on the basis of obtaining the emotion weight value of the sentence where the keyword in the text is located, the sentence where the keyword 'Japanese vehicle' is located is weighted again, the emotion category with the highest membership degree is selected as the emotion category of the text emotion, and the judgment result that the text emotion is negative emotion is obtained. The method and the device effectively improve the accuracy of text emotion judgment.
It should be noted here that after determining the emotion type of the text, the emotion value of the entire text may be modified according to the length of the text, so as to improve the accuracy of emotion judgment of the entire text.
In the embodiment of the invention, a keyword-based weighting mode is adopted, the keywords of the text and a plurality of sentences contained in the text are obtained, the emotion category and the emotion level of each sentence are labeled, the word segmentation processing is carried out on each sentence, the emotion words of each sentence are extracted, the emotion weight value of the emotion words in each sentence is further determined, the membership degree of the keywords in the sentences containing the keywords is further determined according to the emotion weight value, and the emotion category of the text is further determined according to the membership degree. The purpose of effectively judging the text emotion is achieved, the technical effect of improving the text emotion judgment accuracy is achieved, and the technical problem that the judgment is inaccurate due to the fact that keywords are ignored in the existing text emotion judgment mode is solved.
Based on the schemes provided in the above steps S102 to S110, the present application also provides the following preferred schemes:
optionally, the emotion category includes at least one of: positive emotion, negative emotion and neutral emotion, the emotion level is used to characterize how strongly the sentence expresses emotion.
Specifically, the emotion categories may include positive emotion, negative emotion, and neutral emotion, where the emotion categories may be divided according to emotional tendency, for example, if the percentage of words with positive emotional tendency is large, the sentence is determined as positive emotion by the machine; if the proportion of the words with negative emotional tendency is large, the sentence is judged as negative emotion by the machine; if the proportion of the words with the neutral emotional tendency is large, the sentence is judged to be neutral emotion by the machine.
The emotion levels are used for representing the intensity of the expression emotion of the sentence, in an alternative embodiment, the positive emotion and the negative emotion can be respectively set to five emotion levels, and the emotion level can be set to one emotion due to the specificity of the neutral emotion. Specifically, the emotion intensity to be expressed by the emotion level can be distinguished according to the number, wherein the emotion level is higher when the number is larger, and the emotion to be expressed is stronger.
In an alternative embodiment, the emotion categories may be set to positive emotions, negative emotions, and neutral emotions. The positive emotion and the negative emotion can be respectively set to five emotion levels, and the emotion level can be one due to the particularity of the neutral emotion. Through the division, the emotion levels of the three emotion categories can be obtained, wherein the positive emotion is as follows: pos1, pos2, pos3, pos4, pos5, neutral mood: neu, negative mood: neg1, neg2, neg3, neg4, neg 5.
It should be noted that the above is only an example, the present application is not limited to the case of calculating the above three emotion categories and eleven emotion levels, and the emotion categories and emotion levels in the calculation may be added or deleted according to actual needs.
Optionally, fig. 2 is a flowchart of an optional method for determining text emotion according to an embodiment of the present invention, and as shown in fig. 2, in step S106, an emotion weight value of an emotion word in each sentence is determined, where the method includes the following steps:
step S202, calculating the number of the emotional words in each sentence.
Step S204, calculating the total number of words in the sentence containing the emotional words.
Step S206, determining the emotion weight value of the emotion words in each sentence according to the number of the emotion words in each sentence and the total number of words in the sentences containing the emotion words.
Specifically, in the above steps S202 to S206, the emotion weight value of the emotion word in each sentence can be determined by calculating the word frequency of the emotion word, specifically, after the text to be determined with emotion is divided into sentences, each divided sentence may contain emotion words, and when any one sentence contains emotion words, the number of any one emotion word in each sentence can be calculated first, and then the total number of words in the sentence containing emotion words is calculated, so as to obtain two calculation results, and then the number of emotion words in each sentence can be compared with the total number of words in the sentence containing emotion words, so as to determine the emotion weight value of the emotion word in each sentence.
In an optional embodiment, the calculation may be performed from three emotion categories of positive emotion, negative emotion, and neutral emotion, taking the emotion category as the positive emotion, the weight of each emotion word in the positive emotion sentence for determining that the sentence is the positive emotion may be calculated by using the total number of words in the sentence containing the emotion word in terms of word frequency ratio of the emotion word, and the method of calculating the emotion weight value of the emotion word in each sentence is the same as the method of calculating that the emotion category is the positive emotion when the emotion category is the negative emotion and the neutral emotion, and the description is omitted here.
Through the steps S202 to S206, the emotion judgment accuracy of sentences in the text can be effectively improved, and the emotion judgment accuracy of the text can be further improved.
Optionally, in step S108, that is, determining the membership degree of the keyword in the sentence containing the keyword according to the emotion weight value, the method includes the following steps:
step S302, determining the emotion category of the sentence containing the key word according to the emotion weight value.
Step S304, determining the emotion level of the keyword according to the emotion category of the sentence containing the keyword, and determining the membership degree of the keyword in the sentence containing the keyword through the following formula:
Figure BDA0001192524110000071
wherein, W1Is degree of membership, V1Weight value of emotion level, sigma V, for keywordiIs the sum of the weighted values of the keywords in the emotion level, and alpha is the weight of the keywords.
Specifically, in the steps S302 to S306, after obtaining the emotion weight value, the emotion category of the sentence including the keyword may be determined according to the label made when the text is processed, and after obtaining the emotion category, the emotion level of the keyword may be determined.
Further, the emotion of the sentence containing the keyword is weighted again, and the membership degree of the keyword in the sentence containing the keyword is determined, so that the membership degree of the keyword in the sentence containing the keyword is determined.
Through the steps S302 to S306, the emotion intensity expressed by the sentence containing both the keyword and the emotion word and the sentence containing only the emotion word can be effectively distinguished. Under the condition that the keywords and the emotional words appear in one sentence at the same time, the emotional weight of the sentence is increased, and the membership degree of the keywords in the sentence containing the keywords is determined, so that the accuracy of text emotion judgment is improved.
Optionally, in step S110, determining an emotion category of the text according to the membership degree, and determining an emotion category of the text according to the membership degree, the method includes the following steps:
and S402, in at least one emotion category, summing the membership degrees of the keywords in at least one emotion level to obtain a summation result.
And S404, selecting the emotion type with the maximum summation result as the emotion of at least one text.
Specifically, in the above steps S402 to S404, when obtaining the membership degree of the keyword in the sentence containing the keyword, the membership degree of the keyword in each emotion level may be summed according to the different emotion types, and a summation result of each emotion level is obtained. Because the emotion level is not unique, one emotion category with the largest summation result can be selected from the emotion levels contained in the text, and the emotion tendency represented by the emotion category is the emotion of the text.
In the embodiment of the present application, through the steps S402 to S404, the emotion intensity of the sentence containing both the keyword and the emotion word is increased, so as to achieve the purpose of effectively determining the text emotion, thereby achieving the technical effect of improving the text emotion determination accuracy.
It should be noted here that after determining the emotion type of the text, the emotion value of the entire text may be modified according to the length of the text, so as to improve the accuracy of emotion judgment of the entire text.
Example 2
According to the embodiment of the invention, the embodiment of the device for determining the text emotion is also provided.
FIG. 3 is a schematic diagram of an apparatus for determining emotion of text according to an embodiment of the present invention, as shown in FIG. 3, in an alternative embodiment, the apparatus includes: the device comprises an acquisition module 30, a processing module 32, a first calculation module 34, a second calculation module 36 and a judgment module 38.
The obtaining module 30 is configured to obtain a keyword of a text and a plurality of sentences contained in the text, and label an emotion category and an emotion level of each sentence; the processing module 32 is configured to perform word segmentation processing on each sentence, and extract an emotion word of each sentence; a first calculating module 34, configured to determine an emotion weight value of an emotion word in each sentence; a second calculating module 36, configured to determine, according to the emotion weight value, a membership degree of the keyword in a sentence containing the keyword; and the judging module 38 is used for determining the emotion type of the text according to the membership degree.
In the embodiment of the invention, a keyword weighting-based mode is adopted, a keyword of a text and a plurality of sentences contained in the text are obtained through an obtaining module, the emotion category and the emotion level of each sentence are labeled, a processing module carries out word segmentation processing on each sentence, the emotion word of each sentence is extracted, a first calculating module is used for determining the emotion weighted value of the emotion word in each sentence, a second calculating module is used for determining the membership degree of the keyword in the sentence containing the keyword according to the emotion weighted value, and a judging module is used for determining the emotion category of the text according to the membership degree, so that the aim of effectively judging the emotion of the text is fulfilled, the technical effect of improving the emotion judging accuracy of the text is achieved, and the technical problem that the judgment is inaccurate due to the fact that the keyword is ignored in the existing text emotion judging mode is solved.
It should be noted here that the acquiring module 30, the processing module 32, the first calculating module 34, the second calculating module 36, and the determining module 38 correspond to steps S102 to S110 in the first embodiment, and the modules are the same as the corresponding steps in the implementation example and application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
Based on the scheme provided by the above embodiment, the present application also provides the following preferred scheme:
optionally, the emotion category includes at least one of: positive emotion, negative emotion and neutral emotion, the emotion level is used to characterize how strongly the sentence expresses emotion.
Specifically, the emotion categories may include positive emotion, negative emotion, and neutral emotion, where the emotion categories may be divided according to emotional tendency, for example, if the percentage of words with positive emotional tendency is large, the sentence is determined as positive emotion by the machine; if the proportion of the words with negative emotional tendency is large, the sentence is judged as negative emotion by the machine; if the proportion of the words with the neutral emotional tendency is large, the sentence is judged to be neutral emotion by the machine.
Specifically, the emotion levels are used for representing the intensity of the expression emotion of the sentence, in an alternative embodiment, five emotion levels can be set for the positive emotion and the negative emotion respectively, and the emotion levels can be set to be one due to the specificity of the neutral emotion. Specifically, the emotion intensity to be expressed by the emotion level can be distinguished according to the number, wherein the emotion level is higher when the number is larger, and the emotion to be expressed is stronger.
In an alternative embodiment, the emotion categories may be set to positive emotions, negative emotions, and neutral emotions. The positive emotion and the negative emotion can be respectively set to five emotion levels, and the emotion level can be one due to the particularity of the neutral emotion. Through the division, the emotion levels of the three emotion categories can be obtained, wherein the positive emotion is as follows: pos1, pos2, pos3, pos4, pos5, neutral mood: neu, negative mood: neg1, neg2, neg3, neg4, neg 5.
It should be noted that the above is only an example, the present application is not limited to the case of calculating the above three emotion categories and eleven emotion levels, and the emotion categories and emotion levels in the calculation may be added or deleted according to actual needs.
Optionally, fig. 4 is a schematic diagram of an alternative apparatus for determining text emotion according to an embodiment of the present invention, as shown in fig. 4, in an alternative embodiment, the first calculating module 34 includes: a first computation submodule 40, a second computation submodule 42, a third computation submodule 44.
The first calculating submodule 40 is used for calculating the number of the emotional words in each sentence; a second calculating submodule 42, configured to calculate a total number of words in the sentence containing the emotion word; and the third computation submodule 44 is used for determining the emotion weight value of the emotion words in each sentence according to the number of the emotion words in each sentence and the total number of words in the sentences containing the emotion words.
It should be noted here that the first computation submodule 40, the second computation submodule 42, and the third computation submodule 44 correspond to the steps S202 to S204 in the first embodiment, and the modules are the same as the corresponding steps in the implementation example and the application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
Optionally, fig. 5 is a schematic diagram of an alternative apparatus for determining text emotion according to an embodiment of the present invention, as shown in fig. 5, in an alternative embodiment, the second calculation module 36 includes: a fourth computation submodule 50, a fifth computation submodule 52.
The fourth calculating submodule 50 is configured to determine an emotion category of a sentence containing the keyword according to the emotion weight value; the fifth calculating submodule 52 is configured to determine an emotion level of the keyword according to the emotion category of the sentence containing the keyword, and determine a membership degree of the keyword in the sentence containing the keyword according to the following formula:
Figure BDA0001192524110000101
wherein, W1Is degree of membership, V1Weight value of emotion level, sigma V, for keywordiIs the sum of the weighted values of the keywords in the emotion level, and alpha is the weight of the keywords.
It should be noted that the fourth computation submodule 50 and the fifth computation submodule 52 correspond to the steps S302 to S304 in the first embodiment, and the modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of the first embodiment. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
Optionally, fig. 6 is a schematic diagram of an optional apparatus for determining text emotion according to an embodiment of the present invention, as shown in fig. 6, in an optional embodiment, the determining module 38 includes: a sixth calculation submodule 60 and a selection submodule 62.
The sixth calculating submodule 60 is configured to perform summation operation on the membership degree of the keyword in at least one emotion level in at least one emotion category, and obtain a summation result; and a selecting submodule 62 for selecting the emotion category with the largest summation result as the emotion of at least one text.
It should be noted here that the sixth calculating submodule 60 and the selecting submodule 62 correspond to steps S402 to S404 in the first embodiment, and the modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure of the first embodiment. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
The device for determining the text emotion comprises a processor and a memory, wherein the acquisition module, the processing module, the first calculation module, the second calculation module, the judgment module and the like are stored in the memory as program units, and the processor executes the program units stored in the memory. The text and the calculation formula can be stored in the memory.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to one or more than one, and the text content is analyzed by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The present application further provides an embodiment of a computer program product, which, when being executed on a data processing device, is adapted to carry out program code for initializing the following method steps: acquiring keywords of a text and a plurality of sentences contained in the text, and labeling the emotion category and the emotion level of each sentence; performing word segmentation processing on each sentence, and extracting emotional words of each sentence; determining an emotion weight value of an emotion word in each sentence; determining the membership degree of the keywords in the sentences containing the keywords according to the emotion weight values; and determining the emotion category of the text according to the membership degree.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (8)

1. A method for determining emotion of text, comprising:
acquiring keywords of a text and a plurality of sentences contained in the text, and labeling the emotion category and the emotion level of each sentence;
performing word segmentation processing on each sentence, and extracting emotional words of each sentence;
determining an emotion weight value of the emotion word in each sentence;
determining the membership degree of the keyword in a sentence containing the keyword according to the emotion weight value;
determining the emotion category of the text according to the membership degree;
determining the membership degree of the keyword in a sentence containing the keyword according to the emotion weight value, wherein the method comprises the following steps:
determining the emotion category of the sentence containing the key word according to the emotion weight value;
determining the emotion level of the keyword according to the emotion category of the sentence containing the keyword, and determining the membership degree of the keyword in the sentence containing the keyword through the following formula:
Figure FDA0002758455690000011
wherein, the W1To the degree of membership, the V1The weight value of the emotion level of the keyword, the sigma ViAnd the weight value is the sum of the weight values of the keywords in the emotion level, and the alpha is the weight of the keywords.
2. The method of claim 1, wherein the emotion classifications include at least one of: positive emotion, negative emotion and neutral emotion, and the emotion level is used for representing the strong degree of the expression emotion of the sentence.
3. The method of claim 1, wherein determining an emotion weight value for the emotion word in each sentence comprises:
calculating the number of the emotional words in each sentence;
calculating the total number of words in the sentences containing the emotional words;
and determining the emotion weight value of the emotion words in each sentence according to the number of the emotion words in each sentence and the total word number in the sentences containing the emotion words.
4. The method of claim 1, wherein determining the emotion classification for the text based on the membership comprises:
in at least one emotion category, carrying out summation operation on membership degrees of the keywords in at least one emotion level to obtain a summation result;
and selecting the emotion category with the maximum summation result as the emotion of the at least one text.
5. An apparatus for determining emotion of text, comprising:
the obtaining module is used for obtaining keywords of a text and a plurality of sentences contained in the text and marking the emotion category and the emotion level of each sentence;
the processing module is used for carrying out word segmentation processing on each sentence and extracting the emotional words of each sentence;
the first calculation module is used for determining the emotion weight value of the emotion word in each sentence;
the second calculation module is used for determining the membership degree of the keyword in a sentence containing the keyword according to the emotion weight value;
the judging module is used for determining the emotion type of the text according to the membership degree;
wherein the second computing module comprises:
the fourth calculation submodule is used for determining the emotion category of the sentence containing the keyword according to the emotion weight value;
a fifth calculating submodule, configured to determine, according to an emotion category of a sentence including the keyword, an emotion level of the keyword, and determine a membership degree of the keyword in the sentence including the keyword according to the following formula:
Figure FDA0002758455690000021
wherein, the W1To the degree of membership, the V1The weight value of the emotion level of the keyword, the sigma ViAnd the weight value is the sum of the weight values of the keywords in the emotion level, and the alpha is the weight of the keywords.
6. The apparatus of claim 5, wherein the emotion classifications include at least one of: positive emotion, negative emotion and neutral emotion, and the emotion level is used for representing the strong degree of the expression emotion of the sentence.
7. The apparatus of claim 5, wherein the first computing module comprises:
the first calculation submodule is used for calculating the number of the emotion words in each sentence;
the second calculation submodule is used for calculating the total number of words in the sentences containing the emotional words;
and the third computation submodule is used for determining the emotion weight value of the emotion words in each sentence according to the number of the emotion words in each sentence and the total word number in the sentences containing the emotion words.
8. The apparatus of claim 5, wherein the determining module comprises:
the sixth calculating submodule is used for carrying out summation operation on the membership degree of the keyword in at least one emotion level in at least one emotion category to obtain a summation result;
and the selection submodule is used for selecting the emotion type with the maximum summation result as the emotion of the at least one text.
CN201611219673.1A 2016-12-26 2016-12-26 Method and device for determining text emotion Active CN108241682B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611219673.1A CN108241682B (en) 2016-12-26 2016-12-26 Method and device for determining text emotion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611219673.1A CN108241682B (en) 2016-12-26 2016-12-26 Method and device for determining text emotion

Publications (2)

Publication Number Publication Date
CN108241682A CN108241682A (en) 2018-07-03
CN108241682B true CN108241682B (en) 2021-03-30

Family

ID=62702096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611219673.1A Active CN108241682B (en) 2016-12-26 2016-12-26 Method and device for determining text emotion

Country Status (1)

Country Link
CN (1) CN108241682B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109299463B (en) * 2018-09-26 2022-12-02 武汉斗鱼网络科技有限公司 Emotion score calculation method and related equipment
CN109657079A (en) * 2018-11-13 2019-04-19 平安科技(深圳)有限公司 A kind of Image Description Methods and terminal device
CN110399481B (en) * 2019-06-06 2022-04-12 深思考人工智能机器人科技(北京)有限公司 Method and device for screening emotional entity words

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609427A (en) * 2011-11-10 2012-07-25 天津大学 Public opinion vertical search analysis system and method
CN103150367A (en) * 2013-03-07 2013-06-12 宁波成电泰克电子信息技术发展有限公司 Method for analyzing emotional tendency of Chinese microblogs
CN103593334A (en) * 2012-08-15 2014-02-19 中国电信股份有限公司 Method and system for judging emotional degree of text
CN103617158A (en) * 2013-12-17 2014-03-05 苏州大学张家港工业技术研究院 Method for generating emotion abstract of dialogue text
CN104008091A (en) * 2014-05-26 2014-08-27 上海大学 Sentiment value based web text sentiment analysis method
CN104038637A (en) * 2014-06-25 2014-09-10 深圳市中兴移动通信有限公司 Ring playing method and device and mobile terminal
JP2016173742A (en) * 2015-03-17 2016-09-29 株式会社Jsol Face mark emotion information extraction system, method and program

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102609427A (en) * 2011-11-10 2012-07-25 天津大学 Public opinion vertical search analysis system and method
CN103593334A (en) * 2012-08-15 2014-02-19 中国电信股份有限公司 Method and system for judging emotional degree of text
CN103150367A (en) * 2013-03-07 2013-06-12 宁波成电泰克电子信息技术发展有限公司 Method for analyzing emotional tendency of Chinese microblogs
CN103617158A (en) * 2013-12-17 2014-03-05 苏州大学张家港工业技术研究院 Method for generating emotion abstract of dialogue text
CN104008091A (en) * 2014-05-26 2014-08-27 上海大学 Sentiment value based web text sentiment analysis method
CN104038637A (en) * 2014-06-25 2014-09-10 深圳市中兴移动通信有限公司 Ring playing method and device and mobile terminal
JP2016173742A (en) * 2015-03-17 2016-09-29 株式会社Jsol Face mark emotion information extraction system, method and program

Also Published As

Publication number Publication date
CN108241682A (en) 2018-07-03

Similar Documents

Publication Publication Date Title
US20210374196A1 (en) Keyword and business tag extraction
CN110377740B (en) Emotion polarity analysis method and device, electronic equipment and storage medium
CN108364199B (en) Data analysis method and system based on Internet user comments
JP5916947B2 (en) Online product search method and system
KR101600640B1 (en) Automatic customization and rendering of ads based on detected features in a web page
CN107657048B (en) User identification method and device
CN110852793A (en) Document recommendation method and device and electronic equipment
JP2019519019A (en) Method, apparatus and device for identifying text type
CN108241682B (en) Method and device for determining text emotion
WO2014173349A1 (en) Method and device for obtaining web page category standards, and method and device for categorizing web page categories
CN108133058B (en) Video retrieval method
CN106372956B (en) Method and system for identifying intention entity based on user search log
WO2015062359A1 (en) Method and device for advertisement classification, server and storage medium
KR20190128246A (en) Searching methods and apparatus and non-transitory computer-readable storage media
CN108255803B (en) Document emotion judgment method and device
CN110517698B (en) Method, device and equipment for determining voiceprint model and storage medium
CN112215629B (en) Multi-target advertisement generating system and method based on construction countermeasure sample
CN112149003A (en) Commodity community recommendation method and device and computer equipment
CN113807940A (en) Information processing and fraud identification method, device, equipment and storage medium
CN110213660B (en) Program distribution method, system, computer device and storage medium
WO2011078194A1 (en) Text mining system, text mining method, and recording medium
CN106844743B (en) Emotion classification method and device for Uygur language text
CN106649367B (en) Method and device for detecting keyword popularization degree
CN107665222B (en) Keyword expansion method and device
CN107291686B (en) Method and system for identifying emotion identification

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant