CN115659995A - Text emotion analysis method and device - Google Patents

Text emotion analysis method and device Download PDF

Info

Publication number
CN115659995A
CN115659995A CN202211718347.0A CN202211718347A CN115659995A CN 115659995 A CN115659995 A CN 115659995A CN 202211718347 A CN202211718347 A CN 202211718347A CN 115659995 A CN115659995 A CN 115659995A
Authority
CN
China
Prior art keywords
comment information
emotion analysis
layer
information
text
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202211718347.0A
Other languages
Chinese (zh)
Other versions
CN115659995B (en
Inventor
许辉鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202211718347.0A priority Critical patent/CN115659995B/en
Publication of CN115659995A publication Critical patent/CN115659995A/en
Application granted granted Critical
Publication of CN115659995B publication Critical patent/CN115659995B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a text emotion analysis method and device, relates to the field of machine learning algorithms, and can improve the accuracy of emotion type analysis results. The method comprises the following steps: obtaining comment information and source information corresponding to the comment information; inputting the comment information and the source information corresponding to the comment information into an emotion analysis model to obtain an emotion analysis result of the comment information output by the emotion analysis model; the emotion analysis model is obtained by training a preset model through a training data set, the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information, and the preset model comprises a BERT layer, an expert neural network layer, a classifier layer and a normalization index function softmax layer.

Description

Text emotion analysis method and device
Technical Field
The application relates to the field of machine learning algorithms, in particular to a text emotion analysis method and device.
Background
At present, in order to better improve products and improve service quality, enterprises can judge emotional tendency of massive internet public sentiment data (comments of users on the internet), and know advantages and defects of the products by means of the comments of consumers so as to guide the enterprises to improve the products and improve the service quality.
In the related technology, the comments of the user can be processed by a method based on a long-short term memory network and an attention mechanism to obtain a model based on a self-attention mechanism constructed by a text sequence, the comments of the user to be analyzed are led into the model, and the emotional tendency analysis of the target text can be completed. However, this method requires a large amount of supervisory data, and the accuracy of emotion type analysis results is not high in the case where the data amount of the supervisory data is small.
Disclosure of Invention
The embodiment of the application provides a text sentiment analysis method and device, which can improve the accuracy of sentiment type analysis results.
In a first aspect, an embodiment of the present application provides a text sentiment analysis method, including: obtaining comment information and source information corresponding to the comment information; inputting the comment information and the source information corresponding to the comment information into an emotion analysis model to obtain an emotion analysis result of the comment information output by the emotion analysis model; the emotion analysis model is obtained by training a preset model through a training data set, the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information, and the preset model comprises a BERT layer, an expert neural network layer, a classifier layer and a normalization index function softmax layer.
According to the text sentiment analysis method provided by the embodiment of the application, when sentiment analysis is performed on the comment information through the sentiment analysis model, the source information of the comment information is particularly considered, and the sentiment analysis result of the comment information can be more accurate. Compared with the prior art that emotion analysis is carried out on comment information through only one type of simple model, the emotion analysis model provided by the application can effectively improve the accuracy of emotion analysis (for example, can be improved by about 15%), and provides more accurate and real-time emotion analysis capability for business. By accurately analyzing the emotional tendency of the comment information in real time, the recall capability of poor comment public sentiment can be improved, the efficiency of recalling the problem into a work order is improved, the efficiency of business intervention poor comment is improved, and the problems of damaged company (enterprise) image, client loss, sale slip and the like are avoided.
In a possible implementation manner, inputting the comment information and the source information corresponding to the comment information into the emotion analysis model, and obtaining an emotion analysis result of the comment information output by the emotion analysis model includes: inputting the comment information into a BERT layer to obtain a first text vector output by the BERT layer; inputting the source information into a BERT layer to obtain an embedded vector of the source information output by the BERT layer; inputting the first text vector and the embedded vector of the source information into an expert neural network layer to obtain a second text vector output by the expert neural network layer; inputting the second text vector into a classifier layer to obtain a plurality of logic values corresponding to the comment information output by the classifier layer, wherein each logic value indicates a sentiment tendency score corresponding to the comment information; inputting a plurality of logic values into the softmax layer to obtain the probability of at least one emotional tendency output by the softmax layer; and determining the emotion analysis result of the comment information according to the probability of the at least one emotion tendency, wherein the emotion analysis result of the comment information is the emotion tendency with the highest probability in the probability of the at least one emotion tendency.
The expert neural network layer can promote learning of the sentiment analysis model by utilizing the connection between the text characters corresponding to the comment information from different sources so as to improve the sentiment analysis accuracy. The classifier layer can keep the characteristics of the comment information of different sources independent, so that the emotion analysis of the comment information of different sources is more accurate.
In one possible implementation manner, the inputting the first text vector into the expert neural network layer, and the obtaining the second text vector output by the expert neural network layer includes: respectively inputting the first text vector into a plurality of expert neural networks included in an expert neural network layer to obtain a third text vector output by each expert neural network in the plurality of expert neural networks; calculating the routing weight of each expert neural network according to the embedded vector of the source information and a third text vector output by each expert neural network in the plurality of expert neural networks; and carrying out weighted average on the third text vectors output by each expert neural network according to the routing weight of each expert neural network to obtain second text vectors.
In one possible implementation, the embedded vector of the source information satisfies the following formula:
Figure 29073DEST_PATH_IMAGE001
wherein,
Figure 98660DEST_PATH_IMAGE002
an embedded vector representing the source information,
Figure 358740DEST_PATH_IMAGE003
the embedded vector corresponding to each text character included in the source information is represented, and the count (source) represents the number of text characters corresponding to the source information.
It should be noted that the Embedding vector corresponding to the source information may be obtained by calculation according to the Embedding vector corresponding to the comment information, and training the emotion analysis model based on the comment information and the Embedding vector corresponding to the source information may accelerate the training speed of the emotion analysis model.
In one possible implementation, the routing weight and the second text vector of each expert neural network satisfy the following formula:
Figure 234292DEST_PATH_IMAGE004
Figure 466690DEST_PATH_IMAGE005
wherein,
Figure 769496DEST_PATH_IMAGE006
represents the routing weight of the ith expert neural network,
Figure 528591DEST_PATH_IMAGE007
a second text vector is represented that represents a second text vector,
Figure 145517DEST_PATH_IMAGE008
an embedded vector representing the source information, m represents that the comment information is the mthThe comment information to be processed, K represents the number of the expert neural networks,
Figure 294738DEST_PATH_IMAGE009
a third text vector representing an output of the ith expert neural network.
The plurality of expert neural networks in the expert neural network layer can utilize the connection among the text characters corresponding to the comment information from different sources to promote the learning of the sentiment analysis model so as to improve the sentiment analysis accuracy.
In a possible implementation manner, the classifier layer comprises a plurality of classifiers, and each classifier in the plurality of classifiers is used for processing comment information corresponding to one kind of source information; inputting the second text vector into a classifier layer to obtain a plurality of logic values corresponding to the comment information output by the classifier layer; and inputting the second text vector into a first classifier of the multiple classifiers to obtain a logic value corresponding to the comment information output by the first classifier, wherein the first classifier corresponds to the source information corresponding to the comment information.
Each classifier in the classifier layer can keep the characteristics of the comment information of different sources independent, and the emotion analysis of the comment information of different sources can be more accurate.
In one possible implementation, the probability of at least one emotional tendency output by the softmax layer satisfies the following formula:
Figure 971707DEST_PATH_IMAGE010
wherein,
Figure 206380DEST_PATH_IMAGE011
the probability of output of the softmax layer is represented, k represents the number of selected logic values, the probability of the selected logic values is larger than or equal to a preset threshold value, S represents a set of the first k logic values, C is a constant, and C represents the number of classified categories.
The softmax layer can set the probability of the logic values other than the selected logic value as a constant c (the constant c can be 0), avoid the probability of the emotion analysis model being over-fitted to the less-relevant categories, and improve the generalization capability of the emotion analysis model (namely, the capability of the emotion analysis model to give appropriate emotion analysis results to comment information from different sources).
In a second aspect, an embodiment of the present application provides an emotion analysis model training method, including: constructing a training data set, wherein the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information; training a preset model based on a training data set to obtain an emotion analysis model, wherein the emotion analysis model is used for carrying out emotion analysis on comment information and comprises a BERT layer, an expert neural network layer, a classifier layer and a normalization index function softmax layer.
Based on the method provided by the embodiment of the application, the preset model can be trained based on the training data set to obtain the emotion analysis model. Because the training data set comprises the source information of the comment information, the emotion analysis result of the comment information by the emotion analysis model obtained by training according to the training data set can be more accurate. Compared with the prior art that emotion analysis is carried out on comment information through only one type of simple model, the emotion analysis model provided by the application can effectively improve the accuracy of emotion analysis (for example, can be improved by about 15%), and provides more accurate and real-time emotion analysis capability for business.
In one possible implementation, training the preset model based on the training data set to obtain the emotion analysis model includes: selecting a piece of sample comment information in a training data set, and taking the sample comment information as target comment information; processing the target comment information through a preset model to obtain an emotion classification result of the preset model on the target comment information; calculating a loss value of the preset model based on the difference between the emotion classification result of the preset model on the target comment information and the label emotion analysis result of the target comment information; and adjusting parameters of the preset model based on the loss value, returning to the step of selecting one piece of sample comment information in the training data set, and taking the preset model obtained through training as an emotion analysis model until the preset model is converged.
Based on the method provided by the embodiment of the application, the loss value of the preset model can be calculated based on the difference between the emotion classification result of the target comment information by the preset model and the label emotion analysis result of the target comment information, and the parameter of the preset model is adjusted according to the loss value. Because the training data set not only comprises a plurality of pieces of sample comment information, but also comprises different source information corresponding to different sample comment information, the comment information from different sources can be better processed according to the emotion analysis model obtained by training the training data set so as to obtain a more accurate emotion analysis result.
In a third aspect, the present application provides a computer program product for causing a computer to perform the method according to the first aspect, the second aspect or any of its possible designs when the computer program product runs on the computer.
In a fourth aspect, an embodiment of the present application provides an emotion analyzing apparatus, including a processor, and a memory coupled to the processor, where the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the apparatus implements the method according to the first aspect, the second aspect, and any possible design manner of the first aspect. The device can be an electronic device or a server device; or may be an integral part of the electronic device or the server device, such as a chip.
In a fifth aspect, embodiments of the present application provide an emotion analysis apparatus, where the apparatus may be divided into different logical units or modules according to functions, and each unit or module performs a different function, so that the apparatus performs the method described in the first aspect, the second aspect, and any possible design manner thereof.
In a sixth aspect, the present application provides a chip system that includes one or more interface circuits and one or more processors. The interface circuit and the processor are interconnected by a line. The above chip system may be applied to an electronic device including a communication module and a memory. The interface circuit is configured to receive signals from a memory of the electronic device and to transmit the received signals to the processor, the signals including computer instructions stored in the memory. When executed by a processor, the computer instructions may cause an electronic device to perform the method as described in the first aspect, the second aspect and any possible design thereof.
In a seventh aspect, the present application provides a computer-readable storage medium comprising computer instructions. The computer instructions, when executed on an electronic device or server, cause the electronic device or server to perform the method as set forth in the first aspect, the second aspect, and any possible design thereof.
It should be understood that, for the beneficial effects that can be achieved by the computer program product according to the third aspect and the fourth aspect, the apparatus according to the fifth aspect, the chip system according to the sixth aspect, and the computer-readable storage medium according to the seventh aspect, reference may be made to the beneficial effects in the first aspect, the second aspect, and any possible design manner thereof, and details are not repeated here.
According to the text sentiment analysis method provided by the embodiment of the application, when sentiment analysis is performed on the comment information through the sentiment analysis model, the source information of the comment information is particularly considered, and the sentiment analysis result of the comment information can be more accurate. Compared with the prior art that emotion analysis is carried out on comment information through only one type of simple model, the emotion analysis model provided by the application can effectively improve the accuracy of emotion analysis (for example, can be improved by about 15%), and provides more accurate and real-time emotion analysis capability for business. By accurately analyzing the emotional tendency of the comment information in real time, the recall capability of poor comment public sentiment can be improved, the efficiency of recalling the problem into a work order is improved, the efficiency of business intervention poor comment is improved, and the problems of damaged company (enterprise) image, client loss, sale slip and the like are avoided.
Drawings
Fig. 1 is a schematic diagram of comment information provided in an embodiment of the present application;
FIG. 2 is a diagram illustrating a system architecture according to an embodiment of the present disclosure;
fig. 3 is a schematic hardware structure diagram of an apparatus according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating a text emotion analyzing method according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an emotion analysis model provided in an embodiment of the present application;
FIG. 6 is a schematic view of an emotion analysis process provided in an embodiment of the present application;
fig. 7 is a schematic diagram of an embedded vector corresponding to comment information provided in an embodiment of the present application;
FIG. 8 is a diagram illustrating an embedded vector of source information according to an embodiment of the present application;
FIG. 9 is a schematic diagram illustrating an output of a sparse softmax provided in an embodiment of the present application;
FIG. 10 is a schematic flowchart of a method for training an emotion analysis model according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a chip system according to an embodiment of the present disclosure.
Detailed Description
For clarity and conciseness of the following description of the various embodiments, a brief introduction to related concepts or technologies is first presented:
(1) Code-decode model (encoder-decoder model)
Coding, namely converting an input sequence into a vector with a fixed length; decoding, namely converting the fixed length vector generated before into an output sequence. The encoding-decoding model is a model applied to the seq2seq problem. The seq2seq problem is simply to generate one output sequence y from another input sequence x. seq2seq has many applications, such as translation tasks, question and answer tasks, emotion analysis tasks, and so on. For example, in a translation task, the input sequence is text to be translated and the output sequence is translated text; in the question-and-answer task, the input sequence is the question posed, and the output sequence is the answer. In the emotion analysis task, the input sequence is comment information (public opinion information), and the output sequence is an emotion tendency (emotion analysis result) of the comment information.
(2) Transformer model
The Transformer model is essentially an Encoder-Decoder architecture. The Transformer can be divided into two parts: an encoding component and a decoding component. Wherein, the coding component is composed of a multi-layer coder (Encoder). The decoding component is also composed of decoders (decoders) of the same layer number. Each encoder consists of two sublayers: a Self-Attention layer and a Position-wise Feed Forward Network (Position-wise FFN). The structure of each encoder is the same, but they use different weight parameters. The Decoder also has two layers in the Encoder, but there is also an Attention layer (i.e., encoder-Decoder Attention) between them, which applies the Decoder to the relevant parts of the input sentence.
(3) BERT (Bidirectional Encoder expressions from Transformer) model
The BERT model is based on a transform's Encoder, and the main model structure is a transform's stack.
BERT is a model of pre-training, which is briefly described as follows: assuming that a training set of the task a exists, the network can be pre-trained by using the training set of the task a, the network parameters are learned on the task a, and then the network parameters are stored for later use. When a new task (task B) exists, the same network structure is adopted, the learned parameters of the task A can be loaded when the network parameters are initialized, other high-level parameters are initialized randomly, and then the network is trained by using the training data of the task B. When the loaded parameters remain unchanged, called "frezen", the loaded parameters are continuously changed along with the training of the B task, called "fine-tuning", i.e. the parameters are better adjusted to be more suitable for the current B task. Thus, when the training data of the B task is less, the network is difficult to train well, but the parameters of the A task training are obtained and are better than the parameters of the B task training only.
The BERT model converts each word in the text into a one-dimensional vector by inquiring a word vector table, and the one-dimensional vector is used as model input, and the model output is vector representation after the full-text semantic information corresponding to each word is input. Furthermore, the model input may contain two more parts in addition to the word vector:
1. text vector: the value of the vector is automatically learned in the model training process, is used for depicting the global semantic information of the text and is fused with the semantic information of the single character/word.
2. Position vector: because semantic information carried by words appearing at different positions of a text is different (such as 'I love you' and 'I love me'), the BERT model adds different vectors to the words at different positions respectively for distinguishing.
The BERT model has multiple layers of data, each layer of data indicates different angles of input data, such as syntax or semantics of input text, and specific contents are not limited herein.
(4) Embedding:
is one way to convert discrete variables into a continuous vector representation. In a neural network, embedding can reduce the spatial dimension of a discrete variable, and can also represent the variable meaningfully.
For simplicity, E mbedding refers to representing an object by a low-dimensional vector, which may be a word, a commodity, etc. The Embedding vector has the property that objects corresponding to vectors with similar distances have similar meanings, for example, the distance between an Embedding (flower) and an Embedding (grass) is very close, but the distance between the Embedding (flower) and the Embedding (dog) is far.
(5) softmax function: also called normalized exponential function, the result of multi-classification can be shown in the form of probability. It can be appreciated that probability has two properties: 1) The predicted probability is non-negative; 2) The sum of the various prediction probabilities equals 1. The softmax function can convert the predicted result from negative infinity to positive infinity into a probability in these two steps.
In the first step, softmax can convert the prediction result of the model to an exponential function, and the value range of the exponential function is zero to positive infinity, so that the nonnegativity of the probability can be ensured. And secondly, normalizing the result converted into the exponential function. I.e. dividing the converted result by the sum of all converted results, can be understood as the percentage of the converted result to the total, thus obtaining an approximate probability and ensuring that the sum of the probabilities of the individual predictors is equal to 1.
Currently, ways in which users comment (or rate) products (e.g., electronic products) are diverse. For example, a user may comment on various platforms on the internet, as shown in fig. 1, which is an example of a web comment (bad comment). The user can also feed back the comment of the user on the consumer goods to the enterprise through the offline store, or the user can comment on the use feeling of the user on the consumer goods in a mode of filling out a questionnaire survey. Enterprises (for example, equipment manufacturers) can perform sentiment analysis on comments of users, for example, massive internet public opinion data (comments of users on the internet) and the sentiment tendency of store feedback and questionnaire data can be timely and accurately judged by using a text multi-classification method according to defined text sentiment tendency categories (good, medium and bad comments). The advantages and the defects of the products are known by means of the consumer reviews, so that the enterprises are guided to improve the products and the service quality.
In the related technology, a method based on a long-short term memory network plus attention mechanism can be adopted, the method processes a target text to obtain a text sequence, constructs an emotion analysis model based on a self-attention mechanism, and introduces the text sequence into the model to complete emotion trend analysis of the target text. The method needs a large amount of monitoring data, and the accuracy of the emotion type analysis result of the comment text of the product is not high under the condition that the data amount of the monitoring data is small.
In the related technology, the sentiment analysis method based on BERT can be adopted for sentiment analysis of the text comment information of the product, and the method obtains a final model by simply preprocessing the comment information from a single source and then directly fine-tuning the weight based on the BERT from an open source. And performing sentiment analysis on the text comment information of the product according to the final model. The model has poor generalization capability and cannot adapt to the situation of text comment information from multiple sources.
The embodiment of the application provides a text sentiment analysis method, which can be used for accurately analyzing sentiment of comment information from different sources through a sentiment analysis model. The emotion analysis model is high in generalization capability and can adapt to the condition of comment information from multiple sources.
Referring to fig. 2, the embodiment of the present application provides an emotion analysis system architecture, which includes a data acquisition device 210, a database 220, a training device 230, an execution device 240, a data storage system 250, and the like. The data acquisition device 210 is configured to acquire a training sample, where the training sample may include a plurality of pieces of sample comment information and source information corresponding to each piece of comment information. The collected training samples may be stored in a database 220. Training device 230 trains an emotion analysis model based on the training samples in database 220. The trained emotion analysis model may be stored in the processor of the execution device 240. The sentiment analysis model can be used for sentiment analysis on the comment information to determine whether the comment information is good comment or bad comment and the like. The execution device 240 may be disposed in the cloud server, or may be disposed in the user client. The execution device 240 may call data, code, etc. from the data storage system 250 and may store the output data in the data storage system 250. The data storage system 250 may be disposed in the execution device 240, may be disposed independently, or may be disposed in other network entities, and the number may be one or more.
Fig. 2 is only a schematic diagram of a system architecture provided in an embodiment of the present application, and a positional relationship between devices, modules, and the like shown in the diagram does not constitute any limitation. For example, in FIG. 2, the data storage system 250 is an external memory with respect to the execution device 240, and in some cases, the data storage system 250 may also be located in the execution device 240.
In this embodiment, the data acquisition device 210, the training device 230, and the execution device 240 may be separate physical devices (e.g., servers), or may be located on the same physical device or a device cluster, which is not limited in this application.
As shown in fig. 3, taking the hardware structure of the data acquisition device 210, the training device 230 or the execution device 240 as an example of the hardware structure of the server 200, the server 200 includes at least one processor 201, a communication line 202, a memory 203 and at least one communication interface 204.
The processor 201 may be a general-purpose Central Processing Unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more ics for controlling the execution of programs according to the present disclosure.
The communication link 202 may include a path for transmitting information between the aforementioned components.
The communication interface 204 may be any device, such as a transceiver, for communicating with other devices or communication networks, such as an ethernet, a Radio Access Network (RAN), a Wireless Local Area Network (WLAN), etc.
The memory 203 may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that can store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disk read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be separate and coupled to the processor via communication line 202. The memory may also be integral to the processor.
The memory 203 is used for storing computer-executable instructions for executing the present application, and is controlled by the processor 201 to execute. The processor 201 is configured to execute the computer executable instructions stored in the memory 203, so as to implement the exception order handling method provided in the following embodiments of the present application.
Optionally, the computer-executable instructions in the embodiments of the present application may also be referred to as application program codes, which are not specifically limited in the embodiments of the present application.
In particular implementations, processor 201 may include one or more CPUs, such as CPU0 and CPU1 in fig. 3, as one embodiment.
In particular implementations, server 200 may include a plurality of processors, such as processor 201 and processor 207 in FIG. 3, as an embodiment. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. A processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (e.g., computer program instructions).
Optionally, the server 200 may also include an output device 205 and an input device 206. The output device 205 is in communication with the processor 201 and may display information in a variety of ways. For example, the output device 205 may be a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display device, a Cathode Ray Tube (CRT) display device, a projector (projector), or the like. The input device 206 is in communication with the processor 201 and may receive user input in a variety of ways. For example, the input device 206 may be a mouse, a keyboard, a touch screen device, or a sensing device, among others.
The server 200 may be a general-purpose device or a special-purpose device. In a specific implementation, the server 200 may be a desktop computer, a portable computer, a network server, a Personal Digital Assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, an embedded device, or a device with a similar structure as in fig. 3. The embodiment of the present application does not limit the type of the server 200.
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. In the description of the present application, unless otherwise specified, "at least one" means one or more, "a plurality" means two or more. In addition, in order to facilitate clear description of technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish identical items or similar items with substantially identical functions and actions. Those skilled in the art will appreciate that the terms "first," "second," etc. do not denote any order or quantity, nor do the terms "first," "second," etc. denote any order or importance.
For the sake of understanding, the method provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
As shown in fig. 4, an embodiment of the present application provides a text emotion analysis method, which is applied to an execution device, and includes:
s101, obtaining the comment information and source information corresponding to the comment information.
The source indicated by the source information corresponding to the comment information (i.e., the source of the comment information) may be one of a plurality of sources. Wherein the plurality of sources may include an inline source and an offline source. The online sources may include a plurality of websites (e.g., e-commerce websites, social websites, news websites, search engine websites, etc.), forums (e.g., technical forums, enterprise forums, social forums, etc.), posts (e.g., baccarat posts), applications (e.g., shopping applications, social applications, news applications, etc.), and so forth. The offline sources may include store feedback, offline questionnaires, and the like. The method and the system can acquire the comment (evaluation) information of the product (commodity) issued by the consumer through the Internet, and can also acquire the comment information of the product issued by the user through offline questionnaire.
For example, the product of the user comment may be an electronic product, such as a mobile phone, a tablet computer, a notebook computer, a television, a watch, a bracelet, a sound box, a weight scale, an electric cooker, and the like, and the application is not particularly limited.
Illustratively, a piece of comment information may include a title (subject) of a comment and a specific description of the comment. For example, the title (subject) of the comment may be a product name (e.g., XX mobile phone), and the specific description of the comment may be a performance, appearance description, usage feeling, logistics service description, after-sales service description, etc. for XX mobile phone.
It should be understood that different sources of review information typically have different characteristics. For example, the comment information from a shopping application (e.g., tanbao) is usually given based on the evaluation indexes given by Tanbao, in the case of a mobile phone, the Tanbao can give evaluation indexes such as endurance, photographing effect, running speed, etc., and the user can evaluate the mobile phone based on the evaluation indexes such as endurance, photographing effect, running speed, etc. Further, most evaluations in shopping applications are evaluations of new products that have just been purchased, and evaluations of use feeling after a certain period of time are less. As another example, comment information from an enterprise forum (e.g., a honor forum) is often related to the word habits, directions of interest of users active in the forum, as well as to the manner of words of posts in the forum that are viewed in high volume. It can be seen that the comment information from different sources has different characteristics, so that it is necessary to consider different sources of the comment information when performing emotion analysis. Based on the method provided by the application, the characteristics of the comment information from different sources can be effectively captured.
S102, inputting the comment information and the source information into the sentiment analysis model to obtain a sentiment analysis result of the comment information output by the sentiment analysis model.
The emotion analysis model is obtained by training a preset model through a training data set, the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information, and the preset model can comprise at least one of a BERT layer, an expert neural network layer, a classifier layer and a normalization index function softmax layer. The BERT layer is a BERT model, the BERT model can comprise a text Embedding module (namely an Embedding layer), the expert neural network layer can also be called a multi-expert automatic routing module, the classifier layer can also be called a multi-tower classifier module, and the softmax layer can also be called a sparse softmax module.
As shown in fig. 5, comment information and source information may be input into the BERT model, and the comment information and the source information of the comment information may be initialized according to a text Embedding module of the BERT model, so as to obtain an Embedding vector of the comment information and an Embedding vector of the source information. Then, the BERT model processes the Embedding vector of the comment information to obtain a first text vector, and the first text vector is a semantic analysis result of the comment information. The BERT model may output a first text vector and an Embedding vector of the source information. Then, the first text vector and the Embedding vector of the source information can be input into a multi-expert automatic routing module, and the multi-expert automatic routing module can perform deep text representation on the first text vector according to the Embedding vector of the source information to obtain a second text vector. The semantics of the second text vector are more accurate than the semantics of the first text vector, i.e. the second text vector is clearer for the text representation of the comment information than the first text vector. Then, the second text vector may be input into the multi-tower classifier module, so as to obtain a plurality of logic values corresponding to the comment information output by the multi-tower classifier module, where each logic value indicates a sentiment tendency score corresponding to the comment information (i.e., the multi-tower classifier module may mark a sentiment tendency score for the second text vector corresponding to the comment information). The sparse softmax module can perform sparse normalization on the emotional tendency scores of the comments to obtain sparse probability distribution of the comment information on the emotional tendency. And determining the emotion analysis result of the comment information according to the emotion tendency with the maximum probability.
Illustratively, as shown in fig. 6, it is assumed that the comment information is: glorious 50, the power consumption is obviously increased after new, and the situation is unknown whether the person is a person or others. The source information of the comment information is microblog cottage. After the comment information is input into the emotion analysis model, the emotion analysis result output by the emotion analysis model can be poor comment. For another example, assume that the comment content is: glory 80, new machine has received, high face value, cheap price, very worthy of starting. The source of this comment is cullet @. After the comment is input into the emotion analysis model, the emotion analysis result output by the emotion analysis model can be a good comment.
The following describes a process of converting comment information and source information into an Embedding vector by the text Embedding module:
it is understood that the comment information is composed of discrete text characters, and converting the comment information into an Embedding vector is to convert the discrete text characters into a numeric dense vector.
The comment information and the source information can be represented by text characters, the Embedding vectors after the comment information and the source information are converted can coexist in the same representation space, and the text characters corresponding to the source information are usually covered by the text characters corresponding to the comment information, so that the Embedding vectors corresponding to the source information can be obtained by calculation according to the Embedding vectors corresponding to the comment information. Training the emotion analysis model based on the Embedding vector corresponding to the comment information and the source information can accelerate the training speed of the emotion analysis model.
The text corresponding to the comment information and the source information can be input into a text Embedding module to obtain Embedding vectors corresponding to the comment information and the source information. Because the text corresponding to the source information is usually covered by the text corresponding to the comment information, the Embedding vector corresponding to the source information can be calculated according to the Embedding vector corresponding to the comment information, as shown in formula (1).
Figure 361418DEST_PATH_IMAGE001
Formula (1)
Wherein,
Figure 630725DEST_PATH_IMAGE002
an Embedding vector representing source information,
Figure 213016DEST_PATH_IMAGE003
the count (source) may indicate the number (number) of text characters corresponding to the source information. When in useHowever, the count (source) may be a preset value, or may be proportional to the number of text characters corresponding to the source, which is not limited in the present application.
It is to be defined as
Figure 934984DEST_PATH_IMAGE003
And a count (source), can guarantee
Figure 893713DEST_PATH_IMAGE002
The amount of (2) avoids the situation that the text of the source (source) of the comment is more, so as to cause
Figure 17527DEST_PATH_IMAGE003
And
Figure 36298DEST_PATH_IMAGE002
too large, which in turn leads to problems affecting the accuracy of the BERT model.
The Embedding vector of each text corresponding to the source information may be an open-source Embedding vector, that is, the Embedding vector of the source information may be determined according to the open-source Embedding vector. Or the Embedding vector of each text corresponding to the source information may be set by itself, and the Embedding vector of the source information may be determined according to the Embedding vector set by itself. Or, the Embedding vector of each text corresponding to the source information and the Embedding vector of the source information may be obtained by pre-training using algorithms such as Word2Vec and Glove, or may be obtained by training in a Transformer, which is not limited in the present application.
As shown in fig. 7, an example of an Embedding vector representation corresponding to comment information is shown. Where h represents the dimension of the open source vector and m represents the number of text characters. Where the text characters may be a single Chinese character (e.g., the Chinese character shown in FIG. 6: good, little, bo, yao, rong, etc.). Optionally, the text character may be a word or a phrase, or the text character may be a word composed of a plurality of chinese characters, which is not limited in this application.
As shown in fig. 8, an example of the expression of the Embedding vector corresponding to the source information is shown. Wherein h represents the dimension of the Embedding vector corresponding to the source information, and n represents the number of the source information. The Embedding vector corresponding to the source information may be determined according to the Embedding vector corresponding to the comment information and formula (1).
For example, assuming that the source information is a microblog (i.e., the source of the comment is a microblog), the Embedding vector representation of the microblog may be determined according to equation (2).
Figure 245563DEST_PATH_IMAGE012
Formula (2)
That is, the microblog Embedding vector is a quotient of the sum of the Embedding vector of the text "micro" and the Embedding vector of the text "Bo" and the number of texts corresponding to the "microblog" (that is, 2).
As shown in fig. 7, the Embedding vector of the text "micro" is (0.212, 0.677, \8230; \8230, 0.546, 0.282), and the Embedding vector of the text "Bo" is (0.342, 0.233, \8230; \8230, 8230;, 0.313, -0.821), and as shown in fig. 8, the corresponding Embedding vector of the "micro blog" can be (0.277, 0.455, \8230;, 0.429, -0.269) according to formula (2).
The following describes a process in which the multi-expert automatic routing module obtains the second text vector according to the first text vector and the Embedding vector corresponding to the source information:
the multi-expert automatic routing module can be used as a multi-source information sharing module, and can promote the learning of the emotion analysis model by utilizing the relation between text characters corresponding to comment information from different sources so as to improve the emotion analysis accuracy.
Wherein, the multi-expert automatic routing module can comprise n experts (the experts can also be called an expert neural network), and n is larger than 1. All sample review information may be mapped to n experts, such that for each sample review information, its routing weight on a different expert is obtained. That is, for each sample review message, there is a corresponding routing weight on the n experts.
As shown in equation (3), routing weights can be calculated by using the embed of the source information and the text vectors (third text vector, which may also be referred to as text representation) output by a plurality of experts, and the expert corresponding to the maximum weight is the main expert processing the first text vector. Then, as shown in equation (4), the text vectors output by the experts may be weighted and averaged by using the routing weights to obtain a second text vector for the multi-expert decision.
Figure 742403DEST_PATH_IMAGE013
Formula (3)
Figure 720724DEST_PATH_IMAGE014
Formula (4)
Wherein, K represents the number of experts, m represents that the current comment information is the mth comment information to be processed,
Figure 910396DEST_PATH_IMAGE008
a representation of the source of the review information,
Figure 606957DEST_PATH_IMAGE009
a text vector representing the output of the ith expert,
Figure 704226DEST_PATH_IMAGE007
a second text vector representing a multi-expert co-decision.
The multi-expert automatic routing module promotes the learning of the emotion analysis model by utilizing the relation among texts corresponding to the comment information from different sources, and the emotion analysis accuracy can be improved. The problem that independent modeling is carried out on the comment information of a single source, and the characteristics of the comment information of different sources cannot be effectively captured due to the fact that the comment information of different sources has different characteristics is solved. And the problem that due to the fact that characteristics of comment information from different sources are different, a network cannot learn common behavior characteristics, and emotion analysis accuracy is poor is solved. Moreover, in the case of a large number of sources, each source is independently modeled and maintained, which results in large human and resource consumption. The multi-expert automatic routing module provided by the application can learn the relation among texts corresponding to comment information from different sources, and can improve the emotion analysis accuracy.
The following describes a process of obtaining a plurality of logic values (each logic value indicates a score of an emotional tendency corresponding to the comment information) corresponding to the comment information by the multi-tower classifier according to the second text vector:
the multi-expert co-decision text vector (i.e., the second text vector, which may also be referred to as a classification vector) may be input to a multi-tower classifier. The multi-tower classifier may include a plurality of towers, each tower may be considered as a classifier (classification model). Each tower corresponds to a kind of source information and comment information (comment information associated with the source information), that is, each classifier is used for processing the comment information corresponding to a kind of source information. The multi-tower classifier can keep the characteristics of the comment information from different sources independent, so that the sentiment analysis on the comment information from different sources is more accurate.
The following describes a process of probability output of emotion analysis results by a sparse-softmax (sparse-softmax) module.
As shown in fig. 9, the logical value output by a certain tower (e.g., tower 1) in the multi-tower classifier may be input into the sparse softmax module. The sparse softmax module may output probabilities (e.g., 0.02 and 0.98, respectively) for the first k (e.g., k is 2) logical values.
As shown in equation (5), the sparse softmax module has two hyperparameters, the first hyperparameter is k, and represents that k (top k) logical values are selected for ordinary softmax calculation. The probability corresponding to the first k logical values is greater than or equal to a preset threshold (e.g., the preset threshold may be 0.01). The second hyperparameter is a constant c, and indicates that the probabilities corresponding to the next logical values (logical values other than the first k logical values) are uniformly set to the constant c. And the probability corresponding to the logic values except the first k logic values is smaller than a preset threshold value. For example, the logic value at the back may be directly set to 0 (the default constant c is 0), and truncation may be performed to avoid the probability that the emotion analysis model is over-fitted to the less relevant category, and improve the generalization capability of the emotion analysis model (i.e., improve the capability of the emotion analysis model to provide appropriate emotion analysis results for comment information from different sources).
Figure 740315DEST_PATH_IMAGE015
Formula (5)
Wherein,
Figure 100889DEST_PATH_IMAGE011
the probability of the output of the sparse softmax module is represented, k represents the number of logic values selected for normal softmax calculation, S represents the set of the first k logic values, C represents the probability of the next logic value (for example, C may be 0), and C represents the number of classified categories. For example, the number of categories classified may include, for example: at least two of good score, medium score and bad score.
It should be noted that the emotion analysis result may include the probability that the comment information is positive or negative. Alternatively, sentiment analysis results may include probabilities that comment information is positive, negative, and neutral. For example, if the positive probability is 90%, the negative probability is 0%, and the neutral probability is 10% in the emotion analysis result of a piece of comment information, it can be determined that the piece of comment information is a good comment.
The multi-source comment information processing method and device based on the multi-expert routing module and the multi-tower classifier module can guarantee that public characteristics and private characteristics of the multi-source comment information are clear, and can better deal with the multi-source comment information. The emotion tendency probability is obtained by using the self-defined sparse softmax module, and the method has better generalization capability. The emotion analysis model provided by the application can improve the emotion analysis accuracy by about 15%, and provides more accurate and real-time emotion analysis capability for services. By accurately analyzing the emotional tendency of the comment information in real time, the recall capability of poor comment public sentiments can be improved, the efficiency of recalling problems into work orders is improved, the efficiency of business intervention poor comment problems is further improved, and the problems of damaged company (enterprise) images, loss of customers, low sales volume and the like are avoided.
The following description is given by taking an example of performing sentiment analysis on comment information of a product from different sources by a sentiment analysis model. In practical applications, the application scenarios of the emotion analysis model include, but are not limited to, emotion analysis related to a commodity/product (e.g., an electronic product of a certain type), and may also be applied to search engine result emotion analysis (search content is negative, neutral, positive, etc.), music emotion analysis, video (movies, television shows, art programs, etc.) emotion analysis, stock emotion analysis, etc., that is, the emotion analysis object in various application scenarios may be a commodity of a certain type, or a video, or music, or a stock, etc., and this application is not limited thereto.
As shown in fig. 10, an emotion analysis model training method provided in the embodiments of the present application is applied to a training device, and includes the following steps:
s1, a training data set is constructed, wherein the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information.
Optionally, multiple pieces of comment information related to the product may be crawled from forums, websites, posts, application programs, and the like as sample comment information through a web crawler technology, and source information corresponding to each piece of sample comment information may be obtained at the same time. The description of the comment information and the source information may refer to step S101, and is not described herein.
Optionally, the plurality of pieces of sample data may be generated within a specified time period, for example, the specified time period may be one month or one week, and the present application is not particularly limited.
And S2, training the preset model based on the training data set to obtain an emotion analysis model.
In the embodiment of the application, the emotion analysis model is used for performing emotion analysis on the input comment information, so that an emotion analysis result of the comment information is determined.
The preset model may include a BERT layer, an expert neural network layer, a classifier layer, and a softmax layer.
The BERT layer may be a BERT model, and the BERT model may also be replaced by another Deep Neural Network (DNN) model, a Convolutional Neural Network (CNN) model, or a Recurrent Neural Network (RNN) model, which is not specifically limited in the present application. Alternatively, the BERT model may be a model that has been pre-trained.
In one possible design, the process of training the emotion analysis model may include: selecting a piece of sample comment information in a training data set, and taking the sample comment information as target comment information; processing the target comment information through a preset model to obtain an emotion classification result of the preset model on the target comment information; calculating a loss value of the preset model based on the difference between the emotion classification result of the preset model on the target comment information and the label emotion analysis result of the target comment information; and adjusting parameters of the preset model based on the loss value, returning to the step of selecting one piece of sample comment information in the training data set, and taking the preset model obtained through training as an emotion analysis model until the preset model is converged.
The model convergence condition may be set according to an actual requirement, for example, the model convergence condition may be that the loss value is smaller than a preset loss threshold, or the training times reach preset times.
Based on the method provided by the embodiment of the application, the loss value of the preset model can be calculated based on the difference between the emotion classification result of the target comment information by the preset model and the label emotion analysis result of the target comment information, and the parameter of the preset model is adjusted according to the loss value. Because the training data set not only comprises a plurality of pieces of sample comment information, but also comprises different source information corresponding to different sample comment information, the comment information from different sources can be better processed according to the sentiment analysis model obtained by training the training data set so as to obtain a more accurate sentiment analysis result.
Embodiments of the present application further provide a chip system, as shown in fig. 11, where the chip system includes at least one processor 1101 and at least one interface circuit 1102. The processor 1101 and the interface circuit 1102 may be interconnected by wires. For example, the interface circuit 1102 may be used to receive signals from other devices (e.g., a memory of a server). As another example, the interface circuit 1102 may be used to send signals to other devices (e.g., the processor 1101).
For example, the interface circuit 1102 may read instructions stored in a memory in a server and send the instructions to the processor 1101. The instructions, when executed by the processor 1101, may cause a server (such as the server 200 shown in fig. 3) to perform the various steps in the embodiments described above.
Of course, the chip system may further include other discrete devices, which is not specifically limited in this embodiment of the present application.
Embodiments of the present application further provide a computer-readable storage medium, which includes computer instructions, and when the computer instructions are executed on a server (such as the server 200 shown in fig. 3), the server 200 is configured to execute various functions or steps performed by the execution device or the training device in the foregoing method embodiments.
Embodiments of the present application further provide a computer program product, which, when run on a computer, causes the computer to execute each function or step performed by the execution device or the training device in the foregoing method embodiments.
The embodiment of the present application further provides an emotion analysis device, where the emotion analysis device may be divided into different logic units or modules according to functions, and each unit or module executes a different function, so that the emotion analysis device executes each function or step executed by the execution device or the training device in the method embodiments.
From the above description of the embodiments, it is obvious for those skilled in the art to realize that the above function distribution can be performed by different function modules according to the requirement, that is, the internal structure of the device is divided into different function modules to perform all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a variety of media that can store program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only an embodiment of the present application, but the scope of the present application is not limited thereto, and any changes or substitutions within the technical scope of the present disclosure should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (11)

