CN111783453A - Method and device for processing emotion information of text - Google Patents

Method and device for processing emotion information of text Download PDF

Info

Publication number
CN111783453A
CN111783453A CN202010621825.0A CN202010621825A CN111783453A CN 111783453 A CN111783453 A CN 111783453A CN 202010621825 A CN202010621825 A CN 202010621825A CN 111783453 A CN111783453 A CN 111783453A
Authority
CN
China
Prior art keywords
emotion
text
sample
emotional
emotion word
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
CN202010621825.0A
Other languages
Chinese (zh)
Other versions
CN111783453B (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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information 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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202010621825.0A priority Critical patent/CN111783453B/en
Publication of CN111783453A publication Critical patent/CN111783453A/en
Application granted granted Critical
Publication of CN111783453B publication Critical patent/CN111783453B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • 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)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

One or more embodiments of the specification disclose a method and a device for processing emotion information of a text, so as to solve the problem that in the prior art, emotion tendency recognition is inaccurate, and service parameters cannot be accurately adjusted based on the emotion tendency information. The method comprises the following steps: and extracting first emotion words related to the service in the text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words. And performing clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted. And determining the distribution characteristics of the first emotional words corresponding to the text to be predicted according to the first emotional words and the first clauses. And determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model. And determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause. And sending the second emotional tendency information to a service processing platform of the service.

Description

