CN110287405A - The method, apparatus and storage medium of sentiment analysis - Google Patents

The method, apparatus and storage medium of sentiment analysis Download PDF

Info

Publication number
CN110287405A
CN110287405A CN201910421553.7A CN201910421553A CN110287405A CN 110287405 A CN110287405 A CN 110287405A CN 201910421553 A CN201910421553 A CN 201910421553A CN 110287405 A CN110287405 A CN 110287405A
Authority
CN
China
Prior art keywords
target entity
article
detected
title
sentiment analysis
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.)
Granted
Application number
CN201910421553.7A
Other languages
Chinese (zh)
Other versions
CN110287405B (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.)
Baidu Online Network Technology Beijing Co Ltd
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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Machine Translation (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application provides the method, apparatus and storage medium of a kind of sentiment analysis, this method comprises: obtaining the target entity in the title of article to be detected;Acquisition includes the object statement of target entity in the text of article to be detected;According to sentiment analysis model, the emotion score of target entity in title and object statement is obtained, sentiment analysis model is used to characterize the corresponding relationship of entity and emotion score in sentence;According to the emotion score of target entity in title and object statement, the emotion score of target entity in article to be detected is obtained.The application can obtain the emotion score of target entity in the article for including multiple entity, improve the confidence level of article sentiment analysis result.

Description

The method, apparatus and storage medium of sentiment analysis
Technical field
This application involves natural language processing technique field more particularly to the method, apparatus and storage of a kind of sentiment analysis Medium.
Background technique
Sentiment analysis is also known as proneness analysis, opinion extraction, opinion mining, emotion excavation, subjective analysis etc., it is to band There are the subjective texts of emotional color analyzed, handled, concluded and the process of reasoning.Today of high speed development in internet, The internet platforms such as microblogging, news, forum, blog and wechat generate the text data of magnanimity daily, and sentiment analysis can be automatic Effectively detect the Sentiment orientation of these viewpoint data.
In the prior art, sentiment analysis is carried out to article in such a way that text data set constructs deep learning model.It should Method is to short essay chapter, such as microblogging, comment analysis significant effect, because in short essay chapter often only including an entity, emotion Analysis result is the sentiment analysis for an entity.But for what is obtained comprising the long article of multiple entities, this method Sentiment analysis is the result is that the mixed feeling to entity all in entire article analyzes the confidence level as a result, sentiment analysis result It is low.
Summary of the invention
The application provides the method, apparatus and storage medium of a kind of sentiment analysis, can include the article of multiple entity The middle emotion score for obtaining target entity, improves the confidence level of article sentiment analysis result.
The first aspect of the application provides a kind of method of sentiment analysis, comprising:
Obtain the target entity in the title of article to be detected;
Acquisition includes the object statement of the target entity in the text of the article to be detected;
According to sentiment analysis model, the emotion score of target entity described in the title and the object statement is obtained, The sentiment analysis model is used to characterize the corresponding relationship of entity and emotion score in sentence;
According to the emotion score of target entity described in the title and the object statement, the article to be detected is obtained Described in target entity emotion score.
Optionally, the target entity in the title for obtaining article to be detected, comprising:
The title of the article to be detected is segmented, the target word with default part of speech is obtained;
According to the semanteme of the title of the article to be detected, the target entity is obtained in the target word.
Optionally, the target entity in the title for obtaining article to be detected, comprising:
The target entity for receiving user's input confirms instruction, and it is real that the target entity confirmation instruction is used to indicate the target Body;
Confirmed according to the target entity and instructed, obtains the target entity.
Optionally, the acquisition in the text of the article to be detected includes the object statement of the target entity, Include:
According to separator is preset, the text of the article to be detected is divided into multiple candidate sentences;
It will include the target entity candidate sentence as the object statement, and include the target entity candidate language Sentence are as follows: include the corresponding word of the target entity candidate sentence and semanteme in include the target entity time Select sentence.
Optionally, the emotion score for obtaining target entity described in the article to be detected, comprising:
According to the feelings of the target entity in the weight of title, the weight of text, the title and the object statement Feel score, obtains the emotion score of target entity described in the article to be detected.
Optionally, the method also includes:
By sample titles, sample text sentence, the emotion labels of the sample titles and the sample text sentence Emotion label is used as training dataset, and training obtains the sentiment analysis model, emotion label are as follows: the sample titles are described The expectation emotion score of entity in sample text sentence, the practical emotion score of the sentiment analysis model output and the phase The difference of emotion score is hoped to be less than difference threshold.
Optionally, the sentiment analysis model is obtained based on the training of textcnn network structure.
The second aspect of the application provides a kind of device of sentiment analysis, comprising:
Processing module, the target entity in title for obtaining article to be detected;In the text of the article to be detected Middle acquisition includes the object statement of the target entity;According to sentiment analysis model, the title and the target language are obtained The emotion score of target entity described in sentence, the sentiment analysis model are used to characterize pair of entity and emotion score in sentence It should be related to;According to the emotion score of target entity described in the title and the object statement, the article to be detected is obtained Described in target entity emotion score.
Optionally, the processing module, specifically for segmenting the title of the article to be detected, obtaining has in advance If the target word of part of speech;According to the semanteme of the title of the article to be detected, the target is obtained in the target word Entity.
Optionally, described device further include: transceiver module;
The transceiver module, for receiving the target entity confirmation instruction of user's input, the target entity confirmation instruction It is used to indicate the target entity.
The processing module is also used to confirm instruction according to the target entity, obtains the target entity.
Optionally, the processing module is specifically used for dividing the text of the article to be detected according to separator is preset For multiple candidate sentences;It will include the target entity candidate sentence as the object statement, and include that the target is real Body candidate's sentence are as follows: include the corresponding word of the target entity candidate sentence and semanteme in include the target The candidate sentence of entity.
Optionally, the processing module, specifically for according to the weight of title, the weight of text, the title and described The emotion score of the target entity in object statement obtains the emotion point of target entity described in the article to be detected Number.
Optionally, the processing module is specifically used for sample titles, sample text sentence, the feelings of the sample titles The emotion label of sense label and the sample text sentence is used as training dataset, and training obtains the sentiment analysis model, Emotion label are as follows: the expectation emotion score of the sample titles or the entity in the sample text sentence, the sentiment analysis The difference of the practical emotion score of model output and the expectation emotion score is less than difference threshold.
Optionally, the sentiment analysis model is that the processing module is obtained based on the training of textcnn network structure.
The third aspect of the application provides a kind of device of sentiment analysis, comprising: at least one processor and memory;
The memory stores computer executed instructions;
At least one described processor executes the computer executed instructions of the memory storage, so that the sentiment analysis The device method that executes above-mentioned sentiment analysis.
The fourth aspect of the application provides a kind of computer readable storage medium, deposits on the computer readable storage medium Computer executed instructions are contained, when the computer executed instructions are executed by processor, the method for realizing above-mentioned sentiment analysis.
The application provides the method, apparatus and storage medium of a kind of sentiment analysis, can for including the article of multiple entity Target entity is determined according to the title of article with elder generation, so again in the text of article obtain include target entity target language Sentence.Using sentiment analysis model, the emotion score of target entity described in the title and the object statement, Jin Erneng are obtained Enough obtain the emotion score of target entity described in the article to be detected.Method in the application can include multiple entity Article in obtain to the emotion score of target entity, improve the confidence level of article sentiment analysis result.
Detailed description of the invention
Fig. 1 is the flow diagram one of the method for sentiment analysis provided by the present application;
Fig. 2 is the flow diagram two of the method for sentiment analysis provided by the present application;
Fig. 3 is interface schematic diagram provided by the present application;
Fig. 4 is the structural schematic diagram one of the device of sentiment analysis provided by the present application;
Fig. 5 is the structural schematic diagram two of the device of sentiment analysis provided by the present application.
Specific embodiment
To keep the purposes, technical schemes and advantages of the application clearer, below in conjunction with embodiments herein, to this Technical solution in application embodiment is clearly and completely described, it is clear that described embodiment is that the application a part is real Example is applied, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making creation Property labour under the premise of every other embodiment obtained, shall fall in the protection scope of this application.
Sentiment analysis method is applied to every field.For example, the application program of film ticketing can use sentiment analysis, inspection User is surveyed to experience the viewing of film;Public sentiment system can use sentiment analysis, and the social public opinion for detecting hot topic influences;Point Evaluate website can use sentiment analysis, detection restaurant, vegetable, retail shop favorable comment degree.
Sentiment analysis method in the prior art, for include an entity short essay chapter for analytical effect it is significant. For example, user comments on the restaurant A in comment website, the entity in the comment text (article) is the restaurant A, then to the point Comment text carry out sentiment analysis result be to the sentiment analysis in the restaurant A as a result, as the restaurant A sentiment analysis result preferably Comment 80 points.And for the long article for including multiple entity, the sentiment analysis for the long article that method in the prior art obtains It as a result is the fusion of the sentiment analysis result of multiple entities.For example, a long article is the commentary to multiple restaurants, including A meal Shop, the restaurant B and the restaurant C.The final sentiment analysis result favorable comment degree in this way point obtained according to method in the prior art, then should The result is that the fusion of the sentiment analysis result to the restaurant A, the restaurant B and the restaurant C, can not obtain in the long article and eat respectively to A The sentiment analysis result in shop, the restaurant B and the restaurant C.Therefore, the sentiment analysis result is inaccurate, with a low credibility.
To solve the above-mentioned problems, this application provides a kind of methods of sentiment analysis, by the title for identifying long article In target entity, and then include the mesh according in the emotion score of the target entity in title and the text of long article The emotion score for marking the object statement of the entity target entity reaches the emotion score for obtaining the target entity in long article Purpose.
Fig. 1 is the flow diagram one of the method for sentiment analysis provided by the present application.The execution master of method flow shown in Fig. 1 Body can be the device of sentiment analysis, and the device of the sentiment analysis can be by arbitrary software and or hardware realization.
Optionally, the device of the sentiment analysis can be server, for example, the server can be instant chat application journey The corresponding server of sequence, the corresponding server of cuisines comment application program or the corresponding server of news application program etc..Service Device can carry out sentiment analysis to the article in corresponding application program.Optionally, the device of the sentiment analysis can be terminal Equipment, terminal device can carry out sentiment analysis to the article wherein stored.Using executing subject as server in following embodiments For be illustrated.
Terminal device in the application includes but does not select and be limited to for mobile terminal device or fixed terminal equipment.Mobile terminal Equipment includes but is not limited to mobile phone, personal digital assistant (Personal Digital Assistant, referred to as: PDA), plate electricity Brain, portable equipment (for example, portable computer, pocket computer or handheld computer) etc..Fixed terminal equipment includes But be not limited to desktop computer, audio-visual devices, smart television etc..
As shown in Figure 1, the method for sentiment analysis provided in this embodiment may include:
S101 obtains the target entity in the title of article to be detected.
Article to be detected in the present embodiment is the article for including title and text.For example, article to be detected can be News article, paper article, tourism comment etc. include the article of title and text.Wherein, it is said by taking news article as an example Bright, the title of news article contains the most important information of article, the target entity including article, and can embody substantially Emotional attitude of the article for the target entity.Accordingly, headline is that news article in sentiment analysis is important analysis number According to.It should be understood that the entity in the present embodiment is the main object of the sentiment analysis in article to be detected.
It include multiple Internet companies in news article for example, being the commentary article to Internet company in news article. According to the fusion sentiment analysis result that the sentiment analysis result that method in the prior art obtains is to multiple Internet companies.Newly Hearing in article includes Internet company A, Internet company B and Internet company C, and from the point of view of the title of news article, this is new The target entity for hearing article is Internet company A.
If the news article actually should to the sentiment analysis result of Internet company A are as follows: the favorable comment of Internet company A Degree is 80 points, but includes that there are three the sentiment analysis of Internet company as a result, and may be completely different in the news article Sentiment analysis result.If the sentiment analysis result of Internet company A is that favorable comment 80 is divided, the sentiment analysis result of Internet company B Divide for favorable comment 60, the sentiment analysis result of Internet company C is that unfavorable comments 80 divide, then what is obtained according to the method in the prior art is mutual The sentiment analysis result of networking company A may be the fusion of the sentiment analysis result of three Internet companies, as favorable comment 40 is divided. The result that the sentiment analysis result of Internet company A is divided for favorable comment 80 can not really be obtained.
The target entity in the title of article to be detected is obtained in the present embodiment, with the sentiment analysis of determination article to be detected Entity, and then to the entity carry out sentiment analysis, to achieve the purpose that the sentiment analysis result for accurately obtaining article to be detected.
Due to having the format of structuring comprising headed article to be detected, after server obtains article to be detected, The title and text of article to be detected can be determined according to preset structured stencil.
Optionally, target entity can be determined according to the semanteme of the title of article to be detected in the present embodiment.For example, to be checked Entitled " emergence of Internet company A " for surveying article can determine the target entity of the title then according to the semanteme of the title For " Internet company A ".
Optionally, target reality can also be determined in the present embodiment according to the part of speech of the word in the title of article to be detected Body.For example, the target entity in the title of usually article to be detected is noun, then can be arranged in the server in the present embodiment Default part of speech.Server can the word in the title to article to be detected carry out part of speech detection, determine target entity.Such as title For " beautiful Beijing ", server can determine that the word in the title is " beautiful " for adjective, and " Beijing " is noun, then really Fixed " Beijing " is target entity.It should be understood that it is the pre- of target entity that different parts of speech, which can be set, for different application scenarios If part of speech.
The above two mode for obtaining target entity can be individually performed, can also be in conjunction with execution.In conjunction with the mode of execution The target entity in the title of the article to be detected obtained can be made more accurate.
S102, acquisition includes the object statement of target entity in the text of article to be detected.
It may include multiple and different entities in article to be detected, obtain the feelings to target entity in the present embodiment Sense analysis as a result, can be obtained in the text of article to be detected include target entity object statement.
Wherein, article to be detected may include at least one paragraph, may include again at least one sentence in each paragraph. It optionally, can be by the way that in each sentence, by way of word match, determination includes target entity in the present embodiment Object statement.For example, target entity is " Beijing ", then the sentence for including " Beijing " can be object statement.
Optionally, division rule can be preset to the division of the sentence of article to be detected in the present embodiment.Such as foundation Punctuation mark is divided, and can be one between every two fullstop can be one between sentence or fullstop and exclamation mark It can be a sentence between sentence or fullstop and question mark.After server obtains article to be detected, server can basis The text of article to be detected is divided into multiple sentences by preset division rule, and obtaining in multiple sentences includes target reality The object statement of body.
S103 obtains the emotion score of target entity in title and object statement, sentiment analysis according to sentiment analysis model Model is used to characterize the corresponding relationship of entity and emotion score in sentence.
It include target entity in title and object statement, i.e., server can pass through title and mesh in the present embodiment To the analysis of the emotion text of target entity in poster sentence, the sentiment analysis result of the target entity in article to be detected is obtained.
Sentiment analysis model is preset in the present embodiment in server.Wherein, the sentiment analysis model is for characterizing sentence In entity and emotion score corresponding relationship, i.e., by input by sentence into the sentiment analysis model, sentiment analysis model can be with Export the emotion score of the entity in the sentence.
Optionally, the sentiment analysis model in the present embodiment can be based on deep learning network struction.Wherein, deep learning Network can be textcnn network, which includes word embeding layer, convolutional layer, maximum pond layer and full connection Layer, the sentiment analysis model based on the textcnn network can be by input text conversions at emotion score.In the mistake of actual motion Cheng Zhong, it may be considered that initialize word embeding layer, using the term vector model of pre-training with lift scheme precision.
Server can obtain the emotion score of target entity in title and object statement according to the sentiment analysis model. I.e. title and object statement can be input to sentiment analysis model by server, with target entity in output header and object statement Emotion score.
It should be understood that target entity in the title and object statement when object statement is multiple, obtained in the present embodiment Emotion score are as follows: the emotion score of title and the entity in each object statement.For example, the target entity in title is " interconnection Net company A ", and include that the object statement of " Internet company A " has sentence A, sentence B and sentence C.Pass through the sentiment analysis mould Type, the emotion score and the " internet in sentence A, sentence B and sentence C of " Internet company A " in available title The emotion score of company A " gets four emotion scores for target entity in article that is, to be detected.
S104 obtains target entity in article to be detected according to the emotion score of target entity in title and object statement Emotion score.
In the present embodiment, according to sentiment analysis model, the target in the title and text of available article to be detected is real The emotion score of body.Further, multiple emotion scores according to target entity in the article to be detected, it is available to be checked Survey the emotion score of target entity in article.
Optionally, the mean value of multiple emotion scores of the target entity in the article to be detected can be made in the present embodiment For the emotion score of target entity in article to be detected.For example, the emotion score of " Internet company A " in title is favorable comment 80 Point and " Internet company A " in sentence A, sentence B and sentence C emotion score be respectively that favorable comment 70 is divided, favorable comment 50 is divided and Favorable comment 90 is divided, then in article to be detected " Internet company A " emotion score be multiple emotion score mean value favorable comment 72.5 Point.
Optionally, the weight of title and the weight of text can also be preset in the present embodiment, according to title and target The weight of the emotion score of target entity and the weight of title and text in sentence, obtains target entity in article to be detected Emotion score.For example, the weight of title is 0.5, the weight of text is also 0.5, then above-mentioned target entity " Internet company A " Emotion score in article to be detected is that favorable comment 75 is divided.It should be understood that the weight of above-mentioned title and the weight of text are merely illustrative, Also other weights can be set.
The method of sentiment analysis provided in this embodiment includes: the target entity in the title for obtain article to be detected;? Acquisition includes the object statement of target entity in the text of article to be detected;According to sentiment analysis model, title and mesh are obtained The emotion score of target entity in poster sentence, sentiment analysis model are used to characterize the entity pass corresponding with emotion score in sentence System;According to the emotion score of target entity in title and object statement, the emotion score of target entity in article to be detected is obtained. The method of sentiment analysis provided by the present application can obtain the emotion score of target entity in the article for including multiple entity, mention The confidence level of high article sentiment analysis result.
On the basis of the above embodiments, below with reference to Fig. 2 to how being obtained in the method for sentiment analysis provided by the present application The target entity in title and the emotion score in article to be detected is taken to be illustrated.Fig. 2 is emotion provided by the present application point The flow diagram two of the method for analysis.As shown in Fig. 2, the method for sentiment analysis provided in this embodiment may include:
S201, by sample titles, sample text sentence, the emotion label of sample titles and the feelings of sample text sentence Sense label is used as training dataset, and training obtains sentiment analysis model.
, can be according to by training dataset in the present embodiment, training obtains emotion point on the basis of textcnn network Analyse model.Wherein, training data concentration may include: sample titles, sample text sentence, the emotion label of sample titles, with And the emotion label of sample text sentence.
Sample titles and sample text sentence can detect in article from a large amount of history to be obtained, and history detects article It can be the article for including title, include entity in sample titles and sample text sentence.It is worth noting that, emotion mark It is denoted as: the expectation emotion score of sample titles or the entity in sample text sentence.Correspondingly, the emotion of sample titles marks Are as follows: the expectation emotion score of the entity in sample titles.Correspondingly, the emotion of sample text sentence marks are as follows: in text sentence Entity expectation emotion score.
For example, sample titles are " the hot restaurant A ", then the emotion label of sample titles can be 80 accordingly.Ying Li It solves, the emotion score in sample titles, the emotion of sample text sentence label can be according in sample titles, sample text sentence The positive and negative attribute of word be labeled as that there is positive and negative score, such as favorable comment 80 in above-described embodiment is positive score.
For example, sample titles are " the bad restaurant A ", then the emotion label of sample titles can be -50 accordingly.Its In, " bad " and " hot " in sample titles is the positive and negative attribute of word.In the present embodiment, concentrated in training data Each sample sentence and each sample titles all have corresponding expectation emotion score.
On the basis of textcnn network, by using training dataset, constantly sentiment analysis model is instructed Practice, until the practical emotion score of sentiment analysis model output and the difference of desired emotion score are less than difference threshold.This implementation The sentiment analysis model finally used in example is at the end of training, the practical emotion score of output and the difference of desired emotion score Less than difference threshold, i.e. computing capability of the sentiment analysis model with high accuracy.
It should be understood that the step of sentiment analysis model is obtained in S201, it can be to be detected using the acquisition of sentiment analysis model It is carried out before the emotion score of article, obtains sentiment analysis model when not obtaining the emotion score of article to be detected every time.
Two kinds are divided into the target entity in the title for obtaining article to be detected in the present embodiment below with reference to S202-S204 Situation is illustrated.Wherein, S202-S203 is a kind of feasible side of the target entity in the title for obtain article to be detected Formula, S204-S205 are another feasible mode.It should be understood that S202-S203 and S204-S205 are the mode for selecting an execution.
S202 segments the title of article to be detected, obtains the target word with default part of speech.
In the present embodiment, obtain the target entity in the title of article to be detected, can title to article to be detected into Row participle obtains the corresponding multiple words of title.Optionally, it can be previously provided with default part of speech, title is corresponding obtaining , can be according to the part of speech of multiple word after multiple words, and then obtain the target word with default part of speech.It should be understood that this The title of article to be detected is carried out segmenting can be segmenting using jieba, SnowNLP, THULAC or NLPIR etc. in embodiment Tool is segmented.
For example, default part of speech is noun, entitled " tomorrow of the Internet company A of fast development " of article to be detected. " fast development " available after being segmented to title, " Internet company A ", " " and " tomorrow ".Wherein, " swift and violent Development " be adjective, " " be conjunction, " Internet company A " and " tomorrow " are noun, then have noun part-of-speech target Word is " Internet company A " and " tomorrow ".
S203 obtains target entity according to the semanteme of the title of article to be detected.
In order to enable obtain article to be detected title in target entity it is more accurate, in the present embodiment also according to The semanteme for detecting the title of article, obtains target entity in target word.
For example, above-mentioned determining target word was " Internet company A " and after " tomorrow ", then analyze the title of article to be detected Semanteme be " Internet company A later development ", then can be determined in target word target entity be " Internet company A”。
S204, the target entity for receiving user's input confirm that instruction, target entity confirmation instruction are used to indicate target entity.
In the present embodiment, user can also set target entity.Optionally, the scene of this kind of situation application can be with are as follows: really Emotion score in fixed a large amount of article to be tested about same entity, or determine the feelings of a certain entity in an article to be detected Feel score.
User can input target entity confirmation instruction by voice or other modes, and target entity confirmation instruction is used In instruction target entity.Fig. 3 is interface schematic diagram provided by the present application.Wherein, which can be the display interface of server. As shown in figure 3, can show the input frame of target entity on interface, user can input target entity in input frame, i.e., It can trigger the target entity confirmation instruction that server receives user's input.Optionally, inputting target entity in input frame can be with For the corresponding word of input target entity.It should be understood that being shown so that the device of sentiment analysis is terminal as an example in Fig. 3.
S205 confirms according to target entity and instructs, and obtains target entity.
Target entity confirmation instruction is used to indicate target entity, and server is receiving target entity confirmation instruction, can be with Obtain the target entity in the title of article to be detected.
For example, it is " Internet company A " that user inputs target entity in input frame, then server determines article to be detected Title in target entity be " Internet company A ".
The text of article to be detected is divided into multiple candidate sentences according to separator is preset by S206.
, can be according to default separator in order to obtain the object statement for including target entity in the present embodiment, it will be to be checked The text for surveying article is divided into multiple candidate sentences.Wherein, default separator can be the punctuation mark in article, as fullstop, Question mark or exclamation mark.
Optionally, the server in the present embodiment can inquire the text of article to be detected, obtain in text Default separator, using the sentence between two default separators as a candidate sentence.It adopts in a like fashion, it is available Multiple candidate sentences of article to be detected.
S207 will include target entity candidate's sentence as object statement.
In the present embodiment, after the object statement in the title for obtaining article to be detected, can article to be detected just Acquisition includes the object statement of target entity in text.Wherein it is possible to will include target entity candidate's sentence as target language Sentence.
It optionally, can will include the candidate sentence of the corresponding word of target entity in the present embodiment as target language Sentence.For example, target entity is " Internet company A ", candidate sentence is " leader of Internet company A is xxx ", candidate's language It include the corresponding word of target entity " Internet company A " in sentence, i.e., using candidate's sentence as object statement.
It optionally, can will include the candidate sentence of target entity in semanteme in the present embodiment as object statement.Example Such as, target entity is " Beijing ", and candidate sentence is " our capital is worth pride ", includes in the semanteme of candidate's sentence Target entity " Beijing ", i.e., using candidate's sentence as object statement.It wherein, include that target entity may is that time in semanteme Select include in sentence target entity synonym, refer to word.
Optionally, in the present embodiment can also semanteme based on context, will include the candidate of target entity in semanteme Sentence is as object statement.
S208 obtains the emotion of target entity described in the title and the object statement according to sentiment analysis model Score.
The embodiment in S208 in the present embodiment is referred to the associated description of the S103 in above-described embodiment, herein It does not repeat them here.
S209, according to the emotion score of the target entity in the weight of title, the weight of text, title and object statement, Obtain the emotion score of target entity in article to be detected.
Weight, the weight of text of title can be preset in the present embodiment.Optionally, title can embody substantially The weight of title and text therefore can be respectively set to 0.5 for the emotional attitude of target entity by article.
Wherein, obtain the concrete mode of the emotion score of target entity in article to be detected are as follows: according to the weight of title and The product of the emotion score of target entity in title obtains the first emotion score;Obtain the target entity in object statement The mean value of emotion score obtains the second emotion score according to the product of the weight of text and the mean value;First emotion score and The adduction of two emotion scores is the emotion score of target entity in article to be detected.
In the present embodiment, it can be obtained by the part of speech of the word in the title of article to be detected and the semantic of title Target entity can also obtain target entity by the predefined mode of user, further, obtain the text of article to be detected In include target entity object statement;In conjunction with the emotion score of target entity in title and object statement, obtain to be detected The emotion score of target entity in article.The application can improve article sentiment analysis in the emotion score for obtaining target entity As a result confidence level, and can satisfy user for the demand of the emotion score of target entity.
Fig. 4 is the structural schematic diagram one of the device of sentiment analysis provided by the present application.As shown in figure 4, the sentiment analysis Device 400 includes: processing module 401 and transceiver module 402.
Processing module 401, the target entity in title for obtaining article to be detected;In the text of article to be detected Acquisition includes the object statement of target entity;According to sentiment analysis model, target entity in title and object statement is obtained Emotion score, sentiment analysis model are used to characterize the corresponding relationship of entity and emotion score in sentence;According to title and target The emotion score of target entity in sentence, obtains the emotion score of target entity in article to be detected.
Optionally, processing module 401, specifically for segmenting the title of article to be detected, obtaining has default word The target word of property;According to the semanteme of the title of article to be detected, target entity is obtained in target word.
Transceiver module 402, for receiving the target entity confirmation instruction of user's input, target entity confirmation instruction is for referring to Show target entity.
Processing module 401 is also used to confirm instruction according to target entity, obtains target entity.
Optionally, processing module 401 are specifically used for being divided into the text of article to be detected more according to separator is preset A candidate's sentence;It will include target entity candidate sentence as object statement, and include target entity candidate's sentence are as follows: include It include the candidate sentence of target entity in the candidate sentence and semanteme for having the corresponding word of target entity.
Optionally, processing module 401, specifically for according in the weight of title, the weight of text, title and object statement Target entity emotion score, obtain the emotion score of target entity in article to be detected.
Optionally, processing module 401 are specifically used for sample titles, sample text sentence, the emotion mark of sample titles Note and the emotion of sample text sentence label are used as training dataset, and training obtains sentiment analysis model, emotion label are as follows: The expectation emotion score of sample titles or the entity in sample text sentence, sentiment analysis model output practical emotion score with It is expected that the difference of emotion score is less than difference threshold.
Optionally, sentiment analysis model is that processing module 401 is obtained based on the training of textcnn network structure.
The principle and technical effect that the method for the device of sentiment analysis provided in this embodiment and above-mentioned sentiment analysis is realized Similar, therefore not to repeat here.
Fig. 5 is the structural schematic diagram two of the device of sentiment analysis provided by the present application.As shown in figure 5, the sentiment analysis Device 500 includes: memory 501 and at least one processor 502.
Memory 501, for storing program instruction.
Processor 502, it is specific real for being performed the method for realizing the sentiment analysis in the present embodiment in program instruction Existing principle can be found in above-described embodiment, and details are not described herein again for the present embodiment.
The device 500 of the sentiment analysis can also include and input/output interface 503.
Input/output interface 503 may include independent output interface and input interface, or integrated input and defeated Integrated interface out.Wherein, output interface is used for output data, and input interface is used to obtain the data of input.
The application also provides a kind of readable storage medium storing program for executing, is stored with and executes instruction in readable storage medium storing program for executing, works as sentiment analysis At least one processor of device when executing this and executing instruction, when computer executed instructions are executed by processor, in realization The method for stating the sentiment analysis in embodiment.
The application also provides a kind of program product, the program product include execute instruction, this execute instruction be stored in it is readable In storage medium.At least one processor of the device of sentiment analysis can read this from readable storage medium storing program for executing and execute instruction, until A few processor executes this and executes instruction so that the device of sentiment analysis implements the emotion that above-mentioned various embodiments provide The method of analysis.
In several embodiments provided herein, it should be understood that disclosed device and method can pass through it Its mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of the module, only Only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple module or components can be tied Another system is closed or is desirably integrated into, or some features can be ignored or not executed.Another point, it is shown or discussed Mutual coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or logical of device or module Letter connection can be electrical property, mechanical or other forms.
The module as illustrated by the separation member may or may not be physically separated, aobvious as module The component shown may or may not be physical module, it can and it is in one place, or may be distributed over multiple On network module.Some or all of the modules therein can be selected to realize the mesh of this embodiment scheme according to the actual needs 's.
It, can also be in addition, can integrate in a processing module in each functional module in each embodiment of the application It is that modules physically exist alone, can also be integrated in two or more modules in a module.Above-mentioned integrated mould Block both can take the form of hardware realization, can also realize in the form of hardware adds software function module.
The above-mentioned integrated module realized in the form of software function module, can store and computer-readable deposit at one In storage media.Above-mentioned software function module is stored in a storage medium, including some instructions are used so that a computer Equipment (can be personal computer, server or the network equipment etc.) or processor (English: processor) execute this Shen Please each embodiment the method part steps.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviation: ROM), random access memory (English: Random Access Memory, letter Claim: RAM), the various media that can store program code such as magnetic or disk.
In the embodiment of the above-mentioned network equipment or terminal device, it should be appreciated that processor can be central processing unit (English: Central Processing Unit, referred to as: CPU), it can also be other general processors, digital signal processor (English: Digital Signal Processor, abbreviation: DSP), specific integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC) etc..General processor can be microprocessor or the processor It is also possible to any conventional processor etc..Hardware handles can be embodied directly in conjunction with the step of method disclosed in the present application Device executes completion, or in processor hardware and software module combination execute completion.
Finally, it should be noted that the above various embodiments is only to illustrate the technical solution of the application, rather than its limitations;To the greatest extent Pipe is described in detail the application referring to foregoing embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into Row equivalent replacement;And these are modified or replaceed, each embodiment technology of the application that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (10)

