CN109960791A - Judge the method and storage medium, terminal of text emotion - Google Patents

Judge the method and storage medium, terminal of text emotion Download PDF

Info

Publication number
CN109960791A
CN109960791A CN201711420284.XA CN201711420284A CN109960791A CN 109960791 A CN109960791 A CN 109960791A CN 201711420284 A CN201711420284 A CN 201711420284A CN 109960791 A CN109960791 A CN 109960791A
Authority
CN
China
Prior art keywords
text
analyzed
word
emotion
vector
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.)
Pending
Application number
CN201711420284.XA
Other languages
Chinese (zh)
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.)
Shanghai Xiaoi Robot Technology Co Ltd
Shanghai Zhizhen Intelligent Network Technology Co Ltd
Original Assignee
Shanghai Zhizhen Intelligent Network 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 Shanghai Zhizhen Intelligent Network Technology Co Ltd filed Critical Shanghai Zhizhen Intelligent Network Technology Co Ltd
Priority to CN201711420284.XA priority Critical patent/CN109960791A/en
Publication of CN109960791A publication Critical patent/CN109960791A/en
Pending legal-status Critical Current

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/35Clustering; Classification
    • G06F16/353Clustering; Classification into predefined classes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

A kind of method and storage medium, terminal judging text emotion, the method for the judgement text emotion include: to utilize default original language material training term vector model;Text to be analyzed is obtained, the text to be analyzed includes multiple first words;Each first word in the text to be analyzed is converted into term vector using the term vector model;The sentence vector of the text to be analyzed is obtained using each term vector and its corresponding emotion weight calculation, the emotion weight of each term vector is predetermined;The emotional category that the text to be analyzed is determined according to the sentence vector of the text to be analyzed, specifically includes: the emotion probability of the text to be analyzed is calculated according to the sentence vector of the text to be analyzed;If the emotion probability reaches given threshold, it is determined that the text to be analyzed is positive mood, otherwise determines that the text to be analyzed is negative emotions.The efficiency and accuracy of text emotion analysis can be improved in technical solution through the invention.

Description