Method and device for processing emotion information of text
Technical Field
The present disclosure relates to the field of information processing technologies, and in particular, to a method and an apparatus for processing emotion information of a text.
Background
With the rise of mobile internet, products such as e-commerce, community platform, short video, live broadcast and the like are developed vigorously, and a large User group contributes a large amount of high-quality UGC (User Generated Content), so that the internet has the characteristics of openness, virtualization, concealment, divergence, permeability, randomness and the like. More and more users like expressing personal opinions through internet channels, such as opinions on whether they are satisfied with or desire improvement on the treatment effect of a certain service, etc., resulting in the internet becoming a major place for public opinion topic generation and dissemination. Meanwhile, with the explosive growth of comment texts on the internet, a computer is urgently needed to help a user to process and sort the emotion information, and the emotion information of the user can influence service operation and development to a certain extent, so that emotion analysis research has important application.
In articles or comments related to the service, the service roughly divides the emotion into positive emotion and negative emotion, but the Chinese is profound, so that the text often contains implicit and explicit emotion transitions, which becomes a difficulty in emotion judgment. For example, "XX Bao changes rule recently, XX Bao changes rule silently. Zhang III studied that a sentence says that 'the XX treasures claim later is more and more difficult'. But not necessarily just a bad bar, below we are specifically chatting about this new change and what effect. ". The sentences contain two different emotional emotions, namely 'more difficult' and 'not necessarily bad', and the sentences can interfere with emotion recognition, so that the conventional emotion recognition mode can hardly recognize positive emotion or negative emotion.
Disclosure of Invention
In one aspect, one or more embodiments of the present specification provide a method for processing emotion information of a text, including: extracting first emotion words related to services in a text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words. And carrying out clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted. And determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause. And determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model, wherein the emotional prediction model is obtained by training based on sample emotional word distribution characteristics corresponding to a sample text and the sample emotional tendency information of the sample text. And determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factor corresponding to the first clause. And sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
In another aspect, one or more embodiments of the present specification provide an emotion information processing apparatus for a text, including: the extraction module is used for extracting first emotion words related to services in a text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words, and performing sentence segmentation processing on the text to be predicted to obtain first sentences corresponding to the text to be predicted. And the first determining module is used for determining the distribution characteristics of the first emotion words corresponding to the text to be predicted according to the first emotion words and the first clause. And the second determining module is used for determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model, and the emotional prediction model is obtained by training based on sample emotional word distribution characteristics corresponding to a sample text and the sample emotional tendency information of the sample text. And the third determining module is used for determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause. And the sending module is used for sending the second emotional tendency information to a service processing platform of the service so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
In still another aspect, one or more embodiments of the present specification provide an emotion information processing apparatus for a text, including: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to: extracting first emotion words related to services in a text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words. And carrying out clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted. And determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause. And determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model, wherein the emotional prediction model is obtained by training based on sample emotional word distribution characteristics corresponding to a sample text and the sample emotional tendency information of the sample text. And determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factor corresponding to the first clause. And sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
In yet another aspect, an embodiment of the present application provides a storage medium for storing computer-executable instructions, where the computer-executable instructions, when executed, implement the following processes: extracting first emotion words related to services in a text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words. And carrying out clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted. And determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause. And determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model, wherein the emotional prediction model is obtained by training based on sample emotional word distribution characteristics corresponding to a sample text and the sample emotional tendency information of the sample text. And determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factor corresponding to the first clause. And sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
Drawings
In order to more clearly illustrate one or more embodiments or technical solutions in the prior art in the present specification, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in one or more embodiments of the present specification, and other drawings can be obtained by those skilled in the art without inventive exercise.
FIG. 1 is a schematic flow chart of a method for processing emotion information of a text according to an embodiment of the present specification;
FIG. 2 is a schematic flow diagram of a method for training an emotion prediction model in accordance with an embodiment of the present description;
FIG. 3 is a schematic flow chart of a method for emotion information processing of a text according to another embodiment of the present specification;
FIG. 4 is a schematic block diagram of an emotion information processing apparatus for a text according to an embodiment of the present specification;
FIG. 5 is a schematic block diagram of a text emotion information processing apparatus according to an embodiment of the present specification.
Detailed Description
One or more embodiments of the present specification provide a method and an apparatus for processing emotion information of a text, so as to solve the problem in the prior art that service parameters cannot be accurately adjusted based on emotion tendency information due to inaccurate emotion tendency identification.
In order to make those skilled in the art better understand the technical solutions in one or more embodiments of the present disclosure, the technical solutions in one or more embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in one or more embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all embodiments. All other embodiments that can be derived by a person skilled in the art from one or more of the embodiments of the present disclosure without making any creative effort shall fall within the protection scope of one or more of the embodiments of the present disclosure.
Fig. 1 is a schematic flow chart of a text emotion information processing method according to an embodiment of the present specification, and as shown in fig. 1, the method includes:
s102, extracting first emotion words related to services in a text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words; and performing clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted.
The text to be predicted can comprise comment text of the user on the service. The first emotion word related to the service in the text to be predicted is the emotion word which is contained in the text to be predicted and may have a certain influence on the service parameter. For example, the comment text of a certain payment application includes keywords such as "increasingly difficult" and "not necessarily bad", and the keywords represent a personal view of the user on the payment application, and therefore can have a certain influence on parameters related to the payment application, and can serve as a basis for adjusting the parameters, for example, so that the keywords (i.e., "increasingly difficult" and "not necessarily bad") can be regarded as the first emotion words related to the payment application.
The first emotional words associated with the business may be determined in advance based on business experience. For example, the predetermined emotion words related to the service include: like, sadness, difficulty, optimism, etc. Then in S102, a first emotion word may be extracted from the text to be predicted according to a predetermined emotion word related to the service.
The positive emotion words can represent positive opinions of users on satisfaction, support, positive and the like of the business, and the negative emotion words can represent negative opinions of users on dissatisfaction, objection, negation, bad comment, no good and the like of the business.
And S104, determining the distribution characteristics of the first emotion words corresponding to the text to be predicted according to the first emotion words and the first clauses.
The first emotion word distribution characteristics corresponding to the text to be predicted comprise distribution characteristics of the first clauses on the first emotion words.
And S106, determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and the pre-trained emotional prediction model.
The emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to the sample text and sample emotion tendency information of the sample text, the sample emotion tendency information can be determined by a user in advance according to emotion word categories contained in the sample text, and the emotion word categories can include positive emotion words or negative emotion words.
And S108, determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause.
The fine-grained emotion factors can include emotion types corresponding to the first clauses, the number of specified words contained in the first clauses, text body information and the like. The emotion categories may include positive emotions or negative emotions.
The emotion classification corresponding to the first clause can be based on emotion word information of emotion words contained in the first clause, such as the number of emotion words, the emotion word classification and the like. Based on the first emotion word, the first emotion word contained in each first clause can be determined in advance, and then the emotion word information corresponding to each first clause is determined according to the first emotion word contained in each first clause, wherein the emotion word information can comprise the number of emotion words, the category of emotion words and the like; and determining the emotion type corresponding to each first clause according to the emotion word information corresponding to each first clause. For example, the greater the number of the positive emotion words contained in the first clause, the greater the probability that the emotion type corresponding to the first clause is positive emotion; conversely, the greater the number of negative emotion words contained in the first clause, the greater the probability that the emotion classification corresponding to the first clause is negative emotion.
The specified class of words may include turning words (e.g., "but," "however"), exclamatory words (e.g., "Tiano"), and the like. The text body information of the first clause may be service body information related to the first clause, such as service category, service function, and the like. For example, assuming that the text to be predicted is a comment text for the payment-class application a, the text body information of the first sentence in the text to be predicted may be information of an application category, an application name, an application function, and the like of the payment-class application a. In one embodiment, if the first sentence includes a subject word, the text subject information may also be determined according to the subject word.
S110, sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
By adopting the technical scheme of one or more embodiments of the specification, after the first emotional tendency information corresponding to the text to be predicted is predicted through the emotional prediction model, the first emotional tendency information and the fine-grained emotional factors corresponding to the clauses of the text to be predicted can be comprehensively considered, and the second emotional tendency information corresponding to the text to be predicted is further determined, so that the emotional tendency information corresponding to the text to be predicted is related to the fine-grained emotional factors of each clause in the text instead of being only dependent on a single emotional two-classification model (namely, the emotional tendency can be divided into positive emotions or negative emotions), and the accuracy of analysis of the emotional tendency information is improved. Furthermore, the emotion tendency information analyzed accurately is sent to the service processing platform, so that the service processing platform can adjust the service parameters based on the accurate emotion tendency information, and the accuracy of service parameter adjustment is improved.
In addition, the emotion tendency model is obtained by training based on sample emotion word distribution characteristics corresponding to the sample text and sample emotion tendency information of the sample text, so that after second emotion information of the text to be predicted is predicted according to the emotion tendency model, the text to be predicted can be used as a new sample text, the second emotion information of the text to be predicted can be used as new sample emotion tendency information, the new sample text and the corresponding new sample emotion tendency information are used for updating and optimizing the emotion prediction model, and the text emotion tendency information predicted based on the emotion prediction model is more accurate.
The following first describes the method for training the emotion prediction model.
In one embodiment, the emotion prediction model may be trained according to the steps shown in FIG. 2. As shown in fig. 2, the method comprises the following steps:
s201, extracting sample emotion words related to the business in the sample text, and determining sample emotion word vectors corresponding to the sample emotion words.
The sample text may include comment text of the user on the service. The sample emotion words comprise positive sample emotion words and negative sample emotion words.
The sample emotion words related to the service in the sample text are emotion words which are contained in the sample text and may have certain influence on the service parameters. For example, the comment text of a certain payment application includes keywords such as "increasingly difficult" and "not necessarily bad", and the keywords represent a personal view of the user on the payment application, and therefore can have a certain influence on the parameters related to the payment application, and can be used as a basis for adjusting the parameters, for example, so that the keywords (i.e., "increasingly difficult" and "not necessarily bad") can be extracted as sample emotion words.
The emotion words related to the service can be determined in advance according to service experience. For example, the predetermined emotion words related to the service include: like, sadness, difficulty, optimism, etc. Then in executing S201, sample emotion words may be extracted from the sample text according to predetermined emotion words related to the service.
In this step, the sample emotion word vector corresponding to the sample emotion word can be generated by using the existing word vector generation method, which is not described herein again.
S202, performing sentence segmentation and word segmentation processing on the sample text to obtain sample sentences contained in the sample text and sample words contained in each sample sentence, and generating sample sentence vectors corresponding to the sample text based on word vectors corresponding to the sample words.
The sentence segmentation and word segmentation processing comprises sentence segmentation processing and word segmentation processing, for example, for a sample text 'troublesome you bannt and aunt merge post bar, hard you, thank you', after the sentence segmentation and word segmentation processing, the following sample segmentations and sample segmentations contained in each sample segmentations can be obtained: "bother you, help, aunt, merge, post, ',', hard, you, already, ',', thank you".
In this step, the sample sentence vector may be generated by using the existing sentence vector generation method, which is not described herein again.
And S203, determining sample emotion word distribution information respectively corresponding to each sample clause through an attention mechanism according to the sample sentence vectors and the sample emotion word vectors.
The sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word.
In one embodiment, the sample emotion word distribution information includes a sample emotion word distribution vector. Based on the above, the probability distribution value of each sample clause on each sample emotion word can be determined by using the sample sentence vector and the sample emotion word vector as input data of the attention mechanism, so that the sample emotion word distribution vector corresponding to each sample clause is generated according to the probability distribution value of each sample clause on each sample emotion word, and each element in the sample emotion word distribution vector represents the probability distribution value of each sample clause on each sample emotion word.
For example, the sample text includes n sample clauses and m sample emotion words. And taking the sample sentence vectors corresponding to the n sample clauses and the sample emotion word vectors corresponding to the m sample emotion words as input data of an attention mechanism, so as to determine probability distribution values of the n sample clauses on the m sample emotion words respectively. The probability distribution values may be represented by a numerical value between 0 and 1.
Assuming that, for the sample clause vector ai, the probability distribution values of the sample clauses corresponding to the sample clause on the m sample emotion words are pi1, pi2, … and pi, respectively, the sample emotion word distribution vector corresponding to the sample clause is (pi1, pi2, … and pi).
And S204, determining sample emotion word distribution characteristics corresponding to the sample text according to the sample sentence vectors and the sample emotion word distribution information.
Wherein S204 may be performed as follows in steps A1-A4.
Step A1, generating a sample emotion word distribution matrix corresponding to the sample text according to the sample emotion word distribution vector corresponding to each sample clause, wherein each row of elements in the sample emotion word distribution matrix corresponds to the sample emotion word distribution vector corresponding to each sample clause.
By using the above example, if the sample emotion word distribution vector corresponding to the sample clause vector ai is (pi1, pi2, …, and pim), a sample emotion word distribution matrix of n × m may be generated, where the row n of the sample emotion word distribution matrix is the number of sample clauses in the sample text, and the column m is the number of sample emotion words in the sample text.
Taking n-2 and m-2 as an example, the sample emotion word distribution vector corresponding to the sample sentence vector a1 is (p11, p12), and the sample emotion word distribution vector corresponding to the sample sentence vector a2 is (p21, p22), then the following 2 × 2 sample emotion word distribution matrix can be generated:
Figure BDA0002565406920000081
step A2, calculating the product of the sample sentence vector and the sample emotion word distribution matrix to obtain a sample emotion prediction matrix, wherein the column number of the sample emotion prediction matrix is equal to the number of the sample emotion words in the sample text.
Following the above example, assume that the sample sentence vector is (a1, a2), and the corresponding sample emotion word distribution matrix is
Figure BDA0002565406920000082
By calculating the sum of (a1, a2)
Figure BDA0002565406920000083
The sample emotion prediction matrix can be obtained by multiplying: (a1 × p11+ a2 × p12, a1 × p21+ a2 × p 22).
Step A3, performing element average calculation on the sample emotion word prediction matrix to obtain an average value matrix corresponding to the sample emotion word prediction matrix; and carrying out element maximum value calculation on the sample emotion word prediction matrix to obtain a maximum value matrix corresponding to the sample emotion word prediction matrix.
Wherein, the element average calculation is a value obtained by averaging all elements in the sample emotion prediction matrix; and the element maximum value calculation is the maximum value in each element in the determined sample emotion prediction matrix.
Optionally, both the average matrix and the maximum matrix are one-dimensional vectors.
And A4, performing matrix combination on the average value matrix and the maximum value matrix according to a preset combination mode to obtain sample emotion word distribution characteristics corresponding to the sample text.
The preset combination mode may be a mode of splicing the two matrices according to a certain order.
Following the above example, assuming that the sample emotion prediction matrix is (a1 × p11+ a2 × p12, a1 × p21+ a2 × p22), the element average calculation and the element maximum calculation are performed on the sample emotion prediction matrix (a1 × p11+ a2 × p12, a1 × p21+ a2 × p22), respectively. Assuming that a one-dimensional vector b1 is obtained by performing element average calculation on the sample emotion prediction matrix (a1 × p11+ a2 × p12, a1 × p21+ a2 × p22), and a one-dimensional vector b2 is obtained by performing element maximum calculation on the sample emotion prediction matrix (a1 × p11+ a2 × p12, a1 × p21+ a2 × p22), the sample emotion word distribution characteristics (b1, b2) can be obtained by concatenating the one-dimensional vectors b1 and b 2.
S205, training an emotion prediction model according to the sample emotion word distribution characteristics and the sample emotion tendency information of the sample text.
The sample emotional tendency information of the sample text can be determined in advance according to the emotion types (such as positive emotion or negative emotion) of the sample emotional words contained in the sample text.
After the emotion prediction model is used for predicting the emotion tendency information of the text to be predicted, the text to be predicted can be used as a new sample text, the second emotion information of the text to be predicted is used as new sample emotion tendency information, and then the new sample text and the corresponding new sample emotion tendency information are used for updating and optimizing the emotion prediction model.
In this embodiment, because the attention mechanism can identify the probability distribution of each sample clause on each sample emotion word, and the element average value and element maximum value calculation manner can reflect the average distribution information and maximum value distribution information of the sample text in different emotion tendencies to a certain extent (i.e. which emotion type is the most inclined), the sample emotion word distribution characteristics of the sample text can be determined more accurately through the attention mechanism and the element average value and element maximum value calculation manner, so that the finally trained emotion prediction model is more accurate.
After the emotion prediction model is trained, first emotion tendency information corresponding to the text to be predicted can be predicted according to the first emotion word distribution characteristics corresponding to the text to be predicted and the emotion prediction model. The method for determining the distribution characteristics of the first emotion words of the text to be predicted is the same as the method for determining the distribution characteristics of the sample emotion words of the sample text.
Determining first emotional tendency information corresponding to a text to be predicted, and determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and fine-grained emotional factors corresponding to the first clauses in the text to be predicted. The fine-grained emotion factors can include emotion types corresponding to the first clauses, the number of specified words contained in the first clauses, text body information and the like. The emotion categories may include positive emotions or negative emotions.
Fig. 3 is a schematic flowchart of a method for processing emotion information of a text according to an embodiment of the present specification, and as shown in fig. 3, the method includes:
s301, extracting first emotion words related to services in a text to be predicted, wherein the first emotion words comprise positive emotion words and negative emotion words; and performing clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted.
S302, determining a first emotion word vector corresponding to the first emotion word, and generating a first sentence vector corresponding to the text to be predicted.
Before generating the first sentence vector corresponding to the text to be predicted, sentence segmentation and word segmentation processing may be performed on the text to be predicted to obtain a first sentence corresponding to the text to be predicted and a first word segmentation corresponding to each first sentence, and then the first sentence vector is generated according to the first sentence and the first word segmentation corresponding to each first sentence. The first sentence vector can be generated by adopting the existing sentence vector generation method, so the specific sentence vector generation method is not repeated.
And S303, determining first emotion word distribution information respectively corresponding to each first sentence by an attention mechanism according to the first sentence vector and the first emotion word vector.
The first emotional word distribution information comprises distribution information of each first clause on each first emotional word.
In one embodiment, the first emotion word distribution information is a first emotion word distribution vector. Therefore, in step S303, the first sentence vector and the first emotion word vector may be used as input data of the attention mechanism to determine a probability distribution value of each first sentence on each first emotion word, and further generate a first emotion word distribution vector corresponding to each first sentence based on the probability distribution value of each first sentence on each first emotion word. Each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
The method for generating the first emotion word distribution vector corresponding to each first clause is similar to the method for generating the sample emotion word distribution vector corresponding to each sample clause in the above embodiments, and is not described here again.
S304, determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first sentence vector and the first emotion word distribution information.
In one embodiment, S304 may be performed as follows in steps B1-B4:
step B1, generating a first emotion word distribution matrix corresponding to the text to be predicted according to the first emotion word distribution vectors corresponding to the first clauses respectively, wherein each row of elements in the first emotion word distribution matrix corresponds to the first emotion word distribution vector corresponding to each first clause respectively.
The first emotion word distribution matrix corresponding to the text to be predicted and the sample emotion word distribution matrix corresponding to the sample text in the embodiment are generated by the same method.
Step B2, calculating the product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the number of columns of the first emotion prediction matrix is equal to the number of first emotion words in the text to be predicted.
The first emotion prediction matrix is the same as the sample emotion prediction matrix in the above embodiment.
Step B3, performing element average calculation on the first emotion word prediction matrix to obtain an average value matrix corresponding to the first emotion word prediction matrix; and carrying out element maximum value calculation on the first emotion word prediction matrix to obtain a maximum value matrix corresponding to the first emotion word prediction matrix.
The average value matrix and the maximum value matrix corresponding to the first emotion word prediction matrix are the same as the average value matrix and the maximum value matrix corresponding to the sample emotion word prediction matrix in the embodiment.
And step B4, performing matrix combination on the average value matrix and the maximum value matrix according to a preset combination mode to obtain the first emotion word distribution characteristics corresponding to the text to be predicted.
The combination method of the first emotion word distribution characteristics is similar to the combination method of the sample emotion word distribution characteristics in the above embodiment.
S305, determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model.
The emotion prediction model training method has been described in detail in the above embodiments, and is not described herein again.
S306, determining weights corresponding to the first emotional tendency information and the fine-grained emotional factors respectively.
S307, according to the determined weight, performing weighted calculation on the first emotional tendency information and each fine-grained emotional factor to obtain an emotional tendency value corresponding to the text to be predicted.
And positive correlation or negative correlation is carried out between the positive and negative emotional tendency values and the emotional tendency values of the predicted text.
In this step, before performing the weighting calculation, the first emotional tendency information and each fine-grained emotional factor may be assigned with a value capable of performing the weighting calculation. The fine-grained emotion factors can include the emotion type (positive emotion or negative emotion) corresponding to each first clause, the number of specified words contained in the first clause, text body information and the like.
In one embodiment, the first emotional tendency information is a first emotional tendency value, and the value of the first emotional tendency value indicates the degree of the positive emotional tendency, that is, the larger the first emotional tendency value, the higher the degree of the positive emotional tendency is.
Correspondence between emotion classifications and numerical values may be established in advance. For example, a value of 0 indicates a negative emotion category, and a value of 1 indicates a positive emotion category.
The text body information of the first clause may be service body information related to the first clause, and a corresponding relationship between the text body information and a numerical value may be established in advance, where the corresponding relationship is established according to a service type of a service corresponding to the text body information. For example, when the service type corresponding to the text body information is a, the text body information may correspond to a numerical value of 1; when the service type corresponding to the text body information is B, the text body information can correspond to a numerical value 2; and so on.
Of course, the above description is only illustrative to list several ways of assigning fine-grained affective factors. In practical application, fine-grained affective factors can be assigned according to related business requirements, and are not limited to the manners listed in the above embodiments.
And after the first emotional tendency information and each fine-grained emotional factor are assigned, weighting calculation can be carried out according to the corresponding weight, and the emotional tendency value obtained after weighting calculation can represent the emotional tendency of the text to be predicted.
The positive and negative emotional tendency of the text to be predicted means that the text to be predicted is prone to positive emotion or negative emotion. The correspondence between the positive and negative emotional tendency values may be set in advance to be positive correlation or negative correlation. For example, setting positive correlation between the positive emotional tendency and the emotional tendency value, the larger the emotional tendency value is, the higher the degree of the positive emotional tendency corresponding to the text to be predicted is; conversely, the smaller the emotional tendency value is, the lower the positive emotional tendency degree corresponding to the text to be predicted is.
S308, sending the emotional tendency value corresponding to the text to be predicted to the service processing platform of the service, so that the service processing platform adjusts the service parameter of the service based on the emotional tendency value.
In this step, the text to be predicted may be a comment text of the user for the service. The emotional tendency value corresponding to the text to be predicted reflects the emotional tendency information of the user to the service, and if the emotional tendency value is high, the user is indicated to have positive viewpoints of satisfaction, support, aggressiveness and the like for the service; and if the emotional tendency value is low, the negative viewpoints of dissatisfaction, objection, negation, bad comment, no good sight and the like of the user on the business are indicated.
The service processing platform adjusts the service parameters based on the emotional tendency values corresponding to the comment texts, for example, if the emotional tendency values are high, the service parameters corresponding to the emotional tendency values can be refined and strengthened; if the emotional tendency value is low, the service parameter corresponding to the emotional tendency value can be modified, so that the adjusted service can better meet the service processing requirement of the user.
In summary, in the technical scheme provided by this embodiment, the emotion tendency value corresponding to the text to be predicted is related to the fine-grained emotion factor of each sentence in the text, and is no longer dependent on a single emotion two-classification model (that is, the emotion tendency can only be classified into positive emotion or negative emotion), so that the accuracy of analyzing the emotion tendency value is improved. Furthermore, the service processing platform can adjust the service parameters based on the accurate emotional tendency values by sending the accurately analyzed emotional tendency values to the service processing platform, so that the accuracy of adjusting the service parameters is improved.
In summary, particular embodiments of the present subject matter have been described. Other embodiments are within the scope of the following claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may be advantageous.
Based on the same idea, the method for processing emotion information of a text provided in one or more embodiments of the present specification further provides an emotion information processing apparatus of a text.
Fig. 4 is a schematic block diagram of an emotion information processing apparatus for text according to an embodiment of the present specification, as shown in fig. 4, the apparatus including:
the first extraction module 410 is used for extracting a first emotion word related to the service in the text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
the first determining module 420 is configured to determine a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause;
the second determining module 430 is used for determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
a third determining module 440, configured to determine second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factor corresponding to the first clause;
the sending module 450 sends the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameter of the service based on the second emotional tendency information.
In one embodiment, the fine-grained affective factors include at least one of: the emotion type corresponding to each first clause, the number of appointed words contained in the first clause and text body information.
In one embodiment, the apparatus further comprises:
the fourth determining module is used for determining the first emotional words contained in the first clause;
a fifth determining module, configured to determine, according to the first emotion word, emotion word information corresponding to the first clause; the emotional word information comprises the number of emotional words and/or the category of the emotional words;
and the sixth determining module is used for determining the emotion type corresponding to the first clause according to the emotion word information.
In one embodiment, the first determining module 420 comprises:
the first determining unit is used for determining a first emotion word vector corresponding to the first emotion word; generating a first sentence vector corresponding to the text to be predicted;
a second determining unit, configured to determine, according to the first sentence vector and the first emotion word vector, first emotion word distribution information corresponding to each of the first clauses through an attention mechanism; the first emotional word distribution information comprises distribution information of each first clause on each first emotional word;
and the third determining unit is used for determining the first emotion word distribution characteristics corresponding to the text to be predicted according to the first sentence vector and the first emotion word distribution information.
In one embodiment, the first emotion word distribution information includes a first emotion word distribution vector;
the second determining unit is configured to determine a probability distribution value of each first clause on each first emotion word by using the first sentence vector and the first emotion word vector as input data of the attention mechanism; generating a first emotion word distribution vector corresponding to each first clause based on the probability distribution value of each first clause on each first emotion word; each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
In one embodiment, the third determination unit:
generating a first emotion word distribution matrix corresponding to the text to be predicted according to the first emotion word distribution vector corresponding to each first clause; each row element in the first emotion word distribution matrix corresponds to the first emotion word distribution vector corresponding to each first clause;
calculating a product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the number of columns of the first emotion prediction matrix is equal to the number of the first emotion words in the text to be predicted;
performing element average calculation on the first emotion word prediction matrix to obtain an average value matrix corresponding to the first emotion word prediction matrix; performing element maximum value calculation on the first emotion word prediction matrix to obtain a maximum value matrix corresponding to the first emotion word prediction matrix;
and according to a preset combination mode, carrying out matrix combination on the average value matrix and the maximum value matrix to obtain the first emotion word distribution characteristics corresponding to the text to be predicted.
In one embodiment, the apparatus further comprises:
the second extraction module is used for extracting the sample emotion words related to the service in the sample text and determining sample emotion word vectors corresponding to the sample emotion words; the sample emotion words comprise positive sample emotion words and negative sample emotion words;
the processing and generating module is used for carrying out sentence segmentation and word segmentation processing on the sample text to obtain sample clauses contained in the sample text and sample clauses contained in each sample clause; generating a sample sentence vector corresponding to the sample text based on the word vector corresponding to the sample word segmentation;
a seventh determining module, configured to determine, according to the sample sentence vectors and the sample emotion word vectors, sample emotion word distribution information corresponding to each sample clause through an attention mechanism; the sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word;
the eighth determining module is used for determining sample emotion word distribution characteristics corresponding to the sample text according to the sample sentence vectors and the sample emotion word distribution information;
and the training module is used for training the emotion prediction model according to the sample emotion word distribution characteristics and the sample emotion tendency information of the sample text.
In one embodiment, the third determining module 440 includes:
a fourth determining unit, configured to determine weights corresponding to the first emotional tendency information and the fine-grained emotional factors, respectively;
the weighting calculation unit is used for carrying out weighting calculation on the first emotional tendency information and each fine-grained emotional factor according to the weight to obtain an emotional tendency value corresponding to the text to be predicted; positive correlation or negative correlation is carried out between the positive and negative emotional tendency values of the text to be predicted and the emotional tendency values.
By adopting the device in one or more embodiments of the specification, after the first emotional tendency information corresponding to the text to be predicted is predicted through the emotional prediction model, the first emotional tendency information and the fine-grained emotional factors corresponding to the clauses of the text to be predicted can be comprehensively considered, and the second emotional tendency information corresponding to the text to be predicted is further determined, so that the emotional tendency information corresponding to the text to be predicted is related to the fine-grained emotional factors of each clause in the text instead of being only dependent on a single emotional two-classification model (namely, the emotional tendency can be divided into positive emotions or negative emotions), and the analysis accuracy of the emotional tendency information is improved. Furthermore, the emotion tendency information analyzed accurately is sent to the service processing platform, so that the service processing platform can adjust the service parameters based on the accurate emotion tendency information, and the accuracy of service parameter adjustment is improved.
It should be understood by those skilled in the art that the apparatus for processing emotion information of the above-mentioned text can be used to implement the method for processing emotion information of the above-mentioned text, and the detailed description thereof should be similar to the description of the above method, and therefore, in order to avoid complexity, no further description is provided herein.
Based on the same idea, one or more embodiments of the present specification further provide an emotion information processing apparatus for text, as shown in fig. 5. The emotion information processing apparatus for text may have a large difference due to a difference in configuration or performance, and may include one or more processors 501 and a memory 502, and one or more stored applications or data may be stored in the memory 502. Memory 502 may be, among other things, transient or persistent storage. The application program stored in memory 502 may include one or more modules (not shown), each of which may include a series of computer-executable instructions in an emotion information processing apparatus for text. Still further, processor 501 may be configured to communicate with memory 502 to execute a series of computer-executable instructions in memory 502 on a textual emotion information processing device. The textual emotion information processing apparatus may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input-output interfaces 505, and one or more keyboards 506.
Specifically, in this embodiment, the apparatus for processing emotion information of text includes a memory, and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions for the apparatus for processing emotion information of text, and the one or more programs configured to be executed by the one or more processors include computer-executable instructions for:
extracting a first emotion word related to a service in a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause;
determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause;
and sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
Optionally, the fine-grained affective factor comprises at least one of: the emotion type corresponding to each first clause, the number of appointed words contained in the first clause and text body information.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
determining the first emotion word contained in the first clause;
determining emotion word information corresponding to the first clause according to the first emotion word; the emotional word information comprises the number of emotional words and/or the category of the emotional words;
and determining the emotion type corresponding to the first clause according to the emotion word information.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
determining a first emotion word vector corresponding to the first emotion word; generating a first sentence vector corresponding to the text to be predicted;
determining first emotion word distribution information corresponding to each first sentence respectively through an attention mechanism according to the first sentence vector and the first emotion word vector; the first emotional word distribution information comprises distribution information of each first clause on each first emotional word;
and determining the first emotion word distribution characteristics corresponding to the text to be predicted according to the first sentence vector and the first emotion word distribution information.
Optionally, the first emotion word distribution information includes a first emotion word distribution vector;
the computer executable instructions, when executed, may further cause the processor to:
taking the first sentence vector and the first emotion word vector as input data of the attention mechanism to determine a probability distribution value of each first clause on each first emotion word;
generating a first emotion word distribution vector corresponding to each first clause based on the probability distribution value of each first clause on each first emotion word; each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
generating a first emotion word distribution matrix corresponding to the text to be predicted according to the first emotion word distribution vector corresponding to each first clause; each row element in the first emotion word distribution matrix corresponds to the first emotion word distribution vector corresponding to each first clause;
calculating a product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the number of columns of the first emotion prediction matrix is equal to the number of the first emotion words in the text to be predicted;
performing element average calculation on the first emotion word prediction matrix to obtain an average value matrix corresponding to the first emotion word prediction matrix; performing element maximum value calculation on the first emotion word prediction matrix to obtain a maximum value matrix corresponding to the first emotion word prediction matrix;
and according to a preset combination mode, carrying out matrix combination on the average value matrix and the maximum value matrix to obtain the first emotion word distribution characteristics corresponding to the text to be predicted.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
extracting the sample emotion words related to the service in the sample text, and determining sample emotion word vectors corresponding to the sample emotion words; the sample emotion words comprise positive sample emotion words and negative sample emotion words;
performing sentence and word segmentation processing on the sample text to obtain sample sentences contained in the sample text and sample words contained in each sample sentence; generating a sample sentence vector corresponding to the sample text based on the word vector corresponding to the sample word segmentation;
determining sample emotion word distribution information respectively corresponding to each sample clause through an attention mechanism according to the sample sentence vectors and the sample emotion word vectors; the sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word;
determining sample emotion word distribution characteristics corresponding to the sample text according to the sample sentence vectors and the sample emotion word distribution information;
and training the emotion prediction model according to the sample emotion word distribution characteristics and the sample emotion tendency information of the sample text.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
determining weights corresponding to the first emotional tendency information and the fine-grained emotional factors respectively;
according to the weight, performing weighted calculation on the first emotional tendency information and each fine-grained emotional factor to obtain an emotional tendency value corresponding to the text to be predicted; positive correlation or negative correlation is carried out between the positive and negative emotional tendency values of the text to be predicted and the emotional tendency values.
One or more embodiments of the present specification also provide a computer-readable storage medium storing one or more programs, the one or more programs including instructions, which when executed by an electronic device including a plurality of application programs, enable the electronic device to perform the method for processing emotion information of the above-mentioned text, and are specifically configured to perform:
extracting a first emotion word related to a service in a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause;
determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause;
and sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the various elements may be implemented in the same one or more software and/or hardware implementations in implementing one or more embodiments of the present description.
One skilled in the art will recognize that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present specification are described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only one or more embodiments of the present disclosure, and is not intended to limit the present disclosure. Various modifications and alterations to one or more embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of claims of one or more embodiments of the present specification.

