Sentiment classification model training method, sentiment classification method, storage medium and equipment
By considering part of speech, syntactic dependence type and syntactic perceptual distance in the training of the emotion classification model, the problem of low accuracy of the existing model is solved, and higher emotional classification accuracy is achieved.
Patent Information
- Application Number
- CN202410978599.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-12
AI Technical Summary
During the training process, the existing emotion classification model ignores the part-of-speech, syntactic dependence type and syntactic perceptual distance of words, resulting in a low accuracy of emotion classification.
By splicing attribute words in original text sentences, the part-of-speech sequence, the dependent syntax sequence and the syntactic perceived distance sequence are calculated, and this information is input into the network model, and the loss function is constructed to adjust the model parameters to ensure that the model considers it during the training process. Part of speech, syntactic dependence type, and syntactic perceptual distance.
It improves the accuracy of the emotion classification model, enables the model to capture the emotional expression of attribute words more accurately, and enhances the coding ability of emotional information.
Smart Images

Figure CN118940752A_ABST
Abstract
Description
Background Art
[0002] In the existing training methods of sentiment classification models, contextual semantic information can be used to learn attribute-related sentiment representations, while ignoring the word's part of speech, the word's syntactic dependency type, and the word's syntactic perceptual distance, which results in a low accuracy rate of the resulting sentiment classification model.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] The purpose of the present disclosure is to provide a training method for a sentiment classification model, a training device for a sentiment classification model, a sentiment classification method, a computer-readable storage medium, and an electronic device, thereby at least to a certain extent overcoming the problem of low accuracy of the sentiment classification model caused by the limitations and defects of the relevant technology.
[0005] According to one aspect of the present disclosure, a method for training a sentiment classification model is provided, comprising:
[0006] Splicing the original text sentences and the original attribute words in the original text sentences to obtain a text splicing sequence, and calculating the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic perception distance sequence of the text splicing sequence;
[0007] Inputting the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence into the network model to be trained, and obtaining the first polarity prediction result, the second polarity prediction result, and the first polarity reference result of the original attribute word;
[0008] Constructing a first loss function according to the first polarity prediction result and the first polarity reference result, and constructing a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word;
[0009] The parameters in the network model to be trained are adjusted according to the first loss function and the second loss function to obtain the sentiment classification model.
[0010] According to one aspect of the present disclosure, a sentiment classification method is provided, comprising:
[0011] Acquire a text sentence to be classified, and extract attribute words to be classified in the text sentence to be classified;
[0012] Splicing the text sentences to be classified and the attribute words to be classified to obtain a spliced sequence to be classified, and calculating a part-of-speech sequence to be classified, a dependency syntactic sequence to be classified, and a syntactic perception distance sequence to be classified of the spliced sequence to be classified;
[0013] Input the concatenated sequence to be classified, the part-of-speech sequence to be classified, the dependency syntactic sequence to be classified, and the syntactic perception distance sequence to be classified into the sentiment classification model to obtain the sentiment polarity prediction result of the attribute word to be classified; wherein the sentiment classification model is obtained by training the network model to be trained using any of the sentiment classification model training methods described above;
[0014] The sentiment category of the text sentence to be classified is determined according to the sentiment polarity prediction result.
[0015] According to one aspect of the present disclosure, a training device for a sentiment classification model is provided, comprising:
[0016] A first concatenation module is used to concatenate the original text sentences and the original attribute words in the original text sentences to obtain a text concatenation sequence, and calculate the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic perception distance sequence of the text concatenation sequence;
[0017] A first prediction module is used to input the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic perception distance sequence into the network model to be trained, and obtain the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word;
[0018] A loss function construction module, used to construct a first loss function according to the first polarity prediction result and the first polarity reference result, and to construct a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word;
[0019] A parameter adjustment module is used to adjust the parameters in the network model to be trained according to the first loss function and the second loss function to obtain the sentiment classification model.
[0020] According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the training method of the sentiment classification model described in any of the above-mentioned example embodiments and the sentiment classification method described above are implemented.
[0021] According to one aspect of the present disclosure, there is provided an electronic device, including:
[0022] Processor; and
[0023] A memory, configured to store executable instructions of the processor;
[0024] The processor is configured to execute the training method of the sentiment classification model described in any of the above-mentioned example embodiments and the sentiment classification method described above by executing the executable instructions.
[0025] The present disclosure provides a training method for a sentiment classification model. On the one hand, a text splicing sequence is obtained by splicing original text sentences and original attribute words in the original text sentences, and the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-perceptual distance sequence of the text splicing sequence are calculated; then the text splicing sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-perceptual distance sequence are input into a network model to be trained to obtain a first polarity prediction result, a second polarity prediction result and a first polarity reference result of the original attribute words; then a first loss function is constructed based on the first polarity prediction result and the first polarity reference result, and a second loss function is constructed based on the second polarity prediction result and the actual polarity label of the attribute word; finally, the first loss function is used to train the sentiment classification model. The loss function and the second loss function adjust the parameters in the network model to be trained to obtain a sentiment classification model; since the part-of-speech sequence, the dependency syntactic sequence and the syntactic-aware distance sequence are used in the process of model training, the problem of low accuracy of the obtained sentiment classification model due to ignoring the part-of-speech of the word, the syntactic dependency type of the word and the syntactic-aware distance of the word in the prior art can be solved, thereby improving the accuracy of the sentiment classification model; on the other hand, since in the process of constructing the loss function, not only the polarity prediction results and the actual polarity labels of the attribute words are taken into account, but also the polarity reference results are taken into account, so that the sentiment knowledge can be effectively integrated into the model, so that the sentiment classification model can more accurately capture the sentiment expression of the attribute words.
[0026] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0028] Figure 1 A flow chart of a method for training a sentiment classification model according to an exemplary embodiment of the present disclosure is schematically shown.
[0029] Figure 2A diagram schematically shows an example structure of a network model to be trained according to an example embodiment of the present disclosure.
[0030] Figure 3 A detailed architecture diagram of a network model to be trained according to an exemplary embodiment of the present disclosure is schematically shown.
[0031] Figure 4 A flowchart schematically illustrates a specific calculation process of a first polarity prediction result, a second polarity prediction result, and a first polarity reference result of an original attribute word according to an exemplary embodiment of the present disclosure.
[0032] Figure 5 A flowchart schematically illustrates a specific calculation process of a dynamic interactive sentiment representation of original attribute words according to an exemplary embodiment of the present disclosure.
[0033] Figure 6 A scene diagram schematically illustrates an overall prediction process of a first polarity prediction result, a second polarity prediction result, and a first polarity reference result according to an exemplary embodiment of the present disclosure.
[0034] Figure 7 The following schematically shows a flowchart of a sentiment classification method according to an exemplary embodiment of the present disclosure.
[0035] Figure 8 A block diagram schematically illustrates a training device for a sentiment classification model according to an exemplary embodiment of the present disclosure.
[0036] Fig. 9 A block diagram of a sentiment classification device according to an exemplary embodiment of the present disclosure is schematically shown.
[0037] Fig.10 An electronic device for implementing a training method for a sentiment classification model or a sentiment classification method according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0038] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0039] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0040] Attribute-level sentiment analysis is one of the hot topics in the field of natural language processing. It aims to identify the sentiment polarity of attribute words explicitly expressed in sentences. The sentiment polarity recorded here can be positive, negative or neutral. Attribute-level sentiment analysis is not only widely used in academia, but also attracts widespread attention in industry. For example, providers of goods or services can automatically analyze users' evaluations of different attributes of goods or services through attribute-level sentiment analysis technology, thereby improving the quality of products or services.
[0041] At present, attribute-level sentiment classification methods can be divided into rule-based methods, traditional machine learning-based methods, and deep learning-based methods. Among them, rule-based methods use dictionaries and designed semantic rules to identify the sentiment polarity of attribute words. Such rule-based methods rely heavily on language resources, such as dictionaries. Traditional machine learning-based methods use statistical machine learning (such as support vector machines, LDA (Latent Dirichlet Allocation, document topics), etc.) to identify sentiment polarity. The performance of such traditional machine learning-based methods relies heavily on the quality of manually designed features. Deep learning-based methods can automatically learn task-related representations and have achieved good performance. In recent years, methods based on pre-trained language models and graph convolutional neural networks have also made great progress and achieved good performance in attribute-level sentiment classification.
[0042] However, although the above methods have achieved certain success, they still have some shortcomings; for example: on the one hand, these methods use contextual semantic information to learn attribute-related sentiment representations, ignoring the word's part of speech, the word's syntactic dependency type, and the word's syntactic perception distance; that is, the part of speech information and multiple syntactic information are not effectively modeled and integrated into the model; on the other hand, most of these methods use the characteristics of the sentence context or attribute words to generate the final sentiment representation, ignoring the interaction between attribute words and context; and through the interaction between attribute words and context, attribute word representations and context representations containing more useful information can be generated; on the other hand, these methods have not yet effectively integrated sentiment knowledge into the model, ignoring the calibration of sentiment knowledge; and through the calibration of sentiment knowledge, the model can more accurately capture the sentiment expression of attribute words.
[0043] Based on this, this exemplary embodiment first provides a method for training a sentiment classification model, which can be run on a terminal device, a server, a server cluster or a cloud server, etc. Of course, those skilled in the art can also run the method disclosed in this disclosure on other platforms as required, and this exemplary embodiment does not specifically limit this. Figure 1 As shown, the training method of the sentiment classification model may include the following steps:
[0044] Step S110. splicing the original text sentence and the original attribute words in the original text sentence to obtain a text splicing sequence, and calculating the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic perception distance sequence of the text splicing sequence;
[0045] Step S120. Input the text concatenation sequence, the original part-of-speech sequence, the original dependency syntax sequence, and the original syntax-aware distance sequence into the network model to be trained, and obtain the first polarity prediction result, the second polarity prediction result, and the first polarity reference result of the original attribute word;
[0046] Step S130. construct a first loss function according to the first polarity prediction result and the first polarity reference result, and construct a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word;
[0047] Step S140. Adjust the parameters in the network model to be trained according to the first loss function and the second loss function to obtain the sentiment classification model.
[0048] In the training method of the above sentiment classification model, on the one hand, by splicing the original text sentences and the original attribute words in the original text sentences, a text splicing sequence is obtained, and the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-perceptual distance sequence of the text splicing sequence are calculated; then the text splicing sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-perceptual distance sequence are input into the network model to be trained to obtain the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word; then, according to the first polarity prediction result and the first polarity reference result, a first loss function is constructed, and according to the second polarity prediction result and the actual polarity label of the attribute word, a second loss function is constructed; finally, according to the first loss function And the second loss function adjusts the parameters in the network model to be trained to obtain the sentiment classification model; because the part-of-speech sequence, the dependency syntactic sequence and the syntactic-aware distance sequence are used in the process of model training, it can solve the problem that the part-of-speech of the word, the syntactic dependency type of the word and the syntactic-aware distance of the word in the prior art are ignored, which makes the obtained sentiment classification model have low accuracy, thereby improving the accuracy of the sentiment classification model; on the other hand, because in the process of constructing the loss function, not only the polarity prediction result and the actual polarity label of the attribute word are taken into account, but also the polarity reference result is taken into account, so that the sentiment knowledge can be effectively integrated into the model, so that the sentiment classification model can more accurately capture the sentiment expression of the attribute word.
[0049] Hereinafter, the training method of the sentiment classification model described in the exemplary embodiment of the present disclosure will be further explained and illustrated in conjunction with the accompanying drawings.
[0050] First, the terms involved in the exemplary embodiments of the present disclosure are explained and illustrated.
[0051] BERT (Bidirectional Encoder Representation from Transformers) is a pre-trained language model that aims to pre-train deep bidirectional representations by jointly adjusting the left and right contexts in all layers.
[0052] BiLSTM (Bidirectional Long Short-Term Memory) is an improvement based on LSTM. It consists of forward LSTM and reverse LSTM. It can consider bidirectional information at the same time and effectively process long-term dependencies in data.
[0053] BiGRU (Bidirectional Gating Recurrent Unit) is an improvement based on GRU. It consists of forward GRU and reverse GRU. It can consider bidirectional information at the same time and can effectively process long-term dependencies in data.
[0054] Part-of-speech sequence refers to the part-of-speech sequence formed by each word in a natural language sentence according to its grammatical function in the sentence. This sequence reflects the grammatical categories of words in the sentence and the structural relationship between them; for example, in a sentence, the sequence formed by the arrangement of content words such as nouns, verbs, and adjectives according to their positions and functions in the sentence is the part-of-speech sequence. The classification of part-of-speech sequences is based on the grammatical features of words, which include syntactic functions and morphological changes. In Chinese, words can be divided into 12 parts of speech, which can be divided into content words and function words according to their actual meaning and grammatical structure. Content words represent specific concepts, such as nouns and verbs, while function words do not represent specific concepts, such as conjunctions and auxiliary words. Content words can be further subdivided into more specific parts of speech, such as nouns can be divided into common nouns, proper nouns, etc.
[0055] Dependency syntactic sequences focus on the dependencies between words in a sentence rather than the phrase structure. Dependency syntactic sequences describe the dependencies between words in a sentence by constructing a syntactic dependency tree, where each word is regarded as a dependency or modifier of other words, forming a directed acyclic graph. The main advantage of dependency syntactic sequences is that they can handle languages with rich morphology and relatively free word order, such as Czech, which has a more flexible word order than English. In practical applications, dependency syntactic sequences can be obtained as follows: the dependency syntactic tree is regarded as a subgraph of the complete graph, and the probability of each edge in the graph belonging to the syntactic tree is scored, and then the algorithm is used to find the maximum spanning tree as the dependency syntactic tree. This method faces the problem of high running overhead in the traditional machine learning era, because the features it relies on are too sparse, and the training algorithm needs to make global structured predictions on the entire graph.
[0056] Secondly, the technical implementation principle of the example embodiment of the present disclosure is explained and illustrated. Specifically, the training method of the sentiment classification model provided in the example embodiment of the present disclosure is a model training method based on multi-information aggregation and interactive attribute-level sentiment enhanced by sentiment knowledge. The method aims to solve the following technical problems: 1) In attribute-level sentiment classification, the current method only uses contextual semantic information to learn attribute-related sentiment representations, ignoring the word's part of speech, the word's syntactic dependency type, and the word's syntactic perception distance. Therefore, this type of part-of-speech information and various syntactic information have not been effectively modeled and integrated into the model, while the word's part-of-speech information and various syntactic information can provide the model with more useful information, thereby improving The expressive power of the model; 2) In attribute-level sentiment classification, current methods mostly use sentence context or attribute word representation to generate the final sentiment representation, ignoring the interaction between attribute words and context; while through the interaction between attribute words and context, they can provide useful information to each other during the encoding process of attribute words and context, generating attribute word representations and context representations that contain more useful information; 3) In attribute-level sentiment classification, current methods have not effectively integrated sentiment knowledge into the model, ignoring the calibration of sentiment knowledge, while through the calibration of sentiment knowledge, the model can more accurately capture the sentiment expression of attribute words.
[0057] Further, the network model to be trained involved in the exemplary embodiment of the present disclosure is explained and illustrated, specifically, refer to Figure 2As shown, the network model to be trained may include an input layer 201, a multi-type embedding layer 202, a multi-information aggregation layer 203, a multi-information dynamic interaction layer 204, a sentiment calibration layer 205, a sentiment prediction layer 206, and an output layer 207. Among them, the multi-type embedding layer is used to obtain the context representation, part-of-speech type representation, syntactic perception distance representation, and syntactic dependency type representation of each word in the sentence; the multi-information aggregation layer is used to fuse the context semantic information, part-of-speech information, syntactic perception distance information, and syntactic dependency information to generate a multi-information fusion representation; the multi-information dynamic interaction layer is used to dynamically interact the attribute word information and the context information to generate an attribute word representation and a context representation containing more useful information, thereby obtaining a dynamic interactive sentiment representation with a larger amount of information; the sentiment calibration module layer is used to inject sentiment knowledge into the model, calibrate the multi-information fusion representation with sentiment knowledge, so that the fused representation can contain more sentiment knowledge and capture more sentiment expressions; the sentiment prediction module layer is used to output the sentiment polarity of a certain attribute word in the sentence. In the actual application process, first, the sentence and the attribute words are concatenated and their corresponding part-of-speech types, syntactic-aware distances, and syntactic dependency types are input into the multi-type embedding layer to obtain the context representation, part-of-speech type representation, syntactic-aware distance representation, and syntactic dependency type representation corresponding to each word in the sentence; secondly, the context representation, part-of-speech type representation, syntactic-aware distance representation, and syntactic dependency type representation of each word are input into the multi-information aggregation layer to generate the multi-information fusion representation corresponding to each word; then, the multi-information fusion representation and context representation of each word in the sentence and the attribute words are input into the multi-information dynamic interaction module, and the context interaction attention and the syntactic dependency type representation in the multi-information dynamic interaction layer are used to generate the multi-information fusion representation corresponding to each word. The guidance information of the self-attribute words is used to generate contextual representations that contain more useful information. The attribute word interactive attention mechanism and the guidance information from the context are used in the multi-information dynamic interaction layer to generate attribute word representations that contain more useful information. Combined with the multi-information fusion representation, a dynamic interactive sentiment representation with more information is obtained. Furthermore, the multi-information fusion representation of each word in the sentence and attribute word is input into the sentiment calibration layer, and the sentiment calibration mechanism is used to inject sentiment knowledge into the model, so that the representation learned by the model can contain more sentiment knowledge and capture more sentiment expressions. Finally, the obtained dynamic interactive sentiment representation is input into the sentiment prediction layer, and the sentiment polarity of a certain attribute word in the sentence is output.
[0058] In an exemplary embodiment, referring to Figure 3As shown, the multi-type embedding layer recorded above includes a Bert embedding mapping unit 301, a part-of-speech mapping unit 302, a syntactic dependency type mapping unit 303, and a syntactic-aware distance mapping unit 304; the multi-information aggregation layer recorded above includes a sentence-aware long short-term memory network 305 corresponding to the original text sentence and an attribute word-aware long short-term memory network 306 corresponding to the original attribute word; the multi-information dynamic interaction layer recorded above includes a context interaction attention unit 307, an attribute word interaction attention unit 308, a first average pooling unit 309, a second average pooling unit 310, and a vector concatenation unit 311; the sentiment prediction layer recorded above includes a linearization unit 312 and a Softmax 313. The specific functions of each functional unit or functional module will be described in detail later, and will not be repeated here.
[0059] The following will be combined Figure 2 as well as Figure 3 right Figure 1 The sentiment classification method shown in is further explained and illustrated. Specifically:
[0060] In step S110, the original text sentences and the original attribute words in the original text sentences are concatenated to obtain a text concatenation sequence, and the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic perception distance sequence of the text concatenation sequence are calculated.
[0061] In this example embodiment, first, the original text sentence and the original attribute words included in the original text sentence are obtained; wherein the original attribute words recorded here can be extracted from the original text sentence based on a part-of-speech analysis tool, or can be obtained by manual marking, and this example does not impose any special restrictions on this; secondly, the original text sentence and the original attribute words are spliced in the form of "[CLS]+sentence+[SEP]+attribute word+[SEP]", so as to obtain a text splicing sequence of the sentence context and the attribute word; wherein [CLS] and [SEP] in the text splicing sequence are separators, each of which is one character long; the obtained text splicing sequence I ca It can be expressed as the following formula (1):
[0062] I ca ={w cls ,w 1 ,...,w s ,w sep ,a 1 ,...,a m ,w sep}; Formula (1)
[0063] Among them, s represents the length of the original text sentence, and m represents the length of the original attribute word. Further, after obtaining the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic perception distance sequence corresponding to the text concatenation sequence can be calculated; specifically, it can be achieved in the following way: calling a preset part-of-speech parsing tool, and calculating the original part-of-speech sequence I of the text concatenation sequence through the preset part-of-speech parsing tool pos , original dependency syntax sequence I dep and the original syntactic-aware distance sequence I dis Among them, the original part-of-speech sequence I pos , original dependency syntax sequence I dep and the original syntactic-aware distance sequence I dis The specific calculation process can be shown in the following formulas (2), (3) and (4):
[0064] I pos = {pos 1 ,pos 2 ,...,pos n}; Formula (2)
[0065] I dep ={dep 1 ,dep 2 ,...,dep n}; Formula (3)
[0066] I dis ={dis 1 ,dis 2 ,...,dis n}; Formula (4)
[0067] Where n = s + m + 3; pos 1 ,pos 2 ,...,pos n dep respectively represent the part of speech of the first word, the second word, ..., the nth word in the text concatenation sequence; 1 ,dep 2 ,...,dep n Respectively represent the dependency syntax of the first word, the second word, ..., the nth word in the text concatenation sequence; 1 ,dis 2 ,...,dis n They represent the syntactic-perceptual distances of the first word, the second word, ..., and the nth word in the text concatenation sequence respectively; s represents the length of the original text sentence, and m represents the length of the original attribute word; further, the calculation process of the syntactic-perceptual distance can be specifically shown in the following formulas (5) and (6):
[0068]
[0069] Among them, asp_context_dis i A represents the shortest syntactic distance between the i-th text word and the original attribute word in the syntactic dependency tree; i =1 indicates that there is a syntactic connection between the original attribute word and the i-th text word; A i =0 means that there is no syntactic connection between the original attribute word and the i-th text word; n is the input sequence length, and k is the hyperparameter of the syntax-aware distance.
[0070] In step S120, the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-aware distance sequence are input into the network model to be trained to obtain the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word.
[0071] Specifically, refer to Figure 4 As shown, the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence are input into the network model to be trained to obtain the first polarity prediction result, the second polarity prediction result, and the first polarity reference result of the original attribute word, which may include the following steps:
[0072] Step S410, input the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-aware distance sequence into a multi-type embedding layer to obtain the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic-aware distance representation and attribute word syntactic dependency type representation of the original attribute word.
[0073] Specifically, the specific calculation process of the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic-aware distance representation and attribute word syntactic dependency type representation of the original attribute word can be implemented as follows: first, embedding the text splicing sequence based on the Bert embedding mapping unit to obtain the original word context representation of each word in the text splicing sequence, and determine the attribute word context representation of the original attribute word according to the original word context representation; secondly, embedding the original part-of-speech sequence based on the part-of-speech embedding matrix in the part-of-speech mapping unit to obtain the original part-of-speech type representation of each word in the text splicing sequence, and determine the attribute word context representation of the original attribute word according to the original word context representation. The original part-of-speech type representation determines the attribute word part-of-speech type representation of the original attribute word; then, based on the syntactic dependency type mapping unit, the original dependency syntactic sequence is embedded to obtain the original syntactic-aware distance representation of each word in the text concatenation sequence, and the attribute word syntactic-aware distance representation of the original attribute word is determined according to the original syntactic-aware distance representation; finally, based on the syntactic-aware distance mapping unit, the original syntactic-aware distance sequence is embedded to obtain the original syntactic dependency type representation of each word in the text concatenation sequence, and the attribute word syntactic dependency type representation of the original attribute word is determined according to the original syntactic dependency type representation.
[0074] In an example embodiment, in the actual application process, in the multi-type embedding layer, first, the original word context representation of each word in the text concatenation sequence can be obtained using the BERT embedding mapping unit; wherein the specific calculation process is shown in the following formula (7):
[0075]
[0076] Among them, BERT(·) represents all operations of BERT, thereby obtaining the original word context representation h bert ;in, From h bert The attribute word context representation of each word in the original attribute word can be obtained: Furthermore, through average pooling processing, the overall representation of the original attribute word can be obtained.
[0077] In an exemplary embodiment, in the actual application process, the original part-of-speech type representation h of each word in the text concatenation sequence can be obtained through the part-of-speech embedding matrix in the part-of-speech mapping unit. pos ; Among them, the original part-of-speech type representation From h pos The attribute word part-of-speech type representation of each word in the original attribute word can be obtained in,
[0078] In an exemplary embodiment, the original syntactic dependency representation h of each word in the text concatenation sequence can be obtained through the syntactic dependency embedding matrix in the syntactic dependency type mapping unit. dep ; Among them, the original syntactic dependency representation From h dep The attribute word syntactic dependency type representation of each word in the original attribute word can be obtained in,
[0079] In an exemplary embodiment, the original syntax-aware distance representation h of each word in the text concatenation sequence is obtained by using the syntax-aware distance embedding matrix in the syntax-aware distance mapping unit. awd Among them, the original syntactic-aware distance representation From h awd The attribute word syntactic-aware distance representation of each word in the original attribute word can be obtained Among them, the attribute word syntactic perception distance representation
[0080] Step S420, input the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic perception distance representation and attribute word syntactic dependency type representation into the multi-information aggregation layer to obtain the multi-information fusion representation of the original attribute word, and input the multi-information fusion representation into the multi-information dynamic interaction layer to obtain the dynamic interactive sentiment representation of the original attribute word.
[0081] In this example embodiment, first, the multi-information fusion representation of the original attribute word is determined; specifically, it can be achieved in the following manner: based on the attribute word-aware long short-term memory network, the attribute word context representation, attribute part-of-speech type representation, attribute word syntax-aware distance representation, and attribute word syntax-dependency type representation are subjected to information fusion processing to obtain the multi-information fusion representation of the original attribute word. Secondly, it is also necessary to determine the multi-information fusion representation of each word in the text splicing sequence; specifically, it can be achieved in the following manner: based on the sentence-aware long short-term memory network, the original word context representation, the original part-of-speech type representation, the original syntax-aware distance representation, and the original syntax-dependency type representation of the text splicing sequence are subjected to information fusion processing to obtain the multi-information fusion representation of each word in the text splicing sequence.
[0082] In an exemplary embodiment, the multi-information aggregation layer is mainly composed of a sentence-aware BiLSTM and an attribute word-aware BiLSTM; it performs information fusion processing by receiving the attribute word context representation, attribute word part-of-speech type representation, attribute word syntactic-aware distance representation, and attribute word syntactic dependency type representation of the original attribute word, thereby obtaining a multi-information fusion representation of the original attribute word; and, receives the original word context representation, original word part-of-speech type representation, original syntactic-aware distance representation, and original syntactic dependency type representation of the text concatenation sequence, thereby obtaining a multi-information fusion representation of each word in the text concatenation sequence. Among them, the multi-information fusion representation of each word in the text concatenation sequence And the multi-information fusion representation of the original attribute words The specific calculation formulas can be shown as follows:
[0083]
[0084] Among them, BiLSTM(·) represents all operations of BiLSTM, and the symbol “;” represents the concatenation operation. Represents the multi-information fusion representation of the i-th word in the concatenated sequence output by the sentence-aware LSTM; Splicing is performed to obtain a multi-information fusion representation of each word in the text splicing sequence It represents the multi-information fusion representation of the i-th word in the original attribute word output by the attribute word perception LSTM. Concatenate to obtain the multi-information fusion representation of each word in the original attribute word
[0085] Secondly, the sentiment representation of the dynamic interaction of the original attribute words is calculated. The sentiment representation of the dynamic interaction of the original attribute words can be realized based on the multi-information dynamic interaction layer; the multi-information dynamic interaction layer is mainly composed of context interaction attention and attribute word interaction attention; at the same time, the context interaction attention is combined with the guidance information from the attribute words to generate a context interaction representation containing more useful information; the attribute word interaction attention is combined with the guidance information from the context to generate an attribute word interaction representation containing more useful information. For details, refer to Figure 5 As shown, the specific calculation process of the sentiment representation of the dynamic interaction of the original attribute words may include the following steps:
[0086] Step S510, based on the context interaction attention unit and the first average pooling unit, multi-information modeling is performed on the multi-information fusion representation of each word in the text splicing sequence, the multi-information fusion representation of the original attribute word, and the attribute word context representation of the original attribute word to obtain the sentence context interaction representation of the text splicing sequence.
[0087] Specifically, the specific calculation process of the sentence context interaction representation can be implemented as follows: first, based on the context interaction attention unit, the multi-information fusion representation of each word in the text splicing sequence and the attribute word context representation of the original attribute word are multi-information modeled to obtain the sentence context semantic representation of each word in the original text sequence; secondly, based on the context interaction attention unit, the multi-information fusion representation of the original attribute word and the attribute word context representation are multi-information modeled to obtain the attribute word context semantic representation of each word in the original attribute word; then, based on the first average pooling unit, the attribute word context semantic representation is average pooled to obtain the overall context representation of the original attribute word, and the overall context representation and the first context semantic representation are nonlinearly processed to obtain the sentence context interaction attention weight of the text splicing sequence; finally, the sentence context interaction attention weight is normalized, and the sentence context interaction representation is obtained according to the normalized sentence context interaction attention weight and the overall context representation of the original attribute word. Among them, the specific calculation process of the sentence context interaction representation can be shown by the following formulas (10) to (15):
[0088]
[0089]
[0090] Among them, BiGRU(·) represents all operations of BiGRU, Represents the contextual semantic representation of multi-information modeling of the i-th word in the text concatenation sequence; Represents the contextual semantic representation of multi-information modeling of the i-th word in the original attribute word; Represents the multi-information fusion representation of the i-th word in the text concatenation sequence; An attribute word context representation representing the original attribute word; represents the multi-information fusion representation of the i-th word in the original attribute word; the f(·) function is the average pooling operation, and a_mean represents the overall context representation of the attribute word in multi-information modeling; W sen is the parameter of context interaction attention; represents the unnormalized sentence context interaction attention weight, represents the normalized sentence context interaction attention weight, h dac Sentence context interaction representation representing the output of context interaction attention.
[0091] Step S520, based on the attribute word interactive attention unit and the second average pooling unit, multi-information modeling is performed on the multi-information fusion representation of other words in the original text sequence except the context words and the attribute word context semantic representation of each word in the original attribute word to obtain the attribute word context interactive representation of the original attribute word.
[0092] Specifically, the specific calculation process of the attribute word context interaction representation of the original attribute word can be implemented as follows: first, based on the attribute word interaction attention unit, extract the multi-information fusion representation of other words in the original text sequence except the context word, and perform masking operation on the multi-information fusion representation of the other words to obtain the multi-information fusion representation of the context word; secondly, based on the second average pooling unit, average pooling is performed on the multi-information fusion representation of the context word to obtain the context overall fusion representation of the context word; then, the context overall fusion representation of the context word and the attribute word context semantic representation of each word in the original attribute word are nonlinearly processed to obtain the attribute word interaction attention weight of the original attribute word; finally, the attribute word interaction attention weight is normalized, and the attribute word context interaction representation is determined according to the normalized attribute word interaction attention weight and the attribute word context semantic representation. Among them, the specific calculation process of the attribute word context interaction representation can be shown by the following formulas (16) to (19):
[0093]
[0094] Among them, the multi-information fusion representation of each word in the text concatenation sequence By performing masking operations on the non-context words in the original text sentence, we can obtain the multi-information fusion representation of the context words in the original text sentence. e represents the length of the context in the sentence, and the f(·) function is an average pooling operation. The contextual overall fusion representation of the context words representing the fusion of multiple information; Represents the contextual overall fusion representation of multi-information modeling of the i-th word in the original attribute word, W asp is the parameter of the attribute word interaction attention, represents the unnormalized attribute word interaction attention weight, represents the normalized attribute word interaction attention weight; h daa Attribute word context interaction representation representing the attribute word interaction attention output.
[0095] Step S530, based on the vector concatenation unit, concatenates the sentence context interaction representation and the attribute word context interaction representation to obtain the dynamic interaction sentiment representation of the original attribute word. That is, in the actual application process, by fusion of multiple information representations of each word in the text concatenation sequence, By performing average pooling operation, we can obtain the overall representation of multi-information fusion of text splicing sequence. By fusion representation of multiple information of each word in attribute words Perform average pooling operation to obtain the overall representation of multi-information fusion of attribute words Sentence context interaction representation h of concatenated context interaction attention output dac The interactive representation of attribute words and small texts output by interactive attention of attribute words h daa , and obtain the dynamic interactive sentiment representation of the original attribute words. The specific calculation process can be shown in the following formula (20):
[0096]
[0097] The symbol “;” indicates the splicing operation, h att The dynamic interaction attention layer outputs a more informative sentiment representation of dynamic interactions.
[0098] At this point, the specific calculation process of the dynamic interactive sentiment representation of the original attribute words has been fully realized.
[0099] Step S430, input the multi-information fusion representation of the original attribute word into the emotion calibration layer to obtain the first polarity prediction result and the first polarity reference result of the original attribute word, and input the dynamic interactive emotion representation into the emotion prediction layer to obtain the second polarity prediction result of the original attribute word.
[0100] In this exemplary embodiment, first, the first polarity prediction result and the first polarity reference result of the original attribute word are determined; specifically, this can be achieved in the following manner: based on the sentiment dictionary in the sentiment calibration layer, the first polarity reference result of the original attribute word is determined; based on the sentiment calibration layer, the multi-information fusion representation of the original text sequence and the multi-information fusion representation of the original attribute word are linearized to obtain the first polarity prediction result of the original attribute word. Specifically, in the sentiment calibration layer, the multi-information fusion representation of the original attribute word can first be calibrated using sentiment knowledge; wherein the sentiment knowledge recorded here comes from the sentiment dictionary, which contains sentiment words and their corresponding sentiment scores. In actual application, if a word in a sentence is in the sentiment dictionary, its initial sentiment score is If it is not in the sentiment dictionary, then In addition, syntactic distance information can also be integrated into sentiment knowledge, so that the model can pay more attention to the sentiment expression related to attribute words; the specific calculation process of the sentiment calibration model layer can be shown in the following formula (21) and formula (22):
[0101]
[0102] Among them, dis i is the syntactic-perceptual distance of the i-th word in the sentence; is the sentiment score of the i-th word in the original text sentence combined with the syntactic distance; based on The first polarity reference result of the original attribute word can be obtained; W score , b score is a learnable parameter of the sentiment calibration layer; by fusion representation of multiple information of each word in the original attribute word Perform average pooling operation to obtain the overall representation of multi-information fusion of the original attribute words Then, based on the overall representation of the multi-information fusion of the original attribute word and the multi-information fusion representation of each word in the text concatenation sequence, the first polarity prediction result of the original attribute word can be predicted; based on D, all sentences in the training data set are represented.
[0103] Secondly, determine the second polarity prediction result of the original attribute word; specifically, this can be achieved in the following way: linearize and normalize the emotional representation of the dynamic interaction based on the emotional prediction layer to obtain the second polarity prediction result of the original attribute word. That is, in the actual application process, the emotional representation of the dynamic interaction can be input into the emotional prediction layer, and the emotional polarity of the original attribute word in the sentence (that is, the second polarity prediction result) can be output; wherein, the specific calculation process of the emotional prediction layer can be shown in the following formula (23) and formula (24):
[0104] h p =W p h att +b p ; Formula (23)
[0105]
[0106] Among them, W p and b p is the learnable parameter of the model, h att The dynamic interaction emotion representation with more information in the dynamic interaction attention module layer, h p Represents the emotional representation of dynamic interaction after the linear layer, Represents the sentiment polarity distribution output by the sentiment prediction module (i.e., the second polarity prediction result).
[0107] It should be noted that the scene diagram of the overall prediction process of the first polarity prediction result, the second polarity prediction result and the first polarity reference result can be referred to Figure 6 shown.
[0108] In step S130, a first loss function is constructed according to the first polarity prediction result and the first polarity reference result, and a second loss function is constructed according to the second polarity prediction result and the actual polarity label of the attribute word. The obtained first loss function and second loss function can be referred to as shown in the following formula (25) and formula (26):
[0109]
[0110] Among them, l s is the first loss function, which can also be called the emotion calibration loss function; c It is the second loss function, which can also be called the sentiment classification loss function; is the first polarity reference result, and is η i First polarity prediction result; is the second polarity prediction result, and y is the actual polarity label.
[0111] In step S140, the parameters in the network model to be trained are adjusted according to the first loss function and the second loss function to obtain the sentiment classification model.
[0112] Specifically, it can be implemented in the following manner: construct a target loss function according to the first loss function and the second loss function, and adjust the parameters in the network model to be trained based on the target loss function to obtain the adjusted network model; and trim the emotion calibration layer in the adjusted network model to obtain the emotion classification model. The obtained target loss function can be shown in the following formula (27):
[0113] l=l c +λl s ; Formula (27)
[0114] Among them, λ is the hyperparameter of the model, and l is the final loss function of the model training, that is, the target loss function. Furthermore, since the emotion calibration layer is not needed in the actual emotion classification process, after the model training is completed, the emotion calibration layer can be trimmed to obtain the final emotion classification model.
[0115] So far, the training method of the sentiment classification model described in the exemplary embodiments of the present disclosure has been fully implemented. Based on the above-mentioned contents, it can be known that the training method of the sentiment classification model recorded in the exemplary embodiment of the present disclosure, on the one hand, explicitly considers and models the word's part-of-speech information, syntactic dependency type information, and syntactic perception distance information. The method can effectively integrate the word's contextual semantics, part-of-speech type, syntactic dependency type, and the dependency syntactic distance between the attribute word and each word in the sentence into the encoding of the attribute word and sentence representation and the prediction of sentiment polarity, overcoming the problem that the existing attribute-level sentiment classification method has not yet effectively modeled and integrated the contextual semantic information, part-of-speech information, syntactic dependency type information, and syntactic perception distance information, so that the model can learn more useful information and improve the model's encoding ability and expression ability of sentiment information; on the other hand, the method explicitly considers and models the dynamic interaction between the sentence context and the attribute word. The method can effectively dynamically interact the sentence context and the attribute word, overcoming the problem that the attribute word and the sentence context have not yet effectively interacted, so that the model can generate a more informative and dynamically interactive sentiment representation, thereby further improving the performance of the model; on the other hand, the method explicitly integrates sentiment knowledge effectively The method combines the emotion knowledge into the model, overcoming the problem that the emotion knowledge has not been effectively integrated into the model, so that the model can more accurately capture the emotion expression of the attribute words and improve the performance of the model; further, the syntactic-aware distance calculation in this method can effectively inject the syntactic-aware distance between each word and the attribute word into the model, the multi-information aggregation module can effectively integrate the contextual semantic information, part-of-speech type information, syntactic dependency type information and the dependency syntactic distance information between the attribute word and each word in the sentence, and generate a multi-information fusion representation containing more information; the contextual interaction attention can effectively use the guiding information of the attribute word to model the contextual interaction representation; the attribute word interaction attention can effectively use the guiding information of the context to model the attribute word interaction representation; the multi-information dynamic interaction module can effectively dynamically interact the context and the attribute word and provide useful information to each other, generate a dynamic interactive emotion representation with a large amount of information, and further improve the model's modeling and expression capabilities for emotion semantics; at the same time, the emotion calibration layer can effectively inject emotion knowledge into the model, so that the model can learn the representation containing rich emotion knowledge and improve the emotion understanding model performance of the model.
[0116] The exemplary embodiment of the present disclosure also provides a sentiment classification method. Specifically, refer to Figure 7 As shown, the sentiment classification method may include the following steps:
[0117] Step S710, obtaining a text sentence to be classified, and extracting attribute words to be classified in the text sentence to be classified;
[0118] Step S720, concatenating the text sentences to be classified and the attribute words to be classified to obtain a concatenated sequence to be classified, and calculating a part-of-speech sequence to be classified, a dependency syntactic sequence to be classified, and a syntactic perception distance sequence to be classified of the concatenated sequence to be classified;
[0119] Step S730, inputting the concatenated sequence to be classified, the part-of-speech sequence to be classified, the dependency syntactic sequence to be classified, and the syntactic perceptual distance sequence to be classified into a sentiment classification model to obtain a sentiment polarity prediction result of the attribute word to be classified; wherein the sentiment classification model is obtained by training the network model to be trained using any of the sentiment classification model training methods described above;
[0120] Step S740: determining the sentiment category of the text sentence to be classified according to the sentiment polarity prediction result.
[0121] In the above-mentioned sentiment classification method, since the part-of-speech sequence, dependency syntactic sequence and syntactic-aware distance sequence are used in the process of model training, it can solve the problem in the prior art that the part-of-speech of words, the syntactic dependency type of words and the syntactic-aware distance of words are ignored, resulting in a low accuracy rate of the obtained sentiment classification model, thereby improving the accuracy of the sentiment classification model.
[0122] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.
[0123] The exemplary embodiment of the present disclosure also provides a training device for a sentiment classification model. Specifically, refer to Figure 8 As shown, the training device of the sentiment classification model may include a first splicing module 810, a first prediction module 820, a loss function construction module 830 and a parameter adjustment module 840. Among them:
[0124] The first concatenation module 810 may be used to concatenate the original text sentences and the original attribute words in the original text sentences to obtain a text concatenation sequence, and calculate the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic perception distance sequence of the text concatenation sequence;
[0125] The first prediction module 820 can be used to input the text concatenation sequence, the original part-of-speech sequence, the original dependency syntax sequence and the original syntax-aware distance sequence into the network model to be trained to obtain the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word;
[0126] The loss function construction module 830 may be used to construct a first loss function according to the first polarity prediction result and the first polarity reference result, and to construct a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word;
[0127] The parameter adjustment module 840 can be used to adjust the parameters in the network model to be trained according to the first loss function and the second loss function to obtain the sentiment classification model.
[0128] In an exemplary embodiment of the present disclosure, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntax-aware distance sequence of the text concatenation sequence are calculated, including: calling a preset part-of-speech parsing tool, and based on the preset part-of-speech parsing tool, calculating the original part-of-speech sequence, the original dependency syntactic sequence and the original syntax-aware distance sequence corresponding to the text concatenation sequence.
[0129] In an exemplary embodiment of the present disclosure, the network model to be trained includes a multi-type embedding layer, a multi-information aggregation layer, a multi-information dynamic interaction layer, a sentiment calibration layer and a sentiment prediction layer; wherein the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-aware distance sequence are input into the network model to be trained, and the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word are obtained, including: the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-aware distance sequence are input into the multi-type embedding layer, and the attribute word context representation, the attribute part-of-speech type representation, the attribute word context representation and the attribute word context representation of the original attribute word are obtained. The method comprises the following steps: inputting the attribute word context representation, the attribute word part of speech type representation, the attribute word syntactic-aware distance representation and the attribute word syntactic dependency type representation into the multi-information aggregation layer to obtain the multi-information fusion representation of the original attribute word, and inputting the multi-information fusion representation into the multi-information dynamic interaction layer to obtain the dynamic interactive sentiment representation of the original attribute word; inputting the multi-information fusion representation of the original attribute word into the sentiment calibration layer to obtain the first polarity prediction result and the first polarity reference result of the original attribute word, and inputting the dynamic interactive sentiment representation into the sentiment prediction layer to obtain the second polarity prediction result of the original attribute word.
[0130] In an exemplary embodiment of the present disclosure, the multi-type embedding layer includes a Bert embedding mapping unit, a part-of-speech mapping unit, a syntactic dependency type mapping unit, and a syntactic-aware distance mapping unit; wherein the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence are input into the multi-type embedding layer to obtain the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic-aware distance representation, and attribute word syntactic dependency type representation of the original attribute word, including: embedding the text concatenation sequence based on the Bert embedding mapping unit to obtain the original word context representation of each word in the text concatenation sequence, and determining the attribute word context representation of the original attribute word based on the original word context representation; based on the part of speech in the part-of-speech mapping unit The embedding matrix embeds the original part-of-speech sequence to obtain the original part-of-speech type representation of each word in the text concatenation sequence, and determines the attribute word part-of-speech type representation of the original attribute word based on the original part-of-speech type representation; the original dependency syntactic sequence is embedded based on the syntactic dependency type mapping unit to obtain the original syntactic-aware distance representation of each word in the text concatenation sequence, and determines the attribute word syntactic-aware distance representation of the original attribute word based on the original syntactic-aware distance representation; the original syntactic-aware distance sequence is embedded based on the syntactic-aware distance mapping unit to obtain the original syntactic dependency type representation of each word in the text concatenation sequence, and determines the attribute word syntactic dependency type representation of the original attribute word based on the original syntactic dependency type representation.
[0131] In an exemplary embodiment of the present disclosure, the multi-information aggregation layer includes a sentence-aware long short-term memory network corresponding to the original text sentence and an attribute word-aware long short-term memory network corresponding to the original attribute word; the attribute word context representation, attribute part-of-speech type representation, attribute word syntax-aware distance representation and attribute word syntactic dependency type representation are input into the multi-information aggregation layer to obtain a multi-information fusion representation of the original attribute word, including: based on the attribute word-aware long short-term memory network, the attribute word context representation, attribute part-of-speech type representation, attribute word syntax-aware distance representation and attribute word syntactic dependency type representation are subjected to information fusion processing to obtain a multi-information fusion representation of the original attribute word.
[0132] In an exemplary embodiment of the present disclosure, the multi-information fusion representation of each word in the text splicing sequence is obtained in the following manner: based on the sentence-aware long short-term memory network, the original word context representation, the original part-of-speech type representation, the original syntax-aware distance representation and the original syntax dependency type representation of the text splicing sequence are subjected to information fusion processing to obtain the multi-information fusion representation of each word in the text splicing sequence.
[0133] In an exemplary embodiment of the present disclosure, the multi-information dynamic interaction layer includes a context interaction attention unit, an attribute word interaction attention unit, a first average pooling unit, a second average pooling unit and a vector splicing unit; wherein, the multi-information fusion representation is input into the multi-information dynamic interaction layer to obtain the dynamic interaction sentiment representation of the original attribute word, including: based on the context interaction attention unit and the first average pooling unit, the multi-information fusion representation of each word in the text splicing sequence, the multi-information fusion representation of the original attribute word and the attribute word context representation of the original attribute word are multi-information modeled to obtain the sentence context interaction representation of the text splicing sequence; based on the attribute word interaction attention unit and the second average pooling unit, the multi-information fusion representation of other words in the original text sequence except the context words and the attribute word context semantic representation of each word in the original attribute word are multi-information modeled to obtain the attribute word context interaction representation of the original attribute word; based on the vector splicing unit, the sentence context interaction representation and the attribute word context interaction representation are spliced to obtain the dynamic interaction sentiment representation of the original attribute word.
[0134] In an exemplary embodiment of the present disclosure, based on the context interaction attention unit and the first average pooling unit, multi-information modeling is performed on the multi-information fusion representation of each word in the text splicing sequence, the multi-information fusion representation of the original attribute word, and the attribute word context representation of the original attribute word to obtain the sentence context interaction representation of the text splicing sequence, including: based on the context interaction attention unit, the multi-information fusion representation of each word in the text splicing sequence and the attribute word context representation of the original attribute word are multi-information modeling is performed to obtain the sentence context semantic representation of each word in the original text sequence; based on the context interaction attention unit, the multi-information fusion representation of the original attribute word is multi-information modeling is performed to obtain the sentence context semantic representation of each word in the original text sequence; The information fusion representation and the attribute word context representation are used for multi-information modeling to obtain the attribute word context semantic representation of each word in the original attribute word; the attribute word context semantic representation is average pooled based on the first average pooling unit to obtain the overall context representation of the original attribute word, and the overall context representation and the first context semantic representation are nonlinearly processed to obtain the sentence context interaction attention weights of the text splicing sequence; the sentence context interaction attention weights are normalized, and the sentence context interaction representation is obtained based on the normalized sentence context interaction attention weights and the overall context representation of the original attribute word.
[0135] In an exemplary embodiment of the present disclosure, based on the attribute word interactive attention unit and the second average pooling unit, multi-information modeling is performed on the multi-information fusion representations of other words in the original text sequence except the context words and the attribute word context semantic representation of each word in the original attribute words to obtain the attribute word context interactive representation of the original attribute words, including: based on the attribute word interactive attention unit, the multi-information fusion representations of other words in the original text sequence except the context words are extracted, and the multi-information fusion representations of the other words are masked to obtain the multi-information fusion representation of the context words; based on the second average pooling unit, the multi-information fusion representation of the context words is average pooled to obtain the contextual overall fusion representation of the context words; the contextual overall fusion representation of the context words and the attribute word context semantic representation of each word in the original attribute words are nonlinearly processed to obtain the attribute word interactive attention weight of the original attribute words; the attribute word interactive attention weight is normalized, and the attribute word context interactive representation is determined according to the normalized attribute word interactive attention weight and the attribute word context semantic representation.
[0136] In an exemplary embodiment of the present disclosure, the multi-information fusion representation of the original attribute word is input into the sentiment calibration layer to obtain a first polarity prediction result and a first polarity reference result of the original attribute word, including: determining the first polarity reference result of the original attribute word based on the sentiment dictionary in the sentiment calibration layer; linearizing the multi-information fusion representation of the original text sequence and the multi-information fusion representation of the original attribute word based on the sentiment calibration layer to obtain the first polarity prediction result of the original attribute word.
[0137] In an exemplary embodiment of the present disclosure, the emotion representation of the dynamic interaction is input into the emotion prediction layer to obtain the second polarity prediction result of the original attribute word, including: linearizing and normalizing the emotion representation of the dynamic interaction based on the emotion prediction layer to obtain the second polarity prediction result of the original attribute word.
[0138] In an exemplary embodiment of the present disclosure, the parameters in the network model to be trained are adjusted according to the first loss function and the second loss function to obtain the sentiment classification model, including: constructing a target loss function according to the first loss function and the second loss function, and adjusting the parameters in the network model to be trained based on the target loss function to obtain the adjusted network model; and trimming the sentiment calibration layer in the adjusted network model to obtain the sentiment classification model.
[0139] The exemplary embodiment of the present disclosure also provides a sentiment classification device. Specifically, refer to Fig. 9As shown, the sentiment classification device may include a to-be-classified attribute word extraction module 910, a second splicing module 920, a second prediction module 930, and a sentiment category determination module 940. Among them:
[0140] The attribute word extraction module 910 may be used to obtain a text sentence to be classified and extract the attribute words to be classified in the text sentence to be classified;
[0141] The second concatenation module 920 may be used to concatenate the text sentences to be classified and the attribute words to be classified to obtain a concatenated sequence to be classified, and calculate a part-of-speech sequence to be classified, a dependency syntactic sequence to be classified, and a syntactic perception distance sequence to be classified of the concatenated sequence to be classified;
[0142] The second prediction module 930 can be used to input the concatenated sequence to be classified, the part-of-speech sequence to be classified, the dependency syntactic sequence to be classified, and the syntactic perception distance sequence to be classified into the sentiment classification model to obtain the sentiment polarity prediction result of the attribute word to be classified; wherein the sentiment classification model is obtained by training the network model to be trained using any of the sentiment classification model training methods described above;
[0143] The emotion category determination module 940 may be used to determine the emotion category of the text sentence to be classified according to the emotion polarity prediction result.
[0144] The specific details of the training device of the above-mentioned sentiment classification model and each module in the sentiment classification device have been described in detail in the corresponding training method of the sentiment classification model and the sentiment classification method, and will not be repeated here.
[0145] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of the modules or units described above can be further divided into being embodied by multiple modules or units.
[0146] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0147] In an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided.
[0148] Those skilled in the art will appreciate that various aspects of the present disclosure may be implemented as systems, methods or program products. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as "circuits", "modules" or "systems".
[0149] Refer to the following Fig.10 The electronic device 1000 according to this embodiment of the present disclosure is described. Fig.10 The electronic device 1000 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure. Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.
[0150] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 1 Step S110 shown in: concatenate the original text sentence and the original attribute words in the original text sentence to obtain a text concatenation sequence, and calculate the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-aware distance sequence of the text concatenation sequence; step S120: input the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic-aware distance sequence into the network model to be trained to obtain the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word; step S130: construct a first loss function according to the first polarity prediction result and the first polarity reference result, and construct a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word; step S140: adjust the parameters in the network model to be trained according to the first loss function and the second loss function to obtain the sentiment classification model.
[0151] For another example, the processing unit 1010 may execute the following Figure 7The step S710 shown in the figure: obtain the text sentence to be classified, and extract the attribute words to be classified in the text sentence to be classified; step S720: concatenate the text sentence to be classified and the attribute words to be classified to obtain the concatenated sequence to be classified, and calculate the part-of-speech sequence to be classified, the dependency syntactic sequence to be classified and the syntactic-perceptual distance sequence to be classified of the concatenated sequence to be classified; step S730: input the concatenated sequence to be classified, the part-of-speech sequence to be classified, the dependency syntactic sequence to be classified and the syntactic-perceptual distance sequence to be classified into the sentiment classification model to obtain the sentiment polarity prediction result of the attribute words to be classified; wherein the sentiment classification model is obtained by training the network model to be trained by the training method of the sentiment classification model described in any one of the above; step S740: determine the sentiment category of the text sentence to be classified according to the sentiment polarity prediction result.
[0152] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202, and may further include a read-only storage unit (ROM) 10203. The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 include but are not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment.
[0153] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0154] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or may communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0155] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.
[0156] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present disclosure may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present disclosure described in the above "Exemplary Method" section of the present specification.
[0157] The program product for implementing the above method according to the embodiment of the present disclosure may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0158] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0159] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0160] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0161] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0162] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0163] Other embodiments of the present disclosure will be readily apparent to those skilled in the art after considering the specification and practicing the inventions invented herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not invented by the present disclosure. The specification and examples are to be considered merely exemplary, and the true scope and spirit of the present disclosure are indicated by the claims.
Claims
1. A training method for a sentiment classification model, characterized in that: include: Splicing the original text sentences and the original attribute words in the original text sentences to obtain a text splicing sequence, and calculating the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic perception distance sequence of the text splicing sequence; Inputting the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence into the network model to be trained, and obtaining the first polarity prediction result, the second polarity prediction result, and the first polarity reference result of the original attribute word; Constructing a first loss function according to the first polarity prediction result and the first polarity reference result, and constructing a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word; The parameters in the network model to be trained are adjusted according to the first loss function and the second loss function to obtain the sentiment classification model.
2. The training method of the sentiment classification model according to claim 1, characterized in that: Calculating the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence of the text concatenation sequence, including: A preset part-of-speech parsing tool is called, and based on the preset part-of-speech parsing tool, an original part-of-speech sequence, an original dependency syntactic sequence, and an original syntactic-aware distance sequence corresponding to the text concatenation sequence are calculated.
3. The training method of the sentiment classification model according to claim 1, characterized in that: The network model to be trained includes a multi-type embedding layer, a multi-information aggregation layer, a multi-information dynamic interaction layer, a sentiment calibration layer and a sentiment prediction layer; The text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence are input into the network model to be trained, and the first polarity prediction result, the second polarity prediction result, and the first polarity reference result of the original attribute word are obtained, including: Inputting the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence into a multi-type embedding layer to obtain the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic-aware distance representation, and attribute word syntactic dependency type representation of the original attribute word; Input the attribute word context representation, attribute word part of speech type representation, attribute word syntactic perception distance representation and attribute word syntactic dependency type representation into the multi-information aggregation layer to obtain the multi-information fusion representation of the original attribute word, and input the multi-information fusion representation into the multi-information dynamic interaction layer to obtain the dynamic interaction sentiment representation of the original attribute word; The multi-information fusion representation of the original attribute word is input into the emotion calibration layer to obtain the first polarity prediction result and the first polarity reference result of the original attribute word, and the emotion representation of the dynamic interaction is input into the emotion prediction layer to obtain the second polarity prediction result of the original attribute word.
4. The training method of the sentiment classification model according to claim 3, characterized in that: The multi-type embedding layer includes a Bert embedding mapping unit, a part-of-speech mapping unit, a syntactic dependency type mapping unit, and a syntactic-aware distance mapping unit; The text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence, and the original syntactic-aware distance sequence are input into a multi-type embedding layer to obtain the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic-aware distance representation, and attribute word syntactic dependency type representation of the original attribute word, including: Based on the Bert embedding mapping unit, embedding processing is performed on the text concatenation sequence to obtain an original word context representation of each word in the text concatenation sequence, and the attribute word context representation of the original attribute word is determined according to the original word context representation; Embedding the original part-of-speech sequence based on the part-of-speech embedding matrix in the part-of-speech mapping unit to obtain the original part-of-speech type representation of each word in the text concatenation sequence, and determining the attribute word part-of-speech type representation of the original attribute word according to the original part-of-speech type representation; Based on the syntactic dependency type mapping unit, the original dependency syntactic sequence is embedded to obtain the original syntactic perception distance representation of each word in the text concatenation sequence, and the attribute word syntactic perception distance representation of the original attribute word is determined according to the original syntactic perception distance representation; The original syntax-aware distance sequence is embedded based on the syntax-aware distance mapping unit to obtain the original syntax dependency type representation of each word in the text concatenation sequence, and the attribute word syntax dependency type representation of the original attribute word is determined according to the original syntax dependency type representation.
5. The training method of the sentiment classification model according to claim 3, characterized in that: The multi-information aggregation layer includes a sentence-aware long short-term memory network corresponding to the original text sentences and an attribute word-aware long short-term memory network corresponding to the original attribute words; The attribute word context representation, attribute word part-of-speech type representation, attribute word syntactic perception distance representation, and attribute word syntactic dependency type representation are input into the multi-information aggregation layer to obtain the multi-information fusion representation of the original attribute word, including: Based on the attribute word-aware long short-term memory network, information fusion processing is performed on the attribute word context representation, attribute part-of-speech type representation, attribute word syntactic-aware distance representation and attribute word syntactic dependency type representation to obtain a multi-information fusion representation of the original attribute word.
6. The training method of the sentiment classification model according to claim 5, characterized in that: The processing method of the sentiment classification model also includes: Based on the sentence-aware long short-term memory network, information fusion processing is performed on the original word context representation, original part-of-speech type representation, original syntax-aware distance representation and original syntax dependency type representation of the text splicing sequence to obtain a multi-information fusion representation of each word in the text splicing sequence.
7. The training method of the sentiment classification model according to claim 3, characterized in that: The multi-information dynamic interaction layer includes a context interaction attention unit, an attribute word interaction attention unit, a first average pooling unit, a second average pooling unit and a vector splicing unit; The multi-information fusion representation is input into the multi-information dynamic interaction layer to obtain the dynamic interactive sentiment representation of the original attribute words, including: Based on the context interaction attention unit and the first average pooling unit, multi-information fusion representation of each word in the text splicing sequence, multi-information fusion representation of the original attribute word, and attribute word context representation of the original attribute word are modeled to obtain a sentence context interaction representation of the text splicing sequence; Based on the attribute word interactive attention unit and the second average pooling unit, multi-information fusion representations of other words in the original text sequence except the context words and the attribute word context semantic representation of each word in the original attribute word are modeled to obtain the attribute word context interactive representation of the original attribute word; Based on the vector concatenation unit, the sentence context interaction representation and the attribute word context interaction representation are concatenated to obtain the dynamic interaction emotion representation of the original attribute word.
8. The method for training a sentiment classification model according to claim 7, characterized in that: Based on the context interaction attention unit and the first average pooling unit, multi-information fusion representation of each word in the text splicing sequence, multi-information fusion representation of the original attribute word, and attribute word context representation of the original attribute word are modeled to obtain the sentence context interaction representation of the text splicing sequence, including: Based on the context interaction attention unit, multi-information fusion representation of each word in the text concatenation sequence and attribute word context representation of the original attribute word are modeled to obtain a sentence context semantic representation of each word in the original text sequence; Based on the context interaction attention unit, multi-information modeling is performed on the multi-information fusion representation of the original attribute word and the attribute word context representation to obtain the attribute word context semantic representation of each word in the original attribute word; Based on the first average pooling unit, average pooling processing is performed on the context semantic representation of the attribute word to obtain the overall context representation of the original attribute word, and nonlinear processing is performed on the overall context representation and the first context semantic representation to obtain the sentence context interaction attention weight of the text splicing sequence; The sentence context interaction attention weights are normalized, and the sentence context interaction representation is obtained according to the normalized sentence context interaction attention weights and the overall context representation of the original attribute words.
9. The training method of the sentiment classification model according to claim 7, characterized in that: Based on the attribute word interactive attention unit and the second average pooling unit, multi-information fusion representations of other words in the original text sequence except the context words and the attribute word context semantic representation of each word in the original attribute word are modeled to obtain the attribute word context interactive representation of the original attribute word, including: Based on the attribute word interactive attention unit, extract the multi-information fusion representation of other words in the original text sequence except the context word, and perform a mask operation on the multi-information fusion representation of the other words to obtain the multi-information fusion representation of the context word; Performing average pooling processing on the multi-information fusion representation of the context word based on the second average pooling unit to obtain the context overall fusion representation of the context word; Nonlinear processing is performed on the contextual overall fusion representation of the context word and the attribute word contextual semantic representation of each word in the original attribute word to obtain the attribute word interactive attention weight of the original attribute word; The attribute word interaction attention weight is normalized, and the attribute word context interaction representation is determined according to the normalized attribute word interaction attention weight and the attribute word context semantic representation.
10. The method for training a sentiment classification model according to claim 3, characterized in that: Inputting the multi-information fusion representation of the original attribute word into the sentiment calibration layer to obtain the first polarity prediction result and the first polarity reference result of the original attribute word, including: Determining a first polarity reference result of the original attribute word based on the emotion dictionary in the emotion calibration layer; Based on the sentiment calibration layer, linear processing is performed on the multi-information fusion representation of the original text sequence and the multi-information fusion representation of the original attribute word to obtain a first polarity prediction result of the original attribute word.
11. The method for training a sentiment classification model according to claim 3, characterized in that: Inputting the emotional representation of the dynamic interaction into the emotional prediction layer to obtain the second polarity prediction result of the original attribute word includes: Based on the emotion prediction layer, the emotion representation of the dynamic interaction is linearized and normalized to obtain a second polarity prediction result of the original attribute word.
12. The training method of the sentiment classification model according to claim 1, characterized in that: The parameters in the network model to be trained are adjusted according to the first loss function and the second loss function to obtain the sentiment classification model, including: Constructing a target loss function according to the first loss function and the second loss function, and adjusting the parameters in the network model to be trained based on the target loss function to obtain an adjusted network model; The emotion calibration layer in the adjusted network model is trimmed to obtain the emotion classification model.
13. A sentiment classification method, characterized in that: include: Acquire a text sentence to be classified, and extract attribute words to be classified in the text sentence to be classified; Splicing the text sentences to be classified and the attribute words to be classified to obtain a spliced sequence to be classified, and calculating a part-of-speech sequence to be classified, a dependency syntactic sequence to be classified, and a syntactic perception distance sequence to be classified of the spliced sequence to be classified; Input the concatenated sequence to be classified, the part-of-speech sequence to be classified, the dependency syntactic sequence to be classified, and the syntactic perception distance sequence to be classified into a sentiment classification model to obtain a sentiment polarity prediction result of the attribute word to be classified; wherein the sentiment classification model is obtained by training the network model to be trained using the training method of the sentiment classification model described in any one of claims 1 to 12; The sentiment category of the text sentence to be classified is determined according to the sentiment polarity prediction result.
14. A training device for a sentiment classification model, characterized in that: include: A first concatenation module is used to concatenate the original text sentences and the original attribute words in the original text sentences to obtain a text concatenation sequence, and calculate the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic perception distance sequence of the text concatenation sequence; A first prediction module is used to input the text concatenation sequence, the original part-of-speech sequence, the original dependency syntactic sequence and the original syntactic perception distance sequence into the network model to be trained, and obtain the first polarity prediction result, the second polarity prediction result and the first polarity reference result of the original attribute word; A loss function construction module, used to construct a first loss function according to the first polarity prediction result and the first polarity reference result, and to construct a second loss function according to the second polarity prediction result and the actual polarity label of the attribute word; A parameter adjustment module is used to adjust the parameters in the network model to be trained according to the first loss function and the second loss function to obtain the sentiment classification model.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the training method of the sentiment classification model described in any one of claims 1 to 12, and the sentiment classification method described in claim 13.
16. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; Wherein, the processor is configured to execute the training method of the sentiment classification model described in any one of claims 1-12 and the sentiment classification method described in claim 13 by executing the executable instructions.
