Method for sentiment analysis based on emergency scenarios

By employing a collaborative architecture of large and small language models, combined with preprocessing and multi-stage inference techniques, the problem of efficient and accurate sentiment analysis of social media data in emergency scenarios was solved, thereby improving the accuracy and real-time performance of sentiment analysis.

CN120804331BActive Publication Date: 2025-12-23HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve efficient and accurate sentiment analysis in emergency scenarios, especially given the rapid changes in social media data and the multidimensional expression of emotions. Traditional methods are unable to capture emotional details and lack timeliness.

Method used

It adopts a collaborative architecture based on large and small language models, combined with preprocessing, user role and psychologist role prompt templates, and three-stage thought chain reasoning technology. It generates the probability distribution of sentiment categories through a lightweight encoder and Softmax function to achieve sentiment analysis.

Benefits of technology

It significantly improves the accuracy and real-time performance of sentiment analysis in emergency scenarios, enabling it to better capture complex emotional expressions and provide more accurate and detailed sentiment analysis results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120804331B_ABST
    Figure CN120804331B_ABST
Patent Text Reader

Abstract

The application provides an emotion analysis method based on an emergency scene, and relates to the field of natural language processing.In the application, first, social media data under the emergency scene is preprocessed to obtain standardized text; second, the standardized text is provided as information of a user role, and under the guidance of a large language model, a psychologist role analyzes the standardized text by using a three-stage thinking chain reasoning technology to obtain a user portrait, an emotional polarity and an emotional intensity; then, a small language model is used to generate a 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 sequentially converted into an emotional category probability distribution, and are used as the final emotional polarity result.The application constructs a large and small model collaborative architecture, and uses a multi-stage reasoning technology to deeply analyze complex emotional expressions under the emergency scene, thereby significantly improving the accuracy and real-time performance of the emotion analysis under the emergency scene.
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] With the rapid development of social media and the Internet, social media platforms have become an important way for the public to express emotions, exchange information, and interact socially. These real-time generated data provide valuable emotional information that can effectively assist emergency response and public safety management. The massive amount of social media data generated in public emergencies in emergency scenarios has become an important basis for emergency management departments to conduct situation awareness and decision support. Real-time analysis and accurate identification of public emotional tendencies in such emergency scenarios have significant value, on the one hand, to assist in identifying the spread of negative emotions such as group anxiety and panic, and on the other hand, to provide data support for emergency resource scheduling and public opinion guidance strategy formulation.

[0003] In related technologies, traditional sentiment analysis methods mainly focus on the determination 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 emotional information contained therein may become more complex and multi-dimensional due to the suddenness and urgency of the event. 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 emotions, resulting in a significant reduction in the accuracy and timeliness of the analysis results.

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

[0005] (I) Technical problems solved

[0006] 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.

[0007] (II) Technical solutions

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

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

[0010] pre-processing the social media data under the emergency scenario to obtain standardized text;

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

[0012] taking the standardized text, user portrait, sentiment polarity and sentiment intensity as inputs of a small language model respectively, and splicing and fusing the corresponding generated feature vectors to obtain a first composite vector; and using a lightweight encoder architecture to extract features of the first composite vector to obtain a second composite vector;

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

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

[0015] Preferably, the user portrait includes demographic attributes, psychological state and event relevance.

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

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

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

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

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

[0021]

[0022] wherein, represents the probability of predicting the cth sentiment category when the input is ; W is a weight matrix, and the superscript T represents transposition; b is a bias term.

[0023] Assuming that the sentiment categories are divided into negative, neutral and positive, the sentiment polarity is represented as:

[0024]

[0025] wherein, are probabilities of being predicted as negative, neutral, and positive sentiment categories, respectively.

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

[0027]

[0028] wherein, L represents the total cross-entropy loss function, represents the cross-entropy loss function of the i-th social media data sample, and N represents the total number of social media data samples, represents the sentiment category label of the i-th social media data sample; represents the second composite vector corresponding to the i-th social media data sample; the input is the probability of being predicted as the c-th sentiment category.

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

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

[0031] a sentiment reasoning module 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, instruct the psychologist role to analyze the standardized text using a three-stage thinking chain reasoning technology to obtain a corresponding user portrait, sentiment polarity, and sentiment intensity;

[0032] 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;

[0033] a sentiment analysis module 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 sentiment category probability distribution as a final sentiment polarity result.

[0034] 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.

[0035] ​An electronic device comprising:

[0036] 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, the programs including instructions for performing the sentiment analysis method as described above.

[0037] (Three) beneficial effects

[0038] The present application provides a sentiment analysis method based on emergency scenarios. Compared with the prior art, the following beneficial effects are possessed:

[0039] 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 taken as the user role providing 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 the 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 taken as the final sentiment polarity result. The present application uses the large and small model collaborative architecture, which not only retains the strong reasoning ability of the large language model, but also uses the small language model to ensure the real-time performance, uses the multi-stage reasoning technology to deeply analyze the complex emotional expression under the emergency scenario, and significantly improves the accuracy and real-time performance of the sentiment analysis under the emergency scenario. BRIEF DESCRIPTION OF DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. 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 without creative labor on the basis of these drawings.

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

[0042] 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 the present application embodiment. DETAILED DESCRIPTION

[0043] In order to make the purposes, 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.

[0044] 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.

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

[0046] 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:

[0047] (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 sudden event (such as "thank you for the rescue" and "shortage of materials" coexist) is easily misnormalized, new words (such as "secondary disaster") and metaphors often exceed the semantic coverage of the model, resulting in missed key information.

[0048] (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 time sequence, so the subdivision emotion confusion rate is high.

[0049] (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.

[0050] 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 the large language model, but also uses the small language model 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.

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

[0052] Embodiment 1:

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

[0054] S1, preprocessing social media data under an emergency scenario to obtain standardized text;

[0055] S2, setting a user role and a psychologist role respectively, taking the standardized text as the providing information of the user role, and under the guidance of a large language model, making the psychologist role analyze the standardized text by using a three-stage thinking chain reasoning technology to obtain a corresponding user portrait, sentiment polarity and sentiment intensity;

[0056] S3, taking the standardized text, user portrait, sentiment polarity and sentiment intensity as inputs of a small language model respectively, splicing and fusing corresponding generated feature vectors to obtain a first composite vector, and using a lightweight encoder architecture to extract features of the first composite vector to obtain a second composite vector;

[0057] S4, converting the second composite vector into a sentiment category probability distribution through a full connection layer and a Softmax function in sequence, and taking the sentiment category probability distribution as a final sentiment polarity result.

[0058] The embodiment of the application uses a multi-stage reasoning technology to deeply analyze complex emotional expressions under an emergency scenario, and significantly improves the accuracy and real-time performance of sentiment analysis under an emergency scenario.

[0059] As shown in Figure 2 , a sentiment analysis framework based on the cooperation of the reasoning ability of a large model and the representation ability of a small model, namely a Hybrid Emotion-aware Sentiment Analysis (HESSA) framework, is disclosed. Figure 2

[0060] Next, each step of the above scheme will be described in detail: Figure 2

[0061] In step S1, social media data under an emergency scenario is preprocessed to obtain standardized text.

[0062] First of all, it should be pointed out that the social media data under an emergency scenario in the embodiment of the application does not need to limit the type of emergency scenario and the source of social media data. In fact, data from any social media under any type of emergency scenario can be used in the sentiment analysis method provided by the embodiment of the application.

[0063] For the obtained social media data, preprocessing includes data cleaning and word segmentation processing.​​​

[0064] 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.

[0065] 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.

[0066] 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.

[0067] 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.

[0068] 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.

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

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

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

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

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

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

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

[0076] Standardized text: {T}

[0077] Output of this stage: Structured portrait where u represents any latent feature, and m is the total number of latent features.

[0078] 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.

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

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

[0081] Output of this stage: Sentiment polarity label and explicit sentiment word set ; 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.

[0082] 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 intensity score representing the sentiment intensity of the sentence is determined.

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

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

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

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

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

[0088] Output of this stage: Intensity score .

[0089] In step S3, the standardized text, user profile, sentiment polarity, and sentiment intensity are used as inputs to 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.

[0090] This step first involves combining the standardized text (T), user profile (U), and sentiment polarity mentioned above. Both the emotion intensity (I) and the emotional intensity (I) are input into the small model to generate corresponding feature vectors. The feature vectors obtained from user profile, sentiment polarity, and sentiment intensity are concatenated and fused with the standardized text vectors to obtain the first composite vector. ,in This indicates a splicing operation.

[0091] Next, a lightweight encoder architecture is used to process the first composite vector. Perform feature extraction to obtain the second composite vector. .

[0092] For example, the lightweight encoder architecture of the lightweight BERT model adopts a 6-layer Transformer architecture. Specifically, features can be extracted through the [CLS] representation layer of this Transformer architecture, and then reduced to 128 dimensions by linear projection, which is the final feature representation, i.e., the second composite vector. .

[0093] In step S4, the second composite vector is transformed into an emotion category probability distribution by passing through a fully connected layer and a Softmax function in sequence, and this distribution is used as the final emotion polarity result.

[0094] This step specifically includes:

[0095] S41, the second composite vector The input is a fully connected layer, which is then converted into the corresponding sentiment category probability distribution using the Softmax function, as follows:

[0096]

[0097] in, Indicates that the input is The predicted sentiment category is c. W is a weight matrix, the superscript T represents transposition; b is a bias term;

[0098] S42, consistent with the above, set the emotional category into negative, neutral, positive, then the emotional polarity is expressed as:

[0099]

[0100] wherein, are the probabilities of being predicted as negative, neutral, and positive emotional categories, respectively.

[0101] In addition, the training Figure 2 The emotion analysis framework based on the collaborative inference ability of large models and the representation ability of small models in the large model minimizes the loss value to promote model learning and improve the fitting degree of the model to the downstream task data.

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

[0103]

[0104] wherein, L represents the total cross-entropy loss function, represents the cross-entropy loss function of the i-th social media data sample, N represents the total number of social media data samples, represents the emotional category label of the i-th social media data sample; represents the second composite vector corresponding to the i social media data sample; when the input is the probability of being predicted as the c-th emotional category .

[0105] Further, in order to verify the emotion analysis method provided by the embodiment of the present application under the emergency scene, the following examples show the experimental results on the Hurricane Sandy dataset, and the comparison with the traditional method is shown in Table 1, where the dataset is 15,872 Hurricane Sandy related tweets, and the division ratio of the training set and the test set is 8:2. The evaluation indicators 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 model (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 for training in the SRM module, 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.

[0106] The calculation formula of the evaluation indicator is:

[0107]

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

[0109] Table 1 shows the performance of different emotion analysis methods under the emergency scene

[0110]

[0111] Table 1 shows the performance of different emotion analysis methods under the emergency scene Performance on the dataset. From the experimental results, it can be seen that the sentiment analysis method based on the emergency scene proposed in the embodiment of the application is obviously superior to the existing method in the Accuarcy index, among all the pre-training language models, which improves by 4.4% compared with BERT-base, and the reasoning speed is improved by one third. It also shows obvious advantages in F1-score index, proving that the method HESA 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, extracts key information, and then feeds back the information to the small model, enhances 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 and obtain standardized text.

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

[0116] A sentiment representation module is configured to take the standardized text, user portrait, sentiment polarity and sentiment intensity as inputs of a small language model respectively, splice and fuse 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.

[0117] A sentiment analysis module is configured to convert the second composite vector into a sentiment category probability distribution by a full connection layer and a Softmax function in sequence, and take the sentiment category probability distribution as a 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. The relevant content explanation, examples and beneficial effects of the method are referred to the corresponding part of the sentiment analysis method, which will not be repeated here.

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

[0125] 1. The embodiment of the present application uses a large language model to ensure the reasoning ability of the large language model, and uses a small language model to ensure the real-time performance. The multi-stage reasoning technology is used to deeply analyze the complex emotional expression in the emergency scene, and the accuracy and real-time performance of the sentiment analysis in the emergency scene are significantly improved.

[0126] 2. The embodiment of the present application uses the reasoning ability of the large model and combines the thought chain reasoning method to derive the sentiment related information from the tweet data, which can deeply understand the sentiment background and emotional fluctuation in the tweet, thereby providing more accurate and detailed sentiment analysis results, and providing more accurate and detailed sentiment analysis results for The framework provides powerful analysis capabilities.

[0127] 3. The embodiment of the present application uses the small model to generate high-quality sentiment vectors through efficient vectorization representation, which effectively improves the speed and efficiency of the framework, and ensures The framework can realize rapid sentiment classification and decision support in the emergency scene.

[0128] It is to be noted that, in the present text, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0129] The above embodiments are only used to illustrate the technical solutions of the present application, rather than limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions 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: Preprocess social media data in emergency scenarios to obtain standardized text; Set separate prompt templates for user roles and psychologist roles, and use the standardized text as the information provided by the user role; Guided by the large language model, the psychologist role uses a three-stage thought chain reasoning technique to analyze the standardized text in order to obtain the corresponding user profile, emotional polarity, and emotional intensity. The standardized text, user profile, sentiment polarity, and sentiment intensity are respectively used as inputs to 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 transformed into an emotion category probability distribution by passing it through a fully connected layer and a Softmax function in sequence, and this distribution serves as the final emotion polarity result. The analysis of the standardized text using the three-stage mental chain reasoning technique includes: The first phase involves analyzing the user profiles corresponding to the standardized text; wherein the user profiles include demographic attributes, psychological states, and event relevance. In the second stage, the standardized text is subjected to multi-stage reasoning using the mind chain technique to identify words or phrases with explicit emotional polarity and deduce the emotional polarity corresponding to the standardized text; wherein the emotional polarity includes negative, neutral and positive emotional categories. In the third stage, the mind chain technology is used again to perform multi-stage reasoning on the standardized text, and the large language model is used to perform contextual semantic analysis on explicit sentiment words in order to comprehensively judge the sentiment intensity of the standardized text; wherein the sentiment intensity is divided into 0 to 5 levels; The cross-entropy loss function is constructed during the training phase and expressed as: Where L represents the total cross-entropy loss function, Let represent the cross-entropy loss function for the i-th social media data sample, and N represent the total number of social media data samples. This represents the sentiment category label for the i-th social media data sample; Let i represent the second composite vector corresponding to the i social media data samples; Input is The predicted sentiment category is c. The probability of.

2. The sentiment analysis method as described in claim 1, characterized in that, The preprocessing includes data cleaning and word segmentation.

3. The sentiment analysis method as described in claim 1, characterized in that, The lightweight encoder architecture adopts the Transformer architecture.

4. The sentiment analysis method as described in claim 1, characterized in that, The process of sequentially passing the second composite vector through a fully connected layer and a Softmax function to convert it into an emotion category probability distribution, which serves as the final emotion polarity result, includes: The second composite vector The input is a fully connected layer, which is then converted into the corresponding sentiment category probability distribution using the Softmax function, as follows: in, Indicates that the input is The predicted sentiment category is c. The probability; W is the weight matrix, the superscript T indicates transpose; b is the bias term; If we categorize emotions into negative, neutral, and positive, then the polarity of emotions... Represented as: in, These represent the probabilities of predicting negative, neutral, and positive sentiment categories, respectively.

5. A sentiment analysis system based on emergency scenarios, characterized in that, For performing the sentiment analysis method as described in claim 1, comprising: The preprocessing module is used to preprocess social media data in emergency scenarios and obtain standardized text; The sentiment reasoning module is used to set prompt templates for user roles and psychologist roles respectively, and to use the standardized text as information provided by the user role; and under the guidance of the large language model, to enable the psychologist role to use three-stage thinking chain reasoning technology to analyze the standardized text in order to obtain the corresponding user profile, sentiment polarity and sentiment intensity. The sentiment representation module is used to take the standardized text, user profile, sentiment polarity and sentiment intensity as inputs to the small language model, and concatenate and fuse the corresponding generated feature vectors to obtain a first composite vector; and to use a lightweight encoder architecture to extract features from the first composite vector to obtain a second composite vector. The sentiment analysis module is used to transform the second composite vector into a sentiment category probability distribution by passing it through a fully connected layer and a Softmax function in sequence, and use it as the final sentiment polarity result.

6. A storage medium, characterized in that, It stores a computer program for sentiment analysis in emergency scenarios, wherein the computer program causes the computer to perform the sentiment analysis method as described in any one of claims 1 to 4.

7. 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, the programs including methods for performing the sentiment analysis method as described in any one of claims 1 to 4.