1. a kind of method of sentiment analysis characterized by comprising
Obtain the target entity in the title of article to be detected;
Acquisition includes the object statement of the target entity in the text of the article to be detected;
According to sentiment analysis model, the emotion score of target entity described in the title and the object statement is obtained, it is described Sentiment analysis model is used to characterize the corresponding relationship of entity and emotion score in sentence;
According to the emotion score of target entity described in the title and the object statement, institute in the article to be detected is obtained State the emotion score of target entity.
2. the method according to claim 1, wherein the target in the title for obtaining article to be detected is real Body, comprising:
The title of the article to be detected is segmented, the target word with default part of speech is obtained;
According to the semanteme of the title of the article to be detected, the target entity is obtained in the target word.
3. according to the method described in claim 2, it is characterized in that, the target in the title for obtaining article to be detected is real Body, comprising:
The target entity for receiving user's input confirms that instruction, the target entity confirmation instruction are used to indicate the target entity;
Confirmed according to the target entity and instructed, obtains the target entity.
4. the method according to claim 1, wherein described obtain in the text of the article to be detected includes There is the object statement of the target entity, comprising:
According to separator is preset, the text of the article to be detected is divided into multiple candidate sentences;
It will include the target entity candidate sentence as the object statement, and include the target entity candidate sentence Are as follows: include the corresponding word of the target entity candidate sentence and semanteme in include the target entity candidate Sentence.
5. method according to claim 1-4, which is characterized in that described to obtain described in the article to be detected The emotion score of target entity, comprising:
According to the emotion of the target entity in the weight of title, the weight of text, the title and the object statement point Number obtains the emotion score of target entity described in the article to be detected.
6. the method according to claim 1, wherein the method also includes:
By sample titles, sample text sentence, the emotion label of the sample titles and the emotion of the sample text sentence Label is used as training dataset, and training obtains the sentiment analysis model, emotion label are as follows: the sample titles or the sample The expectation emotion score of entity in text sentence, the practical emotion score of the sentiment analysis model output and the expectation feelings The difference for feeling score is less than difference threshold.
7. according to the method described in claim 6, it is characterized in that, the sentiment analysis model is based on textcnn network knot Structure training obtains.
8. a kind of device of sentiment analysis characterized by comprising
Processing module, the target entity in title for obtaining article to be detected;It is obtained in the text of the article to be detected Take include the target entity object statement;According to sentiment analysis model, obtain in the title and the object statement The emotion score of the target entity, the sentiment analysis model are used to characterize the entity pass corresponding with emotion score in sentence System;According to the emotion score of target entity described in the title and the object statement, institute in the article to be detected is obtained State the emotion score of target entity.
9. a kind of device of sentiment analysis characterized by comprising at least one processor and memory;
The memory stores computer executed instructions;
At least one described processor executes the computer executed instructions of the memory storage, so that the dress of the sentiment analysis It sets perform claim and requires the described in any item methods of 1-7.
10. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium It executes instruction, when the computer executed instructions are executed by processor, realizes the described in any item methods of claim 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 true CN110287405A (en) 2019-09-27
CN110287405B 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)

