CN111783453B - Text emotion information processing method and device - Google Patents
Text emotion information processing method and device Download PDFInfo
- Publication number
- CN111783453B CN111783453B CN202010621825.0A CN202010621825A CN111783453B CN 111783453 B CN111783453 B CN 111783453B CN 202010621825 A CN202010621825 A CN 202010621825A CN 111783453 B CN111783453 B CN 111783453B
- Authority
- CN
- China
- Prior art keywords
- emotion
- text
- sample
- predicted
- clause
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000008451 emotion Effects 0.000 title claims abstract description 796
- 230000010365 information processing Effects 0.000 title claims description 22
- 238000003672 processing method Methods 0.000 title description 4
- 238000009826 distribution Methods 0.000 claims abstract description 198
- 238000012545 processing Methods 0.000 claims abstract description 73
- 238000000034 method Methods 0.000 claims abstract description 48
- 239000013598 vector Substances 0.000 claims description 126
- 239000011159 matrix material Substances 0.000 claims description 106
- 238000004364 calculation method Methods 0.000 claims description 31
- 238000012549 training Methods 0.000 claims description 22
- 230000011218 segmentation Effects 0.000 claims description 20
- 230000007246 mechanism Effects 0.000 claims description 19
- 238000003860 storage Methods 0.000 claims description 14
- 238000000605 extraction Methods 0.000 claims description 4
- 238000010586 diagram Methods 0.000 description 9
- 238000004590 computer program Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 230000008569 process Effects 0.000 description 6
- 238000004458 analytical method Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 238000013145 classification model Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 230000001419 dependent effect Effects 0.000 description 2
- 230000008909 emotion recognition Effects 0.000 description 2
- 230000006872 improvement Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000004075 alteration Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 239000002360 explosive Substances 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000005055 memory storage Effects 0.000 description 1
- 230000035699 permeability Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
- G06F40/289—Phrasal analysis, e.g. finite state techniques or chunking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
One or more embodiments of the present disclosure disclose a method and an apparatus for processing emotion information of a text, so as to solve the problem in the prior art that emotion tendency identification is inaccurate, and thus service parameters cannot be accurately adjusted based on 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 emotion words corresponding to the text to be predicted according to the first emotion words and the first clauses. And determining first emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model. And determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factors corresponding to the first clause. And sending the second emotion tendency information to a business processing platform of the business.
Description
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 the mobile internet, products such as electronic commerce, community platforms, short videos, live broadcasting and the like are vigorously developed, and a large number of high-quality UGC (User Generated Content ) is contributed by a large user group, so that the internet has the characteristics of openness, virtualization, concealment, divergence, permeability, randomness and the like. More and more users like to express personal views through internet channels, such as expressing whether themselves are satisfied or where improvement is desired for the processing effect of a certain service, and the like, so that the internet is gradually becoming a main place for public opinion topic generation and transmission. Meanwhile, with the explosive growth of comment texts on the Internet, computers are urgently needed to help users process and arrange emotion information, and the emotion information of the users can influence business operation and development to a certain extent, so that emotion analysis research has important application.
In articles or comments related to the business, the business can roughly divide emotion into positive emotion and negative emotion, but Chinese is profound, so that the text often contains implicit emotion and explicit emotion turning, which becomes a difficulty in emotion judgment. For example, "XX treasures changed to the nearest one, XX treasures silently changed to the rule. Three studies have studied, and one sentence is that the XX treasures are more and more difficult to claim later. But not necessarily the bad bar, we specifically chat this new change and what affects. ". The sentences contain the emotion which is the double difference of 'harder and harder' and 'worse', and the sentences can cause interference to emotion recognition, so that the existing emotion recognition mode is difficult to recognize whether positive emotion or negative emotion is the positive emotion or the negative emotion.
Disclosure of Invention
In one aspect, one or more embodiments of the present disclosure provide a method for processing emotion information of a text, including: and extracting first emotion words related to the service from 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 first emotion word distribution characteristics corresponding to the text to be predicted according to the first emotion words and the first clauses. And determining first emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model, wherein 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. And determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause. And sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
In another aspect, one or more embodiments of the present specification provide an emotion information processing device for text, including: the extraction module is used for 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 sentence segmentation is carried out on the text to be predicted to obtain a first sentence corresponding to the text to be predicted. And the first determining module is used for determining the first emotion word distribution characteristics 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model, and 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. And the third determining module is used for determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factors corresponding to the first clause. And the sending module is used for sending the second emotion tendency information to a service processing platform of the service so that the service processing platform can adjust service parameters of the service based on the second emotion tendency information.
In still another aspect, one or more embodiments of the present specification provide an emotion information processing device of text, including: a processor; and a memory arranged to store computer executable instructions that, when executed, cause the processor to: and extracting first emotion words related to the service from 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 first emotion word distribution characteristics corresponding to the text to be predicted according to the first emotion words and the first clauses. And determining first emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model, wherein 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. And determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause. And sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
In yet another aspect, embodiments of the present application provide a storage medium storing computer-executable instructions that, when executed, implement the following: and extracting first emotion words related to the service from 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 first emotion word distribution characteristics corresponding to the text to be predicted according to the first emotion words and the first clauses. And determining first emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model, wherein 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. And determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause. And sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
Drawings
In order to more clearly illustrate one or more embodiments of the present specification or the prior art, the drawings that are required for the description of the embodiments or the prior art will be briefly described, it being apparent that the drawings in the following description are only some of the embodiments described in one or more embodiments of the present specification, and that other drawings may be obtained from these drawings without inventive faculty for a person of ordinary skill in the art.
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 chart of a training method of emotion prediction models according to an embodiment of the present disclosure;
FIG. 3 is a schematic flow chart of a method for emotion information processing of text according to another embodiment of the present specification;
FIG. 4 is a schematic block diagram of an emotion information processing device for text according to an embodiment of the present specification;
Fig. 5 is a schematic block diagram of an emotion information processing device of a text according to an embodiment of the present specification.
Detailed Description
One or more embodiments of the present disclosure provide a method and an apparatus for processing emotion information of a text, so as to solve the problem in the prior art that emotion tendency identification is inaccurate, and thus service parameters cannot be accurately adjusted based on emotion tendency information.
In order to enable a person skilled in the art to better understand the technical solutions in one or more embodiments of the present specification, the technical solutions in one or more embodiments of the present specification will be clearly and completely described below with reference to the drawings in one or more embodiments of the present specification, and it is obvious that the described embodiments are only some embodiments of the present specification, not all embodiments. All other embodiments, which may be made by one of ordinary skill in the art based on one or more embodiments of the present disclosure without departing from the scope of the invention as defined by the claims.
Fig. 1 is a schematic flowchart of a method for processing emotion information of a text according to an embodiment of the present specification, as shown in fig. 1, the method including:
S102, extracting first emotion words related to a service 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 may include comment text of the business by the user. And the first emotion words related to the service in the text to be predicted are emotion words which are contained in the text to be predicted and can have certain influence on service parameters. For example, since the comment text of a certain payment type application includes keywords such as "increasingly difficult", "not necessarily bad", and the keywords represent the personal views of the user on the payment type application, the keywords can have a certain influence on the relevant parameters of the payment type application, and for example, the keywords can be used as a basis for adjusting the relevant parameters, and therefore the keywords (i.e., "increasingly difficult", "not necessarily bad") can be regarded as first emotion words related to the payment type application.
The first affective word associated with the business may be determined in advance based on business experience. For example, pre-determining affective words associated with a business includes: like, sad, hard, optimistic, etc. Then, in executing S102, a first emotion word may be extracted from the text to be predicted according to a predetermined emotion word associated with the business.
Positive emotion words may represent positive perspectives of user satisfaction, support, positive, etc. with respect to the service, and negative emotion words may represent negative perspectives of user dissatisfaction, objection, negative, poor comment, dislike, etc. with respect to the service.
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 the distribution characteristics of each first clause on each first emotion word.
And S106, determining first emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion 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, wherein 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 comprise positive emotion words or negative emotion words.
S108, determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factors corresponding to the first clause.
The fine granularity emotion factors can comprise emotion categories corresponding to the first clauses respectively, the number of specified words contained in the first clauses, text body information and the like. The emotion classification may include positive emotion or negative emotion.
The emotion category corresponding to the first clause may be based on emotion word information of emotion words included in the first clause, such as the number of emotion words, emotion word category, and the like. Based on the above, the first emotion words contained in each first clause can be predetermined, and then emotion word information corresponding to each first clause is determined according to the first emotion words contained in each first clause, wherein the emotion word information can comprise the number of emotion words, emotion word categories and the like; and further determining emotion categories corresponding to the first clauses according to emotion word information corresponding to the first clauses. For example, the larger the number of positive emotion words contained in the first clause, the larger the probability that the emotion type corresponding to the first clause is positive emotion; conversely, the larger the number of negative emotion words contained in the first clause, the larger the probability that the emotion type corresponding to the first clause is negative emotion.
The specified class of words may include inflections (e.g., "but", "however"), exclamations (e.g., "daily") and the like. The text body information of the first clause may be service body information related to the first clause, such as a service category, a service function, and the like. For example, assuming that the text to be predicted is comment text for the payment class application a, the text body information of the first clause 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 clause includes a subject word, the text subject information may also be determined based on the subject word.
S110, sending the second emotion trend information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion trend information.
By adopting the technical scheme of one or more embodiments of the present disclosure, after the first emotion trend information corresponding to the text to be predicted is predicted by the emotion prediction model, the first emotion trend information and the fine granularity emotion factors corresponding to each clause of the text to be predicted can be comprehensively considered, and the second emotion trend information corresponding to the text to be predicted is further determined, so that the emotion trend information corresponding to the text to be predicted is related to the fine granularity emotion factors of each sentence in the text, and is not dependent on a single emotion classification model (namely, emotion trend can be classified into positive emotion or negative emotion), thereby improving the accuracy of analysis of emotion trend information. Further, by sending the emotion tendency information which is accurately analyzed to the service processing platform, the service processing platform can adjust service parameters based on the accurate emotion tendency information, so that the accuracy of service parameter adjustment is improved.
In addition, because the emotion tendency model is obtained by training based on the sample emotion word distribution characteristics corresponding to the sample text and the sample emotion tendency information of the sample text, after the 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, and the second emotion information of the text to be predicted can be used as new sample emotion tendency information, and further the emotion prediction model is updated and optimized by using the new sample text and the corresponding new sample emotion tendency information, so that the text emotion tendency information predicted based on the emotion prediction model is more accurate.
The following first describes a training method of emotion prediction models.
In one embodiment, emotion prediction models may be trained in accordance with 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 service in the sample text, and determining sample emotion word vectors corresponding to the sample emotion words.
Wherein the sample text may include user comment text for the business. The sample emotion words comprise positive sample emotion words and negative sample emotion words.
And the sample emotion words related to the service in the sample text are emotion words which are contained in the sample text and can have certain influence on service parameters. For example, since the comment text of a certain payment type application includes keywords such as "increasingly difficult", "not necessarily bad", and the keywords represent the personal views of the user on the payment type application, the keywords can have a certain influence on the relevant parameters of the payment type application, and for example, the keywords can be used as a basis for adjusting the relevant parameters, and thus the keywords (i.e., "increasingly difficult", "not necessarily bad") can be extracted as sample emotion words.
The affective words associated with the business may be determined in advance based on business experience. For example, pre-determining affective words associated with a business includes: like, sad, hard, optimistic, etc. Then at execution S201, a sample emotion word may be extracted from the sample text according to a predetermined emotion word associated with the business.
In this step, a sample emotion word vector corresponding to the sample emotion word may be generated by using an existing word vector generation method, which is not described herein.
S202, sentence segmentation processing is carried out on the sample text to obtain sample clauses contained in the sample text and sample segmentation contained in each sample clause, and sample sentence vectors corresponding to the sample text are generated based on word vectors corresponding to the sample segmentation.
The sentence and word segmentation processing comprises sentence and word segmentation processing, for example, aiming at sample texts, namely 'troublesome and aunt to merge posts bar, hard and easy to use', and after the sentence and word segmentation processing, the following sample sentences and sample words contained in the sample sentences can be obtained: "troublesome you, help, aunt, merge, post, ',', pungent and bitter, you, have, ',', duchesness".
In this step, the sample sentence vector may be generated by using an existing sentence vector generation method, which is not described herein.
S203, according to the sample sentence vector and the sample emotion word vector, determining sample emotion word distribution information corresponding to each sample sentence through an attention mechanism.
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 probability distribution value of each sample sentence on each sample emotion word can be determined by taking the sample sentence vector and the sample emotion word vector as input data of an attention mechanism, so that the sample emotion word distribution vector corresponding to each sample sentence is generated according to the probability distribution value of each sample sentence on each sample emotion word, and each element in the sample emotion word distribution vector represents the probability distribution value of each sample sentence 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 values between 0 and 1.
Assuming that, for the sample clause vector ai, probability distribution values of the corresponding sample clause on m sample emotion words are pi1, pi2, … and pim respectively, the sample emotion word distribution vector corresponding to the sample clause is (pi 1, pi2, … and pim).
S204, according to the sample sentence vector and the sample emotion word distribution information, determining sample emotion word distribution characteristics corresponding to the sample text.
Wherein S204 may be performed as follows steps A1-A4.
And A1, generating a sample emotion word distribution matrix corresponding to the sample text according to sample emotion word distribution vectors respectively corresponding to the sample clauses, wherein each row of elements in the sample emotion word distribution matrix respectively correspond to the sample emotion word distribution vectors respectively corresponding to the sample clauses.
Along the above example, if the sample emotion word distribution vector corresponding to the sample clause vector ai is (pi 1, pi2, …, pim), a sample emotion word distribution matrix of n×m may be generated, where the number n of rows of the sample emotion word distribution matrix is the number of sample clauses in the sample text, and the number m of columns 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 clause vector a1 is (p 11, p 12), and the sample emotion word distribution vector corresponding to the sample clause vector a2 is (p 21, p 22), the following sample emotion word distribution matrix of 2×2 can be generated:
And 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 sample emotion words in the sample text.
Along the above example, assume that the sample sentence vector is (a 1, a 2), and the corresponding sample emotion word distribution matrix isThen by calculating (a 1, a 2) and/>And (3) obtaining a sample emotion prediction matrix: (a1×p11+a2×p12, a1×p21+a2×p22).
A3, carrying out element average calculation on the sample emotion word prediction matrix to obtain an average matrix corresponding to the sample emotion word prediction matrix; and performing 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.
The element average calculation is a value obtained by averaging all elements in the sample emotion prediction matrix; and calculating the maximum value of the elements, namely determining the maximum value of each element in the sample emotion prediction matrix.
Optionally, the average value matrix and the maximum value matrix are one-dimensional vectors.
And step A4, according to a preset combination mode, combining the average value matrix and the maximum value matrix to obtain sample emotion word distribution characteristics corresponding to the sample text.
The preset combination mode can be a mode of splicing two matrixes according to a certain order.
Along the above example, assume that the sample emotion prediction matrix is (a1×p11+a2×p12, a1×p21+a2×p22), that is, the sample emotion prediction matrix (a1×p11+a2×p12, a1×p21+a2×p22) is subjected to element average calculation and element maximum calculation, respectively. Assuming that the sample emotion prediction matrix (a1×p11+a2×p12, a1×p21+a2×p22) is subjected to element average calculation to obtain a one-dimensional vector b1, and the sample emotion prediction matrix (a1×p11+a2×p12, a1×p21+a2×p22) is subjected to element maximum calculation to obtain a one-dimensional vector b2, the one-dimensional vectors b1 and b2 are spliced to obtain the sample emotion word distribution characteristics (b 1 and b 2).
S205, training an emotion prediction model according to the sample emotion word distribution characteristics and sample emotion tendency information of the sample text.
The sample emotion tendency information of the sample text may be determined in advance according to emotion types (such as positive emotion or negative emotion) of sample emotion words contained in the sample text.
After the emotion trend information of the text to be predicted is predicted by using the emotion prediction model, 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 trend information, and the emotion prediction model is updated and optimized by using the new sample text and the corresponding new sample emotion trend information.
In this embodiment, because the attention mechanism can identify probability distribution of each sample clause on each sample emotion word, and the element average value and the element maximum value calculation mode can reflect average distribution information and maximum value distribution information (i.e. which emotion type is most prone) of the sample text in different emotion tendencies to a certain extent, the sample emotion word distribution characteristics of the sample text can be more accurately determined through the attention mechanism and the element average value and element maximum value calculation mode, so that the finally trained emotion prediction model is more accurate.
After training the emotion prediction model, the first emotion tendency information corresponding to the text to be predicted can be predicted according to the corresponding first emotion word distribution characteristics of the text to be predicted and the emotion prediction model. The method comprises the steps that corresponding first emotion word distribution characteristics of a text to be predicted are identical to the determination mode of sample emotion word distribution characteristics corresponding to sample text.
Determining first emotion tendency information corresponding to the text to be predicted, and determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to each first clause in the text to be predicted. The fine granularity emotion factors can comprise emotion categories corresponding to the first clauses respectively, the number of specified words contained in the first clauses, text body information and the like. The emotion classification may include positive emotion or negative emotion.
FIG. 3 is a schematic flow chart of a method for processing emotion information of a text according to an embodiment of the present specification, as shown in FIG. 3, the method includes:
S301, extracting first emotion words related to a service 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 can 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 may be generated by using an existing sentence vector generating method, so that a detailed sentence vector generating method is not described herein.
S303, according to the first sentence vector and the first emotion word vector, determining first emotion word distribution information corresponding to each first clause through an attention mechanism.
The first emotion word distribution information comprises distribution information of each first clause on each first emotion word.
In one embodiment, the first affective word distribution information is a first affective word distribution vector. Therefore, when executing S303, the first sentence vector and the first emotion word vector may be used as input data of the attention mechanism to determine probability distribution values of each first clause on each first emotion word, and further generate first emotion word distribution vectors corresponding to each first clause based on the probability distribution values of each first clause on each first emotion word. Each element of the first emotion word distribution vector represents a probability distribution value of a 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 embodiment, and will not be described herein.
S304, according to the first sentence vector and the first emotion word distribution information, determining first emotion word distribution characteristics corresponding to the text to be predicted.
In one embodiment, when executing S304, it may be performed as follows steps B1-B4:
And 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 correspond to the first emotion word distribution vectors corresponding to the first clauses respectively.
The first emotion word distribution matrix corresponding to the text to be predicted is the same as the generation method of the sample emotion word distribution matrix corresponding to the sample text in the above embodiment.
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 method for calculating the sample emotion prediction matrix in the above embodiment.
Step B3, carrying out element average calculation on the first emotion word prediction matrix to obtain an average matrix corresponding to the first emotion word prediction matrix; and 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.
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 above embodiment.
And B4, performing matrix combination on the average value matrix and the maximum value matrix according to a preset combination mode to obtain first emotion word distribution characteristics corresponding to the text to be predicted.
The method for combining the first emotion word distribution features is similar to the method for combining the sample emotion word distribution features in the above embodiment.
S305, determining first emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model.
The training method of the emotion prediction model is described in detail in the above embodiments, and will not be described herein.
S306, determining weights corresponding to the first emotion trend information and each fine granularity emotion factor.
S307, according to the determined weight, carrying out weighted calculation on the first emotion tendency information and each fine granularity emotion factor to obtain an emotion tendency value corresponding to the text to be predicted.
Wherein, positive correlation or negative correlation between positive and negative face emotion tendencies and emotion tendencies values of the predicted text.
In this step, the first emotion tendencies information and each fine grain emotion factor may be assigned a value that enables weight calculation before weight calculation. The fine granularity emotion factor may include emotion categories (positive emotion or negative emotion) corresponding to the first clauses respectively, the number of specified class words contained in the first clauses, text body information, and the like.
In one embodiment, the first emotion tendency information is a first emotion tendency value, and the magnitude of the first emotion tendency value indicates the degree of positive emotion tendency, that is, the greater the first emotion tendency value, the higher the degree of positive emotion tendency.
The correspondence between emotion categories and values may be established in advance. For example, a negative emotion type is represented by a value of 0, and a positive emotion type is represented by a value of 1.
The text body information of the first clause may be service body information related to the first clause, and a correspondence between the text body information and the numerical value may be pre-established, where the establishment of the correspondence may be based on 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 value 1 may be corresponding; when the service type corresponding to the text body information is B, the text body information can correspond to a value of 2; etc.
Of course, the foregoing is merely illustrative of several ways to assign fine-grained emotion factors. In practical applications, the fine granularity emotion factor may be assigned according to the related business requirements, and is not limited to the manner listed in the above embodiments.
And after the first emotion tendency information and each fine granularity emotion factor are assigned, weighting calculation can be carried out according to the corresponding weight, and the emotion tendency value obtained after the weighting calculation can represent the emotion tendency of the text to be predicted.
Positive and negative emotion tendencies of the text to be predicted refer to the text to be predicted tending to positive emotion or tending to negative emotion. The correspondence between positive and negative face emotion tendencies values may be preset as positive or negative correlations. For example, setting positive correlation between positive emotion tendencies and emotion tendencies values, wherein the larger the emotion tendencies values are, the higher the positive emotion tendencies corresponding to the text to be predicted is; conversely, the smaller the emotion tendency value is, the lower the positive emotion tendency degree corresponding to the text to be predicted is.
S308, sending the emotion tendency value corresponding to the text to be predicted to a business processing platform of the business, so that the business processing platform adjusts business parameters of the business based on the emotion tendency value.
In this step, the text to be predicted may be comment text of the user for the service. The emotion tendency value corresponding to the text to be predicted reflects emotion tendency information of the user on the service, and if the emotion tendency value is high, the positive viewpoints of satisfaction, support, positive and the like of the user on the service are indicated; and if the emotion tendency value is low, the user is informed of the negative viewpoints of dissatisfaction, objection, negative, poor evaluation, disqualification and the like of the service.
The business processing platform adjusts business parameters based on emotion tendency values corresponding to comment texts, for example, if the emotion tendency values are higher, the business parameters corresponding to the emotion tendency values can be thinned and enhanced; if the emotion tendency value is lower, the service parameter corresponding to the emotion tendency value can be modified, so that the adjusted service can be more fit with the service processing requirement of the user.
In summary, in the technical solution provided in this embodiment, the emotion tendency value corresponding to the text to be predicted is related to the fine granularity emotion factor of each sentence in the text, instead of relying on only a single emotion classification model (i.e., only the emotion tendency can be classified into positive emotion or negative emotion), so that the accuracy of analysis of the emotion tendency value is improved. Further, by sending the accurately analyzed emotion tendency value to the service processing platform, the service processing platform can adjust the service parameters based on the accurate emotion tendency value, so that the accuracy of service parameter adjustment 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.
The above method for processing emotion information of a text provided for one or more embodiments of the present specification further provides an emotion information processing device of a text based on the same concept.
Fig. 4 is a schematic block diagram of an emotion information processing device for text according to an embodiment of the present specification, as shown in fig. 4, including:
A first extraction module 410 extracts 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; performing clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted;
the first determining module 420 determines a first emotion word distribution feature corresponding to the text to be predicted according to the first emotion word and the first clause;
The second determining module 430 determines, according to the first emotion word distribution feature and a pre-trained emotion prediction model, first emotion tendency information corresponding to the text to be predicted; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
a third determining module 440, configured to determine second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause;
And the sending module 450 is used for sending the second emotion tendency information to a service processing platform of the service so that the service processing platform can adjust service parameters of the service based on the second emotion tendency information.
In one embodiment, the fine granularity emotion factor comprises at least one of: the emotion category corresponding to each first clause, the number of the appointed words contained in the first clause and the text body information.
In one embodiment, the apparatus further comprises:
a fourth determining module configured to determine the first emotion word included in the first clause;
A fifth determining module, configured to determine emotion word information corresponding to the first clause according to the first emotion word; the emotion word information comprises the number of emotion words and/or emotion word categories;
And a sixth determining module, configured to determine, according to the emotion word information, the emotion category corresponding to the first clause.
In one embodiment, the first determining module 420 includes:
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;
The second determining unit is used for determining first emotion word distribution information corresponding to each first clause respectively through an attention mechanism according to the first sentence vector and the first emotion word vector; the first emotion word distribution information comprises distribution information of each first clause on each first emotion word;
And a third determining unit, configured to determine, according to the first sentence vector and the first emotion word distribution information, the first emotion word distribution feature corresponding to the text to be predicted.
In one embodiment, the first emotion word distribution information includes a first emotion word distribution vector;
The second determining unit takes the first sentence vector and the first emotion word vector as input data of the attention mechanism to determine probability distribution values of the first clauses on the first emotion words; generating first emotion word distribution vectors corresponding to the first clauses respectively based on probability distribution values of the first clauses on the first emotion words; 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 determining unit:
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; each row of elements in the first emotion word distribution matrix respectively corresponds to the first emotion word distribution vector respectively corresponding to each first clause;
Calculating the product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the column number 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 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 carrying out 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.
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 processing on the sample text to obtain sample clauses contained in the sample text and sample segmentation 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 vector and the sample emotion word vector, sample emotion word distribution information corresponding to each sample sentence through an attention mechanism; the sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word;
an eighth determining module, configured to determine, according to the sample sentence vector and the sample emotion word distribution information, a sample emotion word distribution feature corresponding to the sample text;
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 emotion tendency information and each of the fine granularity emotion factors;
The weighting calculation unit is used for carrying out weighting calculation on the first emotion tendency information and each fine granularity emotion factor according to the weight to obtain an emotion tendency value corresponding to the text to be predicted; and positive correlation or negative correlation between the positive and negative emotion tendencies of the text to be predicted and the emotion tendencies value.
By adopting the device of one or more embodiments of the present disclosure, after the first emotion trend information corresponding to the text to be predicted is predicted by the emotion prediction model, the first emotion trend information and the fine granularity emotion factors corresponding to each clause of the text to be predicted can be comprehensively considered, and the second emotion trend information corresponding to the text to be predicted is further determined, so that the emotion trend information corresponding to the text to be predicted is related to the fine granularity emotion factors of each sentence in the text, and is not dependent on a single emotion classification model (namely, emotion trend can be classified into positive emotion or negative emotion), thereby improving the accuracy of analysis of emotion trend information. Further, by sending the emotion tendency information which is accurately analyzed to the service processing platform, the service processing platform can adjust service parameters based on the accurate emotion tendency information, so that the accuracy of service parameter adjustment is improved.
It should be understood by those skilled in the art that the above-mentioned emotion information processing device for text can be used to implement the above-mentioned emotion information processing method for text, and the detailed description thereof should be similar to that of the above-mentioned method section, so as to avoid complexity and avoid redundancy.
Based on the same thought, one or more embodiments of the present disclosure further provide an emotion information processing device for text, as shown in fig. 5. The emotion information processing device of the text may have a relatively large difference due to different configurations or performances, and may include one or more processors 501 and a memory 502, where the memory 502 may store one or more stored applications or data. Wherein the memory 502 may be transient storage 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 device for text. Still further, processor 501 may be configured to communicate with memory 502 and execute a series of computer executable instructions in memory 502 on an affective information processing device of a text. The emotion information processing device of the text 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.
In particular, in this embodiment, the emotion information processing device of the 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 in the emotion information processing device of the text, and the execution of the one or more programs by the one or more processors includes computer executable instructions for:
Extracting a first emotion word related to a service from a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; performing clause processing on the text to be predicted 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
Determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to the first clause;
and sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
Optionally, the fine granularity emotion factor includes at least one of: the emotion category corresponding to each first clause, the number of the appointed words contained in the first clause and the text body information.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
determining the first emotion words contained in the first clause;
Determining emotion word information corresponding to the first clause according to the first emotion word; the emotion word information comprises the number of emotion words and/or emotion word categories;
and determining the emotion category 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 clause respectively through an attention mechanism according to the first sentence vector and the first emotion word vector; the first emotion word distribution information comprises distribution information of each first clause on each first emotion 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 probability distribution values of the first clauses on the first emotion words;
generating first emotion word distribution vectors corresponding to the first clauses respectively based on probability distribution values of the first clauses on the first emotion words; 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 vectors corresponding to the first clauses respectively; each row of elements in the first emotion word distribution matrix respectively corresponds to the first emotion word distribution vector respectively corresponding to each first clause;
Calculating the product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the column number 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 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 carrying out 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.
Optionally, the computer executable instructions, when executed, may further cause the processor to:
extracting the sample emotion words related to the service from 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 segmentation processing on the sample text to obtain sample sentences contained in the sample text and sample segmentation 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;
According to the sample sentence vector and the sample emotion word vector, determining sample emotion word distribution information corresponding to each sample sentence respectively through an attention mechanism; the sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word;
according to the sample sentence vector and the sample emotion word distribution information, determining sample emotion word distribution characteristics corresponding to the sample text;
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 emotion tendency information and the fine granularity emotion factors respectively;
according to the weight, carrying out weighted calculation on the first emotion tendency information and each fine granularity emotion factor to obtain an emotion tendency value corresponding to the text to be predicted; and positive correlation or negative correlation between the positive and negative emotion tendencies of the text to be predicted and the emotion tendencies value.
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 emotion information processing method of text described above, and specifically for performing:
Extracting a first emotion word related to a service from a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; performing clause processing on the text to be predicted 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
Determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to the first clause;
and sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, 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 functionally divided into various units, respectively. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing one or more embodiments of the present description.
One skilled in the art will appreciate 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. Moreover, one or more embodiments of the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) 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 flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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 one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
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 storage media for a computer 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, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
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 one … …" 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 specification 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.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing description is merely one or more embodiments of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to one or more embodiments of this description will be apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of one or more embodiments of the present disclosure, are intended to be included within the scope of the claims of one or more embodiments of the present disclosure.
Claims (12)
1. A method for processing emotion information of a text includes:
Extracting a first emotion word related to a service from a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; performing clause processing on the text to be predicted 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
Determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to the first clause;
The determining, according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause, second emotion tendency information corresponding to the text to be predicted includes:
Determining weights corresponding to the first emotion tendency information and the fine granularity emotion factors respectively; according to the weight, carrying out weighted calculation on the first emotion tendency information and each fine granularity emotion factor to obtain an emotion tendency value corresponding to the text to be predicted; positive correlation or negative correlation between the positive and negative face emotion tendencies of the text to be predicted and the emotion tendencies; the fine grain emotion factor comprises at least one of the following: the emotion category corresponding to each first clause, the number of the appointed words contained in the first clause and the text body information;
and sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
2. The method of claim 1, further comprising:
determining the first emotion words contained in the first clause;
Determining emotion word information corresponding to the first clause according to the first emotion word; the emotion word information comprises the number of emotion words and/or emotion word categories;
and determining the emotion category corresponding to the first clause according to the emotion word information.
3. The method of claim 1, wherein the determining, according to the first emotion word and the first clause, a first emotion word distribution feature corresponding to the text to be predicted includes:
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 clause respectively through an attention mechanism according to the first sentence vector and the first emotion word vector; the first emotion word distribution information comprises distribution information of each first clause on each first emotion 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.
4. The method of claim 3, the first affective word distribution information comprising a first affective 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 first clause 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 probability distribution values of the first clauses on the first emotion words;
generating first emotion word distribution vectors corresponding to the first clauses respectively based on probability distribution values of the first clauses on the first emotion words; each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
5. The method of claim 4, wherein determining the first emotion word distribution feature 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 vectors corresponding to the first clauses respectively; each row of elements in the first emotion word distribution matrix respectively corresponds to the first emotion word distribution vector respectively corresponding to each first clause;
Calculating the product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the column number 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 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 carrying out 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.
6. The method of claim 1, further comprising:
extracting the sample emotion words related to the service from 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 segmentation processing on the sample text to obtain sample sentences contained in the sample text and sample segmentation 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;
According to the sample sentence vector and the sample emotion word vector, determining sample emotion word distribution information corresponding to each sample sentence respectively through an attention mechanism; the sample emotion word distribution information comprises distribution information of each sample clause on each sample emotion word;
according to the sample sentence vector and the sample emotion word distribution information, determining sample emotion word distribution characteristics corresponding to the sample text;
training the emotion prediction model according to the sample emotion word distribution characteristics and the sample emotion tendency information of the sample text.
7. An emotion information processing device of a text, comprising:
the first extraction module is used for extracting first emotion words related to the business in the text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; performing clause processing on the text to be predicted to obtain a first clause corresponding to the text to be predicted;
the first determining module is used for determining first emotion word distribution characteristics 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
the third determining module is used for determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to the first clause;
The determining, according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause, second emotion tendency information corresponding to the text to be predicted includes:
Determining weights corresponding to the first emotion tendency information and the fine granularity emotion factors respectively; according to the weight, carrying out weighted calculation on the first emotion tendency information and each fine granularity emotion factor to obtain an emotion tendency value corresponding to the text to be predicted; positive correlation or negative correlation between the positive and negative face emotion tendencies of the text to be predicted and the emotion tendencies; the fine grain emotion factor comprises at least one of the following: the emotion category corresponding to each first clause, the number of the appointed words contained in the first clause and the text body information;
and the sending module is used for sending the second emotion tendency information to a service processing platform of the service so that the service processing platform can adjust service parameters of the service based on the second emotion tendency information.
8. The apparatus of claim 7, the first determination 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;
The second determining unit is used for determining first emotion word distribution information corresponding to each first clause respectively through an attention mechanism according to the first sentence vector and the first emotion word vector; the first emotion word distribution information comprises distribution information of each first clause on each first emotion word;
And a third determining unit, configured to determine, according to the first sentence vector and the first emotion word distribution information, the first emotion word distribution feature corresponding to the text to be predicted.
9. The apparatus of claim 8, the first affective word distribution information comprising a first affective word distribution vector;
The second determining unit takes the first sentence vector and the first emotion word vector as input data of the attention mechanism to determine probability distribution values of the first clauses on the first emotion words; generating first emotion word distribution vectors corresponding to the first clauses respectively based on probability distribution values of the first clauses on the first emotion words; each element of the first emotion word distribution vector represents a probability distribution value of the corresponding first clause on each first emotion word.
10. The apparatus of claim 9, the third determining unit:
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; each row of elements in the first emotion word distribution matrix respectively corresponds to the first emotion word distribution vector respectively corresponding to each first clause;
Calculating the product of the first sentence vector and the first emotion word distribution matrix to obtain a first emotion prediction matrix; the column number 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 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 carrying out 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.
11. An emotion information processing device 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 from a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; performing clause processing on the text to be predicted 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
Determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to the first clause;
The determining, according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause, second emotion tendency information corresponding to the text to be predicted includes:
Determining weights corresponding to the first emotion tendency information and the fine granularity emotion factors respectively; according to the weight, carrying out weighted calculation on the first emotion tendency information and each fine granularity emotion factor to obtain an emotion tendency value corresponding to the text to be predicted; positive correlation or negative correlation between the positive and negative face emotion tendencies of the text to be predicted and the emotion tendencies; the fine grain emotion factor comprises at least one of the following: the emotion category corresponding to each first clause, the number of the appointed words contained in the first clause and the text body information;
and sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
12. A storage medium storing computer-executable instructions that when executed implement the following:
Extracting a first emotion word related to a service from a text to be predicted; the first emotion words comprise positive emotion words and negative emotion words; performing clause processing on the text to be predicted 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 emotion tendency information corresponding to the text to be predicted according to the first emotion word distribution characteristics and a pre-trained emotion prediction model; the emotion prediction model is obtained based on sample emotion word distribution characteristics corresponding to a sample text and sample emotion tendency information training of the sample text;
Determining second emotion tendency information corresponding to the text to be predicted according to the first emotion tendency information and fine granularity emotion factors corresponding to the first clause;
The determining, according to the first emotion tendency information and the fine granularity emotion factor corresponding to the first clause, second emotion tendency information corresponding to the text to be predicted includes:
Determining weights corresponding to the first emotion tendency information and the fine granularity emotion factors respectively; according to the weight, carrying out weighted calculation on the first emotion tendency information and each fine granularity emotion factor to obtain an emotion tendency value corresponding to the text to be predicted; positive correlation or negative correlation between the positive and negative face emotion tendencies of the text to be predicted and the emotion tendencies; the fine grain emotion factor comprises at least one of the following: the emotion category corresponding to each first clause, the number of the appointed words contained in the first clause and the text body information;
and sending the second emotion tendency information to a service processing platform of the service so that the service processing platform adjusts service parameters of the service based on the second emotion tendency information.
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 CN111783453A (en) | 2020-10-16 |
CN111783453B true 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) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114003815B (en) * | 2021-11-04 | 2024-03-29 | 之江实验室 | Network public opinion theme and discovery method of user group concerned by same |
Citations (3)
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 |
-
2020
- 2020-07-01 CN CN202010621825.0A patent/CN111783453B/en active Active
Patent Citations (3)
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)
Title |
---|
基于情感词典与LDA模型的股市文本情感分析;延丰;杜腾飞;毛建华;刘学锋;;电子测量技术(第12期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN111783453A (en) | 2020-10-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110309427B (en) | Object recommendation method and device and storage medium | |
CN108920654B (en) | Question and answer text semantic matching method and device | |
US11550871B1 (en) | Processing structured documents using convolutional neural networks | |
US9147154B2 (en) | Classifying resources using a deep network | |
US9141906B2 (en) | Scoring concept terms using a deep network | |
WO2018033030A1 (en) | Natural language library generation method and device | |
CN107291840B (en) | User attribute prediction model construction method and device | |
US10685012B2 (en) | Generating feature embeddings from a co-occurrence matrix | |
CN117609444B (en) | Searching question-answering method based on large model | |
CN111143551A (en) | Text preprocessing method, classification method, device and equipment | |
CN116547681A (en) | Dynamic language model for continuously evolving content | |
CN111767394A (en) | Abstract extraction method and device based on artificial intelligence expert system | |
CN114547257B (en) | Class matching method and device, computer equipment and storage medium | |
CN112070550A (en) | Keyword determination method, device and equipment based on search platform and storage medium | |
CN116151235A (en) | Article generating method, article generating model training method and related equipment | |
CN111783453B (en) | Text emotion information processing method and device | |
CN112446206A (en) | Menu title generation method and device | |
CN116028626A (en) | Text matching method and device, storage medium and electronic equipment | |
CN112148902B (en) | Data processing method, device, server and storage medium | |
CN114168787A (en) | Music recommendation method and device, computer equipment and storage medium | |
CN114386431B (en) | Sentence-based resource library hot updating method, sentence-based recommending method and related devices | |
CN117951515A (en) | Model training method and device | |
CN117951535A (en) | Text processing method and related device | |
CN117725923A (en) | Text matching method, device, equipment and medium | |
Malaysia | Mobile Intelligent Web Pre-fetching Scheme for Cloud Computing Services in Industrial Revolution 4.0 |
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 |