A fine-grained parsing method for user reviews based on large language model

The preprocessing and matching of user comments through large language models and optimization prompt strategies has solved the problem of difficult to achieve fine-grained analysis in the existing technology, and achieved efficient and accurate user comment analysis, which is suitable for multiple industries and reduces computing resource requirements.

CN119760140BActive Publication Date: 2025-08-08CHINA AUTOMOTIVE INFORMATION TECH (TIANJIN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510272656.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-10
Publication Date
2025-08-08
Estimated Expiration
2045-03-10

AI Technical Summary

Technical Problem

Existing user comment analysis methods are difficult to achieve fine-grained sentiment analysis, and require a large amount of manual annotation training data, making it difficult to adapt to rapidly changing market demand.

Method used

A large language model is used to combine optimization prompt strategy to preprocess user comments, domain knowledge matching and dynamic tuning training, and fine-grained analysis is performed through aspect word extraction and emotional polarity classification.

Benefits of technology

It realizes efficient and accurate fine-grained user review analysis, which can quickly adapt to the needs of different industries, reduce computing resource requirements, and provide in-depth customer insights.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119760140B_ABST
    Figure CN119760140B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of semantic understanding technology, and more specifically, to a method for fine-grained parsing of user comments based on a large language model. The method includes preprocessing user comments; matching the comments against specialized knowledge in a specific field to obtain target knowledge; training the large language model based on target tasks and dynamic tuning prompts, the target tasks including aspect word extraction and sentiment polarity classification; and fusing the comments with the target knowledge and inputting them into the large language model to obtain parsed results for the comments. The present invention utilizes a large language model and an optimized prompting strategy to perform fine-grained parsing of user comments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of semantic understanding technology, and in particular to a fine-grained parsing method for user comments based on a large language model. Background Art

[0002] With the rapid development of e-commerce and online services, user review analysis has become a crucial tool for understanding customer needs and improving product and service quality. Traditional review analysis methods often only provide coarse-grained sentiment analysis or keyword extraction, failing to accurately capture users' specific opinions on products or services. Furthermore, these methods typically require large amounts of manually annotated training data, which is time-consuming and labor-intensive, and difficult to adapt to rapidly changing market demands.

[0003] In recent years, large language models have achieved significant breakthroughs in natural language processing, demonstrating powerful language understanding and generation capabilities. However, how to effectively utilize these models to improve fine-grained user review analysis while ensuring accuracy and efficiency remains a pressing technical challenge. Summary of the Invention

[0004] The purpose of the present invention is to provide a method for fine-grained parsing of user comments based on a large language model, which utilizes a large language model and an optimized prompt strategy to perform fine-grained parsing of user comments.

[0005] In order to achieve the above object, the present invention adopts the following technical solutions:

[0006] The present invention provides a method for fine-grained parsing of user comments based on a large language model, comprising:

[0007] Preprocess user comments;

[0008] Matching the comments with expertise in a specific field to obtain target knowledge;

[0009] Training a large language model based on target tasks and dynamic tuning cues, wherein the target tasks include aspect word extraction and sentiment polarity classification;

[0010] The comments are fused with the target knowledge and input into the large language model to obtain parsing results of the comments.

[0011] Compared with the prior art, the present invention has the following beneficial effects:

[0012] This invention leverages the powerful language understanding capabilities of large language models to identify fine-grained objects in user reviews and analyze satisfaction. This process, which includes data preprocessing, domain knowledge infusion, model training, and fine-grained parsing using large language models, enables efficient and accurate analysis of user reviews, providing businesses with valuable customer insights. This invention is particularly suitable for various scenarios requiring a deep understanding of user feedback and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0014] Figure 1 This is a flowchart of a method for fine-grained parsing of user comments based on a large language model provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0015] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0016] Example 1

[0017] The method provided in this embodiment is used to perform fine-grained analysis on user comments to obtain the semantics contained in the comments. This method can be executed by an electronic device. Figure 1 The present invention provides a method for fine-grained parsing of user comments based on a large language model, comprising:

