Text attribute-level sentiment classification method based on distance information and related device

By integrating the fusion representation information of words in a sentence and the word embedding information of attribute words, and combining local and global distance information for sentiment classification, this method solves the problem of insufficient utilization of multi-class distance information in existing methods and improves the accuracy of sentiment classification.

CN116756323BActive Publication Date: 2026-05-22CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER
Filing Date
2023-07-26
Publication Date
2026-05-22

Smart Images

  • Figure CN116756323B_ABST
    Figure CN116756323B_ABST
Patent Text Reader

Abstract

The present disclosure provides a text attribute-level sentiment classification method based on distance information and related equipment, and relates to the technical field of natural language processing. The method comprises: obtaining fusion feature information of each word in a target sentence in a text to be classified and word embedding information of an attribute word, wherein the fusion feature information of each word in the target sentence is obtained by integrating the word embedding information, local distance embedding information and global distance embedding information thereof; and processing the fusion feature information of each word in the target sentence and the word embedding information of the attribute word to obtain sentence representation information of the target sentence; and finally obtaining the sentiment classification of the target sentence according to the sentence representation information of the target sentence. When determining the sentiment classification of the target sentence, the present disclosure fully considers the influence of the local distance information and the global distance information of each word in the sentence on the sentiment classification thereof, thereby improving the accuracy of the sentiment classification of the text to be classified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of natural language processing technology, and in particular to a text attribute-level sentiment classification method and related equipment based on distance information. Background Technology

[0002] Attribute-level sentiment classification is an important subtask of attribute-level sentiment analysis, aiming to identify the sentiment polarity of attribute words in sentences. It is currently a research hotspot in the field of natural language processing and a key technology for achieving strong artificial intelligence and intelligent question answering. Attribute-level sentiment classification has attracted widespread attention not only in academia but also in industry. For example, product suppliers can use attribute-level sentiment classification methods to identify positive or negative evaluations of a product or its attributes from a large number of user text reviews, thereby enabling targeted product improvements and reducing the cost of manual research and analysis.

[0003] Existing attribute-level sentiment classification methods can be broadly categorized into three types: rule-based methods, traditional statistical machine learning methods, and deep learning methods. Rule-based methods utilize heuristic rules and sentiment dictionaries to identify the sentiment polarity of attribute words; however, these methods have poor generalization ability and cannot be applied to language and scenarios where resources are scarce. Traditional statistical machine learning methods can mine the sentiment polarity of attribute words using statistical machine models, but they heavily rely on the quality of manually designed features, which is a very time-consuming and labor-intensive task. Deep learning methods can automatically learn relevant features suitable for specific tasks, and as the number of layers increases, they can generate more abstract features. This method has been widely used in attribute-level sentiment classification and has achieved good performance.

[0004] Although deep learning-based models have achieved great success in attribute-level sentiment classification, such methods still face the problem of ignoring multi-class distance information in sentences and having insufficient ability to model multi-class distance information in sentences. Therefore, an attribute-level sentiment classification method that can effectively utilize multi-class distance information in sentences is needed.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] This disclosure provides a text attribute-level sentiment classification method and related device based on distance information, which at least to some extent overcomes the problem that existing text attribute-level sentiment classification methods do not fully utilize multi-class distance information in sentences.

[0007] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.

[0008] According to one aspect of this disclosure, a text attribute-level sentiment classification method based on distance information is provided, comprising:

[0009] Obtain the text to be classified, wherein the text to be classified includes: at least one sentence, each sentence includes: multiple words, and the multiple words contain: attribute words;

[0010] Determine the fusion representation information of each word and the word embedding information of the attribute words in the target sentence. The fusion representation information of each word is obtained by integrating the word embedding information, local distance embedding information and global distance information of each word. The target sentence is any sentence in the text to be classified.

[0011] Based on the fusion representation information of each word in the target sentence and the word embedding information of the attribute words, the sentence representation information of the target sentence is determined;

[0012] Based on the sentence representation information of the target sentence, determine the sentiment classification of the target sentence.

[0013] In some embodiments, before determining the fused representation information of each word in the target sentence and the word embedding information of the attribute words, the method further includes:

[0014] Determine the local and global distance information of each word in the target sentence;

[0015] Each word in the target sentence, along with its local and global distance information, is input into a pre-trained word information retrieval model, which outputs word embeddings, local distance representations, and global distance representations for each word in the target sentence.

[0016] In some embodiments, determining the local distance information and global distance information of each word in the target sentence includes:

[0017] The local distance information of each word in the target sentence is obtained using the following formula:

[0018]

[0019] Among them, l i This represents the relative distance between the i-th word in the target sentence and attribute words in the target sentence, where k is a hyperparameter, k≤n, and n is the number of words in the target sentence. This refers to the local distance information of the i-th word in the target sentence.

[0020] In some embodiments, determining the local distance information and global distance information of each word in the target sentence further includes:

[0021] Based on the order information of each word in the target sentence, obtain the global distance information of each word in the target sentence.

[0022] In some embodiments, determining the fused representation information of each word in the target sentence and the word embedding information of the attribute words includes:

[0023] The word embedding information, local distance representation information, and global distance representation information of each word in the target sentence are input into a pre-trained information fusion model, which outputs the fused representation information of each word in the target sentence.

[0024] In some embodiments, determining the fused representation information of each word in the target sentence and the word embedding information of the attribute words further includes:

[0025] Each word of the attribute words in the target sentence is input into a pre-trained word information acquisition model, which outputs the word embedding information of each word of the attribute words in the target sentence.

[0026] Average pooling is performed on the word embedding information of each word of the attribute words in the target sentence to obtain the word embedding information of the attribute words in the target sentence.

[0027] In some embodiments, determining the sentiment classification of the target sentence based on its sentence representation information includes:

[0028] Retrieve multiple predefined sentiment categories;

[0029] Define at least one sentiment word under each sentiment category;

[0030] Determine the embedding information corresponding to each sentiment word under each sentiment category;

[0031] Based on the sentence representation information of the target sentence and the embedding information of each sentiment word under each sentiment category, the similarity between the target sentence and each sentiment category is determined.

[0032] The sentiment category corresponding to the target sentence is determined based on the similarity between the target sentence and each sentiment category.

[0033] According to another aspect of this disclosure, a text attribute-level sentiment classification device based on distance information is also provided, comprising:

[0034] The text acquisition module is configured to acquire text to be classified, wherein the text to be classified includes: at least one sentence, each sentence includes: multiple words, and the multiple words include: attribute words;

[0035] The word information acquisition module is configured to determine the fusion representation information and the word embedding information of the attribute words for each word in the target sentence. The fusion representation information of each word is obtained by integrating the word embedding information, local distance embedding information and global distance information of each word. The target sentence is any sentence in the text to be classified.

[0036] The sentence information acquisition module is configured to determine the sentence representation information of the target sentence based on the fusion representation information of each word in the target sentence and the word embedding information of the attribute words;

[0037] The sentiment classification module is configured to determine the sentiment classification of the target sentence based on the sentence representation information of the target sentence.

[0038] According to another aspect of this disclosure, an electronic device is also provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the distance-information-based text attribute-level sentiment classification method described above by executing the executable instructions.

[0039] According to another aspect of this disclosure, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the distance-information-based text attribute-level sentiment classification method described in any one of the preceding claims.

[0040] According to another aspect of this disclosure, a computer program product is also provided, including a computer program that, when executed by a processor, implements the distance-information-based text attribute-level sentiment classification method of any of the above.

[0041] The text attribute-level sentiment classification method and related device based on distance information provided in the embodiments of this disclosure obtain the fusion feature information of each word in the target sentence of the text to be classified and the word embedding information of the attribute words. The fusion feature information of each word in the target sentence is obtained by integrating its word embedding information, local distance embedding information and global distance embedding information. The fusion feature information of each word in the target sentence and the word embedding information of the attribute words are processed to obtain the sentence representation information of the target sentence. Finally, the sentiment classification of the target sentence is obtained based on the sentence representation information of the target sentence. This achieves the goal of fully considering the role of multiple distance information, including local distance information and global distance information, in the sentence when performing text attribute-level sentiment classification, so that the results obtained by text attribute-level sentiment classification are more accurate.

[0042] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0043] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0044] Figure 1 This diagram illustrates a flowchart of a text attribute-level sentiment classification method based on distance information in an embodiment of this disclosure.

[0045] Figure 2 This diagram illustrates a flowchart of obtaining the fused representation information of each word in a target sentence according to an embodiment of the present disclosure;

[0046] Figure 3 This diagram illustrates a flowchart of obtaining word embedding information of attribute words in an embodiment of the present disclosure;

[0047] Figure 4 This diagram illustrates a flowchart for determining the sentiment classification of a target sentence in an embodiment of this disclosure;

[0048] Figure 5 A flowchart illustrating the algorithm for obtaining the sentiment classification of a target sentence in an embodiment of this disclosure is shown.

[0049] Figure 6 This document illustrates a flowchart illustrating the use of a sentiment classification model to obtain the sentiment classification of a target sentence in an embodiment of this disclosure.

[0050] Figure 7 This diagram illustrates the use of a sentiment classification model to obtain the sentiment classification of a target sentence in an embodiment of this disclosure.

[0051] Figure 8 This diagram illustrates a text attribute-level sentiment classification device based on distance information in an embodiment of the present disclosure.

[0052] Figure 9 This diagram illustrates the structure of an electronic device that implements a text attribute-level sentiment classification method based on distance information in an embodiment of this disclosure. Detailed Implementation

[0053] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0054] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0055] The specific implementation methods of the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.

[0056] Figure 1 This document illustrates a flowchart of a text attribute-level sentiment classification method based on distance information, as shown in an embodiment of the present disclosure. Figure 1 As shown in the embodiments of this disclosure, the text attribute-level sentiment classification method based on distance information includes the following steps:

[0057] S102, Obtain the text to be classified, wherein the text to be classified includes: at least one sentence, each sentence includes: multiple words, and the multiple words contain: attribute words.

[0058] The text to be classified can be any text with an undetermined sentiment category. The sentences in the text usually contain some attribute words that can be used to characterize the sentiment category. The attribute words are words specified from the text to be classified to characterize the sentiment category.

[0059] In some embodiments, after obtaining the text to be classified, attribute words in the text are specified from the text to be classified.

[0060] S104, determine the fusion representation information of each word and the word embedding information of the attribute words in the target sentence. The fusion representation information of each word is obtained by integrating the word embedding information, local distance embedding information and global distance embedding information of each word. The target sentence is any sentence in the text to be classified.

[0061] The fusion representation information of each word in the target sentence is a vector representation containing the word embedding information, local distance embedding information, and global distance embedding information. The word embedding information is a vector representation obtained by vectorizing each word in the target sentence. The local distance embedding information is a vector representation obtained by vectorizing the local distance information of each word in the target sentence. The global distance embedding information is a vector representation obtained by vectorizing the global distance information of each word in the target sentence. The word embedding information of the attribute word is a vector representation obtained by vectorizing the attribute word.

[0062] In some embodiments, word embedding information, local distance embedding information, and global distance embedding information of each word in the target sentence are integrated to obtain fused representation information of each word in the target sentence. This can be achieved by adding the word embedding information, local distance embedding information, and global distance embedding information of each word in the target sentence and using the result as the fused representation information of each word in the target sentence.

[0063] S106. Determine the sentence representation information of the target sentence based on the fusion representation information of each word in the target sentence and the word embedding information of the attribute words.

[0064] The sentence representation information of the target sentence is the result obtained by inputting the fused representation information of each word in the target sentence and the word embedding information of the attribute words into the contrastive attention mechanism.

[0065] S108. Determine the sentiment classification of the target sentence based on the sentence representation information of the target sentence.

[0066] Specifically, the sentence representation information of the target sentence is input into a pre-trained sentiment classification model for processing to output the sentiment classification of the target sentence; the sentiment classification of the target sentence is the attribute-level sentiment described in the target sentence, which can be positive sentiment, negative sentiment, or neutral sentiment.

[0067] Figure 2 A flowchart illustrating the process of obtaining fused representation information for each word in a target sentence, as shown in this embodiment of the disclosure, is provided. Figure 2 As shown in the embodiments of this disclosure, obtaining the fusion representation information of each word in the target sentence includes the following steps:

[0068] S202, determine the local distance information and global distance information of each word in the target sentence.

[0069] Local distance information can represent the distance between each word in the target sentence and the attribute word. Local distance information can also represent the relative distance between each word in the target sentence and the attribute word. The relative distance between each word in the target sentence and the attribute word can reflect the contribution of each word to the sentiment classification of the current attribute word to a certain extent. Global distance information can represent the relationship between each word in the target sentence and the target sentence. Global distance information can also represent the order of each word in the target sentence. The global distance information of each word in the target sentence can reflect the overall word order information to a certain extent.

[0070] In some embodiments, the relative distance information between each word in the target sentence and the attribute word can be used as the local distance information of each word in the target sentence, wherein the relative distance information between each word in the target sentence and the attribute word is determined according to the following formula:

[0071]

[0072] Where k is a hyperparameter, l i This represents the relative distance between the i-th word in the sentence and the attribute word. For example, when a word in the target sentence is adjacent to an attribute word, the relative distance of that word is recorded as 1. When the target sentence contains multiple attribute words, the relative distance information between the word and each of the attribute words is calculated first, and then the minimum value among them is taken as the relative distance information between the word and the attribute word. This represents the local distance information of the i-th word in the target sentence.

[0073] In some embodiments, the global distance information of each word in the target sentence can be obtained based on the order information of each word in the target sentence, wherein the global distance information of each word in the target sentence is obtained according to the following formula:

[0074]

[0075] Where i represents the global distance of the i-th word in the target sentence. For example, the global distance of the second word in the target sentence is 2. Used to represent the global distance information of the i-th word in the target sentence.

[0076] S204 inputs each word in the target sentence, along with the local and global distance information of each word in the target sentence, into a pre-trained word information acquisition model, and outputs the word embedding information, local distance embedding information, and global distance embedding information of each word in the target sentence.

[0077] Among them, the pre-trained word information acquisition model can be a model that vectorizes each word, local distance information and global distance information in the target sentence to obtain the word embedding information, local distance embedding information and global distance embedding information of each word in the target sentence.

[0078] In some embodiments, the context of the target sentence is assumed to be S = {w1, w2, ..., w...} n}, where S represents the set of each word in the target sentence, and w n Let S represent the nth word in the target sentence. When inputting S into a pre-trained word information retrieval model for vectorization, each word in S is first converted into a one-hot vector, and then the one-hot vector of each word is coupled to the pre-set word embedding matrix E. g Multiply the results to obtain the word embedding information for each word, and finally output the word embedding information for each word in the target sentence. in, Embed information for the nth word in the target sentence.

[0079] In some embodiments, when inputting the local distance information of each word in the target sentence into a pre-trained word information acquisition model for vectorization processing, the local distance information of each word in the target sentence is first converted into a one-hot vector, and the one-hot vector of each local distance information is respectively coupled with a pre-set local distance embedding matrix E. l Multiply the results to obtain the local distance embedding information for each local distance information, and finally output the local distance embedding information for each word in the target sentence. in, Embed information about the local distance of the nth word in the target sentence.

[0080] In some embodiments, when inputting the global distance information of each word in the target sentence into a pre-trained word information acquisition model for vectorization processing, the global distance information of each word in the target sentence is first converted into a one-hot vector, and the one-hot vector of each global distance information is respectively coupled with the set global distance embedding matrix E. s Multiply the results to obtain the local distance embedding information for each global distance information, and finally output the global distance embedding information for each word in the target sentence. in, Embed information about the global distance of the nth word in the target sentence.

[0081] The word embedding matrix E in the above embodiments g It can be a GloVe (Global Vectors for Word Representation) matrix; a local distance embedding matrix E l It can be a matrix obtained by randomly initializing or normally distributing the vector representation of the local distance information of each word in the target sentence; the global distance embedding matrix E s It can be a matrix obtained by randomly initializing or normally distributing the vector representation of the global distance information of each word in the target sentence.

[0082] As an optional embodiment, after obtaining the word embedding information, local distance embedding information, and global distance embedding information of each word in the target sentence through S204, the word embedding information, local distance representation information, and global distance representation information of each word in the target sentence are input into a pre-trained information fusion model, and the fused representation information of each word in the target sentence is output. Specifically, after inputting the word embedding information, local distance representation information, and global distance representation information of each word into the pre-trained information fusion model, the word embedding information, local distance representation information, and global distance representation information of each word can be processed according to the following formula:

[0083]

[0084] Among them, symbols This indicates element-wise addition. This represents the word embedding information of the i-th word in the target sentence. This represents the local distance embedding information of the i-th word in the target sentence. This represents the global distance embedding information of the i-th word in the target sentence. This represents the fused representation information of the i-th word in the target sentence.

[0085] After calculating the fusion representation information of each word in the target sentence and each word in the sentence according to formula (3), the fusion representation information of each word in the target sentence is obtained.

[0086] Figure 3 A flowchart illustrating the process of obtaining word embedding information of attribute words in an embodiment of this disclosure is shown, such as... Figure 3 As shown in the embodiments of this disclosure, obtaining the word embedding information of attribute words includes the following steps:

[0087] S302, input each word of the attribute words in the target sentence into the pre-trained word information acquisition model, and output the word embedding information of each word of the attribute words in the target sentence.

[0088] The pre-trained word information acquisition model can also be used to vectorize each word in the attribute words to obtain the word embedding information of each word in the attribute words.

[0089] In some embodiments, let the attribute words in the target sentence be A = {a1, a2, ..., a...} m}, where A represents the set of attribute words in the target sentence, a m Let A represent the m-th word in the attribute words. When A is input into a pre-trained word information retrieval model for vectorization, each attribute word in A is first converted into a one-hot vector, and the one-hot vector of each attribute word is then coupled to the pre-set word embedding matrix E. g Multiply the results to obtain the word embedding information for each attribute word, and finally output the word embedding information for each word in the attribute word. in, Embed information for the m-th attribute word in the target sentence.

[0090] S304. Perform average pooling on the word embedding information of each word of the attribute words in the target sentence to obtain the word embedding information of the attribute words in the target sentence.

[0091] Specifically, the word embedding information of each word in the attribute words obtained in S302 above is subjected to average pooling processing, and the result is used as the word embedding information of the attribute words in the target sentence.

[0092] In some embodiments, when the word embedding information of each word in the obtained attribute word is H a Then, perform average pooling to obtain the word embedding information h of the attribute words. a .

[0093] As an optional embodiment, in S106, the sentence representation information of the target sentence is determined based on the fused representation information of each word in the target sentence and the word embedding information of the attribute words. This can be calculated according to the following formula:

[0094]

[0095]

[0096]

[0097] Where γ is a hyperparameter of the contrastive attention mechanism, v i Attention to the i-th word in the target sentence, q i Let z be the attention weight of the i-th word in the target sentence, and let z be the importance of the i-th word in the target sentence when determining the sentiment classification of the target sentence. After obtaining the attention weight of each word in the target sentence through formulas (4) and (5), the sentence representation information z of the target sentence is calculated according to formula (6), where z is the attribute word related representation information containing word embedding information and multiple distance information.

[0098] Figure 4 A flowchart illustrating the determination of the sentiment classification of a target sentence in an embodiment of this disclosure is shown, such as... Figure 4 As shown in the embodiments of this disclosure, the method for determining the sentiment classification of a target sentence includes the following steps:

[0099] S402, obtain multiple predefined sentiment categories.

[0100] Among them, the predefined sentiment classification can be a vector representation obtained by vectorizing the set sentiment polarity labels.

[0101] In some embodiments, the sentiment polarity labels can be set as: positive sentiment, negative sentiment, and neutral sentiment. These three sentiment polarity labels are then converted into one-hot vectors, which are multiplied by the GloVe matrix to obtain the sentiment classification corresponding to positive sentiment. Emotional categories corresponding to negative emotions Emotional categories corresponding to neutral emotions

[0102] S404 defines at least one sentiment word under each sentiment category.

[0103] The sentiment words can be words selected from a pre-defined vocabulary that represent each sentiment polarity label. The pre-defined vocabulary is a set of words containing multiple sentiment words.

[0104] In some embodiments, when emotions are categorized into positive emotions, negative emotions, and neutral emotions, for positive emotions, the emotion words can be "good," "great," or "not bad" selected from a preset vocabulary list, or other words in the preset vocabulary list that express positive emotions; for negative emotions, the emotion words can be "bad," "poor," or "not good" selected from a preset vocabulary list, or other words in the preset vocabulary list that express negative emotions.

[0105] S406, determine the embedding information corresponding to each sentiment word under each sentiment category.

[0106] In this process, the sentiment words under each sentiment category are vectorized to obtain the embedding information corresponding to each sentiment word.

[0107] In some embodiments, when emotions are classified as positive, negative, and neutral, for positive emotions, each emotion word selected in the embodiment of S406 is converted into a one-hot vector and then multiplied by the GloVe matrix to obtain the embedding information corresponding to the emotion words of positive emotions. and For negative emotions, each emotion word selected in the S406 embodiment is converted into a one-hot vector and then multiplied by the GloVe matrix to obtain the embedding information corresponding to the emotion word of the negative emotion. and For neutral sentiment, positive and negative sentiment words are first removed from a pre-defined vocabulary. Five words are then randomly selected from the remaining vocabulary, converted into one-hot vectors, and multiplied by a GloVe matrix. The results are then subjected to average pooling to obtain the embedding information corresponding to the neutral sentiment words. This process is repeated twice to obtain two additional embedded pieces of information corresponding to the emotion words of neutral emotion. and

[0108] S408. Based on the sentence representation information of the target sentence and the corresponding embedding information of each sentiment word under each sentiment category, determine the similarity between the target sentence and each sentiment category.

[0109] The similarity between the target sentence and each sentiment category is used to represent the degree of association between the target sentence and each sentiment category. The similarity between the target sentence and each sentiment category can be the cosine similarity between the sentence representation information of the target sentence and the embedding information corresponding to each sentiment category.

[0110] In some embodiments, the cosine similarity between the target sentence and each sentiment category is calculated according to the following formula, and is used as the similarity between the target sentence and each sentiment category:

[0111]

[0112]

[0113]

[0114] Where cos(·) represents the calculation of cosine similarity, and score poo The cosine similarity between the target sentence and positive sentiment is used to calculate the score. neg The cosine similarity between the target sentence and negative sentiment is used to calculate the score. neu Cosine similarity between the target sentence and neutral sentiment.

[0115] S410, Determine the sentiment category corresponding to the target sentence based on the similarity between the target sentence and each sentiment category.

[0116] Specifically, based on the similarity between the target sentence and each sentiment category calculated in S410, the sentiment category corresponding to the highest similarity value is selected as the sentiment category of the target sentence.

[0117] In some embodiments, the sentiment classification of the target sentence is obtained based on the similarity between the target sentence and each sentiment classification using the following formula:

[0118]

[0119] The argmax function is used to obtain the sentiment polarity label corresponding to the maximum cosine similarity of the target sentence. d represents the number of categories of emotional polarity. Let C ∈ {pos, neg, neu} be the number of the sentiment polarity label, and C ∈ {pos, neg, neu} be the set of sentiment categories for the label. In this embodiment, 0 can represent a positive sentiment label, 1 represents a negative sentiment label, and 2 represents a neutral sentiment label. Therefore, based on the obtained... Determine the emotional polarity of the target sentence.

[0120] As an optional embodiment, this disclosure also provides a sentiment classification model for implementing a distance-based text attribute-level sentiment classification method. This model includes a multi-information embedding layer, a contrastive attention layer, and a sentiment computation layer. Figure 5 The flowchart illustrates the algorithm that uses a sentiment classification model to process a target sentence and obtain its sentiment classification. Figure 5 As shown, the algorithm includes the following steps:

[0121] S502, input each word in the target sentence, along with the local distance information and global distance information of each word, into the most information embedding layer to obtain the word embedding information, local distance embedding information, and global distance embedding information of each word in the target sentence. Then, add the three types of embedding information element by element to obtain the fused representation information of each word in the sentence.

[0122] In this step, the local distance information of each word in the target sentence is obtained by processing each word in the target sentence using formula (1); the global distance information of each word in the target sentence is obtained by processing each word in the target sentence using formula (2); and according to the embodiment provided in S204, the word embedding information, local distance embedding information and global distance embedding information of each word in the target sentence are obtained; finally, the obtained word embedding information, local distance embedding information and global distance embedding information of each word in the target sentence are processed according to formula (3) to obtain the fusion representation information of each word in the target sentence.

[0123] S504, input the attribute words into the multi-information embedding layer to obtain the embedding information of the attribute words.

[0124] In this step, each word in the attribute word is converted into a corresponding one-hot vector, and the one-hot vector corresponding to each word in the attribute word is multiplied by the set word embedding matrix to obtain the embedding information of each word in the attribute word. Then, the obtained embedding information of each word in the attribute word is subjected to average pooling to obtain the embedding information of the attribute word.

[0125] S506 inputs the fused representation information and attribute word representation information of each word output by the multi-information embedding layer into the contrastive attention layer for processing to obtain the sentence representation information of the target sentence.

[0126] In this step, the contrast attention layer processes the fusion representation information of each word in the target sentence and the word embedding information of the attribute words according to formulas (4) to (6) to obtain the sentence representation information of the target sentence. This sentence representation information includes the semantic information and various distance information of the target sentence.

[0127] S508 defines sentiment categories and representative sentiment words corresponding to each sentiment category, and maps sentiment categories and corresponding representative sentiment words to sentiment category embedding information and sentiment word embedding information, respectively; inputs sentence representation information into the sentiment computing layer, calculates the sentiment semantic similarity between sentence representation information and each sentiment category embedding information and sentiment word embedding information, and determines the sentiment category of sentence representation information based on sentiment semantic similarity.

[0128] In this step, the sentiment classification is set as positive sentiment, negative sentiment and neutral sentiment. The sentiment computing layer first performs vectorization processing on the sentiment classification according to the embodiment in S402 to obtain the sentiment classification embedding information, and obtains the sentiment word embedding information corresponding to positive sentiment, negative sentiment and neutral sentiment according to the embodiments in S404 to S406. The cosine similarity between the target sentence and each sentiment classification is calculated using formulas (7) to (9) respectively, and is used as the sentiment semantic similarity between the target sentence and each sentiment classification. The cosine similarity between the target sentence and each sentiment classification is processed using formula (10), and the sentiment polarity label with the largest cosine similarity value is used as the sentiment polarity of the sentence representation information. The sentiment classification of the target sentence is determined according to the sentiment polarity of the sentence representation information.

[0129] As an optional embodiment, Figure 6 It also provides a step-by-step diagram of obtaining the sentiment classification of the target sentence using a sentiment classification model, such as... Figure 6 As shown, the sentiment classification model is used to obtain the sentiment classification of the target sentence, including the following steps:

[0130] S602, Input each word in the target sentence and its distance information.

[0131] In this step, each word in the target sentence is input into the multi-information embedding layer, along with the local and global distance information of each word in the target sentence obtained according to formulas (1) and (2).

[0132] S604, Input attribute words.

[0133] In this step, attribute words from the target sentence are input into the multi-information embedding layer.

[0134] S606 maps each word and its distance information in the target sentence to the corresponding embedding information.

[0135] In this step, each word in the target sentence, along with its local and global distance information, is converted into a corresponding one-hot vector. The one-hot vector corresponding to each word in the target sentence is then multiplied by the GloVe matrix to obtain the word embedding information of each word in the target sentence. The one-hot vector corresponding to the local distance information of each word in the target sentence is then multiplied by the local distance embedding matrix to obtain the local distance embedding information of each word in the target sentence. Finally, the one-hot vector corresponding to the global distance information of each word in the target sentence is then multiplied by the global distance embedding matrix to obtain the global distance embedding information of each word in the target sentence.

[0136] S608 maps attribute words to attribute word embedding information.

[0137] In this step, the multi-information embedding layer converts each word in the attribute word into a one-hot vector, multiplies the one-hot vector corresponding to each word in the attribute word with the GloVe matrix to obtain the embedding information of each word in the attribute word, and performs average pooling on the embedding information of each word in the attribute word to obtain the attribute word embedding information.

[0138] S610 integrates various embedded information to obtain fused representation information.

[0139] In this step, the multi-information embedding layer processes the word embedding information, local distance embedding information and global distance embedding information of each word in the target sentence obtained in S606 according to formula (3) to obtain fused representation information.

[0140] S612, Obtain sentence representation information of the target sentence.

[0141] In this step, the contrastive attention layer uses formulas (4) to (6) to process the attribute word embedding information obtained in S608 and the fusion representation information obtained in S610 according to the contrastive attention mechanism, so as to obtain the sentence representation information of the target sentence.

[0142] S614, determine the sentiment categories and the representative sentiment words for each sentiment category.

[0143] In this step, the sentiment computing layer first specifies sentiment polarity labels and representative sentiment words for each sentiment polarity label based on the actual situation. Sentiment polarity labels can be specified as positive sentiment, negative sentiment, and neutral sentiment, and the representative sentiment words corresponding to positive sentiment can be specified as good, great, and not bad; the representative sentiment words corresponding to negative sentiment can be specified as bad, poor, and unpleasant.

[0144] S616 maps sentiment categories and representative sentiment words to corresponding embedded information.

[0145] In this step, the embedding information corresponding to the emotional polarity label and representative emotional words is determined according to the process shown in the embodiment in S406.

[0146] S618, calculate the similarity between sentence representation information and the embedded information corresponding to sentiment classification and representative sentiment words.

[0147] In this step, according to formulas (7) to (9), the cosine similarity between the sentence representation information and the embedded information corresponding to positive emotion, negative emotion and neutral emotion is calculated respectively, and used as the similarity information between the sentence representation information and positive emotion, negative emotion and neutral emotion respectively.

[0148] S620: Based on the calculated similarity, determine the sentiment classification of the target sentence.

[0149] In this step, formula (10) is used to process the similarity information between the sentence representation information obtained in S618 and positive, negative and neutral emotions, respectively, to obtain the emotional polarity label corresponding to the sentence representation information, which is then used as the emotional classification of the target sentence.

[0150] As an optional embodiment, Figure 7A schematic diagram is shown of obtaining the sentiment classification of a target sentence using a sentiment classification model, which includes a multi-information embedding layer, a contrastive attention layer, and a sentiment computation layer. The multi-information embedding layer maps the target sentence context, local distance information, and global distance information of each word in the target sentence to obtain corresponding embedding information, and then fuses these to obtain fused representation information of each word in the target sentence before inputting it into the contrastive attention layer. Selected attribute words in the target sentence are also mapped, and the embedding information of each attribute word is then averaged to obtain attribute word embedding information, which is then input into the contrastive attention layer. The contrastive attention layer processes the received fused representation information and attribute word embedding information through a contrastive attention mechanism to obtain the representation information of the target sentence, which serves as the sentence representation related to the attribute words. When processing the fused representation information and attribute word embedding information using the contrastive attention mechanism, the processing can be performed according to formulas (4) to (6), and the obtained sentence representation related to the attribute words is then input into the sentiment computation layer. The sentiment computing layer first specifies the sentiment polarity label and the representative sentiment word of each sentiment polarity label according to the actual situation, and determines the embedding information corresponding to the sentiment polarity label and the representative sentiment word; then, according to formulas (7) to (9), it calculates the similarity between the sentence representation and sentiment classification of the attribute word and the embedding information corresponding to the representative sentiment word; finally, it processes the calculated similarity according to the preset sentiment polarity determination strategy to obtain the sentiment polarity of the target sentence. When processing the calculated similarity using the preset sentiment polarity determination strategy, it can be processed according to formula (10).

[0151] In summary, the text attribute-level sentiment classification method based on distance information provided in this disclosure obtains the fusion feature information of each word in the target sentence of the text to be classified and the word embedding information of the attribute words. The fusion feature information of each word in the target sentence is obtained by integrating its word embedding information, local distance embedding information, and global distance embedding information. The fusion feature information of each word in the target sentence and the word embedding information of the attribute words are then processed to obtain the sentence representation information of the target sentence. Finally, the sentiment classification of the target sentence is obtained based on the sentence representation information. This method achieves the goal of comprehensively considering the word embedding information and multiple distance information in the target sentence to determine the sentiment classification of the target sentence, overcoming the problem that existing attribute-level sentiment classification methods do not fully utilize the multiple types of distance information in the sentence. In the process of inverse sentiment classification, this method not only focuses on the surrounding word information of the attribute words but also fully considers the influence of the local and global distance information of the target sentence on the sentence's sentiment classification.

[0152] Furthermore, the text attribute-level sentiment classification method provided in this disclosure also obtains the sentiment semantic association between attribute words and different words in the sentence through a comparative attention mechanism. This allows for better utilization of embedding information, local distance information, and global distance information to determine the sentiment semantic weight distribution in the target sentence, generating more accurate sentence representation information related to attribute words that contain semantic information and multiple distance information, thereby improving the accuracy of the text attribute-level sentiment classification method.

[0153] Furthermore, the text attribute-level sentiment classification method and model based on distance information provided in this disclosure do not require large-scale labeled data for model training when performing text sentiment classification, which enables the model to be better applied to scenarios with insufficient labeled data and improves the model's generalization ability.

[0154] Based on the same inventive concept, this disclosure also provides a text attribute-level sentiment classification device based on distance information, as described in the following embodiments. Since the principle by which this device solves the problem is similar to that of the above-described method embodiments, the implementation of this device embodiment can refer to the implementation of the above-described method embodiments, and repeated details will not be elaborated further.

[0155] Figure 8 This diagram illustrates a text attribute-level sentiment classification device based on distance information, as shown in an embodiment of the present disclosure. Figure 8 As shown, the device includes:

[0156] The text acquisition module 802 is configured to acquire text to be classified, wherein the text to be classified includes: at least one sentence, each sentence includes: multiple words, and the multiple words contain: attribute words;

[0157] The word information acquisition module 804 is configured to determine the fusion representation information and the word embedding information of the attribute words for each word in the target sentence. The fusion representation information of each word is obtained by integrating the word embedding information, local distance embedding information and global distance information of each word. The target sentence is any sentence in the text to be classified.

[0158] The sentence information acquisition module 806 is configured to determine the sentence representation information of the target sentence based on the fusion representation information of each word in the target sentence and the word embedding information of the attribute words;

[0159] The sentiment classification module 808 is configured to determine the sentiment classification of a target sentence based on the sentence representation information of the target sentence.

[0160] It should be noted that the text acquisition module 802, word information acquisition module 804, sentence information acquisition module 806, and sentiment classification module 808 mentioned above correspond to S102 to S108 in the method embodiment. The examples and application scenarios implemented by these modules and their corresponding steps are the same, but they are not limited to the content disclosed in the above method embodiment. It should be noted that the above modules, as part of the device, can be executed in a computer system such as a set of computer-executable instructions.

[0161] As an optional embodiment, the word information acquisition module 804 is further configured to determine the local distance information and global distance information of each word in the target sentence; input each word in the target sentence, the local distance information and global distance information of each word in the target sentence into a pre-trained word information acquisition model, and output the word embedding information, local distance representation information and global distance representation information of each word in the target sentence.

[0162] As an optional embodiment, the word information acquisition module 804 is also configured to acquire local distance information of each word in the target sentence according to formula (1).

[0163] As an optional embodiment, the word information acquisition module 804 is also configured to acquire global distance information of each word in the target sentence based on the order information of each word in the target sentence.

[0164] As an optional embodiment, the word information acquisition module 804 is further configured to input the word embedding information, local distance representation information, and global distance representation information of each word in the target sentence into a pre-trained information fusion model, and output the fused representation information of each word in the target sentence.

[0165] As an optional embodiment, the word information acquisition module 804 is further configured to input each word of the attribute words in the target sentence into a pre-trained word information acquisition model, output the word embedding information of each word of the attribute words in the target sentence, and perform average pooling processing on the word embedding information of each word of the attribute words in the target sentence to obtain the word embedding information of the attribute words in the target sentence.

[0166] As an optional embodiment, the sentiment classification module 808 is further configured to acquire a plurality of predefined sentiment classifications; define at least one sentiment word under each sentiment classification; determine the embedding information corresponding to each sentiment word under each sentiment classification; determine the similarity between the target sentence and each sentiment classification based on the sentence representation information of the target sentence and the embedding information corresponding to each sentiment word under each sentiment classification; and determine the sentiment classification corresponding to the target sentence based on the similarity between the target sentence and each sentiment classification.

[0167] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."

[0168] The following reference Figure 9 To describe an electronic device 900 according to such an embodiment of the present disclosure. Figure 9 The electronic device 900 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.

[0169] like Figure 9 As shown, the electronic device 900 is manifested in the form of a general-purpose computing device. The components of the electronic device 900 may include, but are not limited to: at least one processing unit 910, at least one storage unit 920, and a bus 930 connecting different system components (including the storage unit 920 and the processing unit 910).

[0170] The storage unit stores program code that can be executed by the processing unit 910, causing the processing unit 910 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 910 can perform the following steps of the above method embodiments: obtaining text to be classified, wherein the text to be classified includes: at least one sentence, each sentence including: multiple words, the multiple words including: attribute words; determining the fusion representation information of each word in the target sentence and the word embedding information of the attribute words, wherein the fusion representation information of each word is obtained by integrating the word embedding information, local distance embedding information and global distance information of each word, wherein the target sentence is any sentence in the text to be classified; determining the sentence representation information of the target sentence based on the fusion representation information of each word in the target sentence and the word embedding information of the attribute words; determining the sentiment classification of the target sentence based on the sentence representation information of the target sentence.

[0171] Storage unit 920 may include readable media in the form of volatile storage units, such as random access memory (RAM) 9201 and / or cache memory 9202, and may further include read-only memory (ROM) 9203.

[0172] Storage unit 920 may also include a program / utility 9204 having a set (at least one) program module 9205, such program module 9205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0173] Bus 930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0174] Electronic device 900 can also communicate with one or more external devices 940 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 900, and / or with any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 950. Furthermore, electronic device 900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 960. As shown, network adapter 960 communicates with other modules of electronic device 900 via bus 930. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0175] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0176] In particular, according to embodiments of this disclosure, the process described above with reference to the flowchart can be implemented as a computer program product, which includes a computer program that, when executed by a processor, implements the above-described text attribute-level sentiment classification method based on distance information.

[0177] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps according to various exemplary embodiments of this disclosure described in the "Exemplary Methods" section above.

[0178] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0179] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.

[0180] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0181] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0182] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0183] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.

[0184] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0185] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.

Claims

1. A text attribute-level sentiment classification method based on distance information, characterized in that, include: Obtain the text to be classified, the text to be classified includes: at least one sentence, each sentence includes: multiple words, the multiple words include: attribute words; The fusion representation information of each word and the word embedding information of the attribute words in the target sentence are determined. The fusion representation information of each word is obtained by element-wise summing the word embedding information, local distance representation information, and global distance representation information of each word. The target sentence is any sentence in the text to be classified. The local distance representation information is determined based on the relative distance information between the word and the attribute words. The global distance representation information is determined based on the order information of the word in the target sentence. The relative distance information between the word and the attribute words is the minimum value among the relative distance information between the word and each of the attribute words. The relative distance information between each word in the target sentence and the attribute words is determined by the following formula: in, For the target sentence, the first... i The relative distance information between each word and attribute words in the target sentence. k For hyperparameters, , n The number of words in the target sentence. For the target sentence, the first... i Local distance information for each word; The fused representation information of each word in the target sentence and the word embedding information of the attribute words are input into the contrast attention layer for processing to obtain the sentence representation information of the target sentence. Based on the sentence representation information of the target sentence, the sentiment classification of the target sentence is determined.

2. The text attribute-level sentiment classification method based on distance information according to claim 1, characterized in that, Before determining the fused representation information of each word in the target sentence and the word embedding information of the attribute words, the method further includes: Determine the local and global distance information of each word in the target sentence; Each word in the target sentence, along with its local and global distance information, is input into a pre-trained word information acquisition model, which outputs word embedding information, local distance representation information, and global distance representation information for each word in the target sentence.

3. The text attribute-level sentiment classification method based on distance information according to claim 2, characterized in that, The determination of the local distance information and global distance information of each word in the target sentence further includes: Based on the order information of each word in the target sentence, obtain the global distance information of each word in the target sentence.

4. The text attribute-level sentiment classification method based on distance information according to claim 1, characterized in that, The determination of the fused representation information of each word in the target sentence and the word embedding information of the attribute words includes: The word embedding information, local distance representation information, and global distance representation information of each word in the target sentence are input into a pre-trained information fusion model, which outputs the fusion representation information of each word in the target sentence.

5. The text attribute-level sentiment classification method based on distance information according to claim 4, characterized in that, The determination of the fused representation information of each word in the target sentence and the word embedding information of the attribute words also includes: Each word of the attribute words in the target sentence is input into a pre-trained word information acquisition model, and the word embedding information of each word of the attribute words in the target sentence is output. Average pooling is performed on the word embedding information of each word of the attribute words in the target sentence to obtain the word embedding information of the attribute words in the target sentence.

6. The text attribute-level sentiment classification method based on distance information according to claim 1, characterized in that, The step of determining the sentiment classification of the target sentence based on its sentence representation information includes: Retrieve multiple predefined sentiment categories; Define at least one sentiment word under each sentiment category; Determine the embedding information corresponding to each sentiment word under each sentiment category; Based on the sentence representation information of the target sentence and the embedding information corresponding to each sentiment word under each sentiment category, the similarity between the target sentence and each sentiment category is determined. The sentiment category corresponding to the target sentence is determined based on the similarity between the target sentence and each sentiment category.

7. A text attribute-level sentiment classification device based on distance information, characterized in that, include: The text acquisition module is configured to acquire text to be classified, the text to be classified including: at least one sentence, each sentence including: multiple words, the multiple words including: attribute words; The word information acquisition module is configured to determine the fusion representation information of each word and the word embedding information of the attribute words in the target sentence. The fusion representation information of each word is obtained by element-wise summing the word representation information, local distance representation information, and global distance information of each word. The target sentence is any sentence in the text to be classified. The local distance representation information is determined based on the relative distance information between the word and the attribute words. The global distance representation information is determined based on the order information of the word in the target sentence. The relative distance information between the word and the attribute words is the minimum value among the relative distance information between the word and each word in the attribute words. The relative distance information between each word in the target sentence and the attribute words is determined by the following formula: in, For the target sentence, the first... i The relative distance information between each word and attribute words in the target sentence. k For hyperparameters, , n The number of words in the target sentence. For the target sentence, the first... i Local distance information for each word; The sentence information acquisition module is configured to input the fused representation information of each word in the target sentence and the word embedding information of the attribute words into the comparison attention layer for processing, so as to obtain the sentence representation information of the target sentence; The sentiment classification module is configured to determine the sentiment classification of the target sentence based on the sentence representation information of the target sentence.

8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the distance-information-based text attribute-level sentiment classification method according to any one of claims 1 to 6 by executing the executable instructions.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the text attribute-level sentiment classification method based on distance information as described in any one of claims 1 to 6.