Cited By (6)

* 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
CN111538828A (en) * 2020-04-21 2020-08-14 招商局金融科技有限公司 Text emotion analysis method and device, computer device and readable storage medium
CN111738015A (en) * 2020-06-22 2020-10-02 北京百度网讯科技有限公司 Method and device for analyzing emotion polarity of article, electronic equipment and storage medium
CN114117042A (en) * 2021-11-15 2022-03-01 盐城金堤科技有限公司 Method, device, equipment and medium for predicting emotion of enterprise entity in public opinion text
CN115952787B (en) * 2023-03-13 2023-05-12 北京澜舟科技有限公司 Emotion analysis method, system and storage medium for appointed target entity
CN114117042B (en) * 2021-11-15 2024-07-16 盐城天眼察微科技有限公司 Emotion prediction method, device, equipment and medium for business entity in public opinion text

Citations (5)

* 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
US20130268262A1 (en) * 2012-04-10 2013-10-10 Theysay Limited System and Method for Analysing Natural Language
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130268262A1 (en) * 2012-04-10 2013-10-10 Theysay Limited System and Method for Analysing Natural Language
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

Cited By (7)

* 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
CN111538828A (en) * 2020-04-21 2020-08-14 招商局金融科技有限公司 Text emotion analysis method and device, computer device and readable storage medium
CN111738015A (en) * 2020-06-22 2020-10-02 北京百度网讯科技有限公司 Method and device for analyzing emotion polarity of article, electronic equipment and storage medium
CN111738015B (en) * 2020-06-22 2024-04-12 北京百度网讯科技有限公司 Article emotion polarity analysis method and device, electronic equipment and storage medium
CN114117042A (en) * 2021-11-15 2022-03-01 盐城金堤科技有限公司 Method, device, equipment and medium for predicting emotion of enterprise entity in public opinion text
CN114117042B (en) * 2021-11-15 2024-07-16 盐城天眼察微科技有限公司 Emotion prediction method, device, equipment and medium for business entity in public opinion text
CN115952787B (en) * 2023-03-13 2023-05-12 北京澜舟科技有限公司 Emotion analysis method, system and storage medium for appointed target entity

Also Published As

Publication number Publication date
CN110287405B (en) 2021-06-01

Similar Documents

Publication Publication Date Title
CN104809176B (en) Tibetan language entity relation extraction method
CN106407236B (en) A kind of emotion tendency detection method towards comment data
CN110287405A (en) The method, apparatus and storage medium of sentiment analysis
JP2021089739A (en) Question answering method and language model training method, apparatus, device, and storage medium
US9483462B2 (en) Generating training data for disambiguation
CN110705206B (en) Text information processing method and related device
CN104090955A (en) Automatic audio/video label labeling method and system
CN111930792B (en) Labeling method and device for data resources, storage medium and electronic equipment
CN102279890A (en) Sentiment word extracting and collecting method based on micro blog
KR20110115543A (en) Method for calculating entity similarities
CN104978332B (en) User-generated content label data generation method, device and correlation technique and device
EP4113357A1 (en) Method and apparatus for recognizing entity, electronic device and storage medium
CN105893484A (en) Microblog Spammer recognition method based on text characteristics and behavior characteristics
CN114328852B (en) Text processing method, related device and equipment
CN104615715A (en) Social network event analyzing method and system based on geographic positions
CN108831442A (en) Point of interest recognition methods, device, terminal device and storage medium
CN111160041A (en) Semantic understanding method and device, electronic equipment and storage medium
CN105988978B (en) Determine the method and system of text focus
Algur et al. Sentiment analysis by identifying the speaker's polarity in Twitter data
Skanda et al. Detecting stance in kannada social media code-mixed text using sentence embedding
CN114218951A (en) Entity recognition model training method, entity recognition method and device
Sagcan et al. Toponym recognition in social media for estimating the location of events
CN112559711A (en) Synonymous text prompting method and device and electronic equipment
CN110008314B (en) Intention analysis method and device
CN111555960A (en) Method for generating information

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