Judge the method and storage medium, terminal of text emotion
Technical field
The present invention relates to natural language processing technique fields more particularly to a kind of method for judging text emotion and storage to be situated between Matter, terminal.
Background technique
Text emotion analysis, also known as opinion mining (Opinion Mining), refer to the subjectivity for having emotional color Text is analyzed, handled, concluded and the process of reasoning.Text emotion analytical technology is in network marketing, the monitoring of enterprise's public sentiment, political affairs More and more important role is played the part of in mansion public opinion monitoring etc..Emotional semantic classification is a subtask of text emotion analytical technology, benefit Emotion text is divided into several emotional categories with the result that bottom emotion information extracts, is such as divided into and passes judgement on two class emotional categories, In, praising the corresponding text of class emotional category is front text, and demoting the corresponding text of class emotional category is negative text.
In the prior art, the supervised classification method based on machine learning is mainly used to the method that text is classified.Base It is sorted including training classifier process and treating classifying text progress using classifier in the supervised classification method of machine learning Journey.Wherein, during training classifier, artificial constructed a large amount of Feature Engineering is needed, it is therefore desirable to artificial to carry out for a long time Labour, greatly consumes manpower;On the other hand, text vector constructed in conventional method indicates to be easy there are sparsity Lead to dimension disaster, and keep the training time of classifier longer, treats the efficiency that classifying text is classified to reduce.Instruction The classifier got indicates the semantic information of text due to lacking, and causes to treat classifying text using classifier and classify Result accuracy rate it is lower.
Summary of the invention
Present invention solves the technical problem that being how to improve the efficiency and accuracy of text emotion judgement.
In order to solve the above technical problems, the embodiment of the present invention provides a kind of method for judging text emotion, comprising:
Utilize default original language material training term vector model;
Text to be analyzed is obtained, the text to be analyzed includes multiple first words;
Each first word in the text to be analyzed is converted into term vector using the term vector model;
The sentence vector of the text to be analyzed, each word are obtained using each term vector and its corresponding emotion weight calculation The emotion weight of vector is predetermined;
The emotional category that the text to be analyzed is determined according to the sentence vector of the text to be analyzed, specifically includes: according to The sentence vector of the text to be analyzed calculates the emotion probability of the text to be analyzed;If the emotion probability reaches setting threshold Value, it is determined that the text to be analyzed is positive mood, otherwise determines that the text to be analyzed is negative emotions.
Optionally, the acquisition text to be analyzed includes:
Word segmentation processing is carried out to text to be analyzed according to dictionary, obtains multiple first words, the dictionary includes multiple the Two words.
Optionally, the acquisition text to be analyzed includes further include:
Obtain the initial weight of each second word;
The initial weight is adjusted according to Sentiment orientation of each second word in default sentiment dictionary, with To the corresponding emotion weight of each second word, the corresponding emotion weight of the second word is equal to the term vector of first word Corresponding emotion weight.
Optionally, Sentiment orientation of each second word of the basis in default sentiment dictionary to the initial weight into Row adjusts
If the Sentiment orientation of the second word is front, increased on the basis of the initial weight of second word Greatly, to obtain the emotion weight of second word;
If the Sentiment orientation of the second word be it is negative, subtracted on the basis of the initial weight of second word It is small, to obtain the emotion weight of second word.
Optionally, the text to be analyzed is determined using softmax function, negative sampling function or level softmax function Emotional category.
Optionally, each first word by the text to be analyzed is converted to term vector and includes:
For unregistered word, each word of the unregistered word is converted into word vector, and the sum of all word vectors are made For the term vector of the unregistered word.
Optionally, the term vector is N metagrammar feature vector, and N is typically greater than equal to 2 positive integer.
Optionally, described to obtain the sentence of the text to be analyzed using each term vector and its corresponding emotion weight calculation Vector includes: using the sum of products of the corresponding emotion weight of each term vector as the sentence vector of the text to be analyzed.
The embodiment of the invention also discloses a kind of storage mediums, are stored thereon with computer instruction, and the computer refers to The step of enabling the method for judged text emotion when running.
The embodiment of the invention also discloses a kind of terminal, including memory and processor, being stored on the memory can The computer instruction run on the processor, the processor execute judged text feelings when running the computer instruction The step of method of sense.
Compared with prior art, the technical solution of the embodiment of the present invention has the advantages that
Technical solution of the present invention obtains text to be analyzed, and the text to be analyzed includes multiple first words;Will it is described to Each first word in analysis text is converted to term vector;It is obtained using each term vector and its corresponding emotion weight calculation The emotion weight of the sentence vector of the text to be analyzed, each term vector is predetermined;According to the text to be analyzed Sentence vector determines the emotional category of the text to be analyzed.Technical solution of the present invention each first word in obtaining text to be analyzed After the term vector of language, the emotion weight of each term vector can also be determined;Since emotion weight can characterize the emotion of term vector, Term vector can characterize the semanteme of the first word, therefore term vector and its emotion weight is combined to obtain a vector and be determined for The emotional category of text to be analyzed ensure that the accuracy of text emotion classification;In addition, the process letter of technical solution of the present invention It is single, complex calculation is not needed, the efficiency of text emotion analysis is improved.
Further, the acquisition text to be analyzed includes further include: obtains the initial weight of each second word;According to every Sentiment orientation of a second word in default sentiment dictionary is adjusted the initial weight, to obtain each second word Corresponding emotion weight, the corresponding emotion weight of the second word are equal to the corresponding emotion power of term vector of first word Weight.The initial weight for the second word that technical solution of the present invention obtains can characterize the semantic importance of the second word, according to the The Sentiment orientation of two words the initial weight is adjusted after emotion weight, can be with table on the basis of characterizing semantic Emotion is levied, so as to the sentiment analysis for text to be analyzed, improves the accuracy of text emotion analysis.
Further, it includes: for not stepping on that each first word by the text to be analyzed, which is converted to term vector, Word is recorded, each word of the unregistered word is converted into word vector, and by the sum of all word vectors as the unregistered word Term vector.Since unregistered word is not incorporated in dictionary, each word of unregistered word is utilized in technical solution of the present invention Word vector obtain term vector, the sentiment analysis for avoiding not obtaining text to be analyzed caused by the term vector of unregistered word loses It loses, further ensures the accuracy of text emotion analysis.
Detailed description of the invention
Fig. 1 is a kind of flow chart for the method for judging text emotion of the embodiment of the present invention;
Fig. 2 is a kind of flow chart of specific embodiment of step S101 shown in Fig. 1;
Fig. 3 is a kind of flow chart of specific embodiment of step S104 shown in Fig. 1;
Fig. 4 is the flow chart of another specific embodiment of step S104 shown in Fig. 1;
Fig. 5 is a kind of schematic diagram of concrete application scene of the embodiment of the present invention.
Specific embodiment
As described in the background art, due to artificial constructed a large amount of Feature Engineering, it is therefore desirable to artificial to carry out long-time labor It is dynamic, greatly consume manpower;On the other hand, text vector constructed in conventional method indicates to be easy to lead there are sparsity Dimension disaster is caused, and keeps the training time of classifier longer, treats the efficiency that classifying text is classified to reduce.Training Obtained classifier causes to treat what classifying text was classified using classifier due to lacking the semantic information expression to text As a result accuracy rate is lower.
Technical solution of the present invention after the term vector of each first word, can also determine each in obtaining text to be analyzed The emotion weight of term vector;Since emotion weight can characterize the emotion of term vector, term vector can characterize the language of the first word Justice, therefore term vector and its emotion weight is combined to obtain the emotional category that a vector is determined for text to be analyzed, guarantee The accuracy of text emotion classification;In addition, the process of technical solution of the present invention is simple, complex calculation is not needed, improves text The efficiency of sentiment analysis.
To make the above purposes, features and advantages of the invention more obvious and understandable, with reference to the accompanying drawing to the present invention Specific embodiment be described in detail.
Fig. 1 is a kind of flow chart for the method for judging text emotion of the embodiment of the present invention.
Judge that the method for text emotion may comprise steps of shown in Fig. 1:
Step S101: obtaining text to be analyzed, and the text to be analyzed includes multiple first words;
Step S102: each first word in the text to be analyzed is converted into term vector;
Step S103: using each term vector and its corresponding emotion weight calculation obtain the sentence of the text to be analyzed to Amount, the emotion weight of each term vector are predetermined;
Step S104: the emotional category of the text to be analyzed is determined according to the sentence vector of the text to be analyzed.
In the present embodiment, step S101 can obtain text to be analyzed using any enforceable mode, such as can be from Outside directly collects text to be analyzed, and text to be analyzed can also be called by interface.Specifically, text to be analyzed can be with It directly collects, is also possible to obtain by data conversions such as voice, images.
It, can be by the first word in order to calculate the emotion of text to be analyzed using the first word in text to be analyzed Be converted to term vector.The process that first word is converted to term vector can be realized using any enforceable mode, such as can To use word2vec model that word is converted to term vector, neural network model also can be used by word and be converted to term vector Deng.
Term vector can have emotion weight, and emotion weight can indicate the Sentiment orientation of term vector.Specifically, each The emotion weight of term vector is predetermined.Determine that the process of term vector can be before step S103, be also possible to What step S103 was carried out simultaneously.
It, can using each term vector and its corresponding emotion weight since text to be analyzed includes multiple first words The sentence vector of the text to be analyzed is calculated.The sentence vector of text to be analyzed is the emotion that can indicate text to be analyzed Semantic vector.
In a kind of specific implementation of step S103, the sum of products of the corresponding emotion weight of each term vector is made For the sentence vector of the text to be analyzed.Specifically, the sentence vector of text to be analyzed and the corresponding emotion of each term vector The sum of products of weight is positively correlated.For example, x1, x2..., xNRespectively indicate N number of term vector of text to be analyzed, w1, w2..., wNThe corresponding emotion weight of N number of term vector is respectively indicated, the sentence vector h of text to be analyzed can be h=w1x1+w2x2+…+ wNxN;The sentence vector h of text to be analyzed is also possible to
And then in step S104, the sentence vector based on text to be analyzed can use sorting algorithm and determine text to be analyzed This emotional category.Specifically, it can determine that text to be analyzed belongs to each emotional category according to the sentence vector of text to be analyzed Probability, and determine that the corresponding emotional category of maximum probability is the emotional category of text to be analyzed.For example, to be analyzed point originally belongs to The probability of emotional category " happy " is 0.8, and the probability for belonging to emotional category " sadness " is 0.2, then the emotion class of text to be analyzed It Wei " not happy ".
The embodiment of the present invention after the term vector of each first word, can also determine each word in obtaining text to be analyzed The emotion weight of vector;Since emotion weight can characterize the emotion of term vector, term vector can characterize the semanteme of the first word, Therefore it combines term vector and its emotion weight to obtain the emotional category that a vector is determined for text to be analyzed, ensure that text The accuracy of this emotional semantic classification;In addition, the process of technical solution of the present invention is simple, complex calculation is not needed, improves text emotion The efficiency of analysis.
Judge that the method for text emotion can be used for intelligent Answer System shown in Fig. 1.It is defeated that text to be analyzed can be user The problem of entering.By carrying out sentiment analysis to problem, the accuracy replied for problem can be improved, improve user experience.
In a preferred embodiment of the invention, step S104 can use softmax function, negative sampling function or level Softmax function determines the emotional category of the text to be analyzed.
In the present embodiment, it is analysed to sentence vector input softmax function, negative sampling function or the level of text After softmax function, softmax function, negative sampling function or level softmax function can export this vector and be under the jurisdiction of respectively The probability of a default emotional category, and export the corresponding emotional category of maximum probability.By using above-mentioned function, may be implemented more The classification of classification guarantees the accuracy of classification.
As shown in Fig. 2, step S101 shown in Fig. 1 may include step S201, or including step S201 to step S203.
Step S201: word segmentation processing is carried out to text to be analyzed according to dictionary, obtains multiple first words, the dictionary packet Include multiple second words.
Step S202: the initial weight of each second word is obtained;
Step S203: the initial weight is carried out according to Sentiment orientation of each second word in default sentiment dictionary Adjustment, to obtain the corresponding emotion weight of each second word, the corresponding emotion weight of the second word is equal to first word The corresponding emotion weight of the term vector of language.
In the present embodiment, it can use dictionary for word segmentation or participle model and text to be analyzed segmented.It can in dictionary There are multiple first words with record, text to be analyzed can use dictionary and be segmented to obtain matched multiple first words. Furthermore, the second word in dictionary can be preconfigured.
Pass through the corresponding emotion weight of available second word of step S202 and step S203.Specifically, can be first Word frequency inverse document frequency (term frequencyinverse can be used for example in the initial weight for obtaining the second word Document frequency, TF-IDF) algorithm or text ranking (TextRank) algorithm calculate the initial power of the second word Weight.
In addition, the second word has Sentiment orientation in default sentiment dictionary.It can use the Sentiment orientation of the second word The initial weight of second word is adjusted, to obtain the corresponding emotion weight of each second word, so that emotion is weighed Weight can indicate the emotion of the second word.In turn, after determining the emotion weight of the second word, since the first word is word-based What the second word in allusion quotation segmented, then the emotion power of available first word of emotion weight by the second word Weight, and then can determine the emotion weight of the term vector of the first word.
That is, when the Sentiment orientation of the first word and its term vector is front, the feelings of the first word and its term vector It is larger to feel weight;When the Sentiment orientation of first word and its term vector is negative, the emotion weight of the first word and its term vector It is smaller.
It is understood that default emotion may include the second word and its corresponding Sentiment orientation, sentiment dictionary is preset In each second word Sentiment orientation can be it is preconfigured.
In a kind of specific implementation of step S203, if the Sentiment orientation of the second word is front, described second Increased on the basis of the initial weight of word, to obtain the emotion weight of second word;If the emotion of the second word It is negative for being inclined to, then is reduced on the basis of the initial weight of second word, to obtain the emotion of second word Weight.
It is that Sentiment orientation is divided into two major classes in the present embodiment: front and negative or actively and passive, to the The initial weight of two words is adjusted.When Sentiment orientation is front, the emotion weight of the second word is larger;Sentiment orientation is negative When face, the emotion weight of the second word is smaller.Further, positive Sentiment orientation can also be subdivided into more multi-grade, then When being increased on the basis of the initial weight of second word, different numerical value can be increased according to different brackets;Together Reason, negative Sentiment orientation can also be subdivided into more multi-grade, then on the basis of the initial weight of second word into When row reduces, different numerical value can be reduced according to different brackets.
It should be noted that the description as described in positive emotion is to negative emotion is referred in the prior art related retouch It states.
In specific implementation, in order to distinguish positive Sentiment orientation and negative Sentiment orientation, it is also possible to incline in emotion To be front when, the emotion weight of the second word is smaller;When Sentiment orientation is negative, the emotion weight of the second word is larger, this Inventive embodiments are without limitation.
As shown in figure 3, step S104 shown in FIG. 1 may comprise steps of:
Step S301: the emotion probability of the text to be analyzed is calculated according to the sentence vector of the text to be analyzed;
Step S302: if the emotion probability reaches given threshold, it is determined that the text to be analyzed is positive mood.
In the present embodiment, emotional category is divided into positive mood and two kinds of non-frontal mood.
In the present embodiment, since the sentence vector of text to be analyzed is that the emotion weight based on each first word obtains, Therefore its emotion probability can be calculated using sentence vector.Emotion probability can indicate the Sentiment orientation of this vector.As previously mentioned, When the Sentiment orientation of first word is front, emotion weight is larger;When the Sentiment orientation of first word is negative, emotion power Weight is smaller.As a result, if Sentiment orientation is that positive first word is more in text to be analyzed, the emotion probability of vector It is larger;Conversely, the emotion probability of its vector is smaller.
Further, the value range of emotion probability can be [0,1].
In turn, it can be determined that the emotional category of text to be analyzed by the size of the emotion probability of sentence vector.Specific implementation In, the emotional category of text to be analyzed can be determined by the comparison result of emotion probability and given threshold.That is, such as Emotion probability described in fruit reaches given threshold, it is determined that the text to be analyzed is positive mood;Otherwise, it determines described to be analyzed Text is non-frontal mood namely negative emotions.
As shown in figure 4, step S104 shown in FIG. 1 may comprise steps of:
Step S401: the emotion probability of the text to be analyzed is calculated according to the sentence vector of the text to be analyzed;
Step S402: the emotion probability is compared with multiple threshold intervals, each threshold interval corresponds to a kind of feelings Feel classification;
Step S403: the emotional category for determining the text to be analyzed is that the threshold interval that the emotion probability is fallen into is corresponding Emotional category.
In the present embodiment, emotional category is divided into a variety of emotional categories.For example, emotional category can be selected from: happy, pleased Fastly, trust, is grateful, is excited, is sad, pain, disdain, hate, envying.The particular number of emotional category and specific classification side Formula can be configured according to actual application demand, and the embodiment of the present invention is without limitation.
In the present embodiment, since the sentence vector of text to be analyzed is that the emotion weight based on each first word obtains, Therefore its emotion probability can be calculated using sentence vector.Emotion probability can indicate the Sentiment orientation of this vector.As previously mentioned, When the Sentiment orientation of first word is front, emotion weight is larger;When the Sentiment orientation of first word is negative, emotion power Weight is smaller.As a result, if Sentiment orientation is that positive first word is more in text to be analyzed, the emotion probability of vector It is larger;Conversely, the emotion probability of its vector is smaller.
In turn, it can be determined that the emotional category of text to be analyzed by the size of the emotion probability of sentence vector.Specific implementation In, emotional category and threshold interval correspond.For example, can by the comparison result of emotion probability and multiple threshold intervals, Determine the emotional category of text to be analyzed.That is, if the emotion probability falls into threshold interval, it is determined that the threshold zone Between corresponding emotional category be text to be analyzed emotional category.
Step S102 shown in Fig. 1 may comprise steps of: for unregistered word, each word of the unregistered word being turned It is changed to word vector, and the term vector by the sum of all word vectors as the unregistered word.
In the present embodiment, since unregistered word is the word being not recorded in dictionary for word segmentation, in text to be analyzed Unregistered word can not be obtained by participle, therefore can obtain term vector by the word vector of each word using unregistered word. In the subsequent sentence vector for calculating to be analyzed point of sheet, the term vector of unregistered word can also participate in calculating process.Specifically, The emotion weight of unregistered word can be by the initial weight and unregistered word of unregistered word in the emotion for presetting sentiment dictionary Tendency determines.It is understood that the method for determination of the emotion weight of unregistered word is referred to the emotion weight of the second word Method of determination, details are not described herein again.
The sentiment analysis that the embodiment of the present invention avoids not obtaining text to be analyzed caused by the term vector of unregistered word loses It loses, further ensures the accuracy of text emotion analysis.
It may comprise steps of before step S101 shown in Fig. 1: training term vector model using default original language material, with For each first word in the text to be analyzed to be converted to term vector.
In the present embodiment, term vector model can be used for each first word in the text to be analyzed being converted to word Vector.In order to improve the accuracy for the term vector that term vector model generates, default original language material training term vector mould is advanced with Type.Specifically, default original language material can be large-scale corpus, it can be and obtain in advance, such as can be by climbing What worm crawled.
In a preferred embodiment of the invention, the term vector is N metagrammar feature vector, and N is just whole more than or equal to 2 Number.
In specific implementation, the term vector can be the N metagrammar feature vector obtained using n-gram algorithm.Specifically Ground can be two-dimensional grammar (bigram) or three metagrammars.For example, the two-dimensional grammar of " I likes China " be expressed as " I- Love ", " love-China ".
It, can be using the emotion point for simplifying neural fusion text to be analyzed in a concrete application scene of the invention Analysis.As shown in figure 5, simplifying neural network may include input layer 501, hidden layer 502 and output layer 503.Input layer 501 can be with Receive multiple term vector x of text to be analyzed1, x2..., xN.The multiple term vector can be in advance to text to be analyzed What multiple first words were converted to, the context semantic information of text is effectively ensured.The output of hidden layer 502 is to be analyzed The sentence vector h of text,Wherein, w1, w2..., wNFor multiple term vector x1, x2..., xN Corresponding emotion weight.The output of output layer 503 is the emotion probability y=softmax (W of text to be analyzedOH), wherein WOTable The emotion weight matrix for showing output layer 503 may determine that the sentiment analysis result of text to be analyzed according to the size of emotion probability (namely Sentiment orientation).
The negative sampling (negative sampling) of emotion probability is calculated with minor function it is understood that can also use Function or level softmax (Hierarchical softmax) function.
The embodiment of the invention also discloses a kind of storage mediums, are stored thereon with computer instruction, the computer instruction The step of method that text emotion is judged shown in Fig. 1 to Fig. 5 can be executed when operation.The storage medium may include ROM, RAM, disk or CD etc..The storage medium can also include non-volatility memorizer (non-volatile) or non- Transient state (non-transitory) memory etc..
The embodiment of the invention also discloses a kind of terminal, the terminal may include memory and processor, the storage The computer instruction that can be run on the processor is stored on device.The processor can be with when running the computer instruction Execute the step of judging the method for text emotion shown in Fig. 1 to Fig. 5.The terminal include but is not limited to mobile phone, computer, The terminal devices such as tablet computer.
Although present disclosure is as above, present invention is not limited to this.Anyone skilled in the art are not departing from this It in the spirit and scope of invention, can make various changes or modifications, therefore protection scope of the present invention should be with claim institute Subject to the range of restriction.

Claims (10)

1. a kind of method for judging text emotion characterized by comprising
Utilize default original language material training term vector model;
Text to be analyzed is obtained, the text to be analyzed includes multiple first words;
Each first word in the text to be analyzed is converted into term vector using the term vector model;
The sentence vector of the text to be analyzed, each term vector are obtained using each term vector and its corresponding emotion weight calculation Emotion weight be predetermined;
The emotional category that the text to be analyzed is determined according to the sentence vector of the text to be analyzed, specifically includes:
The emotion probability of the text to be analyzed is calculated according to the sentence vector of the text to be analyzed;If the emotion probability reaches To given threshold, it is determined that the text to be analyzed is positive mood, otherwise determines that the text to be analyzed is negative emotions.
2. the method for judgement text emotion according to claim 1, which is characterized in that described to obtain text packet to be analyzed It includes:
Word segmentation processing is carried out to text to be analyzed according to dictionary, obtains multiple first words, the dictionary includes multiple second words Language.
3. the method for judgement text emotion according to claim 2, which is characterized in that described to obtain text to be analyzed and include Further include:
Obtain the initial weight of each second word;
The initial weight is adjusted according to Sentiment orientation of each second word in default sentiment dictionary, it is every to obtain The corresponding emotion weight of a second word, the term vector that the corresponding emotion weight of the second word is equal to first word are corresponding Emotion weight.
4. the method for judgement text emotion according to claim 3, which is characterized in that each second word of basis exists Sentiment orientation in default sentiment dictionary, which is adjusted the initial weight, includes:
If the Sentiment orientation of the second word is front, increased on the basis of the initial weight of second word, To obtain the emotion weight of second word;
If the Sentiment orientation of the second word be it is negative, reduced on the basis of the initial weight of second word, To obtain the emotion weight of second word.
5. the method for judgement text emotion according to claim 1, which is characterized in that using softmax function, negative sampling Function or level softmax function determine the emotional category of the text to be analyzed.
6. it is according to claim 1 judgement text emotion method, which is characterized in that it is described will be in the text to be analyzed Each first word be converted to term vector and include:
For unregistered word, each word of the unregistered word is converted into word vector, and regard the sum of all word vectors as institute State the term vector of unregistered word.
7. the method for judgement text emotion according to claim 1, which is characterized in that the term vector is that N metagrammar is special Vector is levied, N is typically greater than equal to 2 positive integer.
8. the method for judgement text emotion according to claim 1, which is characterized in that it is described using each term vector and its The sentence vector that corresponding emotion weight calculation obtains the text to be analyzed includes:
Using the sum of products of the corresponding emotion weight of each term vector as the sentence vector of the text to be analyzed.
9. a kind of storage medium, is stored thereon with computer instruction, which is characterized in that the right of execution when computer instruction is run Benefit requires the step of method of any one of 1 to 8 judged text emotion.
10. a kind of terminal, including memory and processor, the meter that can be run on the processor is stored on the memory Calculation machine instruction, which is characterized in that perform claim requires any one of 1 to 8 institute when the processor runs the computer instruction The step of judging the method for text emotion.
CN201711420284.XA 2017-12-25 2017-12-25 Judge the method and storage medium, terminal of text emotion Pending CN109960791A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711420284.XA CN109960791A (en) 2017-12-25 2017-12-25 Judge the method and storage medium, terminal of text emotion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711420284.XA CN109960791A (en) 2017-12-25 2017-12-25 Judge the method and storage medium, terminal of text emotion

Publications (1)

Publication Number Publication Date
CN109960791A true CN109960791A (en) 2019-07-02

Family

ID=67020841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711420284.XA Pending CN109960791A (en) 2017-12-25 2017-12-25 Judge the method and storage medium, terminal of text emotion

Country Status (1)

Country Link
CN (1) CN109960791A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108052505A (en) * 2017-12-26 2018-05-18 上海智臻智能网络科技股份有限公司 Text emotion analysis method and device, storage medium, terminal
CN111079404A (en) * 2019-11-14 2020-04-28 联想(北京)有限公司 Data analysis method, device and storage medium
CN111125561A (en) * 2019-11-28 2020-05-08 泰康保险集团股份有限公司 Network heat display method and device
CN111563167A (en) * 2020-07-15 2020-08-21 智者四海(北京)技术有限公司 Text classification system and method
CN111738015A (en) * 2020-06-22 2020-10-02 北京百度网讯科技有限公司 Method and device for analyzing emotion polarity of article, electronic equipment and storage medium
CN116756326A (en) * 2023-08-18 2023-09-15 杭州光云科技股份有限公司 Emotion and non-emotion text feature analysis and judgment method and device and electronic equipment

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108052505A (en) * 2017-12-26 2018-05-18 上海智臻智能网络科技股份有限公司 Text emotion analysis method and device, storage medium, terminal
CN111079404A (en) * 2019-11-14 2020-04-28 联想(北京)有限公司 Data analysis method, device and storage medium
CN111125561A (en) * 2019-11-28 2020-05-08 泰康保险集团股份有限公司 Network heat display method and device
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
CN111563167A (en) * 2020-07-15 2020-08-21 智者四海(北京)技术有限公司 Text classification system and method
CN116756326A (en) * 2023-08-18 2023-09-15 杭州光云科技股份有限公司 Emotion and non-emotion text feature analysis and judgment method and device and electronic equipment
CN116756326B (en) * 2023-08-18 2023-11-24 杭州光云科技股份有限公司 Emotion and non-emotion text feature analysis and judgment method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN109960791A (en) Judge the method and storage medium, terminal of text emotion
CN108052505A (en) Text emotion analysis method and device, storage medium, terminal
WO2020143844A1 (en) Intent analysis method and apparatus, display terminal, and computer readable storage medium
CN108399158B (en) Attribute emotion classification method based on dependency tree and attention mechanism
CN102929861B (en) Method and system for calculating text emotion index
CN110287328B (en) Text classification method, device and equipment and computer readable storage medium
CN112001186A (en) Emotion classification method using graph convolution neural network and Chinese syntax
CN107273348B (en) Topic and emotion combined detection method and device for text
US11803731B2 (en) Neural architecture search with weight sharing
CN110415071B (en) Automobile competitive product comparison method based on viewpoint mining analysis
KR20200127020A (en) Computer-readable storage medium storing method, apparatus and instructions for matching semantic text data with tags
CN113254637B (en) Grammar-fused aspect-level text emotion classification method and system
CN112270196A (en) Entity relationship identification method and device and electronic equipment
CN107291840B (en) User attribute prediction model construction method and device
CN109492217B (en) Word segmentation method based on machine learning and terminal equipment
CN110309308A (en) Text information classification method and device and electronic equipment
CN110147552B (en) Education resource quality evaluation mining method and system based on natural language processing
CN111259823A (en) Pornographic image identification method based on convolutional neural network
CN111814453A (en) Fine-grained emotion analysis method based on BiLSTM-TextCNN
CN107797981B (en) Target text recognition method and device
CN110969005B (en) Method and device for determining similarity between entity corpora
CN116541517A (en) Text information processing method, apparatus, device, software program, and storage medium
CN110085292A (en) Drug recommended method, device and computer readable storage medium
CN107783958B (en) Target statement identification method and device
CN109960793A (en) Opinion mining device and intelligent terminal

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190702