A method and device for automatically annotating text opinions based on a large model and knowledge base

By introducing a knowledge base and a large language model into opinion bias analysis, the problems of uneven dataset quality and cross-language analysis were solved, achieving efficient and accurate text opinion annotation, and improving the quality of the labeled dataset and the model training effect.

CN119988633BActive Publication Date: 2025-10-28NAT COMP NETWORK & INFORMATION SECURITY MANAGEMENT CENT
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510151779.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2024-12-19
Filing Date
2025-02-12
Publication Date
2025-10-28
Estimated Expiration
2045-02-12

AI Technical Summary

Technical Problem

Existing opinion bias analysis techniques suffer from inconsistent dataset quality and difficulty in determining the social and cultural context of specific individuals in cross-linguistic analysis, resulting in complex and inaccurate annotation processes.

Method used

By embedding relevant knowledge from a knowledge base into the original text, generative annotation is performed using a large language model, knowledge completion is achieved by combining finite state automata and predefined entity relationships, knowledge-embedded text is generated, and bias analysis is performed using BERT layers and CNN feature extraction layers.

Benefits of technology

It improves the quality and accuracy of labeled data sets, reduces the workload of manual labeling, improves the training effect of opinion tendency analysis models, and enhances the model's language comprehension ability and the richness of the knowledge base.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119988633B_ABST
    Figure CN119988633B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of natural language processing technology, specifically to a method and apparatus for automatic text opinion annotation based on a large model and knowledge base. The method includes: identifying knowledge base entities corresponding to entities in the original text and extended entities of those entities; inserting the extended entities into the original text based on predefined entity relationships to perform knowledge completion, generating knowledge-embedded text; providing a given topic entity set; creating a prompt template; filling the prompt template with the knowledge-embedded text and the given topic entity set; then using a large language model for generative annotation to obtain attitude labels; obtaining preference labels based on the given topic entities and attitude labels; and constructing an annotation dataset based on the original text and preference labels. This technical solution provides strong support for high-quality annotation datasets.
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, specifically to a method and apparatus for automatic text opinion annotation based on a large model and knowledge base. Background Technology

[0002] Opinion bias analysis originates from artificial intelligence natural language processing technology and is a cutting-edge branch of sentiment classification technology. It can be seen as a sentiment analysis task targeting specific topics, aiming to identify and analyze the bias of text data towards specific objects, opinions, etc.

[0003] Currently, opinion bias analysis primarily employs machine learning and deep learning algorithms. These models are trained on large amounts of labeled data to determine the bias of unknown data. During their research, the inventors discovered that existing datasets vary widely in quality, sometimes requiring deep textual understanding for proper annotation. Furthermore, in cross-linguistic opinion bias analysis, determining the social and cultural context of a specific individual's bias often presents additional challenges. Summary of the Invention

[0004] To address the problems in related technologies, this disclosure provides a method and apparatus for automatic text opinion annotation based on a large model and knowledge base.

[0005] Firstly, this disclosure provides a method for automatically annotating text opinions based on a large model and knowledge base, including:

[0006] Identify the knowledge base entities that correspond to the entities in the original text and the extended entities of the knowledge base entities, and insert the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text.

[0007] Provide a set of entities for a given topic;

[0008] Create a prompt template, embed the knowledge into the text and fill the prompt template with the given topic entity set, and then use a large language model to perform generative annotation to obtain the attitude label corresponding to each given topic entity in the given topic entity set; the prompt template requires the attitude label to be supportive, opposed or neutral.

[0009] Based on the given topic entity, the attitude label corresponding to the given topic entity is used to obtain the tendency label;

[0010] A labeled dataset is constructed based on the original text and the tendency labels.

[0011] In one implementation of this disclosure, the identification of knowledge base entities corresponding to entities in the original text and the extended entities of the knowledge base entities include:

[0012] Construct finite state automata;

[0013] The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

[0014] In one implementation of this disclosure, constructing the finite state automaton includes:

[0015] We use the Aho-Corasick automaton algorithm to preprocess all entities in the knowledge base to construct a finite state automaton.

[0016] In one implementation of this disclosure, the step of inserting the extended entity into the original text based on predefined entity relationships to perform knowledge completion and generate knowledge-embedded text includes:

[0017] An insertion template is constructed based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and character name, character name and profession, event name and honor received.

[0018] Based on the insertion template, the extended entity is inserted into the original text to complete the knowledge and generate knowledge-embedded text.

[0019] One implementation of this disclosure also includes:

[0020] The labeled dataset was used to train an opinion bias analysis model;

[0021] Based on the trained opinion bias analysis model, opinion bias analysis is performed on the new input text to obtain the opinion bias label of the new input text.

[0022] In one implementation of this disclosure, the step of performing opinion bias analysis on the new input text based on a trained opinion bias analysis model to obtain opinion bias labels for the new input text includes:

[0023] The new input text is segmented into sentences to obtain a text sentence set;

[0024] Input the given topic entity set and text sentence set into the BERT layer to obtain entity sentence vectors and text sentence vectors;

[0025] Calculate the relationship matrix between the entity sentence vectors and the text sentence vectors;

[0026] The relationship matrix is ​​input into the CNN feature extraction layer for feature fusion and classification, and then the Softmax layer outputs the tendency label of the new input text.

[0027] Secondly, embodiments of this disclosure provide an adaptive power allocation device based on deep reinforcement learning, comprising:

[0028] The knowledge completion module is configured to identify knowledge base entities that correspond to entities in the original text and extended entities of the knowledge base entities, and insert the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text.

[0029] The first acquisition module is configured to provide a set of entities for a given topic.

[0030] The tagging module is configured to create a prompt template, which is filled with the knowledge embedded in the text and a given set of topic entities. Then, generative annotation is performed using a large language model to obtain attitude tags corresponding to each given topic entity in the given set of topic entities. The prompt template requires a supportive, opposing, or neutral attitude tag.

[0031] The second acquisition module is configured to obtain a tendency label based on the given topic entity and the attitude label corresponding to the given topic entity.

[0032] The building module is configured to construct a labeled dataset based on the original text and the tendency labels.

[0033] In one implementation of this disclosure, the portion of the knowledge completion module that identifies the knowledge base entity corresponding to the entity in the original text and the extended entity of the knowledge base entity is configured as follows:

[0034] Construct finite state automata;

[0035] The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

[0036] In one implementation of this disclosure, the construction of the finite state automaton is configured as follows:

[0037] We use the Aho-Corasick automaton algorithm to preprocess all entities in the knowledge base to construct a finite state automaton.

[0038] In one implementation of this disclosure, the knowledge completion module inserts the extended entity into the original text based on predefined entity relationships to perform knowledge completion, generating a portion of the knowledge-embedded text, which is configured as follows:

[0039] An insertion template is constructed based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and character name, character name and profession, event name and honor received.

[0040] Based on the insertion template, the extended entity is inserted into the original text to complete the knowledge and generate knowledge-embedded text.

[0041] One implementation of this disclosure also includes:

[0042] The training module is configured to train an opinion bias analysis model using the labeled dataset;

[0043] The detection module is configured to perform opinion bias analysis on new input text based on a trained opinion bias analysis model, and obtain the opinion bias label of the new input text.

[0044] In one implementation of this disclosure, the detection module includes:

[0045] The segmentation unit is configured to perform sentence segmentation on the new input text to obtain a text sentence set;

[0046] The acquisition unit is configured to input the given topic entity set and text sentence set into the Bert layer to obtain entity sentence vectors and text sentence vectors;

[0047] The computing unit is configured to calculate the relationship matrix between the entity sentence vectors and the text sentence vectors;

[0048] The output unit is configured to input the relation matrix into the CNN feature extraction layer for feature fusion and classification, and then output the tendency label of the new input text through the Softmax layer.

[0049] Thirdly, embodiments of this disclosure provide an electronic device including a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method as described in any of the first aspects.

[0050] Fourthly, this disclosure provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the method as described in any of the first aspects.

[0051] The technical effects provided by the embodiments of this disclosure may include the following beneficial effects:

[0052] According to the technical solution provided in this disclosure, an automatic text opinion annotation method based on a large model and knowledge base includes: identifying knowledge base entities corresponding to entities in the original text and extended entities of the knowledge base entities; inserting the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text; providing a given topic entity set; creating a prompt template; filling the prompt template with the knowledge-embedded text and the given topic entity set; then using a large language model for generative annotation to obtain attitude tags corresponding to each given topic entity in the given topic entity set; the prompt template requires providing support, opposition, or neutral attitude tags; obtaining a tendency tag based on the given topic entity and the attitude tag corresponding to the given topic entity; and constructing an annotation dataset based on the original text and the tendency tag. The above technical solution, by introducing knowledge base-related knowledge embedded into the original text, provides richer and more accurate object and topic background information for the corpus, enabling the model to more accurately understand and analyze the tendency of the corpus. The application of a large language model makes the annotation process more efficient and greatly reduces the workload of manual annotation. Furthermore, the powerful language understanding capabilities of large-scale language models significantly improve the quality and accuracy of labeled datasets compared to other automatic annotation models, thereby further enhancing the training performance of opinion bias analysis models. In summary, the proposed solution effectively combines the powerful language understanding capabilities of large-scale language models with the richness and accuracy of knowledge bases, providing strong support for the annotation of high-quality labeled datasets.

[0053] 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

[0054] Other features, objects, and advantages of this disclosure will become more apparent from the following detailed description of non-limiting embodiments, taken in conjunction with the accompanying drawings. The following is a description of the accompanying drawings.

[0055] Figure 1 A flowchart is shown for an automatic text opinion annotation method based on a large model and knowledge base according to an embodiment of the present disclosure.

[0056] Figure 2 A schematic diagram of a training opinion bias analysis model according to an embodiment of the present disclosure is shown.

[0057] Figure 3 A schematic diagram of a computational relation matrix according to an embodiment of the present disclosure is shown.

[0058] Figure 4 A structural block diagram of an automatic text opinion annotation apparatus based on a large model and knowledge base according to an embodiment of the present disclosure is shown.

[0059] Figure 5 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.

[0060] Figure 6 A schematic diagram of the structure of a computer system suitable for implementing the method according to embodiments of the present disclosure is shown. Detailed Implementation

[0061] In the following, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings to enable those skilled in the art to readily implement them. Furthermore, for clarity, portions unrelated to the description of exemplary embodiments have been omitted from the drawings.

[0062] In this disclosure, it should be understood that terms such as “comprising” or “having” are intended to indicate the presence of features, figures, steps, behaviors, components, parts or combinations thereof disclosed in this specification, and are not intended to exclude the possibility of the presence or addition of one or more other features, figures, steps, behaviors, components, parts or combinations thereof.

[0063] It should also be noted that, unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other. This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.

[0064] Currently, opinion bias analysis primarily employs machine learning and deep learning algorithms. These models are trained on large amounts of labeled data to determine the bias of unknown data. During their research, the inventors discovered that existing datasets vary widely in quality, sometimes requiring deep textual understanding for proper annotation. Furthermore, in cross-linguistic opinion bias analysis, determining the social and cultural context of a specific individual's bias often presents additional challenges.

[0065] To address the aforementioned shortcomings, this disclosure presents an automatic text opinion annotation method based on a large-scale model and knowledge base. By embedding relevant knowledge from the knowledge base into the original text, the corpus acquires richer and more accurate background information on objects and topics, enabling the model to more accurately understand and analyze the sentiment of the corpus. The application of a large-scale language model makes the annotation process more efficient, significantly reducing the workload of manual annotation. Furthermore, the powerful language understanding capabilities of the large-scale language model significantly improve the quality and accuracy of the annotated dataset compared to other automatic annotation models, thereby further enhancing the training effect of the opinion sentiment analysis model. In summary, the solution disclosed in this disclosure effectively combines the powerful language understanding capabilities of a large-scale language model with the richness and accuracy of knowledge from the knowledge base, providing strong support for the annotation of high-quality datasets.

[0066] Figure 1 A flowchart is shown for an automatic text opinion annotation method based on a large model and knowledge base according to an embodiment of the present disclosure.

[0067] like Figure 1 As shown, the automatic text opinion annotation method based on a large model and knowledge base includes the following steps S110-S150:

[0068] In step S110, the knowledge base entities corresponding to the entities in the original text and the extended entities of the knowledge base entities are identified. The extended entities are then inserted into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text.

[0069] In step S120, a set of given topic entities is provided;

[0070] In step S130, a prompt template is created, and the knowledge embedded text and the given topic entity set are filled into the prompt template. Then, generative annotation is performed using a large language model to obtain the attitude label corresponding to each given topic entity in the given topic entity set. The prompt template requires the expression of a supportive, opposing, or neutral attitude label.

[0071] In step S140, a tendency label is obtained based on the given topic entity and the attitude label corresponding to the given topic entity;

[0072] In step S150, a labeled dataset is constructed based on the original text and the tendency labels.

[0073] In this disclosure, a knowledge base is used to complete the knowledge of entities in the original text based on predefined entity relationships. The knowledge base includes information on various aspects such as people and events. It can be a self-built knowledge base or it can be generated from publicly available materials; this disclosure does not impose any restrictions. The data stored in the knowledge base is structured data, denoted as a set of triples (h, r, t); where h and t are knowledge base entities, and r is an entity relationship. The predefined entity relationships include one or more of the following: nickname / alias and person name, person name and occupation, event name and honors received.

[0074] In this disclosure method, the given topic entity can be a custom topic entity, such as celebrity gossip, concerts, basketball games, athlete transfers, etc.

[0075] The attitude labels in this disclosure can be supportive, opposing, or neutral.

[0076] In this disclosure, a large-scale language model is used to perform generative annotation on the corpus to be annotated, forming a high-quality annotated dataset. The large-scale language model can be a publicly available model, such as Qwen1.5-32B-Chat-AWQ. In addition to using the above model, this disclosure also utilizes the inference tool vllm for inference acceleration, thereby improving the performance and efficiency of the model.

[0077] In one implementation of this disclosure, the step S110 of identifying the knowledge base entity corresponding to the entity in the original text and the extended entity of the knowledge base entity includes:

[0078] Construct finite state automata;

[0079] The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

[0080] In this disclosure, the Aho-Corasick automaton algorithm is used to preprocess all entities in the knowledge base to construct a finite state automaton.

[0081] The Aho-Corasick automaton (AC automaton) is a highly efficient multi-pattern string matching algorithm used to simultaneously find the occurrence positions of multiple pattern strings (substrings) in a text string. This disclosure utilizes the AC automaton to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of those entities. Then, the extended entities are inserted into the original text based on predefined entity relationships to perform knowledge completion, generating knowledge-embedded text.

[0082] In one implementation of this disclosure, step S110, which involves inserting the extended entity into the original text based on predefined entity relationships to perform knowledge completion and generate knowledge-embedded text, includes:

[0083] An insertion template is constructed based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and character name, character name and profession, event name and honor received.

[0084] Based on the insertion template, the extended entity is inserted into the original text to complete the knowledge and generate knowledge-embedded text.

[0085] In this disclosed method, by creating an insertion template, extended entities are inserted near the entities in the original text according to predefined entity relationships, thereby obtaining knowledge-embedded text.

[0086] For example, the original sample is "A's new movie was a box office hit on its opening day and became a hot topic recently";

[0087] Identify the knowledge base entity "A" and the extended entity "Director" corresponding to the entity of the original sample from the knowledge base;

[0088] The insertion template, built based on the predefined entity relationship between a person's name and their profession, is "{person}{profession}".

[0089] Based on the occupation information of "A" as "director", the occupation information is inserted before the character. The processed knowledge-embedded text is "Director A's new movie was a box office hit on its opening day and has become a hot topic recently".

[0090] In one implementation of this disclosure, a specific prompt template in step S130 is, for example, "Based on the following content T, analyze the tendency of the viewpoint towards the elements in P as supportive, opposed, or neutral, without providing the analysis process."

[0091] For the aforementioned prompt template, knowledge-embedded text is used as content T, and it is filled into the prompt template along with a given topic entity set P. Then, a large language model is used to generate attitude tags corresponding to each given topic entity. Next, in step S140, based on the given topic entity, a tendency tag is obtained from the attitude tag corresponding to the given topic entity.

[0092] Taking the aforementioned topics of basketball events, celebrity gossip, and athlete transfers as examples, the resulting bias labels are, for instance, "Basketball events: Support >", "Celebrity gossip: Neutral >", and "Athlete transfers: Oppose >".

[0093] In one implementation of this disclosure, the text opinion automatic annotation method based on a large model and knowledge base further includes:

[0094] The labeled dataset was used to train an opinion bias analysis model;

[0095] Based on the trained opinion bias analysis model, opinion bias analysis is performed on the new input text to obtain the opinion bias label of the new input text.

[0096] In this disclosure, the opinion bias analysis model can be a Bert-Condition-CNN opinion bias analysis model. This model uses a Bert layer to process a given set of topic entities and a set of text sentences (obtained by sentence segmentation of the original text) to obtain two sentence vectors. Then, a Condition layer constructs a relation matrix between the two sentence vectors to calculate the relation features between each given topic entity and each text sentence. Finally, a CNN feature extraction layer learns the final bias information, which is then input into a Softmax layer to obtain the attitude label of the text on the given topic entity: support, opposition, or neutral.

[0097] Figure 2 A schematic diagram of a training opinion bias analysis model according to an embodiment of the present disclosure is shown.

[0098] like Figure 2 As shown, the unlabeled original text is first augmented using a knowledge base. Knowledge information (extended entities) from the knowledge base is inserted near the entities in the original text according to predefined entity relationships, resulting in knowledge-embedded text. Then, a large language model is used to annotate the knowledge-embedded text to obtain the sentiment labels of the original text. These sentiment labels and the original text are combined to form an annotated dataset. When training the opinion sentiment analysis model using the annotated dataset, a loss function is constructed based on the sentiment labels output by the model and those in the annotated dataset. Weight parameters of layers such as the BERT layer, Condition layer, and CNN feature extraction layer are adjusted. After the model converges, the trained opinion sentiment analysis model is obtained.

[0099] The specific training process of the above-mentioned viewpoint bias analysis model can refer to existing technologies and is not the focus of this disclosure.

[0100] In one implementation of this disclosure, the step of performing opinion bias analysis on the new input text based on a trained opinion bias analysis model to obtain opinion bias labels for the new input text includes:

[0101] The new input text is segmented into sentences to obtain a text sentence set;

[0102] Input the given topic entity set and text sentence set into the BERT layer to obtain entity sentence vectors and text sentence vectors;

[0103] Calculate the relationship matrix between the entity sentence vectors and the text sentence vectors;

[0104] The relationship matrix is ​​input into the CNN feature extraction layer for feature fusion and classification, and then the Softmax layer outputs the tendency label of the new input text.

[0105] In this disclosure, the given topic entity set is denoted as Entities={e1,e2,...,e m}, e i (1≤i≤m) represents a given topic entity, and the text sentence set is denoted as Sents={s1,s2,...,s...}. n}, s j (1≤j≤n) represents the text sentences, where m and n represent the number of given topic entities contained in the given topic entity set and the number of sentences contained in the text, respectively.

[0106] Figure 3 A schematic diagram of a computational relation matrix according to an embodiment of the present disclosure is shown.

[0107] Combination Figure 3 As shown, the relationship matrix between the entity sentence vector and the text sentence vector is calculated, and this relationship matrix covers the given topic entity e. i and text sentences s j The implied relationships and biases present in this pair of text sequences can be divided into the following two steps: first, determining s j Is it centered around e? i The first is to expand on the commentary, that is, whether there is an implicit relationship between the two text sequences; the second is s j For e i The inclination is support, neutrality, or opposition. If s j With e i When no implication relationship exists, the tendency is neutral. Before calculating the relation matrix for Entities and Sents, first set e... i and s j The BERT layer outputs a sentence vector, denoted as u. i =Bert(e i ), v j =Bert(s) j The elements x in the obtained relation matrix ij =Score(u i ,v j ), where in calculating element c ij The calculation of the distance between reference vectors is not detailed in this disclosure.

[0108] In this disclosure, the CNN feature extraction layer targets the calculated c ij Feature fusion and classification are performed, and adjacent sequence pairs are calculated through two-dimensional convolution. i ,v j The weight of the relational features on the final tendency label is calculated using the following formula:

[0109]

[0110] In the formula, C(m,n) represents e in the above text. i and s j The relation matrix is ​​given by K(im,jn), where K(im,jn) is the convolution kernel weight parameter, b is the bias term, and f is the non-linear activation function, typically ReLU, Sigmoid, or Tanh. The feature matrix after convolution (whose matrix elements are M) is given by K(im,jn). i,j ​The input vectors undergo max pooling, followed by feature fusion using a fully connected layer. Then, a softmax algorithm is applied for classification. The main tasks of the fully connected and softmax layers are to fuse the final feature information, obtain the score of the feature vector for each preference label, and output the final preference label for <entities, sentences>. This paper uses the softmax layer as a probability transformation layer, representing the input vector in probabilistic form to predict the preference label.

[0111] This publicly disclosed method for automatic text opinion annotation based on large-scale models and knowledge bases combines the powerful language understanding capabilities of large-scale language models with the richness and accuracy of knowledge bases. Its application not only improves the accuracy and robustness of opinion bias analysis but also increases annotation efficiency and reduces manual costs, providing strong support for research and applications in the field of text analysis.

[0112] Figure 4 This diagram illustrates a structural block diagram of an automatic text opinion annotation device based on a large model and knowledge base according to an embodiment of the present disclosure. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both.

[0113] like Figure 4 As shown, the automatic text opinion annotation device 400 based on a large model and knowledge base includes:

[0114] The knowledge completion module 410 is configured to identify knowledge base entities that correspond to entities in the original text and extended entities of the knowledge base entities, and insert the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text.

[0115] The first acquisition module 420 is configured to provide a set of entities for a given topic.

[0116] The tag module 430 is configured to create a prompt template, which is filled with the knowledge embedded in the text and the given topic entity set. Then, generative annotation is performed using a large language model to obtain attitude tags corresponding to each given topic entity in the given topic entity set. The prompt template requires the expression of support, opposition or neutral attitude tags.

[0117] The second acquisition module 440 is configured to obtain a tendency label based on the given topic entity and the attitude label corresponding to the given topic entity.

[0118] Module 450 is configured to construct a labeled dataset based on the original text and the tendency labels.

[0119] This disclosure provides an automatic text opinion annotation device based on a large model and knowledge base. By embedding relevant knowledge from the knowledge base into the original text, the corpus gains richer and more accurate background information on objects and topics, enabling the model to more accurately understand and analyze the sentiment of the corpus. The application of a large language model makes the annotation process more efficient, significantly reducing the workload of manual annotation. Furthermore, the powerful language understanding capabilities of the large language model significantly improve the quality and accuracy of the annotated dataset compared to other automatic annotation models, thereby further enhancing the training effect of the opinion sentiment analysis model. In summary, the solution disclosed in this disclosure effectively combines the powerful language understanding capabilities of a large language model with the richness and accuracy of knowledge from the knowledge base, providing strong support for the annotation of high-quality datasets.

[0120] In one implementation of this disclosure, the portion of the knowledge completion module that identifies the knowledge base entity corresponding to the entity in the original text and the extended entity of the knowledge base entity is configured as follows:

[0121] Construct finite state automata;

[0122] The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

[0123] In one implementation of this disclosure, the construction of the finite state automaton is configured as follows:

[0124] We use the Aho-Corasick automaton algorithm to preprocess all entities in the knowledge base to construct a finite state automaton.

[0125] In one implementation of this disclosure, the knowledge completion module inserts the extended entity into the original text based on predefined entity relationships to perform knowledge completion, generating a portion of the knowledge-embedded text, which is configured as follows:

[0126] An insertion template is constructed based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and character name, character name and profession, event name and honor received.

[0127] Based on the insertion template, the extended entity is inserted into the original text to complete the knowledge and generate knowledge-embedded text.

[0128] One implementation of this disclosure also includes:

[0129] The training module is configured to train an opinion bias analysis model using the labeled dataset;

[0130] The detection module is configured to perform opinion bias analysis on new input text based on a trained opinion bias analysis model, and obtain the opinion bias label of the new input text.

[0131] In one implementation of this disclosure, the detection module includes:

[0132] The segmentation unit is configured to perform sentence segmentation on the new input text to obtain a text sentence set;

[0133] The acquisition unit is configured to input the given topic entity set and text sentence set into the Bert layer to obtain entity sentence vectors and text sentence vectors;

[0134] The computing unit is configured to calculate the relationship matrix between the entity sentence vectors and the text sentence vectors;

[0135] The output unit is configured to input the relation matrix into the CNN feature extraction layer for feature fusion and classification, and then output the tendency label of the new input text through the Softmax layer.

[0136] This disclosure also discloses an electronic device, Figure 5 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.

[0137] like Figure 5 As shown, the electronic device includes a memory and a processor, wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method according to embodiments of the present disclosure.

[0138] The automatic text opinion annotation method based on large models and knowledge bases includes:

[0139] Identify the knowledge base entities that correspond to the entities in the original text and the extended entities of the knowledge base entities, and insert the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text.

[0140] Provide a set of entities for a given topic;

[0141] Create a prompt template, embed the knowledge into the text and fill the prompt template with the given topic entity set, and then use a large language model to perform generative annotation to obtain the attitude label corresponding to each given topic entity in the given topic entity set; the prompt template requires the attitude label to be supportive, opposed or neutral.

[0142] Based on the given topic entity, the attitude label corresponding to the given topic entity is used to obtain the tendency label;

[0143] A labeled dataset is constructed based on the original text and the tendency labels.

[0144] In one implementation of this disclosure, the identification of knowledge base entities corresponding to entities in the original text and the extended entities of the knowledge base entities include:

[0145] Construct finite state automata;

[0146] The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

[0147] In one implementation of this disclosure, constructing the finite state automaton includes:

[0148] We use the Aho-Corasick automaton algorithm to preprocess all entities in the knowledge base to construct a finite state automaton.

[0149] In one implementation of this disclosure, the step of inserting the extended entity into the original text based on predefined entity relationships to perform knowledge completion and generate knowledge-embedded text includes:

[0150] An insertion template is constructed based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and character name, character name and profession, event name and honor received.

[0151] Based on the insertion template, the extended entity is inserted into the original text to complete the knowledge and generate knowledge-embedded text.

[0152] One implementation of this disclosure also includes:

[0153] The labeled dataset was used to train an opinion bias analysis model;

[0154] Based on the trained opinion bias analysis model, opinion bias analysis is performed on the new input text to obtain the opinion bias label of the new input text.

[0155] In one implementation of this disclosure, the step of performing opinion bias analysis on the new input text based on a trained opinion bias analysis model to obtain opinion bias labels for the new input text includes:

[0156] The new input text is segmented into sentences to obtain a text sentence set;

[0157] Input the given topic entity set and text sentence set into the BERT layer to obtain entity sentence vectors and text sentence vectors;

[0158] Calculate the relationship matrix between the entity sentence vectors and the text sentence vectors;

[0159] The relationship matrix is ​​input into the CNN feature extraction layer for feature fusion and classification, and then the Softmax layer outputs the tendency label of the new input text.

[0160] Figure 6 A schematic diagram of the structure of a computer system suitable for implementing the method according to embodiments of the present disclosure is shown.

[0161] like Figure 6 As shown, the computer system includes a processing unit that can execute various methods described above based on a program stored in a read-only memory (ROM) or a program loaded from a storage portion into a random access memory (RAM). The RAM also stores various programs and data required for the operation of the computer system. The processing unit, ROM, and RAM are interconnected via a bus. Input / output (I / O) interfaces are also connected to the bus.

[0162] The following components are connected to the I / O interface: input sections including keyboards, mice, etc.; output sections including cathode ray tubes (CRTs), liquid crystal displays (LCDs), and speakers; storage sections including hard disks, etc.; and communication sections including network interface cards such as LAN cards and modems. The communication section performs communication processes via a network such as the Internet. Drives are also connected to the I / O interface as needed. Removable media, such as disks, optical disks, magneto-optical disks, semiconductor memories, etc., are installed on the drive as needed so that computer programs read from them can be installed into the storage section as needed. The processing unit can be implemented as a CPU, GPU, TPU, FPGA, NPU, etc.

[0163] In particular, according to embodiments of this disclosure, the methods described above can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing the methods described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium.

[0164] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0165] The units or modules described in the embodiments of this disclosure can be implemented in software or programmable hardware. The described units or modules can also be located in a processor, and the names of these units or modules do not necessarily constitute a limitation on the unit or module itself.

[0166] In another aspect, this disclosure also provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system described above; or it may be a standalone computer-readable storage medium not assembled into a device. The computer-readable storage medium stores one or more programs, which are used by one or more processors to perform the methods described in this disclosure.

[0167] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

Claims

1. A method for automatically labeling text opinions based on a large model and knowledge base, characterized in that, include: Identify the knowledge base entities that correspond to the entities in the original text and the extended entities of the knowledge base entities, and insert the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text. Provide a set of entities for a given topic; Create a prompt template, embed the knowledge into the text and fill the prompt template with the given topic entity set, and then use a large language model to perform generative annotation to obtain the attitude label corresponding to each given topic entity in the given topic entity set. The prompt template requires a supportive, opposing, or neutral attitude label; Based on the given topic entity, the attitude label corresponding to the given topic entity is used to obtain the tendency label; A labeled dataset is constructed based on the original text and the tendency labels. An opinion bias analysis model is trained using the labeled dataset; wherein the opinion bias analysis model is a Bert-Condition-CNN opinion bias analysis model. Based on the trained opinion bias analysis model, opinion bias analysis is performed on the new input text to obtain the opinion bias label of the new input text; The step of inserting the extended entity into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text includes: constructing an insertion template based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and name, name and profession, event name and honor; and inserting the extended entity into the original text based on the insertion template to complete the knowledge and generate knowledge-embedded text.

2. The automatic text opinion annotation method based on a large model and knowledge base according to claim 1, characterized in that, The knowledge base entities corresponding to the entities in the original text and the extended entities of the knowledge base entities include: Construct finite state automata; The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

3. The automatic text opinion annotation method based on a large model and knowledge base according to claim 2, characterized in that, The construction of the finite state automaton includes: We use the Aho-Corasick automaton algorithm to preprocess all entities in the knowledge base to construct a finite state automaton.

4. The automatic text opinion annotation method based on a large model and knowledge base according to claim 1, characterized in that, The opinion bias analysis model, based on a pre-trained model, performs opinion bias analysis on the new input text, resulting in opinion bias labels for the new input text, including: The new input text is segmented into sentences to obtain a text sentence set; Input the given topic entity set and text sentence set into the BERT layer to obtain entity sentence vectors and text sentence vectors; Calculate the relationship matrix between the entity sentence vectors and the text sentence vectors; The relationship matrix is ​​input into the CNN feature extraction layer for feature fusion and classification, and then the Softmax layer outputs the tendency label of the new input text.

5. A text opinion annotation device based on a large model and knowledge base, characterized in that, include: The knowledge completion module is configured to identify knowledge base entities that correspond to entities in the original text and extended entities of the knowledge base entities, and insert the extended entities into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text. The first acquisition module is configured to provide a set of entities for a given topic. The tagging module is configured to create a prompt template, embed the knowledge into the text and fill the prompt template with a given set of topic entities, and then use a large language model to perform generative annotation to obtain attitude tags corresponding to each given topic entity in the given set of topic entities. The prompt template requires a supportive, opposing, or neutral attitude label; The second acquisition module is configured to obtain a tendency label based on the given topic entity and the attitude label corresponding to the given topic entity. The construction module is configured to build a labeled dataset based on the original text and the tendency labels; The training module is configured to train an opinion bias analysis model using the labeled dataset; wherein the opinion bias analysis model is a Bert-Condition-CNN opinion bias analysis model. The detection module is configured to perform opinion bias analysis on new input text based on a trained opinion bias analysis model to obtain opinion bias labels for the new input text; The step of inserting the extended entity into the original text based on predefined entity relationships to complete the knowledge and generate knowledge-embedded text includes: constructing an insertion template based on the predefined entity relationships; the predefined entity relationships include one or more of the following: nickname, alias and name, name and profession, event name and honor; and inserting the extended entity into the original text based on the insertion template to complete the knowledge and generate knowledge-embedded text.

6. The automatic text opinion annotation device based on a large model and knowledge base according to claim 5, characterized in that, The portion of the knowledge completion module that identifies the knowledge base entities corresponding to the entities in the original text and the extended entities of the knowledge base entities is configured as follows: Construct finite state automata; The finite state automaton is used to identify knowledge base entities that correspond to entities in the original text, as well as extended entities of the knowledge base entities.

7. An electronic device, characterized in that, It includes a memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method of any one of claims 1-4.

8. A computer-readable storage medium storing computer instructions thereon, characterized in that, When executed by a processor, the computer instructions implement the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Chinese dialogue semantic role labeling method and system

    CN114625830A

  • Dialogue pre-labeling method and system, computer equipment and storage medium

    CN116860921A