Claims (15)

1. A method for processing emotion information of a text comprises the following steps:
extracting a first emotion word related to a service in a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause;
determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause;
and sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
2. The method of claim 1, the fine-grained affective factors comprising at least one of: the emotion type corresponding to each first clause, the number of appointed words contained in the first clause and text body information.
3. The method of claim 2, further comprising:
determining the first emotion word contained in the first clause;
determining emotion word information corresponding to the first clause according to the first emotion word; the emotional word information comprises the number of emotional words and/or the category of the emotional words;
and determining the emotion type corresponding to the first clause according to the emotion word information.
4. The method of claim 1, wherein the determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause comprises:
determining a first emotion word vector corresponding to the first emotion word; generating a first sentence vector corresponding to the text to be predicted;
determining first emotion word distribution information corresponding to each first sentence respectively through an attention mechanism according to the first sentence vector and the first emotion word vector; the first emotional word distribution information comprises distribution information of each first clause on each first emotional word;
and determining the first emotion word distribution characteristics corresponding to the text to be predicted according to the first sentence vector and the first emotion word distribution information.
5. The method of claim 4, the first emotion word distribution information comprising a first emotion word distribution vector;
the determining, according to the first sentence vector and the first emotion word vector, first emotion word distribution information corresponding to each of the first sentences through an attention mechanism includes:
taking the first sentence vector and the first emotion word vector as input data of the attention mechanism to determine a probability distribution value of each first clause on each first emotion word;
generating a first emotion word distribution vector corresponding to each first clause based on the probability distribution value of each first clause on each first emotion word; each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
6. The method of claim 5, wherein the determining the first emotion word distribution characteristic corresponding to the text to be predicted according to the first sentence vector and the first emotion word distribution information comprises:
generating a first emotion word distribution matrix corresponding to the text to be predicted according to the first emotion word distribution vector corresponding to each first clause; each row element in the first emotion word distribution matrix corresponds to the first emotion word distribution vector corresponding to each first clause;
calculating a product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the number of columns of the first emotion prediction matrix is equal to the number of the first emotion words in the text to be predicted;
performing element average calculation on the first emotion word prediction matrix to obtain an average value matrix corresponding to the first emotion word prediction matrix; performing element maximum value calculation on the first emotion word prediction matrix to obtain a maximum value matrix corresponding to the first emotion word prediction matrix;
and according to a preset combination mode, carrying out matrix combination on the average value matrix and the maximum value matrix to obtain the first emotion word distribution characteristics corresponding to the text to be predicted.
7. The method of claim 1, further comprising:
extracting the sample emotion words related to the service in the sample text, and determining sample emotion word vectors corresponding to the sample emotion words; the sample emotion words comprise positive sample emotion words and negative sample emotion words;
performing sentence and word segmentation processing on the sample text to obtain sample sentences contained in the sample text and sample words contained in each sample sentence; generating a sample sentence vector corresponding to the sample text based on the word vector corresponding to the sample word segmentation;
determining sample emotion word distribution information respectively corresponding to each sample clause through an attention mechanism according to the sample sentence vectors and the sample emotion word vectors; the sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word;
determining sample emotion word distribution characteristics corresponding to the sample text according to the sample sentence vectors and the sample emotion word distribution information;
and training the emotion prediction model according to the sample emotion word distribution characteristics and the sample emotion tendency information of the sample text.
8. The method of claim 1, wherein the determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factor corresponding to the first clause comprises:
determining weights corresponding to the first emotional tendency information and the fine-grained emotional factors respectively;
according to the weight, performing weighted calculation on the first emotional tendency information and each fine-grained emotional factor to obtain an emotional tendency value corresponding to the text to be predicted; positive correlation or negative correlation is carried out between the positive and negative emotional tendency values of the text to be predicted and the emotional tendency values.
9. An emotion information processing apparatus for a text, comprising:
the first extraction module is used for extracting a first emotion word related to the service in the text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
the first determining module is used for determining the distribution characteristics of the first emotion words corresponding to the text to be predicted according to the first emotion words and the first clauses;
the second determining module is used for determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
a third determining module, configured to determine second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factor corresponding to the first clause;
and the sending module is used for sending the second emotional tendency information to a service processing platform of the service so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
10. The apparatus of claim 9, the fine-grained affective factors comprising at least one of: the emotion type corresponding to each first clause, the number of appointed words contained in the first clause and text body information.
11. The apparatus of claim 9, the first determining module comprising:
the first determining unit is used for determining a first emotion word vector corresponding to the first emotion word; generating a first sentence vector corresponding to the text to be predicted;
a second determining unit, configured to determine, according to the first sentence vector and the first emotion word vector, first emotion word distribution information corresponding to each of the first clauses through an attention mechanism; the first emotional word distribution information comprises distribution information of each first clause on each first emotional word;
and the third determining unit is used for determining the first emotion word distribution characteristics corresponding to the text to be predicted according to the first sentence vector and the first emotion word distribution information.
12. The apparatus of claim 11, the first emotion word distribution information comprising a first emotion word distribution vector;
the second determining unit is configured to determine a probability distribution value of each first clause on each first emotion word by using the first sentence vector and the first emotion word vector as input data of the attention mechanism; generating a first emotion word distribution vector corresponding to each first clause based on the probability distribution value of each first clause on each first emotion word; each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
13. The apparatus of claim 12, the third determination unit:
generating a first emotion word distribution matrix corresponding to the text to be predicted according to the first emotion word distribution vector corresponding to each first clause; each row element in the first emotion word distribution matrix corresponds to the first emotion word distribution vector corresponding to each first clause;
calculating a product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the number of columns of the first emotion prediction matrix is equal to the number of the first emotion words in the text to be predicted;
performing element average calculation on the first emotion word prediction matrix to obtain an average value matrix corresponding to the first emotion word prediction matrix; performing element maximum value calculation on the first emotion word prediction matrix to obtain a maximum value matrix corresponding to the first emotion word prediction matrix;
and according to a preset combination mode, carrying out matrix combination on the average value matrix and the maximum value matrix to obtain the first emotion word distribution characteristics corresponding to the text to be predicted.
14. An emotion information processing apparatus of a text, comprising:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
extracting a first emotion word related to a service in a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause;
determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause;
and sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
15. A storage medium storing computer-executable instructions that, when executed, implement the following:
extracting a first emotion word related to a service in a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; the text to be predicted is subjected to clause processing to obtain a first clause corresponding to the text to be predicted;
determining a first emotion word distribution characteristic corresponding to the text to be predicted according to the first emotion word and the first clause;
determining first emotional tendency information corresponding to the text to be predicted according to the first emotional word distribution characteristics and a pre-trained emotional prediction model; the emotion prediction model is obtained by training based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information of the sample text;
determining second emotional tendency information corresponding to the text to be predicted according to the first emotional tendency information and the fine-grained emotional factors corresponding to the first clause;
and sending the second emotional tendency information to a service processing platform of the service, so that the service processing platform adjusts the service parameters of the service based on the second emotional tendency information.
CN202010621825.0A 2020-07-01 2020-07-01 Text emotion information processing method and device Active CN111783453B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010621825.0A CN111783453B (en) 2020-07-01 2020-07-01 Text emotion information processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010621825.0A CN111783453B (en) 2020-07-01 2020-07-01 Text emotion information processing method and device

Publications (2)

Publication Number Publication Date
CN111783453A true CN111783453A (en) 2020-10-16
CN111783453B CN111783453B (en) 2024-05-21

Family

ID=72760538

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010621825.0A Active CN111783453B (en) 2020-07-01 2020-07-01 Text emotion information processing method and device

Country Status (1)

Country Link
CN (1) CN111783453B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114003815A (en) * 2021-11-04 2022-02-01 之江实验室 Method for discovering online public opinion theme and user group concerned by same

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019174423A1 (en) * 2018-03-16 2019-09-19 北京国双科技有限公司 Entity sentiment analysis method and related apparatus
CN110309308A (en) * 2019-06-27 2019-10-08 北京金山安全软件有限公司 Text information classification method and device and electronic equipment
CN111125360A (en) * 2019-12-19 2020-05-08 网易(杭州)网络有限公司 Emotion analysis method and device in game field and model training method and device thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019174423A1 (en) * 2018-03-16 2019-09-19 北京国双科技有限公司 Entity sentiment analysis method and related apparatus
CN110309308A (en) * 2019-06-27 2019-10-08 北京金山安全软件有限公司 Text information classification method and device and electronic equipment
CN111125360A (en) * 2019-12-19 2020-05-08 网易(杭州)网络有限公司 Emotion analysis method and device in game field and model training method and device thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
延丰;杜腾飞;毛建华;刘学锋;: "基于情感词典与LDA模型的股市文本情感分析", 电子测量技术, no. 12 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114003815A (en) * 2021-11-04 2022-02-01 之江实验室 Method for discovering online public opinion theme and user group concerned by same
CN114003815B (en) * 2021-11-04 2024-03-29 之江实验室 Network public opinion theme and discovery method of user group concerned by same

Also Published As

Publication number Publication date
CN111783453B (en) 2024-05-21

Similar Documents

Publication Publication Date Title
CN110276066B (en) Entity association relation analysis method and related device
CN107451199B (en) Question recommendation method, device and equipment
CN108829808B (en) Page personalized sorting method and device and electronic equipment
CN111881343A (en) Information pushing method and device, electronic equipment and computer readable storage medium
CN110334356A (en) Article matter method for determination of amount, article screening technique and corresponding device
CN110162778B (en) Text abstract generation method and device
CN110069545B (en) Behavior data evaluation method and device
CN117609444B (en) Searching question-answering method based on large model
US20210193130A1 (en) Recommending multimedia based on user utterances
CN110502614A (en) Text hold-up interception method, device, system and equipment
CN113656699A (en) User feature vector determination method, related device and medium
CN117409419A (en) Image detection method, device and storage medium
CN117648418A (en) Multi-document question-answering method and device, electronic equipment and storage medium
CN114428838A (en) Content recall method and device, computer equipment and storage medium
CN112464106B (en) Object recommendation method and device
CN111783453A (en) Method and device for processing emotion information of text
KR20210090706A (en) Sort
CN112446206A (en) Menu title generation method and device
CN115757786A (en) Text classification method, device, equipment and storage medium
CN110059219A (en) A kind of video preference prediction technique, device, equipment and readable storage medium storing program for executing
CN106776529B (en) Business emotion analysis method and device
CN114048392B (en) Multimedia resource pushing method and device, electronic equipment and storage medium
CN113590960B (en) User identification model training method, electronic equipment and computer storage medium
CN118094016B (en) Recommendation method, recommendation device, recommendation apparatus, recommendation computer readable storage medium, and recommendation program product
CN117253061B (en) Data recommendation method, device and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant