Aspect-level sentiment analysis method and system based on domain knowledge graph

By constructing a domain knowledge graph and combining the masked language modeling method of pre-trained language models, the problem of limited coverage and bias of label words in aspect-level sentiment analysis is solved, and higher emotional polarity prediction is achieved Accuracy, especially when data is scarce.

CN117056524BActive Publication Date: 2025-02-11TIANZE SMART TECH (CHENGDU) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310278253.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-21
Publication Date
2025-02-11
Estimated Expiration
2043-03-21

AI Technical Summary

Technical Problem

Traditional cue learning methods have problems with limited coverage of label words and bias in aspect-level sentiment analysis tasks, especially in zero-sample or small-sample learning situations, making it difficult to accurately predict emotional polarity.

Method used

Enhance prompt performance by constructing a domain-based knowledge graph based approach. The specific steps include obtaining the target text, analyzing and extracting target terms, building a domain knowledge graph, using a pre-trained language model to perform mask language modeling, and querying relevant descriptive words based on the domain knowledge graph to fill the mask.

Benefits of technology

The accuracy of aspect-level sentiment analysis tasks is improved, especially in the case of zero or few samples, and the possible deviations in manual entry of prompts and insufficient coverage of tag words are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117056524B_ABST
    Figure CN117056524B_ABST
Patent Text Reader

Abstract

The present invention provides an aspect-level sentiment analysis method and system based on a domain knowledge graph, the method comprising: obtaining a target text, analyzing and extracting target aspect words; constructing a mask language template based on prompt learning; constructing a domain knowledge graph of the domain involved in the target text; splicing the target text and the mask language template and inputting them into a pre-trained language model for mask language modeling, querying the target aspect category in the domain knowledge graph according to the target aspect words, extracting all descriptive words associated with the target aspect category as target aspect descriptive words and filling in the mask; respectively predicting the aspect-level sentiment polarity of the target aspect descriptive words, and obtaining the aspect-level sentiment polarity of the target text. The present invention can maintain a high prediction accuracy for both ATSC and ACSC tasks in the case of zero or few samples, avoiding the problem of deviation in manually entering prompts and limiting the coverage of label words.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an aspect-level sentiment analysis method and system based on a domain knowledge graph. Background Art

[0002] Sentiment analysis is an important research direction within the field of natural language processing (NLP), focusing on extracting and analyzing the sentiments expressed in text data. Aspect-based sentiment analysis (ABSA) is a subtask of sentiment analysis that provides a more detailed analysis of the sentiments of specific items or categories. This insight can be leveraged by businesses to identify the pros and cons of products and reveal unexpected aspects that generate positive or negative sentiment. ABSA can be divided into two variants: aspect-category sentiment classification (ACSC) and aspect-target sentiment classification (ATSC). ACSC focuses on determining the overall sentiment towards a broader category or aspect, while ATSC aims to determine the sentiment towards a more specific target or entity. By using ABSA, businesses can gain a more comprehensive understanding of customers' opinions and attitudes towards their products or services, which can provide information support for product development, marketing strategies, and customer service programs.

[0003] In recent years, there has been an important shift in the field of natural language processing towards pre-trained language models (PLMs), which rely on their superior performance as the basis for many downstream tasks. Researchers have conducted extensive studies to gain insight into the principles of the PLM effect, which acquires rich knowledge during the pre-training process. Therefore, how to stimulate and utilize this knowledge has attracted increasing attention. Fine-tuning is a traditional method used to achieve this goal, where additional classifiers are added on top of PLMs and the model is further trained based on a classification objective. Fine-tuning has achieved promising results through supervised learning strategies. However, applying fine-tuning to few-shot learning and zero-shot learning scenarios remains a challenging task, as the additional classifiers require a sufficient amount of labeled training data for tuning.

[0004] Recent research has shown that prompt learning can be used to connect pre-training objectives and downstream tasks, improving the performance of pre-trained language models on few-shot and zero-shot tasks. For example, research on model adjustment using GPT-3 and LAMA showed that using discrete or continuous prompts can improve the performance of PLMs on these tasks. This connection between vocabulary and label space has a significant impact on classification performance.

[0005] Traditional cue learning methods use a one-to-one mapping of manual label words to lexicalization modules for each template. However, manual lexicalizers are usually limited by limited information and have difficulty making accurate predictions based on limited information. This one-to-one mapping limits the coverage of label words, and thus lacks sufficient information to make accurate predictions, which may introduce bias in the lexicalizer. In addition, in the ABSA task, people tend to use more specific and targeted adjectives when evaluating different aspects, such as using "delicious" instead of "good" when evaluating food, and the semantics of such label words are important in predictions, which cannot be addressed by existing cue learning methods. Summary of the invention

[0006] In order to solve the above technical problems, the present invention aims to provide a new idea for enhancing the prompting performance in ABSA tasks by integrating external knowledge graphs. An effective domain knowledge graph is constructed by using a combination of word network extraction and small-scale data annotation. The resulting linguistic modules provide richer and more specific label word mappings, which help to improve the accuracy of ABSA tasks.

[0007] In order to achieve the above technical objectives, the technical solution provided by the present invention includes:

[0008] The aspect-level sentiment analysis method based on domain knowledge graph includes the following steps:

[0009] Obtain the target text, analyze and extract the target aspect words of the target text; construct a mask language template based on prompt learning;

[0010] Constructing a domain knowledge graph of the domain involved in the target text, wherein the domain knowledge graph includes several aspect categories included in the domain, and their corresponding hypernymous descriptor-hyponymous descriptor and descriptor-aspect relationships;

[0011] The target text and the mask language template are concatenated and input into the pre-trained language model for mask language modeling. The target aspect category is queried in the domain knowledge graph according to the target aspect word, and all description words associated with the target aspect category are extracted as target aspect description words and filled into the mask.

[0012] The aspect-level sentiment polarities of the target aspect description words are predicted respectively to obtain the aspect-level sentiment polarities of the target text.

[0013] In some preferred embodiments, the method for constructing a domain knowledge graph of a domain involved in a target text includes:

[0014] Acquire several evaluation texts in the same field as the target text, extract aspect words and descriptive words of each aspect contained in the evaluation texts, and establish an aspect-descriptive word list;

[0015] Based on the aspect-descriptive word list, the aspect categories and their corresponding descriptive word-descriptive word and descriptive word-aspect relationships are extracted from the word network database to construct a domain knowledge graph.

[0016] In some preferred embodiments, it is characterized in that the method of obtaining the aspect-level sentiment polarity of the target text includes:

[0017] The aspect-level sentiment polarity mapped to the target aspect description word with the highest prediction score is used as the aspect-level sentiment polarity of the target text.

[0018] In some preferred embodiments, the method for obtaining the aspect-level sentiment polarity of the target text includes:

[0019] The prediction scores of all target aspect description words are weighted averaged according to the aspect-level sentiment polarity category, and the aspect-level sentiment polarity with the highest weighted average is taken as the aspect-level sentiment polarity of the target text.

[0020] In some preferred embodiments, the language model includes a BERT model or a GPT model.

[0021] In some preferred embodiments, the wordnet database includes the WordNet thesaurus and / or the ChineseWordNet thesaurus.

[0022] The present invention also provides an aspect-level sentiment analysis system based on a domain knowledge graph, comprising:

[0023] A first acquisition module is configured to acquire a target text and analyze and extract target aspect words from the target text;

[0024] A domain knowledge graph module is configured to have a domain knowledge graph with built-in categories of aspects of the domain involved in the target text and their corresponding hypernymous descriptor-hyponymous descriptor and descriptor-aspect relationships;

[0025] A masked language template module is configured to have a built-in masked language template based on prompt learning, and concatenates the target text and the masked language template as the first output text;

[0026] A pre-trained language model is set to have a pre-trained language model built in, the first output text is input for masked language modeling, a target aspect category is queried in the domain knowledge graph according to the target aspect word, all description words associated with the target aspect category are extracted as target aspect description words, and filled in the mask;

[0027] The prediction and analysis module is configured to predict the aspect-level sentiment polarity of the target aspect description words respectively to obtain the aspect-level sentiment polarity of the target text.

[0028] In some preferred embodiments, the method for constructing the domain knowledge graph includes:

[0029] Acquire several evaluation texts in the same field as the target text, extract aspect words and descriptive words of each aspect contained in the evaluation texts, and establish an aspect-descriptive word list;

[0030] Based on the aspect-descriptive word list, the aspect categories and their corresponding descriptive word-descriptive word and descriptive word-aspect relationships are extracted from the word network database to construct a domain knowledge graph.

[0031] In some preferred embodiments, the prediction analysis module includes a first prediction analysis unit configured to use the aspect-level sentiment polarity mapped to the target aspect description word with the highest prediction score as the aspect-level sentiment polarity of the target text.

[0032] In some preferred embodiments, the prediction analysis module includes a second prediction analysis unit, which is configured to perform weighted averaging of the prediction scores of all target aspect description words according to aspect-level sentiment polarity categories, and take the aspect-level sentiment polarity with the highest weighted average as the aspect-level sentiment polarity of the target text.

[0033] Beneficial Effects

[0034] By using the domain knowledge graph of the field involved that is highly targeted to obtain comprehensive descriptive words and entity relationships, it can maintain a high prediction accuracy for both ATSC and ACSC tasks in the case of zero or few samples, avoiding the possible deviations in manually entering prompts and limiting the coverage of label words. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A schematic diagram of the steps of an aspect-level sentiment analysis method based on a domain knowledge graph in a preferred embodiment of the present invention;

[0036] Figure 2 A schematic diagram of the steps of a method for constructing a domain knowledge graph of a domain involved in a target text in another preferred embodiment of the present invention;

[0037] Figure 3 It is a schematic diagram of the structure of an aspect-level sentiment analysis system based on a domain knowledge graph in a preferred embodiment of the present invention;

[0038] Figure 4 A schematic diagram of the process and structure of a mask language template constructed in another preferred embodiment of the present invention;

[0039] Figure 5 It is a statistical diagram of experimental results of another preferred embodiment of the present invention and the mainstream baseline model in the current field;

[0040] Figure 6 It is a line graph of the experimental results of another preferred embodiment of the present invention and the mainstream baseline model in the current field; DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention is further described below in conjunction with the accompanying drawings. In the description of the present invention, it should be understood that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inside", "outside" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention.

[0042] Example 1

[0043] like Figure 1 As shown, this embodiment provides an aspect-level sentiment analysis method based on a domain knowledge graph, comprising the following steps:

[0044] S1. Obtain the target text, analyze and extract the target aspect words of the target text; and construct a masked language template based on prompt learning.

[0045] Among them, the aspect mainly includes category and item. The predictions for the two are called aspect category sentiment analysis (ACSC) and aspect target sentiment analysis (ATSC), which are collectively referred to as aspect level sentiment analysis (ABSA). ACSC focuses on determining the overall sentiment towards a broader category or aspect, while ATSC aims to determine the sentiment towards a more specific target or entity. By using ABSA, users' opinions and attitudes towards the target product or service can be more fully understood, which can provide information support for enterprises in product development, marketing strategies and customer service plans.

[0046] The target text refers to the text data whose aspect-level sentiment polarity needs to be predicted, which contains different words used by people to express their feelings about different aspects of a specific target. For example, food is often described as "delicious" or "unpalatable", while the environment may be labeled as "neat" or "messy".

[0047] The target aspect words extracted from the target text refer to the aspect term extraction task (ATE), which is a basic subtask in aspect-level sentiment analysis. Its goal is to extract aspect phrases that express emotions of users given a target text. For example, for the comment "The Bombay style bhelpuri is very palatable.", ATE hopes to extract the aspect word "bhelpuri". There are a lot of studies on this task in the prior art, specifically including various models and algorithms based on unsupervised, semi-supervised and unsupervised. Those skilled in the art can select a suitable model in the prior art to implement this task according to actual needs, and the present invention does not make further limitations on this.

[0048] The prompt learning is currently recognized as the fourth stage (also known as the fourth paradigm) in the field of natural language processing (NLP), that is, pre-training->prompt->prediction. Its focus is to adapt the downstream tasks to the language model, rather than the previous adaptation to changes in downstream tasks by improving the language model. Therefore, the parameters of the pre-trained model are generally not changed. The specific method is to provide a contextual prompt about the input, which enters the model together with the input, so as to tell and guide the model what task you should do next. For the task of the present invention, it is to formalize the aspect-level sentiment classification task as a masked language modeling problem. Specifically, a template is used to package the input sequence, and the template is a natural language text. For example, the following template example:

[0049] I felt the{aspect}was[MASK].

[0050] I[MASK]{aspect}.

[0051] The{aspect}made me feel[MASK].

[0052] The{aspect}is[MASK].

[0053] Among them, Figure 4 As shown, {aspect} is the target aspect word, which is extracted by the previous step; [MASK] is the mask of the aspect word description word. The specific selection or construction of the mask language template can be obtained by those skilled in the art based on the prior art, and the present invention does not make any further limitation.

[0054] S2. Construct a domain knowledge graph of the field involved in the target text, wherein the domain knowledge graph includes several aspect categories included in the field, and their corresponding superordinate descriptor-subordinate descriptor and descriptor-aspect relationships.

[0055] It should be understood that in the ATSC or ACSC tasks, the core challenge is to expand the triadic sentiment to a more fine-grained sentiment. People use different words to describe their feelings about different aspects. For example, food is often described as "delicious" or "unpalatable", while the environment may be labeled as "neat" or "messy". Using prompt learning to predict the sentiment of a sentence for a specific aspect involves predicting mask words based on the context. This process is not a simple selection, as there may be many suitable words in such a context. Therefore, the descriptive words for the ABSA task should have three characteristics: wide coverage, less subjective bias, and strong aspect relevance. This comprehensive prediction is crucial for pre-training language models (PLMs) and is the essence of prompt learning. The present invention completes the structuring of external knowledge by using a domain knowledge graph that is strongly related to the field involved so that the descriptive words meet these three requirements at the same time.

[0056] In some preferred embodiments, a specific method for constructing a domain knowledge graph of the domain involved in the target text is given, such as Figure 2 As shown, including:

[0057] S201, obtaining a number of evaluation texts in the same field as the target text, extracting aspect words and descriptive words of each aspect contained in the evaluation texts, and establishing an aspect-descriptive word list. The number of evaluation texts does not need to be too large, and the source of the evaluation texts can be a public evaluation database of the target field, etc.

[0058] The following is a detailed explanation using the example of creating an aspect-descriptive word list in the restaurant field. It should be understood that the description here should not be understood as the only limitation to this step, but rather a reflection of an operational logic. Those skilled in the art can obviously adopt similar processing steps for aspect-descriptive word lists in other fields under the inspiration of this logic.

[0059] First, a thousand unlabeled data items were randomly selected from the Yelp open dataset, which includes a large number of user-generated restaurant reviews. These reviews cover different aspects of the dining experience, from food quality to staff friendliness to restaurant atmosphere. Next, the selected reviews were manually or automatically annotated to identify words and phrases that express specific sentiments about different aspects of the restaurant. Specifically, eight key aspects were focused on: food quality, service quality, atmosphere, menu, staff, price, location, and overall experience. For each aspect, a list of aspect-descriptors was generated to capture all the emotions expressed by the reviewers in the dataset. These words include positive descriptors such as "delicious" and "perfect", as well as negative descriptors such as "disappointing" and "unprofessional". By annotating a subset of the Yelp dataset in this way, it is possible to create a small and targeted review vocabulary that contains words that are highly relevant to the restaurant review domain. These words can be used as descriptors for the ABSA task, helping to improve the accuracy and granularity of sentiment analysis in this domain. Obviously, this approach can also be applied to other domains with limited review vocabularies.

[0060] S202. Based on the aspect-descriptor list, extract the aspect categories and their corresponding descriptor-descriptor and descriptor-aspect relationships in the word network database to construct a domain knowledge graph. The word network database refers to a dictionary made based on cognitive linguistics, which is a "word network" composed of the meanings of individual words, covering a wide range of lexical semantic networks. Nouns, verbs, adjectives and adverbs are each organized into a synonym network. Each synonym set represents a basic semantic concept, and these sets are also connected by various relationships. It is a popular tool dataset in the current NLP field. Representative databases include: English-class WordNet, multilingual BabelNet, and ChineseWordNet for Chinese. Because this type of word network database has a wide range of synonym sets, these synonym sets group nouns, verbs, adjectives and adverbs according to cognitive similarity. And it has a clear hierarchical structure, organizing synonym sets into a network of concept-semantic and lexical relationships.

[0061] For the knowledge graph, it is composed of entities (such as "Zhang San"), concepts (such as "actor"), the generic relationship between entities and concepts (also known as isA relationship, such as "Zhang San isA actor"), and the generic relationship between concepts (such as "movie actor" is a subclass of "actor"). If A isA B, A is usually called the hyponym of B, or B is the hypernym of A.

[0062] Taking WordNet as an example, ISA relations are the most commonly encoded relations between synsets, linking more general categories to specific categories. Hyponym relations are relations between a subcategory and its parent category, and hyponymy relations are transitive, so meaningful relations between concepts in a given domain can be derived from them.

[0063] S3, concatenating the target text and the mask language template and inputting them into the pre-trained language model to perform mask language modeling, querying the target aspect category in the domain knowledge graph according to the target aspect word, extracting all the description words associated with the target aspect category as the target aspect description words, and filling them into the mask;

[0064] It should be noted that for the ATSC task, the target aspect word extracted in the pre-step is the aspect target, which can be understood as a subordinate concept of the aspect category (equivalent to the waiter relative to the front desk service). At this time, it is necessary to use the target aspect word to query the aspect category to which it belongs in the domain knowledge graph, and then extract the polarity words associated with the category as the description words of the aspect. This method ensures that the verbalization program is adjusted for a specific context and captures the subtle differences in category sentiment. For the ACSC task, the target aspect word extracted in the pre-step is the aspect category, so the polarity words associated with the category can be directly extracted as the description words of the aspect. Such a method of using the domain knowledge graph utilizes the well-defined categories in the domain knowledge graph, so that the appropriate language module for each entity can be efficiently identified and used. In some special embodiments, the descriptive word data of certain categories or terms may be limited or non-existent. In the case of scarcity of such data, an effective language module can be generated by utilizing the rich semantic relationships contained in the domain knowledge graph.

[0065] S4. Predict the aspect-level sentiment polarity of the target aspect description words respectively to obtain the aspect-level sentiment polarity of the target text. It is common for people to use different words in different sentences to express the same sentiment polarity for a specific aspect. Assuming that the mapping relationship between label words and sentiment polarity is accurate, the purpose of this step is to determine the label word that makes the greatest contribution to the predicted label. Since the number of samples in each target field is different, different standards can be used to measure the sentiment polarity reflected by the prediction score.

[0066] In some zero-sample embodiments, the maximum value of the predicted score is used instead of the average value to determine the sentiment polarity it reflects, so that there is no need to adjust the training parameters of the model. The predicted score refers to the probability of filling the target aspect description word in the aspect-related mask, denoted as

[0067] The specific prediction formula is as follows:

[0068]

[0069] in, are sentiment polarity labels, including "Positive" (marked as 0), "Negative" (marked as 1), or "Neutral" (marked as 2); Represents a language model pre-trained on a large corpus; Indicates the sentiment polarity of the text Where θ represents the number of sentiment polarities; Represents a set of aspect description words and defines the function f: [MASK] indicates the target aspect description word; Represents a mask language template, such as XThe{aspect}is[MASK];

[0070] In some embodiments with few samples, the predicted scores are weighted averaged according to the aspect-level sentiment polarity categories, and the aspect-level sentiment polarity with the highest weighted average is used as the aspect-level sentiment polarity of the target text. The specific prediction formula is as follows:

[0071]

[0072] Among them, s(y|X p ) is defined as:

[0073] This function can continuously optimize the predicted probability using the cross entropy loss function.

[0074] Example 2

[0075] like Figure 2 As shown, this embodiment is developed on the basis of the above-mentioned embodiment 1. This embodiment provides an aspect-level sentiment analysis system based on a domain knowledge graph, including:

[0076] A first acquisition module is configured to acquire a target text and analyze and extract target aspect words from the target text;

[0077] A domain knowledge graph module is configured to have a domain knowledge graph with built-in categories of aspects of the domain involved in the target text and their corresponding hypernymous descriptor-hyponymous descriptor and descriptor-aspect relationships;

[0078] A masked language template module is configured to have a built-in masked language template based on prompt learning, and concatenates the target text and the masked language template as the first output text;

[0079] A pre-trained language model is set to have a pre-trained language model built in, the first output text is input for masked language modeling, a target aspect category is queried in the domain knowledge graph according to the target aspect word, all description words associated with the target aspect category are extracted as target aspect description words, and filled in the mask;

[0080] The prediction and analysis module is configured to predict the aspect-level sentiment polarity of the target aspect description words respectively to obtain the aspect-level sentiment polarity of the target text.

[0081] In some preferred embodiments, the method for constructing the domain knowledge graph includes:

[0082] Acquire several evaluation texts in the same field as the target text, extract aspect words and descriptive words of each aspect contained in the evaluation texts, and establish an aspect-descriptive word list;

[0083] Based on the aspect-descriptive word list, the aspect categories and their corresponding descriptive word-descriptive word and descriptive word-aspect relationships are extracted from the word network database to construct a domain knowledge graph.

[0084] In some preferred embodiments, the prediction analysis module includes a first prediction analysis unit configured to use the aspect-level sentiment polarity mapped to the target aspect description word with the highest prediction score as the aspect-level sentiment polarity of the target text.

[0085] In some preferred embodiments, the prediction analysis module includes a second prediction analysis unit, which is configured to perform weighted averaging of the prediction scores of all target aspect description words according to aspect-level sentiment polarity categories, and take the aspect-level sentiment polarity with the highest weighted average as the aspect-level sentiment polarity of the target text.

[0086] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0087] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the function / operation specified in the flow chart and / or the block diagram to be implemented. The program code can be executed completely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine or completely on a remote machine or server. In the context of the present disclosure, a machine-readable medium can be a tangible medium, which can contain or store a program used for or in combination with an instruction execution system, a device or an equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include electrical connections based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0088] Example 3

[0089] This embodiment is developed on the basis of the above-mentioned embodiment 1. This embodiment provides a process of conducting experiments on different data sets and comparison of results.

[0090] Dataset

[0091] This embodiment conducts experiments on two datasets, namely the MAMS dataset and the SemEval 2014task4 dataset, to test the effectiveness of the aspect-level sentiment analysis method based on the domain knowledge graph proposed in the present invention. The labels of all datasets are limited to positive, negative and neutral. Among them, neutral means that no positive or negative sentiment is expressed.

[0092] Table 1 below is the statistical results of the above two data sets.

[0093]

[0094] Table 1 Dataset parameter statistics

[0095] Among them, the SemEval 2014Task 4 dataset is widely used as a benchmark for evaluating performance on ATSC and ACSC tasks. The dataset contains English review sentences in two target domains (laptops and restaurants). In order to evaluate the performance of the proposed method and baseline on the test set in this field and ensure comparability, two preprocessing steps are required. First, instances with conflicting sentiment labels are removed, which are rare and often ignored in previous studies. Second, sentences with multiple sentiment aspects are split into separate instances, each of which focuses on a single sentiment aspect.

[0096] The MAMS dataset includes sentences containing at least two sentiment attributes, where the sentiments of these attributes are different. The MAMS dataset includes two versions, one for ACSC and one for ATSC tasks. For the ATSC dataset, the researchers extracted the attribute words in the sentences and annotated the sentiment polarity of each attribute. Sentences containing only one attribute or multiple attributes with the same sentiment polarity were removed. For the ACSC dataset, the authors predefined eight categories, including food, service, staff, price, environment, menu, location, and confusion categories. Based on the category information, the researchers annotated the sentences with the corresponding categories and sentiment polarity.

[0097] Experimental setup

[0098] The performance of the proposed method and the baseline method is evaluated over a range of training data sizes across the entire domain, covering cases from zero samples to full samples (i.e., fully supervised). Specifically, our model is trained using randomly resampled training set sizes, with the number of samples including {Zero, 16, 64, 256, 1024, Full}. For all experiments, BERT and GPT-2 are used as pre-trained language models. To evaluate the performance, accuracy and Micro-F1 are used as test metrics. To ensure robustness, five random seeds are used for each prompt and baseline, and their scores are averaged, and the average performance across all four prompts is calculated.

[0099] Benchmark Model

[0100] The following benchmark models are selected for comparison with the method proposed in this invention, including:

[0101] (1)the last hidden state of the[CLS]token in BERT(referred to as BERT[CLS]);

[0102] (2)the NSP head of BERT (referred to as BERT NSP);

[0103] (3) BERT LM;

[0104] (4)GPT-2LM\cite{seoh2021open};

[0105] (5)CapsNet-BERT\cite{jiang2019challenge}.

[0106] Results and Analysis

[0107] like Figure 5-Figure 6 As shown in the figure, it shows the experimental results of the aspect-level sentiment analysis method based on domain knowledge graph proposed in the present invention and the mainstream baseline model in the current field. Among them, KG BERT LM and KG GPT-2LM respectively represent the prediction models established based on the aspect-level sentiment analysis method proposed in the present invention, using BERT and GPT-2 models as pre-trained language models.

[0108] By comparison, it can be seen that when the present invention is compared with different tasks on two different datasets, it outperforms the baseline model in all cases, indicating the effectiveness of using domain knowledge graphs to improve performance. Specifically, for small sample learning, the present invention achieves greater performance improvement relative to the existing baseline model, and the accuracy (Acc) and Micro-F1 value (MF1) are significantly higher than other prediction models with the same number of available labels. In addition, the present invention performs well in the zero-sample case, significantly outperforming the baseline model trained with only 16 samples, further demonstrating its usefulness. The present invention learns faster, and performs several orders of magnitude better than the existing unprompted model on 16, 64, and 256 samples, and is also better than the existing prompted model. This shows that in the case of limited data, combining domain knowledge graphs may improve prediction performance. One possible explanation is that the domain knowledge graph provides a more structured and informative way of prompting. By incorporating domain knowledge into the prompt, the model can take advantage of relevant information about a specific domain and improve its generalization ability to new examples.

[0109] The above shows and describes the basic principles, main features and advantages of the present invention. It should be understood by those skilled in the art that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, which fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. Aspect-level sentiment analysis method based on domain knowledge graph, characterized by: The following steps are involved: Obtain the target text, analyze and extract the target aspect words of the target text; construct a mask language template based on prompt learning; Constructing a domain knowledge graph of the domain involved in the target text, wherein the domain knowledge graph includes several aspect categories included in the domain, and their corresponding hypernymous descriptor-hyponymous descriptor and descriptor-aspect relationships; The target text and the mask language template are concatenated and input into the pre-trained language model for mask language modeling. The target aspect category is queried in the domain knowledge graph according to the target aspect word, and all description words associated with the target aspect category are extracted as target aspect description words and filled into the mask. Predicting the aspect-level sentiment polarities of the target aspect description words respectively to obtain the aspect-level sentiment polarities of the target text; The method for constructing a domain knowledge graph of a domain involved in a target text includes: Acquire several evaluation texts in the same field as the target text, extract aspect words and descriptive words of each aspect contained in the evaluation texts, and establish an aspect-descriptive word list; Based on the aspect-descriptive word list, the aspect categories and their corresponding descriptive word-descriptive word and descriptive word-aspect relationships are extracted from the word network database to construct a domain knowledge graph.

2. The aspect-level sentiment analysis method based on domain knowledge graph according to claim 1, characterized in that: The method for obtaining the aspect-level sentiment polarity of the target text includes: The aspect-level sentiment polarity mapped to the target aspect description word with the highest prediction score is used as the aspect-level sentiment polarity of the target text.

3. The aspect-level sentiment analysis method based on domain knowledge graph according to claim 1, characterized in that: The method for obtaining the aspect-level sentiment polarity of the target text includes: The prediction scores of all target aspect description words are weighted averaged according to the aspect-level sentiment polarity category, and the aspect-level sentiment polarity with the highest weighted average is taken as the aspect-level sentiment polarity of the target text.

4. The aspect-level sentiment analysis method based on domain knowledge graph according to claim 1, characterized in that: The language model includes a BERT model or a GPT model.

5. The aspect-level sentiment analysis method based on domain knowledge graph according to claim 1, characterized in that: The wordnet database includes the WordNet word library and / or the Chinese WordNet word library.

6. Aspect-level sentiment analysis system based on domain knowledge graph, characterized by: include: A first acquisition module is configured to acquire a target text and analyze and extract target aspect words from the target text; A domain knowledge graph module is configured to have a domain knowledge graph with built-in categories of aspects of the domain involved in the target text and their corresponding hypernymous descriptor-hyponymous descriptor and descriptor-aspect relationships; A masked language template module is configured to have a built-in masked language template based on prompt learning, and concatenates the target text and the masked language template as the first output text; A pre-trained language model is set to have a pre-trained language model built in, the first output text is input for masked language modeling, a target aspect category is queried in the domain knowledge graph according to the target aspect word, all description words associated with the target aspect category are extracted as target aspect description words, and filled in the mask; A prediction and analysis module, configured to predict the aspect-level sentiment polarity of the target aspect description words respectively, to obtain the aspect-level sentiment polarity of the target text; The method for constructing the domain knowledge graph includes: Acquire several evaluation texts in the same field as the target text, extract aspect words and descriptive words of each aspect contained in the evaluation texts, and establish an aspect-descriptive word list; Based on the aspect-descriptive word list, the aspect categories and their corresponding descriptive word-descriptive word and descriptive word-aspect relationships are extracted from the word network database to construct a domain knowledge graph.

7. The aspect-level sentiment analysis system of the domain knowledge graph according to claim 6, characterized in that: The prediction analysis module comprises a first prediction analysis unit configured to use the aspect-level sentiment polarity mapped to the target aspect description word with the highest prediction score as the aspect-level sentiment polarity of the target text.

8. The aspect-level sentiment analysis system of the domain knowledge graph according to claim 6, characterized in that: The prediction analysis module includes a second prediction analysis unit, which is configured to perform weighted average of the prediction scores of all target aspect description words according to aspect-level sentiment polarity categories, and take the aspect-level sentiment polarity with the highest weighted average as the aspect-level sentiment polarity of the target text.

Citation Information

Patent Citations

  • Model pre-training and natural language processing method and device, equipment and storage medium

    CN114780691A

  • Emotion knowledge graph construction method and device based on aspects

    CN115391570A