Text sentiment analysis method and device, electronic equipment and storage medium
By integrating social network text and user behavior information in sentiment analysis, extracting and weighting coding vectors for emotion classification, the problem of inaccurate sentiment analysis of social network text in the prior art is solved, and higher accuracy and robustness are achieved.
Patent Information
- Application Number
- CN202510963070.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-14
- Publication Date
- 2025-08-12
AI Technical Summary
Existing sentiment analysis methods are poorly accurate in social network texts and rely solely on text information for sentiment analysis.
By obtaining social network text and user behavior information, text encoding vectors and co-encoded vectors are extracted, and uncertainty weighting is performed, fusion encoding vectors are generated, and inputted to the classifier for emotional classification. The weight coefficients of text encoding vectors and co-encoded vectors are determined based on the confidence of the vectors.
It improves the accuracy and comprehensiveness of sentiment analysis, and enhances the accuracy and robustness of emotional judgment by integrating text semantics with user behavior patterns.
Smart Images

Figure CN120471055A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a text sentiment analysis method, device, electronic device, and storage medium. Background Art
[0002] With the rapid development of social media platforms, sentiment analysis technology is playing an increasingly important role in areas such as event monitoring, user profiling, and precision marketing. Existing sentiment analysis methods primarily rely on natural language processing (NLP) techniques, determining sentiment polarity through semantic analysis of text content, sentiment lexicon matching, or machine learning model classification. Typical implementations include lexicon-based methods (such as HowNet and SentiWordNet), machine learning-based methods (such as support vector machines and Naive Bayes), and the recently emerging deep learning methods (such as LSTM and BERT). However, existing methods rely solely on textual information for sentiment analysis, resulting in poor accuracy. Summary of the Invention
[0003] The purpose of the embodiments of the present application is to provide a text sentiment analysis method, device, electronic device and storage medium to solve the problem that existing sentiment analysis models are inaccurate in sentiment analysis of social network text.
[0004] In a first aspect, the present invention provides a method for sentiment analysis of text, the method comprising obtaining social network text of a content body to be analyzed and corresponding user behavior information; extracting a text coding vector from the social network text to be analyzed, and extracting a collaborative coding vector from the user behavior information; performing uncertainty weighting on the text coding vector and the collaborative coding vector to generate a fused coding vector; inputting the text coding vector, the collaborative coding vector, and the fused coding vector into a classifier so that the classifier outputs a sentiment classification result of the target user for the social network text; wherein the weight coefficients of the text coding vector and the collaborative coding vector are determined based on the confidence of each vector.
[0005] In an optional embodiment, the text encoding vector is extracted in the following manner: Preprocess the social network text to obtain multiple words; concatenate the multiple words and add special tags at specified positions to generate tag text; input the tag text into the large language model to obtain a text encoding vector corresponding to the special tag in the encoding result of the large language model.
[0006] In an optional embodiment, the social network text is preprocessed in the following manner: Filter preset characters in social network text; input the filtered social network text into a word segmenter to obtain a first word set output by the word segmenter; convert emoticons and / or topic tags in the social network text into a second word set according to preset rules; expand target words in the first word set and the second word set to obtain a third word set, where the target words are words that semantically indicate emotions; and merge the first word set, the second word set, and the third word set.
[0007] In an optional embodiment, the user behavior information includes at least the target user's interactive behavior data for the content subject, the target user's social relationship data, and the target user's historical social behavior data. The collaborative coding vector is extracted in the following manner: The target user's interactive behavior data on the content body is input into a lightweight graph convolutional network to obtain a user interaction encoding vector; the target user's social relationship data is input into a graph attention network to obtain a user influence encoding vector; the target user's historical social behavior data is input into a self-attention mechanism network to obtain a user temporal behavior encoding vector; the user interaction encoding vector, the user influence encoding vector and the user temporal behavior encoding vector are fused to generate a behavior encoding vector; the behavior encoding vector is multimodally projected and compressed to obtain a fused encoding vector.
[0008] In an optional embodiment, a modality alignment projection is performed on the behavior encoding vector based on the text encoding vector to obtain an aligned encoding vector; The dimension of the alignment encoding vector is reduced through nonlinear manifold learning to obtain a collaborative encoding vector, which has the same dimension as the text encoding vector.
[0009] In an optional embodiment, the confidence of each of the text encoding vector and the collaborative encoding vector is calculated as follows: Calculate the logarithmic variance value of the text encoding vector / co-encoding vector; and calculate the confidence level corresponding to the text encoding vector / co-encoding vector based on the inverse of the sum of the logarithmic variance value of the text encoding vector / co-encoding vector and a constant.
[0010] In an optional embodiment, the large language model includes at least an attention layer, and is trained to generate the large language model in the following manner: The historical text is input into the large language model, so that the large language model outputs the corresponding sample encoding vector; based on the sample encoding vector, the weight matrix of the attention layer is adjusted to obtain a trained large language model.
[0011] In a second aspect, the present invention provides a text sentiment analysis device, the device comprising: The acquisition module is used to obtain the social network text of the content subject to be analyzed and the corresponding user behavior information; An extraction module, used to extract text encoding vectors from the social network text to be analyzed, and to extract collaborative encoding vectors from user behavior information; A fusion module is used to perform uncertainty weighting on the text encoding vector and the collaborative encoding vector to generate a fused encoding vector; A classification module is used to input the text encoding vector, the collaborative encoding vector and the fusion encoding vector into a classifier, so that the classifier outputs the target user's sentiment classification result for the social network text; The weight coefficients of the text encoding vector and the collaborative encoding vector are determined based on the confidence of each vector.
[0012] In a third aspect, the present invention provides an electronic device comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the sentiment analysis method of any text in the aforementioned embodiment.
[0013] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the sentiment analysis method of a text in any of the aforementioned embodiments are executed.
[0014] This application provides a text sentiment analysis method, device, electronic device, and storage medium. The method includes obtaining social network text containing the main content to be analyzed and corresponding user behavior information; extracting a text encoding vector from the social network text to be analyzed, and extracting a collaborative encoding vector from the user behavior information; performing uncertainty weighting on the text encoding vector and the collaborative encoding vector to generate a fused encoding vector; and inputting the text encoding vector, the collaborative encoding vector, and the fused encoding vector into a classifier so that the classifier outputs a target user's sentiment classification result for the social network text. The weight coefficients of the text encoding vector and the collaborative encoding vector are determined based on the confidence level of each vector. While extracting features from the social network text, user behavior is also analyzed to form a multimodal sentiment classification model, improving the accuracy and comprehensiveness of sentiment analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0016] Figure 1Flowchart of a method for sentiment analysis of text provided by an embodiment of the present application; Figure 2 Schematic structural diagram of a sentiment analysis model of text provided by an embodiment of the present application; Figure 3 Schematic structural diagram of a sentiment analysis device of text provided by an embodiment of the present application; Figure 4 Schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0017] First, the application scenarios of the present application are described. The technical solution of the present application is applicable to sentiment classification of social network texts.
[0018] Next, the technical solutions in the embodiments of the present application will be described with reference to the accompanying drawings in the embodiments of the present application.
[0019] Embodiment 1 Figure 1 Flowchart of a method for sentiment analysis of text provided by an embodiment of the present application, Figure 2 Schematic structural diagram of a sentiment analysis model of text provided by an embodiment of the present application. As Figure 1 and Figure 2 shown, a method for sentiment analysis of text provided by the present application includes: S1. Obtain social network texts of the content subject to be analyzed and corresponding user behavior information.
[0020] The social network texts here may be social contents such as comments and shares published by users on the network.
[0021] After collecting the social network texts, the social network texts can be preprocessed in the following ways: Filter preset characters in the social network texts; input the filtered social network texts into a tokenizer to obtain a first set of words output by the tokenizer; convert emoticons and / or topic tags in the social network texts into a second set of words according to preset rules; expand target words in the first set of words and the second set of words to obtain a third set of words, where the target words are words indicating sentiment semantically; merge the first set of words, the second set of words, and the third set of words.
[0022] Specifically, an adaptive tokenization tool in the social network field (Jieba combined with an online language dictionary) can be used to tokenize the original content first, and at the same time filter general stop words (such as words like "de", "shi", etc.) and noise symbols specific to social platforms (such as "#", "@", and hyperlinks). This can perform tokenization better, especially in dealing with scenarios of some online languages.
[0023] On this basis, we can analyze the grammatical structure and key entities of the text through part-of-speech tagging and named entity recognition (NER), expand the sentiment lexicon based on the characteristics of social content, and convert emoticons and hashtags into interpretable sentiment vocabulary. Ultimately, we generate an enhanced text representation that contains semantic structure, entity information, and sentiment signals, providing fine-grained language feature support for subsequent models.
[0024] User behavior information includes at least the target user's interactive behavior data on the content, such as likes and reposts. It also includes the target user's social relationship data, such as the number of users they follow and the distribution of their followers. It also includes the target user's historical social behavior data, such as the sentiment labels of comments made within the past 30 days.
[0025] S2. Extract text encoding vectors from the social network text to be analyzed, and extract collaborative encoding vectors from user behavior information.
[0026] In step S2, the text encoding vector can be extracted in the following way: Preprocess the social network text to obtain multiple words. Concatenate the multiple words and add special tags at designated locations to generate tagged text. Input the tagged text into the large language model to obtain the text encoding vector corresponding to the special tags in the large language model's encoding results.
[0027] The large language model here can be built using GPT, BERT, Transformer, etc.
[0028] In step S2, the collaborative coding vector can be extracted in the following manner: The target user's interactive behavior data for the content body is input into a lightweight graph convolutional network to obtain a user interaction encoding vector. The target user's social relationship data is input into a graph attention network to obtain a user influence encoding vector. The target user's historical social behavior data is input into a self-attention mechanism network to obtain a user temporal behavior encoding vector. The user interaction encoding vector, the user influence encoding vector, and the user temporal behavior encoding vector are fused to generate a behavior encoding vector; the behavior encoding vector is multimodally projected and compressed to obtain a fused encoding vector. Specifically, the behavior encoding vector is modally aligned based on the text encoding vector to obtain an aligned encoding vector. The aligned encoding vector is then dimensionality reduced through nonlinear manifold learning to obtain a collaborative encoding vector, which has the same dimension as the text encoding vector.
[0029] In one embodiment, a collaborative data processing branch of the three-stage modeling of LightGCN-GAT-Transformer is provided. Based on LightGCN, the explicit interaction between users and content is modeled to generate low-dimensional vectors to represent user interest preferences. The user social relationships are encoded through the graph attention network (GAT) to capture the social influence characteristics, and the user historical behavior sequence is temporally modeled in combination with the Transformer encoder to extract dynamic interest representations. To further achieve multimodal compatibility, collaborative information embedding (including user-content interaction, social relationships and temporal behavior) is mapped to the text semantic space through a cross-modal projection layer to ensure the semantic alignment of the numerical collaborative signal and the text features, providing a basis for model fusion.
[0030] S3. Perform uncertainty weighting on the text encoding vector and the collaborative encoding vector to generate a fused encoding vector.
[0031] The collaborative branch concatenates the user behavior embedding with the social relationship embedding, and then compresses it into low-dimensional features through an autoencoder, retaining the key nonlinear user interest patterns. To enhance modal interaction, in one embodiment, a cross-attention mechanism can be introduced to dynamically calculate the association weights between text and collaborative features, and fuse the information of the two based on the weights. At the same time, UMAP dimensionality reduction technology is used instead of traditional PCA to solve the information loss problem caused by linear compression, and adversarial training is used to constrain the consistency of multimodal feature distribution, supplemented by a modal random dropout strategy (blocking single-modal input with a probability of 20% during training), which significantly improves the model's robustness to noise and modality loss.
[0032] In step S3, the confidence of the text encoding vector and the collaborative encoding vector can be calculated as follows: Calculate the logarithmic variance value of the text encoding vector / co-encoding vector; and calculate the confidence level corresponding to the text encoding vector / co-encoding vector based on the inverse of the sum of the logarithmic variance value of the text encoding vector / co-encoding vector and a constant.
[0033] In a specific implementation, the text encoding vector and the cross-modal projection result are spliced into a unified feature vector, and distribution differences are eliminated through layer normalization.
[0034] An uncertainty weighting mechanism is introduced to dynamically balance modal contributions, and the confidence of text and collaborative modalities is quantified through learnable parameters to achieve automatic distribution of loss weights during training.
[0035] The features extracted by the neural network from the text encoding vector / co-encoding vector can be expressed as and , the uncertainty (log variance) is calculated by the following formula: ; ; in, 、 are the scalar values output by the network respectively.
[0036] The confidence calculation formulas for the text encoding vector and the collaborative encoding vector can be expressed as: ; ; The calculation formula of the fused coding vector can be expressed as: = .
[0037] S4. Input the text encoding vector, the collaborative encoding vector and the fusion encoding vector into the classifier, so that the classifier outputs the target user's sentiment classification result for the social network text.
[0038] The weight coefficients of the text encoding vector and the collaborative encoding vector are determined based on the confidence of each vector.
[0039] The input of the classifier can be cross-modal attention .
[0040] The text sentiment analysis method provided in this application embodiment classifies the sentiment of user-generated content based on multimodal data from social networks, supporting binary or multi-classification scenarios. By integrating text semantics with user behavior patterns, the model retains the native text understanding capabilities of LLM while effectively injecting collaborative signals through decoupled parameter updates. This adapts to the needs of different application scenarios, dynamically adjusts classification strategies, and improves the accuracy and robustness of sentiment judgment.
[0041] Example 2 In one embodiment of the present application, a method for training a text sentiment analysis model is provided.
[0042] In one embodiment, the model training can adopt a phased optimization strategy. First, a basic large language model is pre-trained on large-scale social network data to enable it to master general language understanding capabilities.
[0043] The large language model includes at least an attention layer, which can be trained and generated in the following ways: The historical text is input into the large language model, which then outputs the corresponding sample encoding vector. The weight matrix of the attention layer is adjusted based on the sample encoding vector to obtain a trained large language model.
[0044] Low-rank fine-tuning (LoRA) and cross-modal projection are used to efficiently integrate large models with collaborative signals. The text branch uses LoRA to fine-tune only the low-rank matrix of the LLM attention layer, reducing the number of fine-tuning parameters while preserving the original language understanding capabilities.
[0045] Subsequently, user collaborative behavior data is introduced based on the pre-trained model. By jointly training text and collaborative information, the model can simultaneously learn text sentiment characteristics and user personalized preferences.
[0046] Specifically, a hierarchical dynamic fusion strategy is proposed. At the feature layer, UMAP dimensionality reduction and adversarial training are used to address modal distribution discrepancies. At the dynamic fusion layer, a cross-modal attention and uncertainty weighting module is constructed. Through learnable modal confidence parameters, real-time assessment of text quality (such as keyword completeness) and collaborative signal reliability (such as user behavior stability) is achieved during training, dynamically adjusting the weights of their contributions in the loss function.
[0047] By adding a cross-modal attention module to the self-attention layer, the collaborative encoding vector is used as the key-value pair and the text encoding vector is used as the query to calculate the attention weight (Attention( , , )), thereby explicitly modeling the correlation between text sentiment and user behavior, and enhancing the model's ability to discern complex social scenarios (such as ironic expressions and group preference conflicts).
[0048] in, The dimension is n× , n is the number of words, is the text embedding dimension.
[0049] Calculate the attention weight A by the similarity between Query and Key: ; Through the attention weight Weighted Sum
[0050] Finally, for specific sentiment classification tasks, we use labeled data for supervised fine-tuning to optimize the model's ability to integrate multimodal information and ensure its classification effect in real scenarios.
[0051] Example 3 like Figure 3 As shown, based on the same inventive concept, an embodiment of the present application further provides a text sentiment analysis device 30, which includes: The acquisition module 300 is used to obtain the social network text of the content body to be analyzed and the corresponding user behavior information; An extraction module 310 is used to extract text encoding vectors from the social network text to be analyzed, and to extract collaborative encoding vectors from user behavior information; A fusion module 320 is used to perform uncertainty weighting on the text coding vector and the collaborative coding vector to generate a fused coding vector; A classification module 330 is configured to input the text encoding vector, the collaborative encoding vector, and the fusion encoding vector into a classifier, so that the classifier outputs a sentiment classification result of the target user for the social network text; The weight coefficients of the text encoding vector and the collaborative encoding vector are determined based on the confidence of each vector.
[0052] In a preferred embodiment, the extraction module 310 extracts the text encoding vector in the following manner: Preprocess the social network text to obtain multiple words; concatenate the multiple words and add special tags at specified positions to generate tag text; input the tag text into the large language model to obtain a text encoding vector corresponding to the special tag in the encoding result of the large language model.
[0053] In a preferred embodiment, the extraction module 310 pre-processes the social network text in the following manner: Filter preset characters in social network text; input the filtered social network text into a word segmenter to obtain a first word set output by the word segmenter; convert emoticons and / or topic tags in the social network text into a second word set according to preset rules; expand target words in the first word set and the second word set to obtain a third word set, where the target words are words that semantically indicate emotions; and merge the first word set, the second word set, and the third word set.
[0054] In a preferred embodiment, the user behavior information includes at least the target user's interactive behavior data for the content subject, the target user's social relationship data, and the target user's historical social behavior data. The extraction module 310 extracts the collaborative coding vector in the following manner: The target user's interactive behavior data on the content body is input into a lightweight graph convolutional network to obtain a user interaction encoding vector; the target user's social relationship data is input into a graph attention network to obtain a user influence encoding vector; the target user's historical social behavior data is input into a self-attention mechanism network to obtain a user temporal behavior encoding vector; the user interaction encoding vector, the user influence encoding vector and the user temporal behavior encoding vector are fused to generate a behavior encoding vector; the behavior encoding vector is multimodally projected and compressed to obtain a fused encoding vector.
[0055] In a preferred embodiment, the extraction module 310 is specifically used to perform modal alignment projection on the behavior coding vector based on the text coding vector to obtain an aligned coding vector; and to reduce the dimension of the aligned coding vector through nonlinear manifold learning to obtain a collaborative coding vector, which has the same dimension as the text coding vector.
[0056] In a preferred embodiment, the fusion module 320 calculates the confidence of the text encoding vector and the collaborative encoding vector in the following manner: Calculate the logarithmic variance value of the text encoding vector / co-encoding vector; and calculate the confidence level corresponding to the text encoding vector / co-encoding vector based on the inverse of the sum of the logarithmic variance value of the text encoding vector / co-encoding vector and a constant.
[0057] In a preferred embodiment, the large language model includes at least an attention layer and a training module (not shown in the figure) for training and generating the large language model in the following manner: The historical text is input into the large language model, so that the large language model outputs the corresponding sample encoding vector; based on the sample encoding vector, the weight matrix of the attention layer is adjusted to obtain a trained large language model.
[0058] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown in FIG, the electronic device 400 includes a processor 410 , a memory 420 and a bus 430 .
[0059] The memory 420 stores machine-readable instructions executable by the processor 410. When the electronic device 400 is running, the processor 410 communicates with the memory 420 through the bus 430. When the machine-readable instructions are executed by the processor 410, the steps of a text sentiment analysis method in the above-mentioned method embodiment can be executed. The specific implementation method can be found in the method embodiment and will not be repeated here.
[0060] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it can execute the steps of a text sentiment analysis method as in the above-mentioned method embodiment. The specific implementation method can be found in the method embodiment and will not be repeated here.
[0061] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0062] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interface, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0063] In addition, the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0064] Furthermore, the functional modules in each embodiment of the present application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0065] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, and other media that can store program code.
[0066] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any actual relationship or order between these entities or operations.
[0067] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. For those skilled in the art, various modifications and variations of the present application are possible. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A text sentiment analysis method, characterized in that: The method comprises: Obtaining the social network text of the content subject to be analyzed and the corresponding user behavior information; Extracting text encoding vectors from the social network text to be analyzed, and extracting collaborative encoding vectors from user behavior information; Perform uncertainty weighting on the text encoding vector and the collaborative encoding vector to generate a fusion encoding vector; Inputting the text encoding vector, the collaborative encoding vector and the fusion encoding vector into the classifier so that the classifier outputs the target user's sentiment classification result for the social network text; The weight coefficients of the text encoding vector and the collaborative encoding vector are determined based on the confidence of each vector.
2. The method according to claim 1, characterized in that The text encoding vector is extracted in the following way: Preprocessing social network text to obtain multiple words; Concatenate multiple words and add special marks at designated positions to generate markup text; The identifier text is input into the large language model to obtain a text encoding vector corresponding to the special identifier in the encoding result of the large language model.
3. The method according to claim 2, characterized in that The social network text is preprocessed in the following ways: Filter preset characters in social network texts; Input the filtered social network text into the word segmenter to obtain the first word set output by the word segmenter; Convert emoticons and / or hashtags in social network texts into a second word set according to preset rules; Expanding the target words in the first word set and the second word set to obtain a third word set, where the target words are words that semantically indicate emotions; The first word set, the second word set, and the third word set are merged.
4. The method according to claim 1, wherein User behavior information includes at least the target user's interactive behavior data on the content subject, the target user's social relationship data, and the target user's historical social behavior data. The collaborative coding vector is extracted in the following way: Input the target user's interactive behavior data for the content body into the lightweight graph convolutional network to obtain the user interaction encoding vector; Input the target user’s social relationship data into the graph attention network to obtain the user influence encoding vector; Input the target user’s historical social behavior data into the self-attention mechanism network to obtain the user’s temporal behavior encoding vector; Fusing the user interaction coding vector, the user influence coding vector, and the user temporal behavior coding vector to generate a behavior coding vector; The behavior encoding vector is multimodally projected and compressed to obtain a fused encoding vector.
5. The method according to claim 4, characterized in that Perform modality alignment projection on the behavior encoding vector based on the text encoding vector to obtain an aligned encoding vector; The dimension of the alignment encoding vector is reduced through nonlinear manifold learning to obtain a collaborative encoding vector, which has the same dimension as the text encoding vector.
6. The method according to claim 1, wherein The confidence of the text encoding vector and the co-encoding vector is calculated as follows: Calculate the logarithmic variance of the text encoding vector / co-encoding vector; The confidence level corresponding to the text encoding vector / co-encoding vector is calculated based on the inverse of the sum of the logarithmic variance value of the text encoding vector / co-encoding vector and a constant.
7. The method according to claim 2, characterized in that The large language model includes at least an attention layer and is trained in the following way: Input historical text into the large language model, so that the large language model outputs the corresponding sample encoding vector; The weight matrix of the attention layer is adjusted based on the sample encoding vector to obtain a trained large language model.
8. A text sentiment analysis device, characterized in that: The device comprises: The acquisition module is used to obtain the social network text of the content subject to be analyzed and the corresponding user behavior information; An extraction module, used to extract text encoding vectors from the social network text to be analyzed, and to extract collaborative encoding vectors from user behavior information; A fusion module is used to perform uncertainty weighting on the text encoding vector and the collaborative encoding vector to generate a fused encoding vector; A classification module is used to input the text encoding vector, the collaborative encoding vector and the fusion encoding vector into a classifier, so that the classifier outputs the target user's sentiment classification result for the social network text; The weight coefficients of the text encoding vector and the collaborative encoding vector are determined based on the confidence of each vector.
9. An electronic device, characterized in that: include: A processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the text sentiment analysis method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the text sentiment analysis method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Social network comment text sentiment analysis method and system fusing user sentiment tendency
CN114443844A
Target-centered semi-supervised fine-grained sentiment analysis method
CN119358548A
Information processing method and device based on sentiment analysis, equipment and medium
CN119416796A
Text user sentiment analysis method and system based on multiple modes and AI
CN120216700A
Cited By
Scientific and technological supply and demand matching method and equipment based on double-tower model and medium
CN120851541A