CN110287405B - Emotion analysis method, emotion analysis device and storage medium - Google Patents

Emotion analysis method, emotion analysis device and storage medium Download PDF

Info

Publication number
CN110287405B
CN110287405B CN201910421553.7A CN201910421553A CN110287405B CN 110287405 B CN110287405 B CN 110287405B CN 201910421553 A CN201910421553 A CN 201910421553A CN 110287405 B CN110287405 B CN 110287405B
Authority
CN
China
Prior art keywords
emotion
target
article
target entity
detected
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
CN201910421553.7A
Other languages
Chinese (zh)
Other versions
CN110287405A (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 Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910421553.7A priority Critical patent/CN110287405B/en
Publication of CN110287405A publication Critical patent/CN110287405A/en
Application granted granted Critical
Publication of CN110287405B publication Critical patent/CN110287405B/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/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation

Abstract

The application provides a method, a device and a storage medium for emotion analysis, wherein the method comprises the following steps: acquiring a target entity in a title of an article to be detected; acquiring a target sentence containing a target entity from the text of the article to be detected; acquiring the title and the emotion scores of target entities in the target sentences according to the emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entities in the sentences and the emotion scores; and acquiring the emotion mark of the target entity in the article to be detected according to the title and the emotion mark of the target entity in the target sentence. According to the method and the device, the emotion scores of the target entities can be acquired from the articles containing multiple entities, and the reliability of the emotion analysis results of the articles is improved.

Description

Emotion analysis method, emotion analysis device and storage medium
Technical Field
The present application relates to the field of natural language processing technologies, and in particular, to a method, an apparatus, and a storage medium for emotion analysis.
Background
Emotion analysis, also known as trend analysis, opinion extraction, opinion mining, emotion mining, subjective analysis, etc., is a process of analyzing, processing, generalizing, and reasoning subjective text with emotional colors. At present, the internet platforms such as microblogs, news, forums, blogs and WeChat generate massive text data every day, and emotion analysis can automatically and effectively detect emotional tendency of the viewpoint data.
In the prior art, emotion analysis is performed on an article in a manner of constructing a deep learning model by using a text data set. The method has a remarkable analysis effect on short articles, such as microblogs, comments and the like, because the short articles often only contain one entity, and the emotion analysis results are all subjected to emotion analysis on the entity. However, for a long article containing a plurality of entities, the emotion analysis result obtained by the method is a mixed emotion analysis result of all the entities in the whole article, and the reliability of the emotion analysis result is low.
Disclosure of Invention
The application provides a method, a device and a storage medium for emotion analysis, which can acquire emotion scores of target entities in articles containing multiple entities and improve the reliability of emotion analysis results of the articles. .
A first aspect of the present application provides a method of sentiment analysis, comprising:
acquiring a target entity in a title of an article to be detected;
acquiring a target sentence containing the target entity from the text of the article to be detected;
acquiring the title and the emotion score of the target entity in the target statement according to an emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entity in the statement and the emotion score;
and acquiring the emotion score of the target entity in the article to be detected according to the title and the emotion score of the target entity in the target sentence.
Optionally, the obtaining of the target entity in the title of the article to be detected includes:
segmenting words of the title of the article to be detected to obtain target words with preset parts of speech;
and acquiring the target entity in the target word according to the semantics of the title of the article to be detected.
Optionally, the obtaining of the target entity in the title of the article to be detected includes:
receiving a target entity confirmation instruction input by a user, wherein the target entity confirmation instruction is used for indicating the target entity;
and acquiring the target entity according to the target entity confirmation instruction.
Optionally, the obtaining a target sentence including the target entity in the text of the article to be detected includes:
dividing the text of the article to be detected into a plurality of candidate sentences according to preset separators;
taking the target entity candidate sentence as the target sentence, wherein the target entity candidate sentence is: the candidate sentences containing the words corresponding to the target entities and the candidate sentences whose semantics contain the target entities.
Optionally, the obtaining of the sentiment score of the target entity in the article to be detected includes:
and acquiring the emotion mark of the target entity in the article to be detected according to the weight of the title, the weight of the text, the title and the emotion mark of the target entity in the target sentence.
Optionally, the method further includes:
taking a sample title, a sample text statement, an emotion mark of the sample title and an emotion mark of the sample text statement as a training data set, training to obtain the emotion analysis model, wherein the emotion mark is as follows: and the difference value between the actual emotion score output by the emotion analysis model and the expected emotion score is smaller than a difference threshold value.
Optionally, the emotion analysis model is obtained based on textcnn network structure training.
A second aspect of the present application provides an apparatus for emotion analysis, comprising:
the processing module is used for acquiring a target entity in the title of the article to be detected; acquiring a target sentence containing the target entity from the text of the article to be detected; acquiring the title and the emotion score of the target entity in the target statement according to an emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entity in the statement and the emotion score; and acquiring the emotion score of the target entity in the article to be detected according to the title and the emotion score of the target entity in the target sentence.
Optionally, the processing module is specifically configured to perform word segmentation on the title of the article to be detected, and acquire a target word with a preset part of speech; and acquiring the target entity in the target word according to the semantics of the title of the article to be detected.
Optionally, the apparatus further comprises: a transceiver module;
the receiving and sending module is used for receiving a target entity confirmation instruction input by a user, and the target entity confirmation instruction is used for indicating the target entity.
The processing module is further configured to obtain the target entity according to the target entity confirmation instruction.
Optionally, the processing module is specifically configured to divide the text of the article to be detected into a plurality of candidate sentences according to a preset delimiter; taking the target entity candidate sentence as the target sentence, wherein the target entity candidate sentence is: the candidate sentences containing the words corresponding to the target entities and the candidate sentences whose semantics contain the target entities.
Optionally, the processing module is specifically configured to obtain the emotion score of the target entity in the article to be detected according to the weight of the title, the weight of the text, the title, and the emotion score of the target entity in the target sentence.
Optionally, the processing module is specifically configured to train and obtain the emotion analysis model by using a sample title, a sample text statement, an emotion tag of the sample title, and an emotion tag of the sample text statement as a training data set, where the emotion tag is: and the difference value between the actual emotion score output by the emotion analysis model and the expected emotion score is smaller than a difference threshold value.
Optionally, the emotion analysis model is obtained by the processing module based on textcnn network structure training.
A third aspect of the present application provides an apparatus for emotion analysis, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes the computer-executable instructions stored in the memory to cause the apparatus for emotion analysis to perform the method for emotion analysis described above.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement the method of sentiment analysis described above.
The application provides a method, a device and a storage medium for emotion analysis, which can determine a target entity according to the title of an article for the article containing multiple entities, and then acquire a target sentence containing the target entity from the text of the article. And acquiring the sentiment scores of the target entities in the title and the target sentence by adopting a sentiment analysis model, and further acquiring the sentiment scores of the target entities in the article to be detected. The method can acquire the emotion scores of the target entities in the articles containing multiple entities, and improves the reliability of the emotion analysis results of the articles.
Drawings
FIG. 1 is a first flowchart illustrating a method for emotion analysis provided in the present application;
FIG. 2 is a second flowchart of a method for emotion analysis provided in the present application;
FIG. 3 is a schematic view of an interface provided herein;
FIG. 4 is a first schematic structural diagram of an emotion analysis apparatus provided in the present application;
fig. 5 is a schematic structural diagram of a sentiment analysis device provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the embodiments of the present application, and it is obvious that the described embodiments are some but not all of the embodiments of the present application. 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 application.
The emotion analysis method is applied to various fields. For example, an application program for selling movies may detect the viewing experience of a user on the movies by using emotion analysis; the public opinion system can detect social public opinion influence of hot topics by adopting sentiment analysis; the comment evaluation website can adopt emotion analysis to detect the favorable comment degree of restaurants, dishes and shops.
The emotion analysis method in the prior art has a remarkable analysis effect for a short chapter containing an entity. For example, if the user rates a restaurant a in a rating website and the entity in the rating text (article) is restaurant a, the emotion analysis result of the rating text is the emotion analysis result of restaurant a, for example, the emotion analysis result of restaurant a is a good score of 80. For a long article containing multiple entities, the emotion analysis result of the long article obtained by the method in the prior art is the fusion of the emotion analysis results of the multiple entities. For example, a long chapter is a review of multiple restaurants, including restaurant A, restaurant B, and restaurant C. If the final emotion analysis result obtained by the method in the prior art is a good score, the result is a fusion of emotion analysis results for restaurant a, restaurant B and restaurant C, and emotion analysis results for restaurant a, restaurant B and restaurant C in the long text cannot be obtained. Therefore, the emotion analysis result is inaccurate and has low reliability.
In order to solve the above problems, the present application provides an emotion analysis method, which achieves the purpose of obtaining an emotion score of a target entity in a long article by identifying the target entity in a title of the long article and further according to the emotion score of the target entity in the title and the emotion score of the target entity in a target sentence containing the target entity in a text of the long article.
Fig. 1 is a first flowchart of a method for emotion analysis provided in the present application. The main body of execution of the method flow shown in fig. 1 may be a device for emotion analysis, which may be implemented by any software and/or hardware.
Optionally, the emotion analyzing apparatus may be a server, for example, the server may be a server corresponding to an instant chat application, a server corresponding to a food comment application, or a server corresponding to a news application. The server can perform sentiment analysis on the articles in the corresponding application program. Optionally, the emotion analyzing device may be a terminal device, and the terminal device may perform emotion analysis on the articles stored in the terminal device. In the following embodiments, an execution subject is described as an example of a server.
The terminal device in the present application includes, but is not limited to, a mobile terminal device or a fixed terminal device. The mobile terminal devices include, but are not limited to, a mobile phone, a Personal Digital Assistant (PDA), a tablet computer, a portable device (e.g., a portable computer, a pocket computer, or a handheld computer), and the like. The fixed terminal equipment includes but is not limited to desktop computers, audio and video equipment, smart televisions and the like.
As shown in fig. 1, the method for emotion analysis provided in this embodiment may include:
s101, acquiring a target entity in the title of the article to be detected.
The article to be detected in this embodiment is an article including a title and a text. For example, the articles to be detected can be news articles, paper articles, travel review articles, and the like, which include titles and texts. The news article is taken as an example to explain, the title of the news article contains the most important information of the article, including the target entity of the article, and the emotional attitude of the article to the target entity can be basically embodied. Accordingly, news headlines are analytical data that is important in sentiment analysis of news articles. It should be understood that the entity in the embodiment is a main object of sentiment analysis in the article to be detected.
For example, a news article is a review article for an internet company, and the news article includes a plurality of internet companies. The emotion analysis result obtained according to the method in the prior art is a fused emotion analysis result for a plurality of internet companies. The news article includes internet company a, internet company B, and internet company C, and the target entity of the news article is internet company a in view of the title of the news article.
If the news article actually had an emotional analysis result for Internet company A, then: internet company a rated 80 points well, but the news article contained the sentiment analysis results of three internet companies, and could be distinct sentiment analysis results. If the emotion analysis result of the internet company a is a good score of 80, the emotion analysis result of the internet company B is a good score of 60, and the emotion analysis result of the internet company C is a bad score of 80, the emotion analysis result of the internet company a obtained by the method in the prior art may be a fusion of the emotion analysis results of the three internet companies, such as a good score of 40. The emotion analysis result of the internet company a cannot be really obtained as a result of a good score of 80.
In this embodiment, a target entity in a title of an article to be detected is obtained to determine an entity for emotion analysis of the article to be detected, and then emotion analysis is performed on the entity, so that an emotion analysis result of the article to be detected is accurately obtained.
Because the article to be detected containing the title has a structured format, after the article to be detected is obtained by the server, the title and the text of the article to be detected can be determined according to a preset structured template.
Optionally, in this embodiment, the target entity may be determined according to semantics of a title of the article to be detected. For example, if the title of the article to be detected is "growing up of internet company a", the target entity of the title may be determined to be "internet company a" according to the semantic of the title.
Optionally, in this embodiment, the target entity may also be determined according to the part of speech of the word in the title of the article to be detected. For example, usually, the target entity in the title of the article to be detected is a noun, and a preset part of speech may be set in the server in this embodiment. The server can detect the part of speech of the words in the title of the article to be detected and determine the target entity. If the title is "beautiful Beijing", the server may determine that the word "beautiful" in the title is an adjective and "Beijing" is a noun, and then determine that "Beijing" is the target entity. It should be understood that different parts of speech may be set as the preset parts of speech of the target entity for different application scenarios.
The two manners of acquiring the target entity may be performed separately or in combination. The combination of the execution modes can make the acquired target entities in the titles of the articles to be detected more accurate.
S102, obtaining a target sentence containing a target entity in the text of the article to be detected.
The article to be detected may include a plurality of different entities, and in this embodiment, in order to obtain an emotion analysis result for the target entity, a target sentence including the target entity may be obtained in the text of the article to be detected.
The article to be detected may include at least one paragraph, and each paragraph may include at least one sentence. Optionally, in this embodiment, the target sentence including the target entity may be determined in each sentence in a word matching manner. For example, if the target entity is "Beijing", the sentence containing "Beijing" may be the target sentence.
Optionally, in this embodiment, a division rule may be preset for dividing the sentence of the article to be detected. For example, a sentence may be between every two periods, or a sentence may be between a period and an exclamation point, or a sentence may be between a period and a question mark, as divided by punctuation. After the server acquires the article to be detected, the server can divide the text of the article to be detected into a plurality of sentences according to a preset division rule, and acquire target sentences including target entities from the plurality of sentences.
S103, obtaining the title and the emotion scores of the target entities in the target sentences according to the emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entities in the sentences and the emotion scores.
In this embodiment, the title and the target sentence both include the target entity, that is, the server may obtain an emotion analysis result of the target entity in the article to be detected by analyzing the emotion text of the target entity in the title and the target sentence.
In this embodiment, an emotion analysis model is preset in the server. The emotion analysis model is used for representing the corresponding relation between the entity in the statement and the emotion score, namely, the statement is input into the emotion analysis model, and the emotion analysis model can output the emotion score of the entity in the statement.
Optionally, the emotion analysis model in this embodiment may be constructed based on a deep learning network. Wherein the deep learning network may be a textcnn network including a word embedding layer, a convolution layer, a max-pooling layer, and a full-link layer, and the emotion analysis model based on the textcnn network may convert the input text into emotion scores. In the actual operation process, the word embedding layer can be initialized by using a pre-trained word vector model so as to improve the model accuracy.
The server can obtain the emotion scores of the target entities in the titles and the target sentences according to the emotion analysis model. That is, the server may input the title and the target sentence to the emotion analysis model to output the emotion scores of the target entity in the title and the target sentence.
It should be understood that, when there are a plurality of target sentences, the emotion scores of the target entities in the title and the target sentence acquired in this embodiment are: title and sentiment score of the entity in each target sentence. For example, the target entity in the title is "internet company a", and the target sentences including "internet company a" include sentence a, sentence B, and sentence C. Through the emotion analysis model, the emotion scores of the internet company A in the title and the emotion scores of the internet company A in the sentence A, the sentence B and the sentence C can be obtained, namely four emotion scores are obtained for the target entity in the article to be detected.
And S104, acquiring the emotion scores of the target entities in the article to be detected according to the titles and the emotion scores of the target entities in the target sentences.
In this embodiment, according to the emotion analysis model, the titles of the articles to be detected and the emotion scores of the target entities in the text can be obtained. Further, according to a plurality of emotion scores of the target entity in the article to be detected, the emotion score of the target entity in the article to be detected can be obtained.
Optionally, in this embodiment, a mean value of a plurality of emotion scores of the target entity in the article to be detected may be used as the emotion score of the target entity in the article to be detected. For example, if the emotion score of "internet company a" in the title is favorable score of 80, and the emotion scores of "internet company a" in sentences a, B and C are favorable score of 70, favorable score of 50 and favorable score of 90, respectively, the emotion score of "internet company a" in the article to be detected is the mean favorable score of 72.5 of the plurality of emotion scores.
Optionally, in this embodiment, the weight of the title and the weight of the text may also be preset, and the emotion score of the target entity in the article to be detected is obtained according to the emotion scores of the title and the target entity in the target sentence, and the weight of the title and the weight of the text. For example, if the title is weighted 0.5 and the text is also weighted 0.5, the emotion score of the target entity "internet company a" in the article to be detected is 75 scores. It should be understood that the weight of the title and the weight of the body are merely examples, and other weights may be set.
The emotion analysis method provided by the embodiment comprises the following steps: acquiring a target entity in a title of an article to be detected; acquiring a target sentence containing a target entity from the text of the article to be detected; acquiring the title and the emotion scores of target entities in the target sentences according to the emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entities in the sentences and the emotion scores; and acquiring the emotion mark of the target entity in the article to be detected according to the title and the emotion mark of the target entity in the target sentence. The method for analyzing the emotion can acquire the emotion scores of the target entities in the articles containing multiple entities, and improves the reliability of the emotion analysis results of the articles.
On the basis of the above embodiment, how to acquire the target entity in the title and the emotion score in the article to be detected in the emotion analysis method provided by the present application is described below with reference to fig. 2. Fig. 2 is a schematic flow chart of a method for emotion analysis provided in the present application. As shown in fig. 2, the method for emotion analysis provided in this embodiment may include:
s201, taking the sample title, the sample text sentence, the emotion mark of the sample title and the emotion mark of the sample text sentence as a training data set, and training to obtain an emotion analysis model.
In this embodiment, the emotion analysis model can be obtained by training on the basis of the textcnn network through the training data set. Wherein the training data set may include: a sample title, a sample text statement, an emotion mark of the sample title, and an emotion mark of the sample text statement.
The sample headline and the sample text sentence can be obtained from a large number of historical test articles, the historical test articles can be articles comprising headlines, and the sample headline and the sample text sentence both comprise entities. Notably, the emotion is labeled as: the expected sentiment score of an entity in a sample title or sample body sentence. Accordingly, the sentiment of the sample title is marked as: the expected sentiment score of the entity in the sample header. Correspondingly, the emotion marks of the sample body sentence are as follows: the expected sentiment score of the entity in the body sentence.
For example, the sample title is "fire exploded restaurant A", then the sentiment tag for the sample title may correspondingly be 80. It should be understood that the emotion scores in the emotion marks of the sample title and the sample text sentences can be marked as scores with positive and negative according to the positive and negative attributes of the words in the sample title and the sample text sentences, and the good score 80 in the above embodiment is a positive score.
For example, the sample title is "bad A restaurant," then the sentiment token for the sample title may be correspondingly-50. Wherein, the 'bad' and 'flaming' in the sample title are positive and negative attributes of the words. In this embodiment, each sample statement and each sample title in the training data set has a corresponding expected sentiment score.
On the basis of the textcnn network, the emotion analysis model is continuously trained by adopting a training data set until the difference value between the actual emotion score and the expected emotion score output by the emotion analysis model is smaller than a difference threshold value. In the embodiment, when the finally used emotion analysis model is trained, the difference value between the output actual emotion score and the expected emotion score is smaller than the difference threshold value, that is, the emotion analysis model has higher accuracy computing capability.
It should be understood that the step of acquiring the emotion analysis model in S201 may be performed before the emotion analysis model is used to acquire the emotion score of the article to be detected, and the emotion analysis model is not acquired each time the emotion score of the article to be detected is acquired.
The following describes, with reference to S202 to S204, two cases of obtaining the target entity in the title of the article to be detected in this embodiment. S202-S203 are one possible way to obtain the target entity in the title of the article to be detected, and S204-S205 are another possible way. It should be understood that S202-S203 and S204-S205 are an alternative manner of execution.
S202, segmenting the titles of the articles to be detected to obtain target words with preset parts of speech.
In this embodiment, the target entity in the title of the article to be detected is obtained, and the title of the article to be detected may be segmented to obtain a plurality of words corresponding to the title. Optionally, a preset part of speech may be preset, and after a plurality of words corresponding to the title are obtained, a target word having the preset part of speech may be further obtained according to the parts of speech of the plurality of words. It should be understood that in this embodiment, the word segmentation of the title of the article to be detected may be performed by using word segmentation tools such as jieba, SnowNLP, THULAC, or NLPIR.
For example, the word is a noun, and the title of the article to be detected is "tomorrow of rapidly developing internet company a". The word segmentation of the title can result in "rapidly developed", "internet company a", "of" and "tomorrow". Wherein, the rapid development is an adjective, the rapid development is a conjunctive word, the Internet company A and the tomorrow are nouns, and the target words with noun parts of speech are the Internet company A and the tomorrow.
S203, acquiring a target entity according to the semantics of the title of the article to be detected.
In order to make the target entity in the title of the article to be detected more accurate, in this embodiment, the target entity is further obtained in the target word according to the semantics of the title of the article to be detected.
For example, after the target words are determined as "internet company a" and "tomorrow", the semantic of the title of the article to be detected is analyzed as "development after internet company a", and then the target entity in the target words can be determined as "internet company a".
S204, receiving a target entity confirmation instruction input by a user, wherein the target entity confirmation instruction is used for indicating a target entity.
In this embodiment, the user may also set the target entity. Optionally, the scenario applied in this case may be: determining the emotion scores of a plurality of articles to be tested about the same entity, or determining the emotion score of a certain entity in an article to be tested.
The user may input a target entity confirmation instruction by voice or other means, the target entity confirmation instruction indicating the target entity. Fig. 3 is a schematic view of an interface provided in the present application. Wherein, the interface can be a display interface of the server. As shown in fig. 3, an input box of the target entity may be displayed on the interface, and the user may input the target entity in the input box, that is, the server may be triggered to receive a target entity confirmation instruction input by the user. Optionally, the input target entity in the input box may be a word corresponding to the input target entity. It should be understood that fig. 3 illustrates an emotion analysis device as an example.
And S205, acquiring the target entity according to the target entity confirmation instruction.
The target entity confirmation instruction is used for indicating the target entity, and the server can acquire the target entity in the title of the article to be detected after receiving the target entity confirmation instruction.
For example, if the user inputs that the target entity is "internet company a" in the input box, the server determines that the target entity in the title of the article to be detected is "internet company a".
S206, dividing the text of the article to be detected into a plurality of candidate sentences according to the preset separators.
In this embodiment, in order to obtain a target sentence including a target entity, the text of the article to be detected may be divided into a plurality of candidate sentences according to the preset delimiter. The preset separator may be a punctuation mark in the article, such as a period, question mark or exclamation mark.
Optionally, the server in this embodiment may query the text of the article to be detected, obtain the preset separators in the text, and use the sentence between the two preset separators as a candidate sentence. By adopting the same mode, a plurality of candidate sentences of the article to be detected can be obtained.
S207, the candidate sentence containing the target entity is taken as the target sentence.
In this embodiment, after the target sentence in the title of the article to be detected is obtained, the target sentence including the target entity may be obtained in the text of the article to be detected. Wherein, the candidate sentence containing the target entity can be used as the target sentence.
Optionally, in this embodiment, a candidate sentence including a word corresponding to the target entity may be used as the target sentence. For example, the target entity is "internet company a", the candidate sentence is "internet company a leader is xxx", and the candidate sentence includes a word corresponding to the target entity "internet company a", that is, the candidate sentence is used as the target sentence.
Optionally, in this embodiment, a candidate sentence whose semantic includes the target entity may be used as the target sentence. For example, the target entity is "beijing", the candidate sentence is "our capital, worth pride", and the semantic of the candidate sentence includes the target entity "beijing", that is, the candidate sentence is taken as the target sentence. The semantic content of the target entity may be: the candidate sentences comprise synonyms and referents of the target entities.
Optionally, in this embodiment, a candidate sentence whose semantic includes a target entity may also be used as the target sentence according to the semantic of the context.
S208, obtaining the title and the emotion mark of the target entity in the target statement according to an emotion analysis model.
The implementation in S208 in this embodiment may refer to the description related to S103 in the foregoing embodiment, which is not described herein again.
S209, obtaining the emotion scores of the target entities in the article to be detected according to the weight of the title, the weight of the text, the title and the emotion scores of the target entities in the target sentences.
In this embodiment, the weight of the title and the weight of the text may be set in advance. Optionally, the title may basically show the emotional attitude of the article to the target entity, and therefore the weights of the title and the text may be set to 0.5 respectively.
The specific method for acquiring the emotion scores of the target entities in the articles to be detected is as follows: acquiring a first emotion score according to the product of the weight of the title and the emotion score of the target entity in the title; acquiring the mean value of the emotion scores of the target entities in the target sentences, and acquiring second emotion scores according to the product of the weight of the text and the mean value; and the sum of the first emotion score and the second emotion score is the emotion score of the target entity in the article to be detected.
In the embodiment, the target entity can be obtained through the part of speech of the words in the title of the article to be detected and the semantics of the title, the target entity can also be obtained in a mode predefined by a user, and further, a target sentence containing the target entity in the text of the article to be detected is obtained; and acquiring the emotion mark of the target entity in the article to be detected by combining the title and the emotion mark of the target entity in the target sentence. According to the method and the device, the emotion scores of the target entities can be obtained, the reliability of the emotion analysis results of the articles is improved, and the requirements of users on the emotion scores of the target entities can be met.
Fig. 4 is a schematic structural diagram of an emotion analysis apparatus provided in the present application. As shown in fig. 4, the apparatus 400 for emotion analysis includes: a processing module 401 and a transceiver module 402.
The processing module 401 is configured to obtain a target entity in a title of an article to be detected; acquiring a target sentence containing a target entity from the text of the article to be detected; acquiring the title and the emotion scores of target entities in the target sentences according to the emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entities in the sentences and the emotion scores; and acquiring the emotion mark of the target entity in the article to be detected according to the title and the emotion mark of the target entity in the target sentence.
Optionally, the processing module 401 is specifically configured to perform word segmentation on the title of the article to be detected, and obtain a target word with a preset part of speech; and acquiring a target entity in the target word according to the semantics of the title of the article to be detected.
The transceiver module 402 is configured to receive a target entity confirmation instruction input by a user, where the target entity confirmation instruction is used to indicate a target entity.
The processing module 401 is further configured to obtain the target entity according to the target entity confirmation instruction.
Optionally, the processing module 401 is specifically configured to divide the text of the article to be detected into a plurality of candidate sentences according to a preset delimiter; taking the candidate sentence containing the target entity as a target sentence, wherein the candidate sentence containing the target entity is as follows: candidate sentences containing words corresponding to the target entities, and candidate sentences containing the target entities in the semantics.
Optionally, the processing module 401 is specifically configured to obtain the emotion score of the target entity in the article to be detected according to the weight of the title, the weight of the text, the title, and the emotion score of the target entity in the target sentence.
Optionally, the processing module 401 is specifically configured to train and obtain an emotion analysis model by using the sample title, the sample text sentence, the emotion tag of the sample title, and the emotion tag of the sample text sentence as a training data set, where the emotion tag is: and the difference value between the actual emotion score and the expected emotion score output by the emotion analysis model is smaller than a difference threshold value.
Optionally, the emotion analysis model is obtained by the processing module 401 based on textcnn network structure training.
The emotion analysis apparatus provided in this embodiment is similar to the emotion analysis method in terms of the principle and technical effect, and is not described herein again.
Fig. 5 is a schematic structural diagram of a sentiment analysis device provided in the present application. As shown in fig. 5, the apparatus 500 for emotion analysis includes: a memory 501 and at least one processor 502.
A memory 501 for storing program instructions.
The processor 502 is configured to implement the method for emotion analysis in this embodiment when the program instructions are executed, and specific implementation principles may be referred to the foregoing embodiments, which are not described herein again.
The apparatus 500 for emotion analysis may further include an input/output interface 503.
The input/output interface 503 may include a separate output interface and input interface, or may be an integrated interface that integrates input and output. The output interface is used for outputting data, and the input interface is used for acquiring input data.
The present application further provides a readable storage medium, in which an execution instruction is stored, and when the execution instruction is executed by at least one processor of an apparatus for emotion analysis, when the execution instruction is executed by the processor, the method for emotion analysis in the above embodiments is implemented.
The present application also provides a program product comprising execution instructions stored in a readable storage medium. The at least one processor of the apparatus for emotion analysis may read the execution instructions from the readable storage medium, and the execution of the execution instructions by the at least one processor causes the apparatus for emotion analysis to implement the method for emotion analysis provided in the various embodiments described above.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. 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, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware form, and can also be realized in a form of hardware and a software functional module.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In the foregoing embodiments of the network device or the terminal device, it should be understood that the Processor may be a Central Processing Unit (CPU), or may be other general-purpose processors, Digital Signal Processors (DSP), Application Specific Integrated Circuits (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor, or in a combination of the hardware and software modules in the processor.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method of sentiment analysis, comprising:
determining a target entity in an article to be detected from a title of the article to be detected, wherein the target entity is an emotion analysis main body of the article to be detected, and the article to be detected comprises at least one entity;
acquiring a target sentence containing the target entity from the text of the article to be detected;
acquiring the title and the emotion score of the target entity in the target statement according to an emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entity in the statement and the emotion score;
and acquiring the emotion score of the target entity in the article to be detected according to the title and the emotion score of the target entity in the target sentence, wherein the emotion score of the target entity represents the evaluation of the user on the target entity.
2. The method of claim 1, wherein the obtaining of the target entity in the title of the article to be detected comprises:
segmenting words of the title of the article to be detected to obtain target words with preset parts of speech;
and acquiring the target entity in the target word according to the semantics of the title of the article to be detected.
3. The method of claim 2, wherein the obtaining the target entity in the title of the article to be detected comprises:
receiving a target entity confirmation instruction input by a user, wherein the target entity confirmation instruction is used for indicating the target entity;
and acquiring the target entity according to the target entity confirmation instruction.
4. The method of claim 1, wherein the obtaining of the target sentence containing the target entity in the text of the article to be detected comprises:
dividing the text of the article to be detected into a plurality of candidate sentences according to preset separators;
taking the target entity candidate sentence as the target sentence, wherein the target entity candidate sentence is: the candidate sentences containing the words corresponding to the target entities and the candidate sentences whose semantics contain the target entities.
5. The method according to any one of claims 1 to 4, wherein the obtaining the sentiment score of the target entity in the article to be detected comprises:
and acquiring the emotion mark of the target entity in the article to be detected according to the weight of the title, the weight of the text, the title and the emotion mark of the target entity in the target sentence.
6. The method of claim 1, further comprising:
taking a sample title, a sample text statement, an emotion mark of the sample title and an emotion mark of the sample text statement as a training data set, training to obtain the emotion analysis model, wherein the emotion mark is as follows: and the difference value between the actual emotion score output by the emotion analysis model and the expected emotion score is smaller than a difference threshold value.
7. The method of claim 6, wherein the emotion analysis model is obtained based on textcnn network structure training.
8. An apparatus for emotion analysis, comprising:
the processing module is used for determining a target entity in the article to be detected from the title of the article to be detected, wherein the target entity is an emotion analysis subject of the article to be detected, and the article to be detected comprises at least one entity; acquiring a target sentence containing the target entity from the text of the article to be detected; acquiring the title and the emotion score of the target entity in the target statement according to an emotion analysis model, wherein the emotion analysis model is used for representing the corresponding relation between the entity in the statement and the emotion score; and acquiring the emotion score of the target entity in the article to be detected according to the title and the emotion score of the target entity in the target sentence, wherein the emotion score of the target entity represents the evaluation of the user on the target entity.
9. An apparatus for emotion analysis, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the apparatus for emotion analysis to perform the method of any of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1-7.
CN201910421553.7A 2019-05-21 2019-05-21 Emotion analysis method, emotion analysis device and storage medium Active CN110287405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910421553.7A CN110287405B (en) 2019-05-21 2019-05-21 Emotion analysis method, emotion analysis device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910421553.7A CN110287405B (en) 2019-05-21 2019-05-21 Emotion analysis method, emotion analysis device and storage medium

Publications (2)

Publication Number Publication Date
CN110287405A CN110287405A (en) 2019-09-27
CN110287405B true CN110287405B (en) 2021-06-01

Family

ID=68002010

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910421553.7A Active CN110287405B (en) 2019-05-21 2019-05-21 Emotion analysis method, emotion analysis device and storage medium

Country Status (1)

Country Link
CN (1) CN110287405B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110837561A (en) * 2019-11-18 2020-02-25 苏州朗动网络科技有限公司 Text analysis method, text analysis device and storage medium
CN111538828B (en) * 2020-04-21 2023-04-25 招商局金融科技有限公司 Text emotion analysis method, text emotion analysis device, computer device, and readable storage medium
CN115952787B (en) * 2023-03-13 2023-05-12 北京澜舟科技有限公司 Emotion analysis method, system and storage medium for appointed target entity

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929861A (en) * 2012-10-22 2013-02-13 杭州东信北邮信息技术有限公司 Method and system for calculating text emotion index
CN103793503A (en) * 2014-01-24 2014-05-14 北京理工大学 Opinion mining and classification method based on web texts
CN108647219A (en) * 2018-03-15 2018-10-12 中山大学 A kind of convolutional neural networks text emotion analysis method of combination sentiment dictionary
CN109325238A (en) * 2018-10-31 2019-02-12 北京国信云服科技有限公司 A kind of method of multiple entity sentiment analysis in long text

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9336205B2 (en) * 2012-04-10 2016-05-10 Theysay Limited System and method for analysing natural language

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102929861A (en) * 2012-10-22 2013-02-13 杭州东信北邮信息技术有限公司 Method and system for calculating text emotion index
CN103793503A (en) * 2014-01-24 2014-05-14 北京理工大学 Opinion mining and classification method based on web texts
CN108647219A (en) * 2018-03-15 2018-10-12 中山大学 A kind of convolutional neural networks text emotion analysis method of combination sentiment dictionary
CN109325238A (en) * 2018-10-31 2019-02-12 北京国信云服科技有限公司 A kind of method of multiple entity sentiment analysis in long text

Also Published As

Publication number Publication date
CN110287405A (en) 2019-09-27

Similar Documents

Publication Publication Date Title
US9948595B2 (en) Methods and apparatus for inserting content into conversations in on-line and digital environments
US20170308523A1 (en) A method and system for sentiment classification and emotion classification
US9483462B2 (en) Generating training data for disambiguation
WO2017075017A1 (en) Automatic conversation creator for news
US9189470B2 (en) Generation of explanatory summaries
CN110287405B (en) Emotion analysis method, emotion analysis device and storage medium
JP2023535709A (en) Language expression model system, pre-training method, device, device and medium
CN112860852B (en) Information analysis method and device, electronic equipment and computer readable storage medium
KR101540683B1 (en) Method and server for classifying emotion polarity of words
KR101491628B1 (en) Method, apparatus and system for extracting keyword affecting for mood change of the public using blog
US9632998B2 (en) Claim polarity identification
WO2020199600A1 (en) Sentiment polarity analysis method and related device
US20130275438A1 (en) Disambiguating authors in social media communications
CN110737774A (en) Book knowledge graph construction method, book recommendation method, device, equipment and medium
KR20210034679A (en) Identify entity-attribute relationships
CN111737961B (en) Method and device for generating story, computer equipment and medium
JP2019091450A (en) Method and system for providing real-time feedback information related to content of user input
US10803247B2 (en) Intelligent content detection
US20180150450A1 (en) Comment-centered news reader
US11010687B2 (en) Detecting abusive language using character N-gram features
CN113032520A (en) Information analysis method and device, electronic equipment and computer readable storage medium
Skanda et al. Detecting stance in kannada social media code-mixed text using sentence embedding
US20230090601A1 (en) System and method for polarity analysis
CN110705308A (en) Method and device for recognizing field of voice information, storage medium and electronic equipment
CN115510860A (en) Text sentiment analysis method and device, electronic equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant