Short text entity sentiment analysis method and equipment

By using the first propt and large language model to extract short text entities, and combining knowledge base for search and sentiment analysis, the problems of inaccurate entity recognition, insufficient granularity of sentiment analysis and limited generalization capabilities in the existing technology are solved, and the more Accurate short text entity sentiment analysis.

CN118916492APending Publication Date: 2024-11-08SHANGHAI MIDU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410953016.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

Existing short text entity sentiment analysis methods have shortcomings in entity recognition, sentiment analysis granularity, context understanding and model generalization capabilities, resulting in inaccurate entity recognition in short text, difficulty in accurate sentiment analysis to specific entities, insufficient context information and models There is limited generalization capability in different fields and datasets.

Method used

The first propt combined with the large language model to extract the original short text entity, and search with the knowledge base. Then the search text, original short text and entity are input into the large language model for sentiment analysis, and the improved Lora model is used to enhance the generalization of the model. abilities and update sentiment analysis results through the knowledge base to improve accuracy.

Benefits of technology

The generalization ability of the model is improved, and the situation and emotional background of entities can be more accurately understood, thereby improving the granularity and accuracy of sentiment analysis and adapting to the sentiment analysis needs of different fields and data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916492A_ABST
    Figure CN118916492A_ABST
Patent Text Reader

Abstract

The invention aims at providing a short text entity sentiment analysis method and device.According to the short text entity sentiment analysis method, entity extraction is conducted on an original short text by using a first prompt in combination with a large language model, and a short text entity is obtained; the short text entity and the original short text are combined in a knowledge base for retrieval, and a retrieval text is obtained; and inputting the original short text, the retrieval text, the short text entity and the second prompt into the large language model, and performing sentiment analysis to obtain an entity sentiment analysis result. Therefore, the generalization ability of the model is improved, and the model can adapt to sentiment analysis requirements of different fields and data sets; by combining the extracted entities with information in the knowledge base, the situation and the emotion background of the entities can be more accurately understood, so that the granularity of emotion analysis is improved; the emotion of a specific entity can be analyzed more accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method and device for short text entity sentiment analysis. Background Art

[0002] In natural language processing (NLP), sentiment analysis is an important research direction, which aims to identify and classify emotional tendencies in text. Short text entity sentiment analysis is further refined and focuses on identifying the emotional tendencies of specific entities in text, which is crucial for understanding users' attitudes and emotional reactions to specific objects. For example, analyzing users' emotional attitudes towards a certain feature or component in product reviews, or analyzing the public's emotional reactions to an event or person in social media posts. Most of the existing short text entity sentiment analysis methods are based on traditional machine learning algorithms and some preliminary deep learning methods. These methods perform well when processing long texts, but often do not work well on short texts, because the entity and emotional expressions in short texts are often more subtle and obscure, and the contextual information of the entities is insufficient, making it more difficult to accurately identify and analyze emotions.

[0003] In the existing method, rules are combined with deep learning BERT to perform short text entity analysis, but this method has the following disadvantages:

[0004] 1) Inaccurate entity recognition: entities in short texts may be difficult to accurately identify due to insufficient context information;

[0005] 2) The granularity of sentiment analysis is insufficient. It can only analyze the overall sentiment of the text and is difficult to accurately analyze the sentiment of a specific entity.

[0006] 3) Insufficient contextual understanding: The contextual information of short texts is limited, which makes it difficult for existing methods to fully understand the situational and emotional background of entities;

[0007] 4) The generalization ability of the model is limited. The existing models have limited generalization ability in different fields and data sets, and it is difficult to adapt to the diverse needs of short text sentiment analysis. Summary of the invention

[0008] One purpose of the present application is to provide a method and device for short text entity sentiment analysis to solve the problems in the prior art of inaccurate entity recognition, insufficient sentiment analysis granularity and context understanding, and limited model generalization ability.

[0009] According to one aspect of the present application, a method for short text entity sentiment analysis is provided, the method comprising:

[0010] Use the first prompt combined with the large language model to extract entities from the original short text to obtain short text entities;

[0011] Combine the short text entity with the original short text to perform retrieval in the knowledge base to obtain the retrieval text;

[0012] The original short text, the searched text, the short text entity and the second prompt are input into the large language model together for sentiment analysis to obtain the entity sentiment analysis result.

[0013] Optionally, the first prompt is used in combination with a large language model to perform entity extraction on the original short text, including:

[0014] Input the original short text and the first prompt into the large language model;

[0015] The first prompt is used to guide the large language model to focus on the entity part in the original short text, and extract the short text entity, wherein the first prompt is a prompt for entity recognition.

[0016] Optionally, the short text entity is combined with the original short text to be searched in the knowledge base to obtain the search text, including:

[0017] Combine the short text entity with the original short text to obtain combined entity information;

[0018] Construct a query and send the combined entity information to the knowledge base as retrieval conditions;

[0019] In the knowledge base, texts or cases similar to the original short text are retrieved according to the retrieval conditions to obtain the retrieval text.

[0020] Optionally, the original short text, the search text, the short text entity and the second prompt are input into a large language model, including:

[0021] Combine the original short text, the search text and the short text entity to obtain combined information;

[0022] The combined information and the second prompt are input into the large language model, and the large language model is guided to focus on the emotional expression in the combined information through the second prompt, wherein the second prompt is a prompt for emotional analysis.

[0023] Optionally, sentiment analysis is performed to obtain entity sentiment analysis results, including:

[0024] Extract the emotional features of entities and determine the emotional tendency of the extracted emotional features;

[0025] Adjust the emotional tendency of the judgment based on the contextual information in the knowledge base;

[0026] Generate a sentiment analysis report for each entity based on the adjustment results.

[0027] Optionally, the method comprises:

[0028] The input of the existing large language model is improved based on Lora, and the improved large language model is used in combination with the first prompt and the second prompt.

[0029] Optionally, the input of the existing large language model is improved based on Lora, including:

[0030] Use Lora to freeze the main parameters of the existing large language model;

[0031] Inject a trainable low-rank matrix into a specific layer or all layers of the frozen large language model to adjust the weight of the frozen large language model;

[0032] Adjusting the frozen entity sentiment analysis task in a large language model.

[0033] Optionally, after obtaining the entity sentiment analysis results, include:

[0034] Update the entity sentiment analysis results into the knowledge base.

[0035] According to another aspect of the present application, a device for short text entity sentiment analysis is also provided, the device comprising:

[0036] one or more processors; and

[0037] A memory storing computer readable instructions, which, when executed, cause the processor to perform the operations of the method as described above.

[0038] According to another aspect of the present application, a computer-readable medium is provided, on which computer-readable instructions are stored. The computer-readable instructions can be executed by a processor to implement the method described above.

[0039] Compared with the prior art, this application extracts entities from the original short text by using the first prompt combined with a large language model to obtain short text entities; combines the short text entities with the original short text for retrieval in the knowledge base to obtain retrieval text; inputs the original short text, retrieval text, short text entities and the second prompt into the large language model for sentiment analysis to obtain entity sentiment analysis results. This improves the generalization ability of the model, enabling it to adapt to sentiment analysis needs in different fields and data sets; by combining the extracted entities with the information in the knowledge base, the context and sentiment background of the entity can be more accurately understood, thereby improving the granularity of sentiment analysis; and the sentiment of a specific entity can be analyzed more accurately. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0041] Figure 1 A schematic diagram of a method flow for short text entity sentiment analysis provided according to one aspect of the present application is shown;

[0042] Figure 2 A schematic diagram of a method flow for short text entity sentiment analysis based on a large model and a knowledge base in one embodiment of the present application is shown.

[0043] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0044] The present application is described in further detail below in conjunction with the accompanying drawings.

[0045] In a typical configuration of the present application, the terminal, the device of the service network and the trusted party all include one or more processors (eg, a central processing unit (CPU)), an input / output interface, a network interface and a memory.

[0046] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.

[0047] Computer readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, Phase-Change RAM (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of random access memory (RAM), Read-Only Memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. According to the definition in this article, computer-readable media does not include non-transitory media such as modulated data signals and carrier waves.

[0048] Figure 1 A schematic flow chart of a method for short text entity sentiment analysis provided according to one aspect of the present application is shown, the method comprising: steps S11 to S13, wherein:

[0049] Step S11, use the first prompt in combination with the large language model to extract entities from the original short text to obtain short text entities; here, the prompt and the large language model are used to extract entities from the original short text. Because different prompts will be used later, the first and second prompts are used here to distinguish; for example, if the original short text is "Iberian pig is a little oily", the extracted entity is "Iberian pig". Due to the large parameter scale and complex calculation results of the large language model (large model), it can handle complex tasks and data. They learn complex patterns and features by training massive data, and have strong generalization capabilities. They can make accurate predictions for unseen data, and even short texts can be accurately recognized. Among them, prompt is a machine learning prediction optimization, which is a natural language processing technology that can automatically generate human language-like texts, such as question answering, short text generation, etc. Using this prompt to annotate data can pre-train language models and achieve specific tasks.

[0050] In the embodiment of the present application, the large language model used contains billions of parameters, and the model size can reach hundreds of GB or even larger. The huge model scale gives the large language model powerful expression and learning capabilities. The large language model also has the ability to emerge, which means that when the training data of the model exceeds a certain scale, the model suddenly emerges with complex capabilities and characteristics that the small model did not have before, unexpected, and can comprehensively analyze and solve deeper problems, showing human-like thinking and intelligence. Emergence is also one of the most significant features of the large language model. In addition, with better performance and generalization capabilities, large language models usually have stronger learning and generalization capabilities, and can perform well in various tasks, including natural language processing, image recognition, speech recognition, etc. Large language models can also perform multi-task learning. Large language models usually learn a variety of different natural language processing (NLP, Neuro-Linguistic Programming) tasks together, such as machine translation, text summarization, question-answering systems, etc. This can enable the model to learn a wider and more generalized language understanding ability. Large language models can perform big data training, and large language models require massive data to train, usually above TB or even PB level data sets. Only a large amount of data can bring out the parameter scale advantage of a large language model. Powerful computing resources: Training a large language model usually requires hundreds or even thousands of GPUs (graphics processing units), as well as a lot of time, usually from weeks to months. Transfer learning and pre-training: A large language model can be pre-trained on large-scale data and then fine-tuned on a specific task to improve the performance of the model on new tasks. Self-supervised learning: A large language model can be trained on large-scale unlabeled data through self-supervised learning, thereby reducing dependence on labeled data and improving the effectiveness of the model. Domain knowledge fusion: A large language model can learn knowledge from data in multiple fields and apply it in different fields to promote cross-domain innovation. Automation and efficiency: A large language model can automate many complex tasks and improve work efficiency, such as automatic programming, automatic translation, and automatic summarization.

[0051] In an embodiment of the present application, the large language model can adopt the chatglm2-6B model. The chatglm2-6B model is an open source, bilingual dialogue language model that supports Chinese and English, based on the General Language Model (GLM) architecture, and has 6.2 billion parameters. Combined with model quantization technology, users can deploy it locally on consumer-grade graphics cards (only 6GB of video memory is required at the INT4 quantization level). The chatglm2 model is optimized for Chinese questions and answers and dialogues. After bilingual training in Chinese and English with about 1T of identifiers, supplemented by supervised fine-tuning, feedback self-help, human feedback reinforcement learning and other technologies, the chatglm2-6B model with 6.2 billion parameters can already generate answers that are quite in line with human preferences.

[0052] Step S12, combining the short text entity with the original short text to search in the knowledge base to obtain the search text; here, the entity is combined with the sentence for retrieval, that is, the extracted short text entity is combined with the original short text, and searched in the knowledge base, and similar sentences are retrieved using the knowledge base. For example, the entity "Iberian pig" is combined with "Iberian pig is a bit too oily" and then searched in the knowledge base to obtain "soup base - the soup base will not be too greasy" and "Iberian pig - Iberian pig tastes a bit greasy". The prompt and the large model are used to extract entities from the text, and then the extracted entities are combined with the sentences for knowledge base retrieval, which can help the system find known sentiment patterns and contextual information related to the entity, and provide a rich source of information for subsequent sentiment analysis. Traditional models perform well in specific fields, but have limitations in cross-domain generalization. The present application improves the generalization ability of the model by combining a large model and a knowledge base, so that it can adapt to the sentiment analysis needs of different fields and data sets.

[0053] Step S13, input the original short text, the retrieved text, the short text entity and the second prompt into the large language model, perform sentiment analysis, and obtain the entity sentiment analysis result. Here, the similar text retrieved from the knowledge base is added to the original text and the extracted entity and input into the large model, and the second prompt is used to guide the large model to focus on sentiment analysis, and then obtain the entity sentiment analysis result, for example, "Iberian pigs are a bit too oily" is analyzed as a negative sentiment. This application inputs the similar text retrieved from the knowledge base together with the original text and the extracted entity into the large model, so that the learning and generalization ability of the large model can be used, combined with the sentiment tendency of similar texts, to more accurately analyze the sentiment of specific entities.

[0054] In one embodiment of the present application, in step S11, the original short text and the first prompt are input into the large language model together; the large language model is guided by the first prompt to focus on the entity part in the original short text and extract the short text entity, wherein the first prompt is a prompt for entity recognition. Figure 2The flowchart shown uses two prompts. In the embodiment of the present application, the first prompt (prompt1) and the second prompt (prompt2) are designed. Prompt1 and prompt2 are for different tasks. Prompt1 focuses on entity recognition, and prompt2 is used for sentiment analysis or other tasks. When designing prompt1, a prompt for entity recognition is designed. This prompt1 will guide the large model to focus on the entity part in the text. The designed prompt1 is input into the large model together with the original text, and the large model's ability to understand and process natural language is used to identify the entities in the text.

[0055] In one embodiment of the present application, in step S12, the short text entity is combined with the original short text to obtain the combined entity information; a query is constructed, and the combined entity information is sent to the knowledge base as a search condition; in the knowledge base, texts or cases similar to the original short text are retrieved according to the search condition to obtain the search text. Figure 2 , the original text is passed through prompt1+ large model to get entities, and the entities are combined with sentences to search in the knowledge base, that is, the entities are combined with texts. When searching for queries, a query is constructed, and the text of the combined entity information is sent to the knowledge base as a search condition for similar matching. In the knowledge base, similar texts or cases are retrieved based on the entities and text content in the query. Among them, the knowledge base stores a large amount of structured information, including the relationship between entities, attributes, and sentiment-related vocabulary. By combining the extracted entities with the information in the knowledge base, the context and emotional background of the entities can be understood more accurately, thereby improving the granularity of sentiment analysis.

[0056] In one embodiment of the present application, in step S13, the original short text, the retrieved text and the short text entity are combined to obtain combined information; the combined information is input into the large language model together with the second prompt, and the large language model is guided to focus on the emotional expression in the combined information through the second prompt, wherein the second prompt is a prompt for sentiment analysis. Here, prompt2 is designed: a prompt for sentiment analysis is designed; prompt2 will guide the large model to focus on the emotional expression in the text, and similar texts retrieved from the knowledge base, the original text and the extracted entities are taken as input together, and the designed second prompt is used as a guide, and input into the large model for sentiment tendency analysis, and the model will output the sentiment label or sentiment score of each entity.

[0057] In one embodiment of the present application, in step S13, the emotional features of the entity are extracted, and the emotional tendency of the extracted emotional features is determined; the determined emotional tendency is adjusted in combination with the context information in the knowledge base; and a sentiment analysis report for each entity is generated based on the adjustment result. Here, the large model performs sentiment analysis to obtain the sentiment analysis results of each entity, which can be positive, negative or neutral sentiment polarity, or more detailed sentiment categories; the specific process of entity sentiment analysis is: sentiment feature extraction, analysis of the vocabulary, phrases or sentence structure in the text, and extraction of characteristics related to sentiment; then, sentiment tendency determination is performed, and the extracted emotional features are learned and inferred using the large model to determine the associated emotional tendency of each entity; then, context consideration is performed, and the emotional tendency is fine-tuned in combination with the context information in the knowledge base to improve the accuracy of the analysis; finally, the results are integrated, and the analysis results are integrated to form a sentiment analysis report for each entity, which may include information such as sentiment polarity and sentiment intensity. Thus, sentiment analysis of specific entities in short texts can be achieved, while taking advantage of the advantages of large models and knowledge bases to improve the accuracy of analysis.

[0058] In one embodiment of the present application, the method includes: improving the input of an existing large language model based on Lora, using the improved large language model in combination with a first prompt and in combination with a second prompt. Here, the large model is fine-tuned using a low-rank adaptation (Low-Rank Adaptation, Lora) method, which reduces the number of trainable parameters through low-rank decomposition while maintaining the expressiveness of the model; this allows the model to be more efficiently adjusted for specific tasks and improves the accuracy of sentiment analysis. The improved large model is used in combination with the first prompt to extract entities from the original short text, and is used in combination with the second prompt to perform sentiment analysis, and output the sentiment analysis results. Traditional large model training requires a lot of computing resources, such as GPU and time, while the present application reduces the demand for computing resources by adopting new training methods, such as Lora.

[0059] Following the above embodiment, when improving the large model, Lora is used to freeze the main parameters of the existing large language model; a trainable low-rank matrix is ​​injected into a specific layer or all layers of the frozen large language model to adjust the weight of the frozen large language model; and the entity sentiment analysis task in the frozen large language model is adjusted. Here, in the Lora method, the main parameters in the pre-trained model (the existing large model) are frozen, and these parameters are not updated during the fine-tuning process, wherein the main parameters include the weights of the Transformer model; a low-rank matrix is ​​injected, and a trainable low-rank matrix (A and B) is injected into a specific layer or all layers of the model, and the product of these matrices simulates the update of the weights of the original model; in the fine-tuning stage, only these low-rank matrices A and B will receive gradients and be updated. Since the number of parameters of A and B is far less than that of the original model, this method greatly reduces the amount of parameters and computing resources required for fine-tuning; task-specific adjustments are performed, and in the entity sentiment analysis task, those parts of the model that are more focused on the recognition and classification of entities and emotions are fine-tuned, such as fine-tuning the attention layer related to entities and emotions. The Lora method can efficiently fine-tune large models to better adapt them to specific downstream tasks, such as entity sentiment analysis, while significantly reducing training costs. Traditional large model training is highly dependent on a large amount of labeled data, while this application uses a self-supervised learning method to reduce dependence on labeled data and improve the performance of the model.

[0060] In an embodiment of the present application, Lora freezes the pre-trained model weights and injects the trainable rank decomposition matrix into each layer of the Transform architecture, greatly reducing the number of trainable parameters for downstream tasks. When improving the large language model, multiple Lora modules for different tasks can be built for downstream tasks, freezing the parameter sharing of the large language model, and choosing to use A and B matrices instead; by replacing matrices A and B to efficiently switch tasks, storage requirements and task switching overhead are significantly reduced. Using a linear design allows the trainable matrix to be merged with the frozen weights at deployment, and no inference delay is introduced compared to a fully fine-tuned model. The process of updating the model parameters is as follows:

[0061] W0+ΔW=W0+BA

[0062] During the training process, W0 is frozen and does not receive gradient updates, while A and B contain trainable parameters. Note that W0 and ΔW=BA are multiplied by the same input, and their respective output vectors are summed in coordinates. At the same time, the output dimensions of W0 and ΔW are consistent, so when the parameters are merged after training is completed, the corresponding positions are added. During initialization, A is initialized with a random Gaussian and B is initialized with zero, which is 0 at the beginning of training. Then ΔW can be scaled by parameters and the left and right parts can be added together without adding additional computing resources.

[0063] In an embodiment of the present application, after obtaining the entity sentiment analysis result, the obtained entity sentiment analysis result is updated to the knowledge base. Figure 2 , the similar text retrieved from the knowledge base is added to the original text and the extracted entity combined with prompt2 and input into the large model to obtain the entity sentiment analysis result, such as "Iberian pig - Iberian pig is a bit too oily - negative", that is, the sentiment analysis result of the original short text is negative sentiment. The results are stored in the knowledge base to update the knowledge base; this feedback mechanism enables the knowledge base to be continuously enriched and updated, further improving the accuracy of subsequent sentiment analysis. The update and maintenance of the large model is very complex. This application creates a self-updating and maintainable system by feeding back the sentiment analysis results to the knowledge base, which helps the model adapt to new data and situations.

[0064] In addition, an embodiment of the present application also provides a computer-readable medium on which computer-readable instructions are stored, and the computer-readable instructions can be executed by a processor to implement the aforementioned method of short text entity sentiment analysis.

[0065] Corresponding to the method described above, the present application also provides a terminal, which includes a terminal capable of executing the above Figure 1 or Figure 2 Or the modules or units of the method steps described in each embodiment, these modules or units can be implemented by hardware, software or a combination of hardware and software, and this application is not limited. For example, in one embodiment of this application, a device for short text entity sentiment analysis is also provided, and the device includes:

[0066] one or more processors; and

[0067] A memory storing computer readable instructions, which, when executed, cause the processor to perform the operations of the method as described above.

[0068] For example, the computer readable instructions, when executed, cause the one or more processors to:

[0069] Use the first prompt combined with the large language model to extract entities from the original short text to obtain short text entities;

[0070] Combine the short text entity with the original short text to perform retrieval in the knowledge base to obtain the retrieval text;

[0071] The original short text, the searched text, the short text entity and the second prompt are input into the large language model together for sentiment analysis to obtain the entity sentiment analysis result.

[0072] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

[0073] It should be noted that the present application can be implemented in software and / or a combination of software and hardware, for example, can be implemented using an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware device. In one embodiment, the software program of the present application can be executed by a processor to implement the steps or functions described above. Similarly, the software program of the present application (including relevant data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the present application can be implemented using hardware, for example, as a circuit that cooperates with a processor to perform each step or function.

[0074] In addition, a part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. The program instruction for calling the method of the present application may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in a working memory of a computer device that runs according to the program instruction. Here, according to an embodiment of the present application, a device is included, the device including a memory for storing computer program instructions and a processor for executing program instructions, wherein, when the computer program instruction is executed by the processor, the device is triggered to run the method and / or technical solution based on the aforementioned multiple embodiments according to the present application.

[0075] It is obvious to those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and that the present application can be implemented in other specific forms without departing from the spirit or basic features of the present application. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

Claims

1. A method for short text entity sentiment analysis, characterized in that: The method comprises: Use the first prompt combined with the large language model to extract entities from the original short text to obtain short text entities; Combine the short text entity with the original short text to perform retrieval in the knowledge base to obtain the retrieval text; The original short text, the searched text, the short text entity and the second prompt are input into the large language model together for sentiment analysis to obtain the entity sentiment analysis result.

2. The method according to claim 1, characterized in that Use the first prompt combined with a large language model to extract entities from the original short text, including: Input the original short text and the first prompt into the large language model; The first prompt is used to guide the large language model to focus on the entity part in the original short text, and extract the short text entity, wherein the first prompt is a prompt for entity recognition.

3. The method according to claim 1, characterized in that Combine the short text entity with the original short text to search in the knowledge base to obtain the search text, including: Combine the short text entity with the original short text to obtain combined entity information; Construct a query and send the combined entity information to the knowledge base as retrieval conditions; In the knowledge base, texts or cases similar to the original short text are retrieved according to the retrieval conditions to obtain the retrieval text.

4. The method according to claim 1, characterized in that: The original short text, the searched text, the short text entity and the second prompt are input into the large language model, including: Combine the original short text, the search text and the short text entity to obtain combined information; The combined information and the second prompt are input into the large language model together, and the large language model is guided to focus on the emotional expression in the combined information through the second prompt, wherein the second prompt is a prompt for emotional analysis.

5. The method according to claim 4, characterized in that Perform sentiment analysis to obtain entity sentiment analysis results, including: Extract the emotional features of entities and determine the emotional tendency of the extracted emotional features; Adjust the emotional tendency of the judgment based on the contextual information in the knowledge base; Generate a sentiment analysis report for each entity based on the adjustment results.

6. The method according to claim 1, characterized in that The method comprises: The input of the existing large language model is improved based on Lora, and the improved large language model is used in combination with the first prompt and the second prompt.

7. The method according to claim 6, characterized in that Improvements to the input of existing large language models based on Lora include: Use Lora to freeze the main parameters of the existing large language model; Inject a trainable low-rank matrix into a specific layer or all layers of the frozen large language model to adjust the weight of the frozen large language model; Adjusting the frozen entity sentiment analysis task in a large language model.

8. The method according to claim 1, characterized in that After obtaining the entity sentiment analysis results, including: Update the entity sentiment analysis results into the knowledge base.

9. A device for short text entity sentiment analysis, characterized in that: The device comprises: one or more processors; and A memory storing computer readable instructions which, when executed, cause the processor to perform the operations of the method as claimed in any one of claims 1 to 8.

10. A computer-readable medium having computer-readable instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Online data network fine-grained emotion detection method and device based on fine-tuning large model

    CN116737938A

  • Emotion analysis method and device and big language model training method and device

    CN117436438A