[0018] S110: Pre-process the user's comments.

[0019] Perform text cleaning, spelling correction, word segmentation and part-of-speech tagging, and normalization on user comments. Specifically,

[0020] (1) Text cleaning:

[0021] Remove HTML (Hypertext Markup Language) tags: Use the regular expression `<[^>]+>` to match and remove HTML tags. Normalize URLs (Uniform Resource Locator): Replace URLs with the special `[URL]` tag. Process Emojis: Convert emojis to text descriptions.

[0022] (2) Spelling Correction:

[0023] Use the edit distance algorithm to detect potential spelling errors. Correct the comments to obtain multiple candidate correction words, calculate the perplexity of the candidate correction words, and select the optimal correction result.

[0024] (3) Word segmentation and part-of-speech tagging:

[0025] A Transformer-based sequence labeling model is used for word segmentation and part-of-speech tagging. The structure of this sequence labeling model can be BERT + BiLSTM + CRF. The annotation set uses the Penn Treebank part-of-speech tagging set. BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language model based on the Transformer architecture. BiLSTM (Bidirectional LSTM) is a bidirectional long short-term memory network that can simultaneously acquire information from both the front and back directions of the sequence through forward and backward propagation. BiLSTM has significant advantages for tasks that require integrating contextual information to make decisions. The CRF model (Conditional Random Field) is a discriminative probabilistic model commonly used in sequence labeling tasks such as part-of-speech tagging and named entity recognition in natural language processing.

[0026] (4) Standardized processing:

[0027] Unify case: Convert all text to lowercase. Number processing: Unify the number format, such as converting "10,000" to "10000".

[0028] S120. Match the comments with the professional knowledge in a specific field to obtain target knowledge.

[0029] This step integrates domain-specific expertise into the large language model. Optionally, domain-specific expertise can be first acquired. For example, this can be done through existing knowledge graphs or by capturing automotive expertise from professional websites, forums, and literature. For example, in the smartphone domain, general knowledge such as "smartphones have cameras" and "battery capacity affects battery life" can be acquired. In addition to general knowledge, a large amount of domain-specific knowledge is also collected and organized. This knowledge may come from industry reports, professional literature, or summaries by domain experts, and includes specialized information such as product features, technical parameters, and evaluation criteria.

[0030] After acquiring domain-specific expertise, to ensure personalized and accurate knowledge injection, reviews are matched against the expertise using a semantic similarity matching algorithm to obtain target knowledge. For example, when a user review is received, the review content is initially analyzed to extract keywords and topics. Then, based on these extracted keywords and topics, the semantic similarity matching algorithm is used to retrieve the most matching knowledge items (i.e., target knowledge) from the pre-acquired expertise, ensuring that the selected target knowledge is highly relevant to the review content. For example, if a user review mentions a phone's camera function, target knowledge related to the camera and image quality will be prioritized.

[0031] S130. Training the large language model based on target tasks and dynamic tuning prompts, where the target tasks include aspect word extraction and sentiment polarity classification.

[0032] Aspect terms are words used to describe or describe a specific aspect, field, or perspective. Examples include spatial terms, technical field terms (such as batteries and body-in-white), service features, and product features. Sentiment polarity classification is performed on each extracted aspect term, and can be determined based on business needs, such as positive, neutral, or negative.

[0033] Large language models, including but not limited to LLaMA models, can generate text, provide conversational capabilities, offer personalized suggestions, resolve issues, and provide support. The primary purpose of this step is to train the large language model through unique dynamic prompts, enabling it to produce more accurate and fine-grained parsing results based on the guidance of dynamic prompts.

[0034] This embodiment uses a prompt mode to train the large language model. Specifically, pre-processed comments and prompts are fed into the large language model, causing it to output aspect terms and sentiment polarity classifications. During the iterative training of the large language model's parameters, achieving satisfactory parsing results in one go is difficult. This requires continuous optimization of the prompt template and content, i.e., dynamic tuning of the prompts, to ensure that the large language model's output approaches the optimal parsing result.

[0035] The core concept of S130 is to guide the model to produce more accurate and relevant outputs by continuously optimizing and adjusting prompts. Dynamic prompt tuning combines task-specific requirements with the real-time nature of user comments, enabling the model to continuously adjust and optimize itself during the analysis process.

[0036] S140: Fuse the comments with the target knowledge and input them into the large language model to obtain the parsed results of the comments.

[0037] The large language model is trained in step S130 to obtain a usable large language model. S140 mainly uses the large language model to parse user comments to obtain aspect words and sentiment polarity classification for the aspect words.

[0038] To effectively integrate reviews with target knowledge, this embodiment designs multiple knowledge templates to accommodate different types of knowledge and parsing tasks. Knowledge templates determine how knowledge is organized and presented to the model. First, an appropriate knowledge template is selected based on the relevance of the target knowledge and the naturalness of its expression. The semantic similarity between the target knowledge and the review is calculated, and this semantic similarity is used as the relevance of the target knowledge. Naturalness of expression can be determined using rule-based methods, such as using a grammar checker and a syntax analyzer to determine whether the target knowledge contains grammatical and syntactic errors or inappropriateness. If there are no errors or inappropriateness, the naturalness score is 100. The naturalness score is then reduced based on the number of errors or inappropriateness to obtain the naturalness score. If both the relevance and naturalness of expression exceed a set threshold, a template that presents key points in a hierarchical manner is selected. Otherwise, the knowledge only provides supplementary information, and a simplified template can be used to ensure a natural and clear presentation of the information. The hierarchical presentation template lists the necessary details of the core knowledge, such as definition, cause, and impact, in points, retaining only the most relevant information. The relevance of the knowledge to the review is directly explained in conjunction with the review content, and the application scenario is presented in the simplest possible sentence or example. Simplified templates directly describe the core content of knowledge in a single sentence or phrase.

[0039] Then, based on the target knowledge type, the target knowledge is embedded in the appropriate location of the selected knowledge template. If the target knowledge type is basic attributes (for example, knowledge describing the basic attributes of a product), the target knowledge is embedded at the beginning of the selected knowledge template. If the target knowledge type is functional description (for example, detailed description of a specific function), the target knowledge is embedded in the selected knowledge template near the comments. By embedding different types of target knowledge in the appropriate locations of the knowledge template, the model can prioritize learning basic attributes, followed by functional descriptions, thereby progressively learning domain-specific knowledge and achieving better integration. Finally, the knowledge template is spliced with the comments.

[0040] For example, a knowledge template might look like this: "When analyzing the following reviews, consider this key information: [Product A] belongs to [Category X], and [Product A] has features [Feature Y, Feature Z]. Feature Y has an impact on product performance of [degree of impact]. Now, analyze the following user review and identify the mentioned product features and their sentiment polarity: [User Review]." This knowledge template allows for flexible insertion of diverse domain knowledge while providing clear analytical guidance for the model.

[0041] This step cleverly integrates domain-specific knowledge into the processing flow of the large language model, enhancing the model's ability to understand user reviews in specific domains, thereby improving the accuracy and relevance of the analysis. Furthermore, this knowledge injection method enables the model to be equipped with the most relevant and valuable domain knowledge when analyzing each review. This not only improves the model's ability to understand and analyze reviews, but also makes the analysis results more accurate and insightful. For example, when analyzing a review about smartphone battery life, the system might inject specialized knowledge about battery capacity and power management techniques, enabling the model to more accurately understand and evaluate the user experience.

[0042] This example successfully combines expert knowledge with the powerful processing capabilities of a large language model, significantly improving the system's performance on fine-grained user review analysis. This approach is not only applicable to smartphones but can also be easily extended to other fields, such as car reviews and restaurant reviews, demonstrating its strong versatility and potential.

[0043] Example 2

[0044] This embodiment optimizes the training process of the large language model based on the above embodiment. Specifically, the large language model is trained based on the target task and dynamic tuning prompts, including the following four steps.

[0045] Step 1: Build a large language model, training samples, and model training strategy.

[0046] Optionally, LLaMA-7B is used as the base model. This model is open source, requires relatively low computational resources, and has excellent performance.

[0047] Collect and annotate a small amount of high-quality, domain-specific data (approximately 1,000 entries), including sample reviews and their corresponding labels: aspect terms and sentiment polarity classification. Then, use data augmentation techniques to expand the training set. Data augmentation techniques include, but are not limited to: 1) Synonym replacement. 2) Back-translation: Back-translation using a multilingual translation model to generate synonymous expressions. 3) Easy Data Augmentation (EDA): Randomly inserting, deleting, and swapping words. EDA is a simple but very effective text data augmentation technique that aims to increase the diversity of text data through a series of operations, thereby improving the performance of text classification tasks.

[0048] Step 2: Build a basic prompt template library.

[0049] The basic prompt template library includes a variety of initial prompt templates. This basic prompt template library contains a variety of initial prompt templates for different types of review analysis tasks. For example, for the product feature recognition task, there may be an initial prompt template like this: "Please identify the product features mentioned in the following user reviews and indicate the evaluation tendency of each feature (positive, negative or neutral)." For the sentiment intensity analysis task, the initial prompt template may be: "Please analyze the sentiment intensity expressed in the following user reviews, using a scale of 1-5, where 1 means very negative and 5 means very positive." These initial prompt templates provide a starting point for subsequent dynamic tuning. Generally speaking, the initial prompt template can be:

[0050] Analyze the following reviews, extract product features and give the corresponding sentiment polarity (positive / negative / neutral):

[0051] Comments: [User Comments]

[0052] Output format:

[0053] Feature 1: [Emotional Polarity]

[0054] Feature 2: [Emotional Polarity]

[0055] Step 3: During the model training process, dynamic tuning is performed based on the initial prompt template to obtain a dynamically tuned prompt template.

[0056] Use LoRA (Low-Rank Adaptation) technology to efficiently fine-tune the parameters of large language models. Optional, LoRA configuration is as follows: rank: 8, adaptive learning rate: 2e -4 , weight decay: 0.1. Training parameters include: batch size: 32, number of training epochs: 5. The optimizer uses AdamW (Adaptive Moment Estimation), a gradient descent-based optimizer. Mixed precision training is used to improve training efficiency.

[0057] This step uses a fusion of multiple strategies to improve the parsing accuracy of the model when dynamically tuning the initial prompt template:

[0058] The first step is to add prompts corresponding to the content features to the initial prompt template during the model training process based on the content features of the review samples to obtain the first dynamically tuned prompt template.

[0059] For example, a preliminary analysis of the review sample is performed to extract key information, such as the topic, sentiment, and language style used. Based on this key information, the most suitable initial prompt template is selected from a library of basic prompt templates. This initial prompt template is then dynamically adjusted based on the content characteristics of the review sample. For example, if a review sample is detected to contain a large amount of technical terminology, a prompt such as "Please pay special attention to the technical details in the review" will be added to the prompt. If the review sample displays strong emotional overtones, the prompt will be adjusted to focus more on analyzing the intensity of the emotion.

[0060] The second step is to compare the output of the large language model with the comment sample to determine the comment content that is ignored in the output, and generate a second dynamic tuning prompt template based on the ignored comment content and the first dynamic tuning prompt template.

[0061] The dynamic tuning strategy in this step is iterative optimization, comparing the initial output of the large language model with the sample reviews. If any aspects of the analysis are found to be insufficient or inaccurate, additional prompts will be automatically generated. For example, if the large language model overlooked a key product feature in the sample reviews during the first round of analysis, a new prompt will be automatically generated, similar to "Please review the reviews again, paying particular attention to the description of [the omitted review content]." This iterative process can be repeated multiple times until the analysis results reach the desired quality level.

[0062] The third step is to select multiple historical review samples that are successful in the historical training process; select historical review samples similar to the review samples, and historical dynamic tuning prompt templates corresponding to the historical review samples; select and combine the historical dynamic tuning prompt templates, and combine them with the second dynamic tuning prompt template to generate a third dynamic tuning prompt template.

[0063] In order to further improve the effect of the prompt, this step also introduces a context-aware mechanism. The historical training process is the process of parsing historical comment samples. This embodiment retains similar comments that have been parsed before and their successful prompt patterns. When encountering new comments, these historical comment samples will be referred to. By comparing the similarity of the comment content, the historical comment samples that are semantically similar to the current comment sample and the historical dynamically tuned prompt template corresponding to the historical comment sample are determined. This template is considered to be a successful template. Select and combine effective prompt elements from the successful template, such as prompts for emotions of special concern, key prompts for a certain feature of the product, etc. This method can use accumulated experience to continuously optimize the prompt strategy.

[0064] Step 4: During the model training process, the effect of the third dynamic tuning prompt template after each iteration is evaluated; the third dynamic tuning prompt template that passes the evaluation is strengthened.

[0065] This step implements reinforcement learning of the prompt templates through a self-learning component. This step continuously monitors the parsing performance of different dynamically tuned prompt templates, including metrics such as model parsing accuracy and the relevance of the parsed content to the review content. Dynamically tuned prompt templates that perform well are reinforced, while those that perform poorly are adjusted or eliminated. This process utilizes a lightweight reinforcement learning algorithm that continuously improves the performance of the trained model without requiring a large amount of additional training data.

[0066] Step 5: Continue training the large language model based on the dynamic tuning prompt template.

[0067] Each time the dynamic tuning prompt template is adjusted, it will be injected into the large language model for further analysis, guiding the large language model to obtain accurate analysis results and complete the model training process.

[0068] Dynamic prompt tuning significantly improves model performance in a variety of complex review scenarios. For example, when processing long reviews that compare multiple products, dynamically tuned prompts guide the large language model to more systematically analyze the strengths and weaknesses of each product, resulting in a more balanced and comprehensive evaluation. When analyzing highly specialized reviews, such as detailed product reviews in technical blogs, the tuned prompts help the model more accurately capture and interpret specialized terminology and technical details.

[0069] Overall, dynamically tuning the prompt template opens up new possibilities for applying large language models to fine-grained user review analysis. It enables the model to adapt more flexibly and accurately to different types of reviews and analysis needs, significantly improving overall performance and applicability. This approach not only improves analysis accuracy but also enhances interpretability and controllability, providing businesses with more valuable and reliable insights into user feedback.

[0070] Example 3

[0071] This example builds on the previous examples by optimizing the use of a trained large language model, including injecting domain knowledge and dynamically tuning prompts to conduct in-depth and detailed analysis of user comments, maximizing the reasoning capabilities of the large language model while ensuring the accuracy and interpretability of the analysis results. Specifically, the comments are fused with the target knowledge and input into the large language model to obtain the parsed results of the comments, which includes the following two steps:

[0072] Step 1: Perform similarity matching on the comments in the comment samples, determine similar comment samples and the dynamic tuning prompt templates corresponding to the similar comment samples.

[0073] The preprocessed reviews are matched against multiple review samples using a semantic similarity matching algorithm to identify semantically similar review samples. During the previous training process, these semantically similar review samples have the same dynamic tuning prompt template used in training. This template incorporates easily overlooked review content, successful historical dynamic tuning prompt templates, and review content features. This dynamic tuning prompt template can still be used when parsing new reviews in this step.

[0074] Step 2: Fuse the dynamically tuned prompt template, comments, and the target knowledge, and input them into the large language model to obtain the parsing result of the comments.

[0075] First, the preprocessed review, target knowledge, and dynamically tuned prompt template (including prompt content) are integrated. This information together forms the input foundation for the large language model. These elements are automatically and skillfully combined into a structured input, for example: "Based on the following domain knowledge: [injected relevant knowledge], please analyze this user review: [preprocessed review text]. Pay special attention to [dynamically tuned prompt template: emphasized points in the dynamic prompt]."

[0076] Next, a multi-stage parsing process begins. The first phase is aspect word extraction. In this phase, the large language model no longer relies solely on traditional named entity recognition methods. Instead, it leverages the large language model's semantic understanding capabilities, combined with injected target knowledge, to identify product or service features mentioned in the review. The large language model lists all relevant aspects mentioned in the review and provides each aspect's location and context in the original text. This approach captures more nuanced and implicit aspect expressions.

[0077] This is followed by the sentiment polarity classification stage. This embodiment generates a dedicated prompt for each identified aspect word. These prompts integrate previously injected target knowledge and dynamic tuning prompts. For example, for the camera performance of a smartphone, the prompt may be as follows: "Taking into account the development trend of modern smartphone camera technology and the points of general concern of users, please analyze the emotional tendencies expressed in the descriptions of 'camera' in the reviews. Please consider aspects such as clarity, low-light performance, and zoom capability, and give positive, negative, or neutral judgments, and provide brief reasons." This context-rich prompt can guide the model to perform more detailed and professional analysis.

[0078] In some embodiments, the parsing results of the comments are evaluated for detail and confidence. The detail evaluation can be judged based on the completeness of the aspect word extraction, the coverage of the sentiment polarity classification, and whether the parsing instructions are sufficient. The confidence evaluation can be quantified based on the model's probabilistic output of the sentiment analysis of each aspect word or its own confidence score. When the confidence is lower than the preset threshold, iterative parsing can be triggered by re-prompting or supplementing domain knowledge to ensure that the results are more reliable. If the detail evaluation or confidence evaluation fails, new prompt content is generated based on the defects of the parsing results; the new prompt content is input into the large language model to obtain a new parsing result; and the steps of performing detail evaluation and confidence evaluation on the parsing results of the comments are returned until the parsing results pass the detail evaluation and confidence evaluation. This iterative parsing method will automatically generate follow-up prompts when the model's initial analysis results are not detailed enough or the confidence is not high, requiring the model to conduct a more in-depth analysis or clarify a specific point of view. For example, if the parsing of a certain aspect word is not in-depth enough, please conduct an in-depth analysis based on the domain knowledge of the aspect word. This process may be repeated multiple times until a satisfactory result is obtained or a preset iteration limit is reached.

[0079] In some embodiments, if even the aforementioned iterative parsing method fails to produce a detailed and highly confident parsed result, the comment context is then analyzed to obtain a first result; the comment tone is identified to obtain a second result; and the relationship between aspect words in the comment is identified to obtain a third result; the first, second, and third results are combined to generate new prompt content. The new prompt content is then input into the large language model to obtain a new parsed result; and the process returns to the steps of evaluating the detail and confidence of the parsed comment until the parsed result passes both the detail and confidence evaluations.

[0080] When a review contains multiple sentences, a natural language model can be used to learn the contextual meaning between the sentences to obtain the first result. For example, if a user expresses dissatisfaction with a certain aspect at the beginning of a review but gives a positive overall evaluation in the summary, the reasoning behind this seemingly contradictory emotional expression will be understood, which helps to improve the confidence of the large language model. Tone recognition is a key aspect of natural language understanding. It involves accurately judging the tone in a sentence or speech to understand the true intention and emotion of the review. By incorporating tone into the prompt, it is easier to obtain accurate sentiment polarity classification. The correlation between aspect words includes causal relationships, parallel relationships, opposition relationships, etc. Including correlation relationships in the prompt can enable the large language model to more accurately identify the semantics of the review.

[0081] This embodiment concatenates the first result, the second result, and the third result to generate new prompt content, and injects the new prompt content into the large language model, so that the large language model can obtain more accurate analysis results based on context understanding, tone, and the relationship between aspect words.

[0082] In some embodiments, the consistency of the parsing results with the injected target knowledge, the clarity of the user comments, and the self-correction or hesitation of the large language model during the analysis process can also be considered, and re-parsing can be automatically performed. For example, for parsing results with low confidence, when it is believed that the comment part has a clear tendency of parsing results, or when the output of the large language model has hesitation or erroneous content, a pre-written explanation template will be called, and the parsing results will be marked as "uncertain" in the explanation template. The following content will be added to the explanation template: "Content that the parsing results are inconsistent with the injected target knowledge, content that the user comments are unclear, content that the large language model self-corrects or hesitates" is unreliable, and the large language model will be automatically prompted to perform further parsing on these unreliable contents.

[0083] Finally, this example generates a comprehensive report that includes not only each identified aspect word and its sentiment polarity, but also an overall sentiment analysis summary, identifying the main points of the user's review, the main reasons for the sentiment, and any contradictions or unique expressions. This report is output in a structured format to facilitate subsequent data analysis and visualization.

[0084] This approach enables a deep understanding and refined analysis of user reviews. It leverages domain knowledge and optimization tips, enabling large language models to perform more accurate, comprehensive, and insightful analyses. This not only improves the quality of analysis but also enhances the interpretability and practicality of the results, providing businesses with valuable insights into user feedback.

[0085] The following is a specific embodiment provided by the embodiment of the present invention:

[0086] Taking smartphone product reviews on an e-commerce platform as an example, the specific application process of the present invention is demonstrated:

[0087] 1. After preprocessing the user's comments, the following content is obtained:

[0088] This phone has a great camera and takes incredibly clear photos! The battery life is a bit lacking, and the charging speed isn't very fast. Overall, it's a great choice.

[0089] 2. Obtain target knowledge based on comments. Example of injected target knowledge:

[0090] Smartphones have characteristics: camera, battery, processor, screen

[0091] Camera-related properties: clarity, night scene, zoom

[0092] Battery-related attributes: battery life, charging speed

[0093] 3. Training a large language model: Using 5,000 annotated smartphone reviews, we fine-tuned the parameters of the LLaMA model and the dynamic tuning prompt template.

[0094] 4. Use a large language model for fine-grained analysis. The large language model outputs aspect words and sentiment polarity, and finally gives a summary:

[0095] json

[0096] {

[0097] "aspects": [

[0098] {

[0099] "term": "camera",

[0100] "sentiment": "positive",

[0101] "confidence": 0.95,

[0102] "evidence": "Great, the photos are very clear"

[0103] },

[0104] {

[0105] "term": "Battery life",

[0106] "sentiment": "negative",

[0107] "confidence": 0.85,

[0108] "evidence": "a little off"

[0109] },

[0110] {

[0111] "term": "Charging speed",

[0112] "sentiment": "negative",

[0113] "confidence": 0.80,

[0114] "evidence": "Not fast enough

[0115] },

[0116] {

[0117] "term": "Overall Rating",

[0118] "sentiment": "positive",

[0119] "confidence": 0.75,

[0120] "evidence": "Overall, it's a very good choice",

[0121] Summary: This user was very satisfied with the phone's camera, especially the clarity of the photos. However, the battery performance was a concern, with both battery life and charging speed being less than satisfactory. Despite this, the user still gave a positive overall review, considering this phone a good choice.

[0122] }]

[0123] }

[0124] The present invention has the following technical effects:

[0125] 1. High-precision analysis: By leveraging the powerful language understanding capabilities of large language models, it can accurately identify fine-grained review objects and perform sentiment analysis, providing in-depth customer insights.

[0126] 2. Strong domain adaptability: Through domain knowledge injection and targeted fine-tuning, it can quickly adapt to the specific needs of different industries without the need for a large amount of domain-labeled data.

[0127] 3. Low resource requirements: The use of parameter-efficient fine-tuning techniques (such as LoRA) greatly reduces the computing resource requirements, making high-quality review analysis services affordable for small and medium-sized enterprises.

[0128] 4. Dynamic adaptability: Through dynamic prompt generation and knowledge injection, it can flexibly respond to different types of reviews and changing market trends.

[0129] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in the present invention can be achieved. This is not limited herein.

[0130] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A fine-grained parsing method for user comments based on a large language model, characterized by: include: Preprocess user comments; Matching the comments with expertise in a specific field to obtain target knowledge; Training a large language model based on target tasks and dynamic tuning prompts includes: constructing a large language model, training samples and model training strategies; constructing a basic prompt template library, the basic prompt template library including a plurality of initial prompt templates; during the model training process, according to the content features of the comment sample, adding prompts corresponding to the content features on the basis of the initial prompt template to obtain a first dynamic tuning prompt template; comparing the output of the large language model with the comment sample to determine the comment content ignored in the output, and generating a second dynamic tuning prompt template based on the ignored comment content and the first dynamic tuning prompt template; selecting multiple historical comment samples that have been successfully prompted during the historical training process; selecting historical comment samples similar to the comment sample, and historical dynamic tuning prompt templates corresponding to the historical comment samples; selecting and combining the historical dynamic tuning prompt templates, and combining them with the second dynamic tuning prompt template to generate a third dynamic tuning prompt template; during the model training process, evaluating the effect of the third dynamic tuning prompt template after each iteration; strengthening the third dynamic tuning prompt template that has passed the evaluation; and continuing to train the large language model according to the third dynamic tuning prompt template; the target tasks include aspect word extraction and sentiment polarity classification; Performing similarity matching on the comments in the comment samples to determine similar comment samples and third dynamic tuning prompt templates corresponding to the similar comment samples; fusing the third dynamic tuning prompt template, the comments, and the target knowledge, and inputting the results into the large language model to obtain parsing results for the comments; The process of fusing the comments with the target knowledge includes: Calculating the semantic similarity between the target knowledge and the comment, and using the semantic similarity as the relevance of the target knowledge; If both the relevance and the naturalness of the target knowledge expression exceed the set threshold, the template for hierarchical presentation of key points is selected; otherwise, the simplified template is selected. A grammar checker and a syntactic analyzer are used to determine whether the target knowledge has grammatical and syntactic errors or inappropriateness. If there are no errors / inappropriateness, the naturalness is 100 points. The naturalness is obtained by decreasing the score from 100 points based on the number of errors or inappropriateness. The template for hierarchical presentation of key points lists the necessary details of the core knowledge in points, while the simplified template directly describes the core content of the knowledge in a single sentence or phrase. If the type of the target knowledge is basic attribute, embedding the target knowledge into the beginning of the selected knowledge template; If the type of the target knowledge is function introduction, embedding the target knowledge into a position close to the comment in the selected knowledge template; The knowledge template is combined with the comment.

2. The method for fine-grained parsing of user comments based on a large language model according to claim 1 is characterized in that: Preprocessing of user comments includes: Perform text cleaning, spelling correction, word segmentation and part-of-speech tagging, and normalization on user comments.

3. The method for fine-grained parsing of user comments based on a large language model according to claim 1 is characterized in that: Match the comments with domain-specific expertise to obtain target knowledge, including: Acquire expertise in specific areas; According to a semantic similarity matching algorithm, the comments are matched with the professional knowledge to obtain target knowledge.

4. The method for fine-grained parsing of user comments based on a large language model according to claim 1 is characterized in that: The third dynamic tuning prompt template, the comment, and the target knowledge are integrated and input into the large language model to obtain a parsing result of the comment, including: Performing detail evaluation and confidence evaluation on the parsed results of the comments; If the detail evaluation or confidence evaluation fails, new prompt content is generated based on the defects of the parsing results; Inputting the new prompt content into the large language model to obtain a new parsing result; Return to the step of performing detail evaluation and confidence evaluation on the parsed result of the comment until the parsed result passes the detail evaluation and confidence evaluation.

5. The method for fine-grained parsing of user comments based on a large language model according to claim 4 is characterized in that: After performing detail evaluation and confidence evaluation on the parsed results of the comments, the following steps are also included: If the detail evaluation or the confidence evaluation fails, the context of the comment is understood to obtain a first result; the tone of the comment is identified to obtain a second result; and the association relationship between aspect words in the comment is identified to obtain a third result; The first result, the second result and the third result are used to generate new prompt content.

Citation Information

Patent Citations

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

    CN117436438A

  • Emotion analysis method, device and system and medium

    CN118916491A

  • Prompt word template generation method and device, electronic equipment and storage medium

    CN119443094A