Emotion analysis method based on emergency scene

Through the collaborative architecture of large language models and small language models, combined with three-stage thinking chain reasoning technology and lightweight encoder, the accuracy and timeliness issues of sentiment analysis of social media data in emergency scenarios are solved, and efficient sentiment analysis is achieved.

CN120804331AActive Publication Date: 2025-10-17HEFEI UNIV OF TECH

Patent Information

Application Number
CN202510910502.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-02
Publication Date
2025-10-17
Estimated Expiration
2045-07-02

AI Technical Summary

Technical Problem

Existing technologies make it difficult to efficiently and accurately analyze emotional expressions in social media data in emergency scenarios, especially in emergencies, where the complexity and multidimensionality of emotional information lead to insufficient accuracy and timeliness of analysis results.

Method used

A collaborative architecture based on large and small language models was adopted. By preprocessing social media data, user roles and psychologist role prompt templates were set. The three-stage thought chain reasoning technology was used to obtain user portraits, emotional polarity, and emotional intensity. Feature extraction and Softmax function conversion were performed through a lightweight encoder architecture to generate the probability distribution of emotional categories.

Benefits of technology

It significantly improves the accuracy and real-time performance of sentiment analysis in emergency scenarios, can better capture complex emotional expressions, and improves the accuracy and processing speed of sentiment analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804331A_ABST
    Figure CN120804331A_ABST
Patent Text Reader

Abstract

The invention provides an emotion analysis method based on an emergency scene, and relates to the field of natural language processing. The method comprises the following steps: firstly, preprocessing social media data in an emergency scene to obtain a standardized text; secondly, taking the standardized text as providing information of a user role, and enabling a psychologist role to analyze the standardized text by utilizing a three-stage thinking chain reasoning technology under the guidance of a large language model to obtain a user portrait, emotional polarity and emotional intensity; then, generating corresponding feature vectors by using a small language model, carrying out splicing fusion, and carrying out feature extraction by using a lightweight encoder architecture; and finally, converting into emotion category probability distribution through a full connection layer and a Softmax function in sequence, and taking the emotion category probability distribution as a final emotion polarity result. According to the method, the big and small model collaborative architecture is constructed, the complex emotion expression in the emergency scene is deeply analyzed by adopting the multi-stage reasoning technology, and the accuracy and the real-time performance of emotion analysis in the emergency scene are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of natural language processing, and in particular to a sentiment analysis method based on an emergency scenario. BACKGROUND

[0002] In related technologies, traditional sentiment analysis methods mainly focus on the judgment of general sentiment polarity (such as positive, negative, and neutral), and less consider the complexity and diversity of sentiment expression in emergency scenarios. In recent years, large language models (GPT-4, LLaMA, etc.) have shown impressive contextual understanding and knowledge generalization capabilities, bringing new hope for solving this task. However, how to effectively apply large models to emergency scenario sentiment analysis still faces challenges. First, social media data in emergency scenarios often have the characteristics of rapid change, and the sentiment information contained therein may become more complex and multi-dimensional due to the suddenness and urgency of events. In addition, the brevity of social media data and the diversity of expression make it difficult for existing sentiment analysis methods to accurately capture the details of sentiment, resulting in a significant reduction in the accuracy and timeliness of the analysis results.

[0003] Therefore, for social media data in emergency scenarios, how to achieve efficient and accurate sentiment analysis has become a difficult problem to be solved in the current field of sentiment computing. SUMMARY

[0004] (I) Technical problems solved

[0005] To solve the technical problems of the prior art, the present application provides a sentiment analysis method based on an emergency scenario, which solves the technical problem of how to achieve efficient and accurate sentiment analysis.

[0006] (II) Technical solutions

[0007] To achieve the above purpose, the present application is implemented by the following technical solutions:

[0008] A sentiment analysis method based on an emergency scenario, comprising:

[0009] Preprocessing social media data in an emergency scenario to obtain standardized text;

[0010] Respectively setting a user role and a psychologist role prompt template, taking the standardized text as the user role providing information; and under the guidance of a large language model, instructing the psychologist role to analyze the standardized text using a three-stage thinking chain reasoning technology to obtain corresponding user portraits, sentiment polarity, and sentiment intensity;

[0011] inputting the standardized text, the user portrait, the sentiment polarity and the sentiment intensity into small language models respectively, splicing and fusing corresponding generated feature vectors to obtain a first composite vector, and extracting features of the first composite vector by using a lightweight encoder architecture to obtain a second composite vector;

[0012] converting the second composite vector into a sentiment category probability distribution by sequentially passing through a full connection layer and a Softmax function, and taking the sentiment category probability distribution as a final sentiment polarity result.

[0013] Preferably, the preprocessing includes data cleaning and word segmentation processing.

[0014] Preferably, the user portrait includes demographic attributes, psychological states and event relevance.

[0015] The sentiment polarity includes negative, neutral and positive sentiment categories.

[0016] The sentiment intensity is divided into 0-5 levels.

[0017] Preferably, the lightweight encoder architecture adopts a Transformer architecture.

[0018] Preferably, the converting the second composite vector into a sentiment category probability distribution by sequentially passing through a full connection layer and a Softmax function, and taking the sentiment category probability distribution as a final sentiment polarity result includes:

[0019] inputting the second composite vector V' into a full connection layer and converting it into a corresponding sentiment category probability distribution by a Softmax function, denoted as:

[0020] P(y c |V′)=Softmax(W T ·V′+b)

[0021] wherein P(y c |V′) represents a probability of predicting the cth sentiment category y c as input V'; W is a weight matrix, and a superscript T represents transposition; b is a bias term.

[0022] Suppose the sentiment categories are negative, neutral and positive, and the sentiment polarity P is represented as:

[0023] P=[P negative ,P neutral ,P positive ]

[0024] wherein P negative , P neutral and P positive are probabilities of predicting negative, neutral and positive sentiment categories respectively.

[0025] Preferably, a cross-entropy loss function is constructed in the training stage, denoted as:

[0026]

[0027] wherein L represents the total cross-entropy loss function, L i represents the cross-entropy loss function of the i-th social media data sample, N represents the total number of social media data samples, y i represents the sentiment category label of the i-th social media data sample; V i represents the second composite vector corresponding to the i-th social media data sample; P(y ic |V i ) input as V i ′ when the probability of predicting the c-th sentiment category y ic .

[0028] A sentiment analysis system based on an emergency scenario, comprising:

[0029] a preprocessing module configured to preprocess social media data under an emergency scenario to obtain standardized text;

[0030] a sentiment reasoning module configured to set a user role and a psychologist role respectively, and set the standardized text as the information provided by the user role; and under the guidance of a large language model, instruct the psychologist role to analyze the standardized text by using a three-stage thinking chain reasoning technology to obtain a corresponding user portrait, sentiment polarity and sentiment intensity;

[0031] a sentiment representation module configured to input the standardized text, user portrait, sentiment polarity and sentiment intensity into a small language model respectively, and splice and fuse the corresponding generated feature vectors to obtain a first composite vector; and use a lightweight encoder architecture to extract features of the first composite vector to obtain a second composite vector;

[0032] a sentiment analysis module configured to convert the second composite vector into a sentiment category probability distribution by using a full connection layer and a Softmax function in sequence, and use the sentiment category probability distribution as a final sentiment polarity result.

[0033] A storage medium storing a computer program for sentiment analysis based on an emergency scenario, wherein the computer program causes a computer to execute the sentiment analysis method as described above.

[0034] An electronic device, comprising:

[0035] One or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs comprising a program for performing the sentiment analysis method as described above.

[0036] (III) Beneficial Effects

[0037] The present application provides a sentiment analysis method based on an emergency scenario. Compared with the prior art, the following beneficial effects are achieved:

[0038] In the present application, first, the social media data under the emergency scenario is preprocessed to obtain standardized text; second, the user role and the psychologist role prompt template are set respectively, the standardized text is used as the user role information, and under the guidance of the large language model, the psychologist role uses the three-stage thinking chain reasoning technology to analyze the standardized text to obtain the corresponding user portrait, sentiment polarity and sentiment intensity; then the small language model is used to generate the corresponding feature vector and perform splicing and fusion, and a lightweight encoder architecture feature extraction is adopted; finally, the full connection layer and the Softmax function are converted into the sentiment category probability distribution in turn, and are used as the final sentiment polarity result. Through the large and small model collaborative architecture, the strong reasoning ability of the large language model is retained, and the real-time performance is ensured by using the small language model, the multi-stage reasoning technology is used to deeply analyze the complex emotional expression under the emergency scenario, and the accuracy and real-time performance of the sentiment analysis under the emergency scenario are significantly improved. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor.

[0040] Figure 1 A block diagram of a sentiment analysis method based on an emergency scenario provided by an embodiment of the present application;

[0041] Figure 2 A schematic diagram of a sentiment analysis framework based on the collaborative large model reasoning ability and small model representation ability provided by an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application are described clearly and completely. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0043] The technical problem of how to realize efficient and accurate sentiment analysis is solved by providing a sentiment analysis method based on an emergency scenario.

[0044] The technical solutions in the embodiments of the present application are as follows to solve the above technical problems:

[0045] Although traditional sentiment analysis methods can also be used for social media data in emergency scenarios, these sentiment analysis methods still have the following three problems in solving the sentiment analysis task in emergency scenarios:

[0046] (1) The traditional model is based on static training data, which is difficult to capture the dynamic sentiment of the emergency scenario. The contradictory expression of the emergency (such as "thank you for the rescue" and "shortage of materials" coexist) is easily misnormalized, new words (such as "secondary disasters") and metaphors often exceed the semantic coverage of the model, resulting in missed key information.

[0047] (2) Emergency tweets often contain complex structures of event-sentiment-appeal (such as "road collapse delays rescue, must speed up! ) Traditional "positive / negative" single-label classification cannot analyze multi-dimensional sentiment. At the same time, sentiment evolves with the event stage, and static models lack the ability to model the context and timing, so the confusion rate of subdivided emotions is high.

[0048] (3) Traditional methods take hundreds of milliseconds to process a single tweet, which cannot handle tens of thousands of burst data streams per minute. The offline training mode is difficult to update the event evolution features in time.

[0049] To this end, the embodiments of the present application use a large-small model collaborative architecture, which not only retains the strong reasoning ability of large language models, but also uses small language models to ensure real-time performance. The multi-stage reasoning technology deeply analyzes the complex sentiment expression in the emergency scenario, significantly improving the accuracy and real-time performance of sentiment analysis in the emergency scenario.

[0050] In order to better understand the above technical solutions, the above technical solutions will be described in detail below in combination with the drawings in the specification and specific embodiments.

[0051] Embodiment 1:

[0052] The embodiments of the present application provide a sentiment analysis method based on an emergency scenario, comprising:

[0053] S1. Preprocess social media data in emergency scenarios to obtain standardized text;

[0054] S2. Setting prompt templates for the user role and the psychologist role respectively, using the standardized text as the information provided by the user role; and under the guidance of the large language model, having the psychologist role analyze the standardized text using a three-stage thought chain reasoning technique to obtain the corresponding user profile, sentiment polarity, and sentiment intensity;

[0055] S3. Using the standardized text, user profile, sentiment polarity, and sentiment intensity as inputs to the small language model, and concatenating and fusing the corresponding generated feature vectors to obtain a first composite vector; and performing feature extraction on the first composite vector using a lightweight encoder architecture to obtain a second composite vector.

[0056] S4. The second composite vector is converted into a probability distribution of emotion categories through a fully connected layer and a Softmax function in sequence, and used as the final emotion polarity result.

[0057] The embodiment of the present invention uses a collaborative architecture of large and small models to retain the powerful reasoning ability of the large language model while utilizing the small language model to ensure real-time performance. It adopts multi-stage reasoning technology to deeply analyze the complex emotional expressions in emergency scenarios, significantly improving the accuracy and real-time performance of emotional analysis in emergency scenarios.

[0058] like Figure 2 As shown, Figure 2 A sentiment analysis framework based on the synergy of large-model reasoning capabilities and small-model representation capabilities, namely the Hybrid Emotion-aware Sentiment Analysis (HESA) framework, is disclosed.

[0059] Next, we will combine Figure 2 The following steps are described in detail:

[0060] In step S1, social media data in emergency scenarios are preprocessed to obtain standardized text.

[0061] First of all, it should be noted that the social media data in emergency scenarios in the embodiments of the present invention do not need to be limited to the type of emergency scenarios and the source of the social media data. In fact, data from any social media in any type of emergency scenario can be used in the sentiment analysis method provided by the embodiments of the present invention.

[0062] For the acquired social media data, preprocessing includes data cleaning and word segmentation.

[0063] Specifically, the social media data can be cleaned using the NLTK toolkit, including: deleting URL links, special symbols and irrelevant characters; converting emoticons to corresponding text descriptions; correcting obvious spelling errors; standardizing emergency scene-specific terminology. And the processed text can be segmented using the BERT segmenter to generate a standardized word sequence.

[0064] After cleaning and segmenting the social media data, the non-standardized expression of the social media data is converted into standardized text that can be used for inference by a large model.

[0065] In step S2, a prompt template for the user role and the psychologist role is set respectively, and the standardized text is provided as information for the user role; and under the guidance of a large language model, the psychologist role analyzes the standardized text using three-stage thought chain reasoning technology to obtain the corresponding user portrait, sentiment polarity and sentiment intensity.

[0066] Using role-playing technology is a new direction emerging in the field of large language models in recent years. Compared with traditional general assistant models, it places more emphasis on simulating the behavior, language style and emotional expression of a specific role to achieve a highly personalized and customized interactive experience. General large models (such as ChatGPT) perform well in question answering and content generation, but their output often has obvious "tool attributes", and there is a tendency to be overly official, written, and lacking in emotion.

[0067] Correspondingly, when analyzing the standardized text obtained in the previous step, this step first sets a role-playing prompt template, including two roles: the user role and the psychologist role. Then, as shown in Figure 2 the standardized text is provided as information for the user role, and under the guidance of a large language model, the psychologist role analyzes the standardized text using three-stage thought chain (Chain-of-Thought, CoT) reasoning technology to obtain the corresponding user portrait, sentiment polarity and sentiment intensity.

[0068] Specifically, the three stages of the above three-stage thought chain reasoning are as follows:

[0069] First stage: If you are a psychology expert, please analyze the user portrait (User Profile) in the standardized text (Text) T.

[0070] For example, the prompt template is as follows:

[0071] "As a psychology expert, please infer the user's potential characteristics based on the tweet content:

[0072] 1. Demographic attributes (e.g., age, gender orientation);

[0073] 2. Psychological state (e.g., anxiety level, appeal type);

[0074] 3. Event relevance (whether directly affected).

[0075] Standardized text: {T}

[0076] Output of this stage: Structured portrait U = {i1, i2, …, u m}, where u represents any latent feature, and m is the total number of latent features.

[0077] Second stage: Multi-stage reasoning on standardized text using CoT technology. First, directly identify explicit sentiment polarity words or phrases, and deduce the sentiment polarity of the standardized text.

[0078] For example, the prompt template is as follows:

[0079] "Extract explicit sentiment words from the following standardized text and determine the overall sentiment polarity (positive / negative / neutral) {p}"

[0080] Output of this stage: Sentiment polarity label L p ∈{0,1,2}, and explicit sentiment word set {e1,e2,…,e k}; where sentiment polarity label values 0,1,2 correspond to negative, neutral and positive sentiment categories respectively, e represents any explicit sentiment word, and k is the total number of explicit sentiment words.

[0081] Third stage: Multi-stage reasoning on standardized text using CoT technology. Use large models to analyze the context semantics of explicit sentiment words, such as "This typhoon has brought some impact to our life, but we still need to maintain an optimistic attitude." By analyzing the intensity of the sentiment in the first half and the second half of the sentence, the sentiment polarity of the sentence is determined.

[0082] For example, the prompt template is as follows:

[0083] "Combine the actual intensity of explicit sentiment words (0-5 levels) and consider the following factors:

[0084] 1. Modifier words (e.g., 'extremely panic' → 5 levels);

[0085] 2. Event urgency (e.g., intensity weighting ×1.5 within 24 hours after the disaster);

[0086] 3. Semantic contradiction (e.g.,'rescue on time but insufficient supplies' needs to be split intensity)."

[0087] Output of this stage: intensity score I ∈ [0, 5].

[0088] In step S3, the standardized text, user profile, sentiment polarity and sentiment intensity are respectively input into a small language model, and the corresponding generated feature vectors are spliced and fused to obtain a first composite vector; and a lightweight encoder architecture is used to extract features from the first composite vector to obtain a second composite vector.

[0089] This step first inputs the standardized text (Text) T, user profile (Profile) u, sentiment polarity (Polarity) L and sentiment intensity (Intensity) I into a small model to generate corresponding feature vectors V p , V T , V U , V L and V I ∈ R d ; the feature vectors obtained by the user profile, sentiment polarity and sentiment intensity are spliced and fused with the standardized text vector to obtain a first composite vector wherein represents a splicing operation.

[0090] Then, a lightweight encoder architecture is used to extract features from the first composite vector to obtain a second composite vector V′.

[0091] For example, the lightweight BERT model of the lightweight encoder architecture adopts a 6-layer Transformer architecture, and the feature extraction can be performed through the [CLS] representation layer of the Transformer architecture, and the linear projection dimensionality reduction is performed to 128-dimensional final feature representation, i.e. the second composite vector V′.

[0092] In step S4, the second composite vector is converted into a sentiment category probability distribution through a fully connected layer and a Softmax function in sequence, and is used as the final sentiment polarity result.

[0093] This step specifically includes:

[0094] S41, input the second composite vector V′ into a fully connected layer, and convert it into a corresponding sentiment category probability distribution through a Softmax function, represented as:

[0095] P(y c |V′)=Softmax(W T ·V′+b)

[0096] wherein, P(yc |V′) represents the probability of predicting the cth emotional category y c ; W is a weight matrix, the superscript T represents transposition; b is a bias term;

[0097] S42, consistent with the above, assuming that the emotional category is divided into negative, neutral, positive, the emotional polarity P is represented as:

[0098] P=[P negative ,P neutral ,P positive ]

[0099] Wherein, P negative ,P neutral ,P positive are the probabilities of predicting negative, neutral, positive emotional categories respectively.

[0100] In addition, the emotion analysis framework based on the collaborative inference ability of large model and the representation ability of small model in the training Figure 2 promotes the model to learn by minimizing the loss value and improves the fitting degree of the model to the downstream task data.

[0101] For example, the embodiment of the present application selects the cross entropy loss function (CrossEntropy Loss) as the method of loss value calculation, and the calculation method is as follows:

[0102]

[0103] Wherein, L represents the total cross entropy loss function, L i represents the cross entropy loss function of the ith social media data sample, N represents the total number of social media data samples, y i represents the emotional category label of the ith social media data sample; V i ′ represents the second composite vector corresponding to the ith social media data sample; P(y ic |V i ′) represents the probability of predicting the cth emotional category y i when inputting V ic ′.

[0104] Further, in order to verify the emotion analysis method based on the emergency scene provided by the embodiment of the present application, the following examples show the experimental results on the Hurricane Sandy data set, and the comparison with the traditional method is shown in Table 1, wherein the data set is 15,872 Hurricane Sandy related tweets, and the division ratio of the training set and the test set is 8:2. The evaluation indexes are accuracy, F1 score and recall, and the evaluation method is 5-fold cross validation. The baseline model for comparison is the basic bidirectional encoder representation from transformers (BERT-base), the text convolutional neural network (TextCNN), and the traditional support vector machine (SVM). The large model selected in the SIE module is GPT-3.5-turbo, the temperature is set to 0.3, the maximum token number is set to 256, the Top-K parameter is set to 0.9, and the frequency penalty is set to 0.5. The Adam optimizer is used in the SRM module for training, the initial learning rate is set to 3e-5, the Dropout is set to 0.1, the batch size is set to 32, the hardware facility is NVIDIA Tesla T4 (16GB), and the memory is 64GB DDR4.

[0105] The calculation formula of the evaluation index is:

[0106]

[0107] Wherein: TP represents that the classifier prediction result is a positive sample, and the actual positive sample is also a positive sample, that is, the number of correctly identified positive samples. FP represents that the classifier prediction result is a positive sample, and the actual negative sample is a negative sample, that is, the number of false negative samples. TN represents that the classifier prediction result is a negative sample, and the actual negative sample is a negative sample, that is, the number of correctly identified negative samples. FN represents that the classifier prediction result is a negative sample, and the actual positive sample is a positive sample, that is, the number of missed positive samples.

[0108] Table 1 Performance of different emotion analysis methods in emergency scene

[0109]

[0110]

[0111] Table 1 shows the performance of the method of sentiment analysis in the emergency scene and the HESA proposed by the embodiment of the application on the data set. From the experimental results, it can be seen that the sentiment analysis method based on the emergency scene proposed by the embodiment of the application is obviously superior to the existing method in the Accuarcy index, among which the pre-training language model is improved by 4.4% compared with BERT-base, and the inference speed is improved by one third. The F1-score index also shows obvious advantages, proving that the HESA method has better generalization ability. Through experiments, it is verified that the method uses the semantic understanding and reasoning ability of the large model to summarize the information in the tweet data, extract key information, and then feed back the information to the small model to enhance the polarity judgment of sentiment analysis, thereby improving the accuracy of sentiment analysis in the emergency scene.

[0112] Embodiment 2

[0113] The embodiment of the application provides a sentiment analysis system based on an emergency scene, comprising:

[0114] A preprocessing module is configured to preprocess social media data in an emergency scene to obtain standardized text.

[0115] A sentiment reasoning module is configured to set a user role and a psychologist role prompt template respectively, and use the standardized text as the user role information; and under the guidance of a large language model, the psychologist role uses a three-stage thinking chain reasoning technology to analyze the standardized text to obtain a corresponding user portrait, sentiment polarity and sentiment intensity.

[0116] A sentiment representation module is configured to input the standardized text, user portrait, sentiment polarity and sentiment intensity into a small language model respectively, and splice and fuse the corresponding generated feature vectors to obtain a first composite vector; and a lightweight encoder architecture is used to extract features of the first composite vector to obtain a second composite vector.

[0117] A sentiment analysis module is configured to convert the second composite vector into a sentiment category probability distribution through a full connection layer and a Softmax function in sequence, and use the second composite vector as the final sentiment polarity result.

[0118] Embodiment 3

[0119] The embodiment of the application provides a storage medium which stores a computer program for sentiment analysis based on an emergency scene, wherein the computer program enables a computer to execute the sentiment analysis method as described in embodiment 1.

[0120] Embodiment 4

[0121] The embodiment of the application provides an electronic device, comprising:

[0122] One or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs comprising a method for performing the sentiment analysis method as described in Embodiment 1.

[0123] It can be understood that the sentiment analysis system, storage medium and electronic device based on the emergency scene provided by the embodiments of the present application correspond to the sentiment analysis method provided by the embodiments of the present application, and the relevant content explanation, examples and beneficial effects of the embodiments of the present application can refer to the corresponding parts in the sentiment analysis method. Here, it will not be repeated.

[0124] In summary, compared with the prior art, the following beneficial effects are possessed:

[0125] 1、The embodiment of the present application uses a large language model to retain the strong reasoning ability of the large language model, and uses a small language model to ensure real-time performance, uses multi-stage reasoning technology to deeply analyze complex emotional expressions in emergency scenarios, and significantly improves the accuracy and real-time performance of sentiment analysis in emergency scenarios.

[0126] 2、The embodiment of the present application uses a large model reasoning ability, combined with a thought chain reasoning method, to derive sentiment-related information from tweet data, which can deeply understand the emotional background and emotional fluctuations in the tweet, thereby providing more accurate and detailed sentiment analysis results, and providing a strong analysis capability for the HESA framework.

[0127] 3、The embodiment of the present application uses a small model to generate high-quality sentiment vectors through efficient vectorization, effectively improving the speed and efficiency of the framework, and ensuring that the HESA framework can realize fast sentiment classification and decision support in emergency scenarios.

[0128] It should be noted that in this paper, relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the sentence "includes a" does not exclude the presence of another identical element in the process, method, article or device including the element.

[0129] The above examples are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can be modified, or some technical features can be replaced by equivalent features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A sentiment analysis method based on emergency scenarios, characterized in that: include: Preprocessing social media data in emergency scenarios to obtain standardized text; Setting prompt templates for the user role and the psychologist role respectively, and using the standardized text as provided information for the user role; and, under the guidance of the large language model, having the psychologist role analyze the standardized text using a three-stage thought chain reasoning technique to obtain corresponding user portraits, sentiment polarity, and sentiment intensity; The standardized text, user profile, sentiment polarity, and sentiment intensity are respectively used as inputs of the small language model, and the corresponding generated feature vectors are concatenated and fused to obtain a first composite vector; and a lightweight encoder architecture is used to extract features from the first composite vector to obtain a second composite vector; The second composite vector is converted into a probability distribution of emotion categories through a fully connected layer and a Softmax function, and used as the final emotion polarity result.

2. The sentiment analysis method according to claim 1, wherein: The preprocessing includes data cleaning and word segmentation.

3. The sentiment analysis method according to claim 1, wherein: The user profile includes demographic attributes, psychological state and event relevance; The sentiment polarity includes negative, neutral and positive sentiment categories; The emotional intensity is divided into 0-5 levels.

4. The sentiment analysis method according to claim 1, wherein: The lightweight encoder architecture adopts the Transformer architecture.

5. The sentiment analysis method according to claim 1, wherein: The second composite vector is converted into a probability distribution of emotion categories through a fully connected layer and a softmax function, and used as the final emotion polarity result, including: The second composite vector V′ is input into the fully connected layer and converted into the corresponding emotion category probability distribution through the Softmax function, which is expressed as: P(y c |V′)=Softmax(W T ·V′+b) Among them, P(y c |V′) indicates that when the input is V′, the prediction is the cth emotion category y c The probability of; W is the weight matrix, the superscript T represents the transpose; b is the bias term; Assuming that the emotional categories are negative, neutral, and positive, the emotional polarity P is expressed as: P=[P negative ,P neutral ,P positive ] Among them, P negative ,P neutral ,P positive are the probabilities of predicting negative, neutral, and positive sentiment categories, respectively.

6. The sentiment analysis method according to claim 5, wherein: The cross entropy loss function is constructed during the training phase and is expressed as: Among them, L represents the total cross entropy loss function, L i represents the cross entropy loss function of the i-th social media data sample, N represents the total number of social media data samples, y i represents the sentiment category label of the i-th social media data sample; V i ′ represents the second composite vector corresponding to i social media data samples; P(y ic |V i ′) Input is V i ′ is predicted to be the cth emotion category y ic probability.

7. A sentiment analysis system based on emergency scenarios, characterized by: include: A preprocessing module is used to preprocess social media data in emergency scenarios and obtain standardized text; an emotional reasoning module, configured to set prompt templates for the user role and the psychologist role respectively, and use the standardized text as provided information for the user role; and, under the guidance of the large language model, having the psychologist role analyze the standardized text using a three-stage thought chain reasoning technique to obtain corresponding user portraits, sentiment polarity, and sentiment intensity; The sentiment representation module is configured to take the standardized text, user profile, sentiment polarity, and sentiment intensity as inputs of the small language model, concatenate and fuse the corresponding generated feature vectors to obtain a first composite vector, and extract features from the first composite vector using a lightweight encoder architecture to obtain a second composite vector. The sentiment analysis module is used to convert the second composite vector into a sentiment category probability distribution through a fully connected layer and a Softmax function in sequence, and use it as the final sentiment polarity result.

8. A storage medium, characterized in that: It stores a computer program for sentiment analysis based on emergency scenarios, wherein the computer program enables a computer to execute the sentiment analysis method according to any one of claims 1 to 6.

9. An electronic device, characterized in that: include: one or more processors; Memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the programs include a program for executing the sentiment analysis method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Text emotion recognition method based on LDA and BERT fusion improved model

    CN114722835A

  • Establishment method and application of model for extracting emotion words of text based on BERT

    CN117332080A

  • Implicit sentiment analysis method and device based on thinking tree

    CN117592483A

  • Emotion analysis method and device, computer equipment and medium

    CN119357398A

  • Interactive text fine-grained sentiment analysis method assisted by large language model

    CN120087369A

Cited By

  • Man-machine interaction voice perception method and system based on gradient intelligent dispatch subnet pool

    CN121148370A

  • Smart park information generation method and device, equipment, storage medium and product

    CN121636695A