Literary theme sentiment analysis system based on artificial intelligence
By using a combination method of two-way LSTM model and SVM model in the emotional tendency analysis of literary works, the problem of difficulty in capturing complex emotions and contextual information in the prior art is solved, and higher emotion analysis accuracy is achieved.
Patent Information
- Application Number
- CN202510159813.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-13
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-02-13
AI Technical Summary
In the analysis of emotional tendency in literary works, it is difficult to accurately capture complex emotional expressions and context information, resulting in insufficient accuracy of the analysis results.
The bidirectional LSTM (BiLSTM) model is used to combine the SVM model, and the context information and emotional changes in the text are captured through the BiLSTM model, and the SVM model is optimized through multiple iterative training to dynamically adjust the emotional polarity of each word.
It improves the accuracy of emotion analysis in literary works, can more accurately identify complex emotional fluctuations and implicit emotions, and enhances the accuracy of emotional classification.
Smart Images

Figure CN119621987B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a literary theme sentiment tendency analysis system based on artificial intelligence. Background Art
[0002] With the rapid development of artificial intelligence technology, natural language processing based on sentiment analysis has become a hot research field. In the sentiment tendency analysis of literary works, how to accurately capture the emotional characteristics in the text and enhance the accuracy of sentiment analysis is an important challenge. Generally, the sentiment tendency analysis method based on sentiment dictionary is mainly oriented to short texts, and fails to consider the complex emotional expression and contextual information of literary works, resulting in insufficient accuracy of the analysis results; the general method of using classification models to judge sentiment polarity mainly relies on the performance of the classification model, and does not fully utilize the advantages of deep learning technology in processing long texts and complex emotions, and the extraction of ambiguity in literary works is not comprehensive enough. Summary of the invention
[0003] In view of the above situation, in order to overcome the defects of the prior art, the present invention provides a literary theme sentiment tendency analysis system based on artificial intelligence. The general sentiment tendency analysis method based on sentiment dictionary is mainly oriented to short texts, fails to consider the complex sentiment expression and context information of literary works, resulting in insufficient accuracy of the analysis results. The present solution uses BiLSTM (bidirectional long short-term memory network) model to make full use of the context information in the text, capture the sentiment changes of each word in the context, and more accurately identify complex sentiment fluctuations and implicit emotions; the general method of using classification models to judge sentiment polarity mainly relies on the performance of the classification model, does not fully utilize the advantages of deep learning technology in processing long texts and complex emotions, and does not fully extract the polysemy in literary works. The present solution flexibly adjusts the sentiment polarity of each word by combining the sentiment polarity values and context windows of adjacent words, and continuously optimizes the SVM (support vector machine) model through multiple rounds of iterative training, especially continuously adjusts the weights and optimizes the classification results when facing complex sentiment expressions, and gradually improves the accuracy of sentiment classification.
[0004] The literary theme sentiment tendency analysis system based on artificial intelligence provided by the present invention comprises a text collection module, a sentiment dictionary construction module, a sentiment polarity classification module, a sentiment fluctuation sequence construction module, a bidirectional LSTM model module, a topic modeling module, a correlation analysis module, and a visualization presentation module;
[0005] The text collection module collects literary works, extracts text data from the literary works, preprocesses the text data to obtain preprocessed text data, and converts the preprocessed text data into a word sequence;
[0006] The emotional dictionary construction module constructs an emotional dictionary, extracts individual words from a word sequence, and assigns an emotional polarity to each word. The emotional dictionary construction module includes a dictionary construction unit and a polarity assignment unit: the dictionary construction unit obtains words with known emotional polarity, generates an emotional polarity table, and stores it in the emotional dictionary; the polarity assignment unit assigns a static emotional polarity value to each word according to the emotional polarity table;
[0007] The sentiment polarity classification module is dynamically adjusted based on the static sentiment polarity value of each word to reallocate the sentiment polarity value of each word;
[0008] The emotion fluctuation sequence construction module converts the emotion polarity value of the word into a binary emotion polarity sequence. The emotion fluctuation sequence construction module includes an emotion polarity value conversion unit and a sequence construction unit: the emotion polarity conversion unit converts the emotion polarity of each word into a binary value; the sequence construction unit converts the binary value into an emotion polarity sequence according to the order of each word in the word sequence;
[0009] The bidirectional LSTM model module constructs a BiLSTM model to capture the sentiment fluctuations in the text data and generate sentiment representation of the text data;
[0010] The topic modeling module extracts the main topics of the literary works through the topic model, and the topic modeling module includes an LDA model unit and a BERT model unit: the LDA model unit infers the topics of the literary works through the word distribution, and each topic is represented by the probability distribution of a group of words; the BERT model unit uses the Transformer architecture to model the text data, capture the contextual relationship between words, and generate topic representation;
[0011] The association analysis module analyzes the sentiment distribution under different topics. The association analysis module includes a sentiment distribution calculation unit and a sentiment trend analysis unit: the sentiment distribution calculation unit generates sentiment distribution according to the sentiment expression; the sentiment trend analysis unit analyzes the fluctuation of sentiment along the topic through the sentiment polarity sequence and the topic distribution;
[0012] The visualization presentation module displays an emotion trend graph and a topic distribution graph, and the visualization presentation module includes an emotion trend graph generation unit and a topic distribution graph generation unit: the emotion trend graph generation unit generates a line graph according to an emotion polarity sequence to display the changing process of emotion in literary works; the topic distribution graph generation unit generates a bar graph according to the emotion distribution of each topic to display the emotion tendency under different topics.
[0013] Furthermore, the bidirectional LSTM model module constructs a BiLSTM model to capture the sentiment fluctuations in the text data, specifically including the following steps:
[0014] Step S1: construct a forward LSTM unit to capture the sentiment information from the beginning to the current word in the word sequence, and construct a reverse LSTM unit to capture the sentiment information from the end to the current word;
[0015] ;
[0016] ;
[0017] In the formula, Represents the time step The sentiment polarity value of the word entered at and Represents the time step The input word is the output of the forward LSTM unit and the reverse LSTM unit. represents the LSTM unit, express The input word at the moment is output in the forward LSTM unit, express The input word at the moment is output in the reverse LSTM unit;
[0018] Step S2: Combine the outputs of the forward LSTM unit and the reverse LSTM unit into a vector to represent the sentiment representation of the entire text data. The formula used is as follows:
[0019] ;
[0020] In the formula, Represents the merged sentiment representation.
[0021] Furthermore, the sentiment polarity classification module trains the SVM model and dynamically adjusts the sentiment polarity value of each word according to the sentiment dictionary, specifically including the following steps:
[0022] Step A1: Feature extraction, converting each word into a high-dimensional vector, using word embedding technology to represent each word separately, capturing the semantic features of each word and converting it into a high-dimensional vector;
[0023] Step A2: Construct a kernel function. The SVM model uses the kernel function to process high-dimensional vectors, maximize the classification interval of words in the high-dimensional space, and divide the words into different sentiment categories.
[0024] Step A3: Dynamic adjustment: Use context windows during training to capture the static sentiment polarity values of adjacent words in a word sequence, and use a sliding window strategy to dynamically adjust the training parameters of the SVM model;
[0025] Step A4: Multiple rounds of iterative training. In each round of training, the misclassified words are weighted based on the classification results of the previous round to gradually reduce the misclassification of the model.
[0026] The beneficial effects achieved by the present invention using the above scheme are as follows:
[0027] (1) In view of the problem that the general sentiment tendency analysis method based on sentiment dictionary is mainly oriented to short texts and fails to consider the complex emotional expression and contextual information of literary works, resulting in insufficient accuracy of the analysis results, this scheme uses a bidirectional LSTM model to make full use of the contextual information in the text, capture the emotional changes of each word in the context, and more accurately identify complex emotional fluctuations and implicit emotions.
[0028] (2) The general method of using classification models to judge sentiment polarity mainly relies on the performance of the classification model, but does not fully utilize the advantages of deep learning technology in processing long texts and complex emotions. The extraction of polysemy in literary works is not comprehensive enough. This scheme combines the sentiment polarity values of adjacent words and the context window to flexibly adjust the sentiment polarity of each word. Through multiple rounds of iterative training, the SVM model is continuously optimized. In particular, when facing complex emotional expressions, the weights are continuously adjusted and the classification results are optimized, thereby gradually improving the accuracy of sentiment classification. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A schematic diagram of the artificial intelligence-based literary theme sentiment analysis system proposed in the present invention.
[0030] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0032] Example 1, see Figure 1 The artificial intelligence-based literary theme sentiment tendency analysis system provided by the present invention includes a text collection module, a sentiment dictionary construction module, a sentiment polarity classification module, a sentiment fluctuation sequence construction module, a bidirectional LSTM model module, a topic modeling module, an association analysis module, and a visualization presentation module;
[0033] The text collection module collects literary works, extracts text data from the literary works, cleans the text data, removes special characters and performs word segmentation processing to obtain preprocessed text data, and converts the preprocessed text data into a word sequence;
[0034] The emotional dictionary construction module constructs an emotional dictionary, extracts individual words from a word sequence, and assigns an emotional polarity to each word. The emotional dictionary construction module includes a dictionary construction unit and a polarity assignment unit: the dictionary construction unit obtains words with known emotional polarity through a vocabulary table, generates an emotional polarity table, and stores it in the emotional dictionary; the polarity assignment unit assigns a static emotional polarity value to each word according to the emotional polarity table, and the emotional polarity values include: positive, negative and neutral;
[0035] The sentiment polarity classification module is dynamically adjusted based on the static sentiment polarity value of each word to reallocate the sentiment polarity value of each word;
[0036] The emotion fluctuation sequence construction module converts the emotion polarity value of the word into a binary emotion polarity sequence. The emotion fluctuation sequence construction module includes an emotion polarity conversion unit and a sequence construction unit: the emotion polarity conversion unit converts the emotion polarity value of each word into a binary value: positive emotion is 1, negative emotion is -1, and neutral emotion is 0; the sequence construction unit converts the binary value into an emotion polarity sequence according to the order of each word in the word sequence;
[0037] The bidirectional LSTM model module constructs a BiLSTM model to capture the sentiment fluctuations in the text data and generate sentiment representation of the text data;
[0038] The topic modeling module extracts the main topics of the literary works through the topic model, and the topic modeling module includes an LDA model unit and a BERT model unit: the LDA model unit infers the topics of the literary works through the word distribution, and each topic is represented by the probability distribution of a group of words; the BERT model unit uses the Transformer architecture to model the text data, capture the contextual relationship between words, and generate topic representation;
[0039] The association analysis module analyzes the sentiment distribution under different topics. The association analysis module includes a sentiment distribution calculation unit and a sentiment trend analysis unit: the sentiment distribution calculation unit generates sentiment distribution according to the sentiment expression; the sentiment trend analysis unit analyzes the fluctuation of sentiment along the topic through the sentiment polarity sequence and the topic distribution;
[0040] The visualization presentation module displays an emotion trend graph and a topic distribution graph, and the visualization presentation module includes an emotion trend graph generation unit and a topic distribution graph generation unit: the emotion trend graph generation unit generates a line graph according to an emotion polarity sequence to display the changing process of emotion in literary works; the topic distribution graph generation unit generates a bar graph according to the emotion distribution of each topic to display the emotion tendency under different topics.
[0041] Example 2, see Figure 1 This embodiment is based on the above embodiment. The bidirectional LSTM model module constructs a BiLSTM model to capture the emotional fluctuations in the text data, which specifically includes the following steps:
[0042] Step S1: construct a forward LSTM unit to capture the sentiment information from the beginning to the current word in the word sequence, and construct a reverse LSTM unit to capture the sentiment information from the end to the current word;
[0043] ;
[0044] ;
[0045] In the formula, Represents the time step The sentiment polarity value of the word entered at and Represents the time step The input word is the output of the forward LSTM unit and the reverse LSTM unit. represents the LSTM unit, express The input word at the moment is output in the forward LSTM unit, express The input word at the moment is output in the reverse LSTM unit;
[0046] Step S2: Combine the outputs of the forward LSTM unit and the reverse LSTM unit into a vector to represent the sentiment representation of the entire text data. The formula used is as follows:
[0047] ;
[0048] In the formula, Represents the merged sentiment representation.
[0049] By performing the above operations, the general sentiment tendency analysis method based on sentiment dictionary is mainly oriented to short texts, fails to consider the complex emotional expression and contextual information of literary works, and leads to the problem of insufficient accuracy of analysis results. In this scheme, a bidirectional LSTM model is used to fully utilize the contextual information in the text, capture the emotional changes of each word in the context, and more accurately identify complex emotional fluctuations and implicit emotions.
[0050] Example 3, see Figure 1 This embodiment is based on the first embodiment. The sentiment polarity classification module trains the SVM model and dynamically adjusts the sentiment polarity value of each word according to the sentiment dictionary. Specifically, the following steps are included:
[0051] Step A1: Feature extraction, convert each word into a high-dimensional vector, use the Word2Vec method to represent each word separately, capture the semantic features of each word and convert it into a high-dimensional vector;
[0052] Step A2: Construct a polynomial kernel function. The SVM model uses a polynomial kernel function to process high-dimensional vectors, maximize the classification interval of words in high-dimensional space, and divide words into different sentiment categories. The formula used is as follows:
[0053] ;
[0054] In the formula, represents the polynomial kernel function, and Indicates two different words. represents the dimension of the mapping space, is the offset constant;
[0055] Step A3: Dynamic adjustment: during the training process, the context window size is set to 5 to capture the static sentiment polarity values of adjacent words in the word sequence, and the training parameters of the SVM model are dynamically adjusted using a sliding window strategy;
[0056] Step A4: Multiple rounds of iterative training. In each round of training, the misclassified words are weighted based on the classification results of the previous round to gradually reduce the misclassification of the model.
[0057] By executing the operations, the general method of using classification models to judge sentiment polarity mainly relies on the performance of the classification model, does not fully utilize the advantages of deep learning technology in processing long texts and complex emotions, and does not comprehensively extract the polysemy in literary works. This solution flexibly adjusts the sentiment polarity of each word by combining the sentiment polarity values of adjacent words and the context window, continuously optimizes the SVM model through multiple rounds of iterative training, and continuously adjusts the weights and optimizes the classification results when facing complex emotional expressions, thereby gradually improving the accuracy of sentiment classification.
[0058] Example 4, see Figure 1 This embodiment is based on the above embodiment. In the sentiment dictionary construction module, the dictionary construction unit obtains SentiWordNet, extracts words with known sentiment polarity from SentiWordNet, generates a sentiment polarity table, and stores it in the sentiment dictionary.
[0059] It should be noted that, in this article, relational terms such as first and second, etc. 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 these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0060] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
[0061] The present invention and its embodiments are described above, and such description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if ordinary technicians in the field are inspired by it, without departing from the purpose of the invention, they can design a structure and embodiment similar to the technical solution without creativity, which should belong to the protection scope of the present invention.
Claims
1. A literary theme sentiment analysis system based on artificial intelligence, characterized by: It includes text collection module, sentiment dictionary construction module, sentiment polarity classification module, sentiment fluctuation sequence construction module, bidirectional LSTM model module, topic modeling module, association analysis module, and visualization presentation module; The text collection module collects literary works, extracts text data from the literary works, preprocesses the text data to obtain preprocessed text data, and converts the preprocessed text data into a word sequence; The emotional dictionary construction module constructs an emotional dictionary, extracts individual words from a word sequence, and assigns an emotional polarity to each word. The emotional dictionary construction module includes a dictionary construction unit and a polarity assignment unit: the dictionary construction unit obtains words with known emotional polarity, generates an emotional polarity table, and stores it in the emotional dictionary; The polarity assignment unit assigns a static sentiment polarity value to each word according to the sentiment polarity table; The sentiment polarity classification module is dynamically adjusted based on the static sentiment polarity value of each word to reallocate the sentiment polarity value of each word; The emotion fluctuation sequence construction module converts the emotion polarity value of the word into a binary emotion polarity sequence. The emotion fluctuation sequence construction module includes an emotion polarity value conversion unit and a sequence construction unit: the emotion polarity conversion unit converts the emotion polarity of each word into a binary value; the sequence construction unit converts the binary value into an emotion polarity sequence according to the order of each word in the word sequence; The bidirectional LSTM model module constructs a BiLSTM model to capture the sentiment fluctuations in the text data and generate sentiment representation of the text data; The topic modeling module extracts the topic of the literary work through the topic model, and the topic modeling module includes an LDA model unit and a BERT model unit: the LDA model unit infers the topic of the literary work through the word distribution, and each topic is represented by a probability distribution of a group of words; the BERT model unit uses the Transformer architecture to model the text data, capture the contextual relationship between words, and generate a topic representation; The association analysis module analyzes the sentiment distribution under different topics, and the association analysis module includes a sentiment distribution calculation unit and a sentiment trend analysis unit: the sentiment distribution calculation unit generates a sentiment distribution according to the sentiment expression; The sentiment trend analysis unit analyzes the fluctuation of sentiment along with the theme through sentiment polarity sequence and theme distribution; The visualization presentation module displays the emotion trend graph and the topic distribution graph, and the visualization presentation module includes an emotion trend graph generation unit and a topic distribution graph generation unit: the emotion trend graph generation unit generates a line graph according to the emotion polarity sequence to display the change process of emotion in the literary work; The topic distribution graph generation unit generates a bar graph based on the sentiment distribution of each topic, showing the sentiment tendency under different topics; The sentiment polarity classification module trains the SVM model and dynamically adjusts the sentiment polarity value of each word according to the sentiment dictionary, specifically including the following steps: Step A1: Feature extraction, converting each word into a high-dimensional vector, using word embedding technology to represent each word separately, capturing the semantic features of each word and converting it into a high-dimensional vector; Step A2: Construct a kernel function. The SVM model uses the kernel function to process high-dimensional vectors, maximize the classification interval of words in the high-dimensional space, and divide the words into different sentiment categories. Step A3: Dynamic adjustment: Use context windows during training to capture the static sentiment polarity values of adjacent words in a word sequence, and use a sliding window strategy to dynamically adjust the training parameters of the SVM model; Step A4: Multiple rounds of iterative training. In each round of training, the misclassified words are weighted based on the classification results of the previous round to gradually reduce the misclassification of the model.
2. The literary theme sentiment tendency analysis system based on artificial intelligence according to claim 1 is characterized by: The bidirectional LSTM model module constructs a BiLSTM model to capture the sentiment fluctuations in text data, specifically including the following steps: Step S1: construct a forward LSTM unit to capture the sentiment information from the beginning to the current word in the word sequence, and construct a reverse LSTM unit to capture the sentiment information from the end to the current word; ; ; In the formula, Represents the time step The sentiment polarity value of the word entered at and Represents the time step The input word is the output of the forward LSTM unit and the reverse LSTM unit. represents the LSTM unit, express The input word at the moment is output in the forward LSTM unit, express The input word at the moment is output in the reverse LSTM unit; Step S2: Combine the outputs of the forward LSTM unit and the reverse LSTM unit into a vector to represent the sentiment representation of the entire text data. The formula used is as follows: ; In the formula, Represents the merged sentiment representation.
Citation Information
Patent Citations
View angle-based sentiment analysis method and system, electronic equipment and storage medium
CN107608961A
Emergency sentiment analysis method fusing theme and multiple modes
CN115392232A