1. A text emotion analysis method is characterized by comprising the following steps:
obtaining comment information and source information corresponding to the comment information;
inputting the comment information and source information corresponding to the comment information into an emotion analysis model to obtain an emotion analysis result of the comment information output by the emotion analysis model;
the emotion analysis model is obtained by training a preset model through a training data set, the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information, and the preset model comprises a BERT layer, an expert neural network layer, a classifier layer and a normalization index function softmax layer.
2. The method of claim 1, wherein the inputting the comment information and the source information corresponding to the comment information into an emotion analysis model, and the obtaining of the emotion analysis result of the comment information output by the emotion analysis model comprises:
inputting the comment information into the BERT layer to obtain a first text vector output by the BERT layer;
inputting the source information into the BERT layer to obtain an embedded vector of the source information output by the BERT layer;
inputting the first text vector and the embedded vector of the source information into the expert neural network layer to obtain a second text vector output by the expert neural network layer;
inputting the second text vector into the classifier layer to obtain a plurality of logic values corresponding to the comment information output by the classifier layer, wherein each logic value indicates a sentiment tendency score corresponding to the comment information;
inputting the plurality of logic values into the softmax layer to obtain the probability of at least one emotional tendency output by the softmax layer;
and determining the emotion analysis result of the comment information according to the probability of the at least one emotion tendency, wherein the emotion analysis result of the comment information is the emotion tendency with the highest probability in the probability of the at least one emotion tendency.
3. The method of claim 2, wherein the inputting the first text vector into the neural network layer to obtain a second text vector output by the neural network layer comprises:
inputting the first text vector into a plurality of expert neural networks included in the expert neural network layer respectively to obtain a third text vector output by each expert neural network in the plurality of expert neural networks respectively;
calculating the routing weight of each expert neural network according to the embedded vector of the source information and a third text vector output by each expert neural network in the plurality of expert neural networks;
and carrying out weighted average on the third text vectors output by each expert neural network according to the routing weight of each expert neural network to obtain the second text vectors.
4. The method according to any one of claims 1-3, wherein the embedded vector of the source information satisfies the following formula:
Figure 886839DEST_PATH_IMAGE001
wherein,
Figure 820160DEST_PATH_IMAGE002
an embedded vector representing the source information,
Figure 754618DEST_PATH_IMAGE003
and representing the embedded vector corresponding to each text character included in the source information, wherein the count (source) represents the number of the text characters corresponding to the source information.
5. The method according to any one of claims 1-3, wherein the routing weight of each expert neural network and the second text vector satisfy the following formula:
Figure 13561DEST_PATH_IMAGE004
Figure 564628DEST_PATH_IMAGE005
wherein,
Figure 36061DEST_PATH_IMAGE006
represents the routing weight of the ith expert neural network,
Figure 356184DEST_PATH_IMAGE007
-representing the second text vector in a second text vector,
Figure 520449DEST_PATH_IMAGE008
and the embedded vector represents the source information, m represents that the comment information is the mth comment information to be processed, K represents the number of the expert neural networks and represents a third text vector output by the ith expert neural network.
6. The method of any one of claims 1-3, wherein the classifier layer comprises a plurality of classifiers, each classifier of the plurality of classifiers is used for processing comment information corresponding to a source information;
inputting the second text vector into the classifier layer to obtain a plurality of logic values corresponding to the comment information output by the classifier layer;
and inputting the second text vector into a first classifier of the plurality of classifiers to obtain a logic value corresponding to the comment information output by the first classifier, wherein the first classifier corresponds to the source information corresponding to the comment information.
7. The method according to any one of claims 1 to 3, wherein the probability of at least one emotional tendency output by the softmax layer satisfies the following formula:
Figure 293233DEST_PATH_IMAGE009
wherein,
Figure 568357DEST_PATH_IMAGE010
the probability of output of the softmax layer is represented, k represents the number of selected logic values, the probability of the selected logic values is larger than or equal to a preset threshold value, S represents a set of the first k logic values, C is a constant, and C represents the number of classified categories.
8. An emotion analysis model training method is characterized by comprising the following steps:
constructing a training data set, wherein the training data set comprises a plurality of pieces of sample comment information and source information corresponding to each piece of sample comment information;
training a preset model based on the training data set to obtain an emotion analysis model, wherein the emotion analysis model is used for carrying out emotion analysis on comment information and comprises a BERT layer, an expert neural network layer, a classifier layer and a normalized exponential function softmax layer.
9. The method of claim 8, wherein the training a predetermined model based on the training data set to obtain an emotion analysis model comprises:
selecting a piece of sample comment information in the training data set, and taking the sample comment information as target comment information;
processing the target comment information through the preset model to obtain an emotion classification result of the preset model on the target comment information;
calculating a loss value of the preset model based on a difference between the emotion classification result of the preset model on the target comment information and the label emotion analysis result of the target comment information;
and adjusting parameters of the preset model based on the loss value, and returning to the step of selecting one piece of sample comment information in the training data set until the preset model is converged, and taking the preset model obtained by training as the emotion analysis model.
10. A computer-readable storage medium comprising computer instructions;
the computer instructions, when executed on an electronic device, cause the electronic device to perform the method of any of claims 1-9.
11. An emotion analysis apparatus, comprising a processor coupled to a memory, the memory storing program instructions which, when executed by the processor, cause the apparatus to carry out the method of any of claims 1-9.
CN202211718347.0A 2022-12-30 2022-12-30 Text emotion analysis method and device Active CN115659995B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211718347.0A CN115659995B (en) 2022-12-30 2022-12-30 Text emotion analysis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211718347.0A CN115659995B (en) 2022-12-30 2022-12-30 Text emotion analysis method and device

Publications (2)

Publication Number Publication Date
CN115659995A true CN115659995A (en) 2023-01-31
CN115659995B CN115659995B (en) 2023-05-23

Family

ID=85022862

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211718347.0A Active CN115659995B (en) 2022-12-30 2022-12-30 Text emotion analysis method and device

Country Status (1)

Country Link
CN (1) CN115659995B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116882412A (en) * 2023-06-29 2023-10-13 易方达基金管理有限公司 Semantic reasoning method and system based on NLP classification
CN118245659A (en) * 2024-05-28 2024-06-25 快页信息技术有限公司 Network viewpoint data early warning method, device and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103886501A (en) * 2014-04-08 2014-06-25 苏州大学 Post-loan risk early warning system based on semantic emotion analysis
CN110334210A (en) * 2019-05-30 2019-10-15 哈尔滨理工大学 A kind of Chinese sentiment analysis method merged based on BERT with LSTM, CNN
WO2020253042A1 (en) * 2019-06-18 2020-12-24 平安科技(深圳)有限公司 Intelligent sentiment judgment method and device, and computer readable storage medium
US20210357591A1 (en) * 2020-05-13 2021-11-18 Early Warning Services, Llc Systems and methods of artificially intelligent sentiment analysis
WO2022095376A1 (en) * 2020-11-06 2022-05-12 平安科技(深圳)有限公司 Aspect-based sentiment classification method and apparatus, device, and readable storage medium
US20220237386A1 (en) * 2021-01-22 2022-07-28 Nec Laboratories America, Inc. Aspect-aware sentiment analysis of user reviews

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103886501A (en) * 2014-04-08 2014-06-25 苏州大学 Post-loan risk early warning system based on semantic emotion analysis
CN110334210A (en) * 2019-05-30 2019-10-15 哈尔滨理工大学 A kind of Chinese sentiment analysis method merged based on BERT with LSTM, CNN
WO2020253042A1 (en) * 2019-06-18 2020-12-24 平安科技(深圳)有限公司 Intelligent sentiment judgment method and device, and computer readable storage medium
US20210357591A1 (en) * 2020-05-13 2021-11-18 Early Warning Services, Llc Systems and methods of artificially intelligent sentiment analysis
WO2022095376A1 (en) * 2020-11-06 2022-05-12 平安科技(深圳)有限公司 Aspect-based sentiment classification method and apparatus, device, and readable storage medium
US20220237386A1 (en) * 2021-01-22 2022-07-28 Nec Laboratories America, Inc. Aspect-aware sentiment analysis of user reviews

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116882412A (en) * 2023-06-29 2023-10-13 易方达基金管理有限公司 Semantic reasoning method and system based on NLP classification
CN116882412B (en) * 2023-06-29 2024-07-23 易方达基金管理有限公司 Semantic reasoning method and system based on NLP classification
CN118245659A (en) * 2024-05-28 2024-06-25 快页信息技术有限公司 Network viewpoint data early warning method, device and medium
CN118245659B (en) * 2024-05-28 2024-08-06 快页信息技术有限公司 Network viewpoint data early warning method, device and medium

Also Published As

Publication number Publication date
CN115659995B (en) 2023-05-23

Similar Documents

Publication Publication Date Title
US11748555B2 (en) Systems and methods for machine content generation
Khan Development of an e-commerce sales Chatbot
CN115659995B (en) Text emotion analysis method and device
CN112308650B (en) Recommendation reason generation method, device, equipment and storage medium
US11195203B2 (en) Predicting outcomes via marketing asset analytics
Shen et al. A voice of the customer real-time strategy: An integrated quality function deployment approach
CN114662696A (en) Time series exception ranking
US11782962B2 (en) Temporal context-aware representation learning for question routing
Khan et al. Comparative analysis on Facebook post interaction using DNN, ELM and LSTM
CN116821372A (en) Knowledge graph-based data processing method and device, electronic equipment and medium
US20230085599A1 (en) Method and device for training tag recommendation model, and method and device for obtaining tag
EP4092598A1 (en) Customer request routing based on social media clout of customers and agents
Lei et al. Influence of Review Properties in the Usefulness Analysis of Consumer Reviews: A Review-Based Recommender System for Rating Prediction
Zhao et al. Research on a complex network and online review data-driven product innovation design
Wang et al. Mobile phone recommender system using information retrieval technology by integrating fuzzy OWA and gray relational analysis
CN114429384A (en) Intelligent product recommendation method and system based on e-commerce platform
Wu et al. Lightweight Scheme to Capture Stock Market Sentiment on Social Media Using Sparse Attention Mechanism: A Case Study on Twitter
Singh et al. Design and Development of Artificial Intelligence Framework to Forecast the Security Index Direction and Value in Fusion with Sentiment Analysis of Financial News
Jadon et al. A Comprehensive Survey of Evaluation Techniques for Recommendation Systems
Shedekar et al. Enhancing E-Commerce Insights: Sentiment Analysis Using Machine Learning and Ensemble Techniques
Bari et al. Analyzing the Performance of Improved Random Forest Based Amazon Product Review Sentiment Analysis
TWI847119B (en) System, method and computer program product for managing crisis information in social network groups
US20230196070A1 (en) Deep embedding learning models with mimicry effect
US20230177366A1 (en) Machine-learned model including incrementality estimation
Qu Influence of Emotional Factors (Positive, Negative) on the Usefulness of Product Reviews Based on Big Data

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