Energy policy factor mining and emotional tendency analysis method and system

By applying energy policy factor mining and emotional tendency analysis methods in the field of energy policy, crawler and deep learning technology extract useful information from massive data, the problem of inefficiency of traditional artificial methods is solved, efficient information extraction and emotion analysis are achieved, and scientific decision-making basis is provided.

CN119848323APending Publication Date: 2025-04-18GUIZHOU POWER GRID CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411720615.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

When formulating energy policies, how to quickly and efficiently extract useful information from massive public opinion information and policy documents to solve the problems of inefficiency of traditional artificial methods and unobjective results.

Method used

A method of mining energy policy elements and emotional tendency analysis is adopted. By setting search strings, crawling news and policy documents are used to clean and preprocess data, using neural networks and Transformer models for semantic analysis and emotion recognition, and automatically extracting and classifying information.

Benefits of technology

It has achieved rapid and efficient extraction of key information and public opinion on energy policies from massive data, can clearly and intuitively display the results, provide scientific decision-making basis, and improve the efficiency and quality of policy formulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848323A_ABST
    Figure CN119848323A_ABST
Patent Text Reader

Abstract

The invention discloses an energy policy element mining and emotional tendency analysis method and system, and relates to the technical field of energy policy mining, and the method comprises the steps: according to a research subject, setting a search character string, collecting news and policy texts, and capturing the news and policy documents through a crawler tool; an API crawler tool is used for obtaining topic posts, and an extraction rule needs to be followed when data is extracted; a neural network is used for obtaining similar semantic vocabulary expansion, a pre-trained word embedding mode is used for obtaining feature vectors of characters, data collection is carried out, and semantic information of words captured by the feature vectors is analyzed. According to the invention, a large amount of network data can be rapidly collected, feedback information on the energy policy can be automatically extracted from the network data, and various viewpoints and feelings of the public on the energy policy can be effectively mined and understood.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of energy policy mining, and in particular to a method and system for energy policy element mining and sentiment tendency analysis. Background Art

[0002] In the process of formulating energy policies, it is very important to understand and obtain public opinion information on energy issues and relevant policy documents. This is crucial for public participation, truly reflecting public demands, and formulating policies that are most beneficial to society. However, in reality, public opinion and policy documents are scattered in countless news reports, social media posts, and policy documents. How to extract useful information from the massive amount of information is a current challenge.

[0003] Traditional technologies mainly use manual methods to collect and analyze data. On the one hand, this method consumes a lot of manpower and time, so it is inefficient; on the other hand, it is difficult to obtain fair and comprehensive results through manual methods because people's subjective judgments will affect the objectivity of the results. In addition, the acquisition and integration of data scattered across various platforms is also a problem, especially on social media and forums, where the data is large and scattered, and the formats are different, which poses a great challenge to data collection and organization.

[0004] In recent years, deep learning technologies such as the out-of-order semantic model (Transformer model) have made rapid progress. As an attention mechanism model, it can not only handle long sequence problems, but also perform parallel computing, greatly improving processing efficiency and effectiveness. At the same time, sentiment analysis based on deep learning is also gradually developing, and there are models that can identify positive and negative emotions. However, public feedback is not just positive and negative, but may contain richer emotions, such as anger, fear, expectation, etc., which puts higher requirements on emotion recognition models. In addition, how to intuitively display a large number of calculation results is also an important issue, which includes both data visualization and the setting of real-time monitoring and alarm systems.

[0005] Therefore, a method is needed to process massive amounts of data quickly and efficiently, obtain key information on energy policies and public opinion, and display them clearly and intuitively to help decision makers make scientific decisions. Summary of the invention

[0006] In view of the problems existing in the existing energy policy element mining and sentiment tendency analysis methods, the present invention is proposed.

[0007] Therefore, the purpose of the present invention is to provide a method and system for energy policy element mining and sentiment tendency analysis. In order to solve the problem that the analysis consumes a lot of manpower and time and is therefore inefficient, the present invention adopts a method and system for energy policy element mining and sentiment tendency analysis to solve the problem.

[0008] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0009] In the first aspect, an embodiment of the present invention provides a method for energy policy element mining and sentiment analysis, which includes setting a search string, setting a search string according to a research topic, collecting news and policy texts, and crawling news and policy documents through a crawler tool; storing the crawled news and policy documents in a database or locally, using an API crawler tool to obtain topic posts, and following extraction rules when extracting data; cleaning and preprocessing the data after acquisition, using a neural network to obtain similar semantic vocabulary expansion, using a pre-trained word embedding model to obtain a feature vector of the text, collecting data, and capturing the semantic information of the word in the feature vector for analysis.

[0010] As a preferred solution of the energy policy element mining and sentiment tendency analysis method of the present invention, wherein: the setting of the search string includes converting the target word into a vector v using a word embedding model, and calculating the cosine similarity between the target word vector v and all word vectors in the word embedding model;

[0011] The calculation formula for cosine similarity is:

[0012]

[0013] Where v and w are two vectors, "*" represents the dot product of the vectors, and ||v|| and ||w|| represent the modulus of the vectors respectively;

[0014] According to the cosine similarity, the target word semantic word is selected, the semantic word is found, and the semantic word is used as the search string.

[0015] As a preferred solution of the energy policy element mining and sentiment tendency analysis method of the present invention, the crawler tool for capturing news and policy documents includes using a Transformer model, automatic retrieval and classification, the core of the Transformer model is the self-attention mechanism, and the implementation process of automatic element retrieval and classification is as follows:

[0016] The encoding layer converts the word embeddings of the input sequence into a continuous vector representation, which is achieved by summing the learned positional encodings and word embeddings;

[0017] The math includes assuming that the input word embedding is E, and for each position i in the sequence, the position encoding is P_i, then the input encoding I_i is E+P_i; the self-attention mechanism captures the dependencies between inputs by calculating the weighted combination of input elements, which is calculated by comparing each part of the input element with other parts;

[0018] Mathematics also includes calculating QueryQ, KeyK and ValueV for each input code I, that is, Q = I*W q ,K=I*W k ,V=I*Wv, where Wq,Wk,Wv are the learned weight parameters, and the attention score of each element is calculated:

[0019]

[0020] Where d_k is the dimension of Key, and the output of self-attention is the product of self-attention score A and ValueV, that is, O=A*V;

[0021] The self-attention mechanism is used in multi-head attention, allowing the model to focus on different positions at the same time and transform the results of the multi-head attention through a feedforward neural network.

[0022] As a preferred solution of the energy policy element mining and sentiment tendency analysis method of the present invention, the mathematics also includes for multi-head attention, dividing the input code I into h parts, performing self-attention control on each part, obtaining h outputs, splicing these h outputs together, and obtaining the result of multi-head attention through linear transformation W_o, that is:

[0023] M=Concat(O_1,O_2,...,O_h)*W_o

[0024] The output of this layer is obtained through the feedforward neural network F, that is, F(M), which is composed of N identical layers stacked together;

[0025] The output of the stacked layer is passed through a linear layer and a softmax layer to obtain the classification result. The advantage of using the Transformer model for automatic feature retrieval and classification is that it captures long-distance dependencies, solves the problems of RNN or LSTM models in processing long sequences, and performs parallel calculations.

[0026] As a preferred solution of the energy policy element mining and sentiment tendency analysis method of the present invention, wherein: the extraction rules to be followed when extracting data include designing a customized neural network model, detecting multiple emotions, and capturing emotional states, wherein the emotional states include anger, fear, and expectation;

[0027] A multi-emotion classification task is set based on a deep learning method, the probability of multiple emotion labels is output, and then the multiple emotion tendencies corresponding to the text are determined;

[0028] Before building the model, we collected training data sets with multiple emotion labels, built the model, and set an output layer with N output nodes, where each node represents an emotion. We used the sigmoid function as the activation function so that its output was in the range of 0-1, representing the probability of having that emotion.

[0029] The mathematics also include that for the input code I, the MLP calculation process is as follows:

[0030] The calculation formula of the first hidden layer is expressed as:

[0031] H_1=f(W_1*I+b_1)

[0032] Among them, W_1 is the weight of the first hidden layer, b_1 is the bias, and f is the activation function, the ReLU function;

[0033] The calculation formula for the second hidden layer is:

[0034] H_2=f(W_2*H_1+b_2)

[0035] The calculation formula for the third hidden layer is:

[0036] O = sigmoid(W_L*H_{L-1}+b_L)

[0037] Among them, L represents the number of layers, and sigmoid is a commonly used activation function in the last layer, which can map any value to the range of (0,1) to represent the probability of an event;

[0038] The loss function is calculated as follows:

[0039] Loss=-[y*log(O)+(1-y)*log(1-O)]

[0040] Among them, O is the output of the model prediction. By minimizing this loss function, the parameters of the model are adjusted to make the model's prediction results close to the true sentiment label.

[0041] As a preferred solution of the energy policy element mining and sentiment tendency analysis method of the present invention, wherein: the data collection includes developing real-time detection and visualization tools to dynamically display sentiment changes and policy impacts, helping decision makers to obtain and respond to public feedback in real time;

[0042] The data extracted in step 1 is repeated N times, and N identical layers are stacked. The output of the stacked layers is passed through the linear layer and the softmax layer to obtain the classification result.

[0043] As a preferred solution of the energy policy element mining and sentiment tendency analysis method of the present invention, wherein: the semantic information analyzed includes new data and new reasoning results obtained by the real-time detection system, which need to be stored in the database, which can provide data support for subsequent analysis and provide historical data for reference;

[0044] Use visualization tools to convert data in the database into intuitive charts and add interactive features. When sentiment changes or policy impact forecasts exceed a certain threshold, the alarm system can automatically issue warnings, allowing policymakers to understand and respond immediately.

[0045] Create user-friendly interfaces, design friendly and intuitive user interfaces, present complex data and model results in an intuitive and understandable form, and provide interactive functions.

[0046] In a second aspect, an embodiment of the present invention provides an energy policy element mining and sentiment tendency analysis system, which includes: a crawling module, which sets a search string, sets a search string according to a research topic, collects news and policy texts, and crawls news and policy documents through a crawler tool;

[0047] The extraction module will grab news and policy documents and store them in a database or locally. It uses the API crawler tool to obtain topic posts and needs to follow the extraction rules when extracting data.

[0048] The analysis module cleans and preprocesses the data after acquisition, uses a neural network to obtain similar semantic vocabulary expansion, uses a pre-trained word embedding model to obtain the feature vector of the text, collects data, and captures the semantic information of the word into the feature vector for analysis.

[0049] In a third aspect, an embodiment of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the processor executes the computer program, it implements any step of the above-mentioned energy policy element mining and sentiment tendency analysis method.

[0050] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the above-mentioned energy policy element mining and sentiment tendency analysis method is implemented.

[0051] The beneficial effects of the present invention are as follows: by utilizing modern web crawler technology and machine learning technology, the present invention can quickly collect a large amount of network data and automatically extract feedback information on energy policies therefrom; by using neural network semantic similarity vocabulary expansion and Transformer model automatic element retrieval and classification, the present invention can effectively explore and understand the public's various views and feelings on energy policies; by establishing a real-time monitoring system and an alarm system, the present invention can understand the public's latest feedback on energy policies in real time, promptly discover and warn of possible problems, and provide policy makers with timely and effective decision-making basis. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0053] Figure 1 A specific flow chart of an energy policy element mining and sentiment tendency analysis method and system provided for one embodiment of the present invention.

[0054] Figure 2 An internal structural diagram of a computer device of an energy policy element mining and sentiment tendency analysis method and system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0055] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.

[0056] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0057] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0058] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0059] At the same time, in the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the directions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0060] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0061] Example 1

[0062] Reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, and provides a method for energy policy element mining and sentiment tendency analysis, including:

[0063] S1: Set search strings. According to the research topic, set search strings, collect news and policy texts, and crawl news and policy documents through crawler tools.

[0064] Wherein, setting the search string includes converting the target word into a vector v using a word embedding model, and calculating the cosine similarity between the target word vector v and all word vectors in the word embedding model;

[0065] The calculation formula for cosine similarity is:

[0066]

[0067] Where v and w are two vectors, "*" represents the dot product of the vectors, and ||v|| and ||w|| represent the modulus of the vectors respectively;

[0068] According to the cosine similarity, the target word semantic word is selected, the semantic word is found, and the semantic word is used as the search string.

[0069] Crawl news and policy documents through crawler tools, including using the Transformer model, automatic retrieval and classification. The core of the Transformer model is the self-attention mechanism. The implementation process of automatic feature retrieval and classification is as follows:

[0070] The encoding layer converts the word embeddings of the input sequence into a continuous vector representation, which is achieved by summing the learned positional encodings and word embeddings;

[0071] The math includes assuming that the input word embedding is E, and for each position i in the sequence, the position encoding is P_i, then the input encoding I_i is E+P_i; the self-attention mechanism captures the dependencies between inputs by calculating the weighted combination of input elements, which is calculated by comparing each part of the input element with other parts;

[0072] Mathematics also includes calculating QueryQ, KeyK and ValueV for each input code I, that is, Q = I*W q ,K=I*W k ,V=I*Wv, where Wq,Wk,Wv are the learned weight parameters, and the attention score of each element is calculated:

[0073]

[0074] Where d_k is the dimension of Key, and the output of self-attention is the product of self-attention score A and ValueV, that is, O=A*V;

[0075] The self-attention mechanism is used in multi-head attention, allowing the model to focus on different positions at the same time and transform the results of multi-head attention through a feedforward neural network.

[0076] S1.1: Mathematics also includes multi-head attention, dividing the input code I into h parts, performing self-attention control on each part, obtaining h outputs, splicing these h outputs together, and obtaining the result of multi-head attention through linear transformation W_o, that is:

[0077] M=Concat(O_1,O_2,...,O_h)*W_o

[0078] The output of this layer is obtained through the feedforward neural network F, that is, F(M), which is composed of N identical layers stacked together;

[0079] The output of the stacked layer is passed through a linear layer and a softmax layer to obtain the classification result. The advantage of using the Transformer model for automatic feature retrieval and classification is that it captures long-distance dependencies, solves the problems of RNN or LSTM models in processing long sequences, and performs parallel calculations.

[0080] Preferably, the output of this layer is obtained through a feedforward neural network FF, i.e., F(M)F(M), where MM is composed of NN identical layers stacked together. Assuming N=6N=6, the entire model consists of 6 identical multi-head attention layers and feedforward neural network layers. The intermediate layer dimension of each feedforward neural network layer is 20482048, and the final output dimension is 512512. The output of the stacked layer is passed through a linear layer and a softmax layer to obtain the classification result. The advantage of using the Transformer model for automatic feature retrieval and classification is that it captures long-distance dependencies, solves the problems of RNN or LSTM models when processing long sequences, and performs parallel calculations. For example, when processing a data set containing 100,000 records, the processing time of the Transformer model is reduced by an average of about 30%, and the parameter layer data is shown in Table 1 below:

[0081] Table 1 Parameter layer data table

[0082]

[0083] Table 1 shows the input and output data table of self-attention control.

[0084] S2: Store the captured news and policy documents in a database or locally, use the API crawler tool to obtain topic posts, and follow the extraction rules when extracting data.

[0085] Among them, the extraction rules that need to be followed when extracting data include designing a custom neural network model, detecting multiple emotions, and capturing emotional states, including anger, fear, and expectation;

[0086] A multi-emotion classification task is set based on a deep learning method, the probability of multiple emotion labels is output, and then the multiple emotion tendencies corresponding to the text are determined;

[0087] Before building the model, we collected training data sets with multiple emotion labels, built the model, and set an output layer with N output nodes, where each node represents an emotion. We used the sigmoid function as the activation function so that its output was in the range of 0-1, representing the probability of having that emotion.

[0088] The math also includes that for the input code I, the MLP calculation process is as follows:

[0089] The calculation formula of the first hidden layer is expressed as:

[0090] H_1=f(W_1*I+b_1)

[0091] Among them, W_1 is the weight of the first hidden layer, b_1 is the bias, and f is the activation function, the ReLU function;

[0092] The calculation formula for the second hidden layer is:

[0093] H_2=f(W_2*H_1+b_2)

[0094] The calculation formula for the third hidden layer is:

[0095] O = sigmoid(W_L*H_{L-1}+b_L)

[0096] Among them, L represents the number of layers, and sigmoid is a commonly used activation function in the last layer, which can map any value to the range of (0,1) to represent the probability of an event;

[0097] The loss function is calculated as follows:

[0098] Loss=-[y*log(O)+(1-y)*log(1-O)]

[0099] Among them, O is the output of the model prediction. By minimizing this loss function, the parameters of the model are adjusted to make the model's prediction results close to the true sentiment label.

[0100] S3: After acquiring the data, clean and preprocess it, use a neural network to obtain similar semantic vocabulary expansion, use a pre-trained word embedding model to obtain the feature vector of the text, collect data, and capture the semantic information of the word with the feature vector for analysis.

[0101] Data collection includes the development of real-time monitoring and visualization tools to dynamically display emotional changes and policy impacts, helping decision makers obtain and respond to public feedback in real time;

[0102] The data extracted in step 1 is repeated N times, and N identical layers are stacked. The output of the stacked layers is passed through the linear layer and the softmax layer to obtain the classification result.

[0103] S3.1: The semantic information analyzed includes new data and new inference results obtained through the real-time detection system, which need to be saved in the database to provide data support for subsequent analysis and provide historical data for reference;

[0104] Use visualization tools to convert data in the database into intuitive charts and add interactive features. When sentiment changes or policy impact forecasts exceed a certain threshold, the alarm system can automatically issue warnings, allowing policymakers to understand and respond immediately.

[0105] Create user-friendly interfaces, design friendly and intuitive user interfaces, present complex data and model results in an intuitive and understandable form, and provide interactive functions.

[0106] In a preferred embodiment, a method and system for energy policy element mining and sentiment tendency analysis includes a crawling module, which sets a search string, collects news and policy texts according to a research topic, and crawls news and policy documents through a crawler tool;

[0107] The extraction module will grab news and policy documents and store them in a database or locally. It uses the API crawler tool to obtain topic posts and needs to follow the extraction rules when extracting data.

[0108] The analysis module cleans and preprocesses the data after acquisition, uses a neural network to obtain similar semantic vocabulary expansion, uses a pre-trained word embedding model to obtain the feature vector of the text, collects data, and captures the semantic information of the word into the feature vector for analysis.

[0109] The above-mentioned unit modules may be embedded in or independent of a processor in a computer device in the form of hardware, or may be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to the above-mentioned modules.

[0110] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 2 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0111] In summary, the present invention can quickly collect a large amount of network data and automatically extract feedback information on energy policies from it by utilizing modern web crawler technology and machine learning technology. By using neural network semantic similarity vocabulary expansion and Transformer model automatic element retrieval and classification, it can effectively explore and understand the public's various views and feelings on energy policies. By establishing a real-time monitoring system and an alarm system, it can understand the public's latest feedback on energy policies in real time, promptly discover and warn of possible problems, and provide policy makers with timely and effective decision-making basis.

[0112] Example 2

[0113] Reference Figure 1 and Figure 2 , which is the second embodiment of the present invention, and this embodiment provides a method for energy policy element mining and sentiment tendency analysis. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through simulation experiments.

[0114] The present invention proposes a method and system for energy policy element mining and sentiment analysis, which aims to convert target keywords into vector form by setting a specific search string, using a word embedding model, and selecting semantically related words as search conditions by calculating cosine similarity. News and policy documents are captured from the Internet through crawler tools, and these documents are stored in a database or local environment. Pre-trained word embedding models and neural network technology are used to clean, pre-process and extract feature vectors of data to capture the semantic information of vocabulary. On this basis, the self-attention mechanism of the Transformer model is used to automatically retrieve and classify text elements. The model can effectively capture long-distance dependencies and improve processing efficiency and accuracy. Compared with traditional RNN or LSTM models, its parallel computing capability significantly improves the processing speed. For example, when processing a data set containing 100,000 records, the processing time of the Transformer model is reduced by about 30% on average.

[0115] Furthermore, in order to accurately identify and analyze the emotional tendency in the text, the present invention proposes a method of combining a multi-head attention mechanism with a feedforward neural network to detect multiple emotions, such as anger, fear, and expectation. By constructing a deep learning model with three hidden layers, each hidden layer uses ReLU and sigmoid as the activation function, accurate classification of the emotional state of the text is achieved. The cross entropy loss function is used in the model training process, and the model parameters are continuously optimized through the back propagation algorithm, so that the emotional classification accuracy on the test set reaches more than 85%.

[0116] In addition, the present invention has also developed real-time monitoring and visualization tools that can dynamically display sentiment trends and policy impacts, supporting decision makers to respond to public opinion in a timely manner. All analysis results will be stored in the database for historical data analysis and future predictions. When the sentiment change or policy impact prediction value exceeds the preset threshold, the system will automatically trigger an alarm to alert relevant personnel to pay attention. Finally, through the friendly user interface design, complex analysis results are presented to users in an intuitive and easy-to-understand manner, enhancing the system's usability and user experience. The entire system not only improves the efficiency and quality of energy policy research, but also provides a scientific basis and technical support for the formulation of relevant policies. The experimental data is shown in Table 2 below:

[0117] Table 2 Experimental data table

[0118]

[0119] Table 2 shows the data performance of the key technical indicators in the present invention. Compared with the traditional RNN or LSTM model, the Transformer model reduces the processing time by an average of 30% when processing a data set containing 100,000 records; and in the sentiment classification task, through the multi-head attention mechanism combined with the feedforward neural network method, the classification accuracy of the model on the test set reached more than 85%. These data reflect the significant advantages of the present invention in improving processing efficiency and sentiment analysis accuracy, and are compared with the prior art as shown in Table 3 below:

[0120] Table 3 Comparison with existing technology

[0121]

[0122] Table 3 clearly demonstrates the advantages of the present invention in terms of processing speed, long-distance dependency capture, sentiment classification accuracy, data processing capability, real-time monitoring and visualization, and user interface friendliness.

[0123] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for energy policy element mining and sentiment tendency analysis, characterized by: include, Set search strings, according to the research topic, set search strings, collect news and policy texts, and crawl news and policy documents through crawler tools; Store the captured news and policy documents in a database or locally, use API crawler tools to obtain topic posts, and follow the extraction rules when extracting data; After the data is acquired, it is cleaned and preprocessed, a neural network is used to obtain similar semantic vocabulary expansion, a pre-trained word embedding model is used to obtain the feature vector of the text, data collection is performed, and the feature vector is captured to analyze the semantic information of the word.

2. The energy policy factor mining and sentiment tendency analysis method according to claim 1, characterized in that: The setting of the search string includes converting the target word into a vector v using a word embedding model, and calculating the cosine similarity between the target word vector v and all word vectors in the word embedding model; The calculation formula for cosine similarity is: Where v and w are two vectors, "*" represents the dot product of the vectors, and ||v|| and ||w|| represent the modulus of the vectors respectively; According to the cosine similarity, the target word semantic word is selected, the semantic word is found, and the semantic word is used as the search string.

3. The energy policy element mining and sentiment tendency analysis method according to claim 2, characterized in that: The crawling of news and policy documents by crawler tools includes using the Transformer model, automatic retrieval and classification. The core of the Transformer model is the self-attention mechanism. The implementation process of automatic feature retrieval and classification is as follows: The encoding layer converts the word embeddings of the input sequence into a continuous vector representation, which is achieved by summing the learned positional encodings and word embeddings; The math includes assuming that the input word embedding is E, and for each position i in the sequence, the position encoding is P_i, then the input encoding I_i is E+P_i; the self-attention mechanism captures the dependencies between inputs by calculating the weighted combination of input elements, which is calculated by comparing each part of the input element with other parts; Mathematics also includes calculating QueryQ, KeyK and ValueV for each input code I, that is, Q = I*W q ,K=I*W k ,V=I*Wv, where Wq,Wk,Wv are the learned weight parameters, and the attention score of each element is calculated: Where d_k is the dimension of Key, and the output of self-attention is the product of self-attention score A and ValueV, that is, O=A*V; The self-attention mechanism is used in multi-head attention, allowing the model to focus on different positions at the same time and transform the results of the multi-head attention through a feedforward neural network.

4. The energy policy element mining and sentiment tendency analysis method according to claim 3, characterized in that: The mathematics also includes that for multi-head attention, the input code I is divided into h parts, each part is self-attention controlled to obtain h outputs, these h outputs are spliced ​​together, and the result of multi-head attention is obtained through linear transformation W_o, that is: M=Concat(O_1,O_2,...,O_h)*W_o The output of this layer is obtained through the feedforward neural network F, that is, F(M), which is composed of N identical layers stacked together; The output of the stacked layer is passed through a linear layer and a softmax layer to obtain the classification result. The advantage of using the Transformer model for automatic feature retrieval and classification is that it captures long-distance dependencies, solves the problems of RNN or LSTM models in processing long sequences, and performs parallel calculations.

5. The energy policy element mining and sentiment tendency analysis method according to claim 4, characterized in that: The extraction of data requires following extraction rules including designing a custom neural network model, detecting multiple emotions, and capturing emotional states, wherein the emotional states include anger, fear, and expectation; A multi-emotion classification task is set based on a deep learning method, the probability of multiple emotion labels is output, and then the multiple emotion tendencies corresponding to the text are determined; Before building the model, we collected training data sets with multiple emotion labels, built the model, and set an output layer with N output nodes, where each node represents an emotion. We used the sigmoid function as the activation function so that its output was in the range of 0-1, representing the probability of having that emotion. The mathematics also include that for the input code I, the MLP calculation process is as follows: The calculation formula of the first hidden layer is expressed as: H_1=f(W_1*I+b_1) Among them, W_1 is the weight of the first hidden layer, b_1 is the bias, and f is the activation function, the ReLU function; The calculation formula for the second hidden layer is: H_2=f(W_2*H_1+b_2) The calculation formula for the third hidden layer is: O = sigmoid(W_L*H_{L-1}+b_L) Among them, L represents the number of layers, and sigmoid is a commonly used activation function in the last layer, which can map any value to the range of (0,1) to represent the probability of an event; The loss function is calculated as follows: Loss=-[y*log(O)+(1-y)*log(1-O)] Among them, O is the output of the model prediction. By minimizing this loss function, the parameters of the model are adjusted to make the model's prediction results close to the true sentiment label.

6. The energy policy element mining and sentiment tendency analysis method according to claim 5, characterized in that: The data collection includes the development of real-time detection and visualization tools to dynamically display sentiment changes and policy impacts, helping decision makers obtain and respond to public feedback in real time; The data extracted in step 1 is repeated N times, and N identical layers are stacked. The output of the stacked layers is passed through the linear layer and the softmax layer to obtain the classification result.

7. The energy policy element mining and sentiment tendency analysis method according to claim 6, characterized in that: The semantic information analyzed includes new data and new inference results obtained through the real-time detection system, which need to be stored in the database to provide data support for subsequent analysis and provide historical data for reference; Use visualization tools to convert data in the database into intuitive charts and add interactive features. When sentiment changes or policy impact forecasts exceed a certain threshold, the alarm system can automatically issue warnings, allowing policymakers to understand and respond immediately. Create user-friendly interfaces, design friendly and intuitive user interfaces, present complex data and model results in an intuitive and understandable form, and provide interactive functions.

8. An energy policy element mining and sentiment tendency analysis system, based on the energy policy element mining and sentiment tendency analysis method according to any one of claims 1 to 7, characterized in that: include, The crawling module sets the search string, collects news and policy texts according to the research topic, and crawls the news and policy documents through the crawler tool; The extraction module will grab news and policy documents and store them in a database or locally. It uses the API crawler tool to obtain topic posts and needs to follow the extraction rules when extracting data. The analysis module cleans and preprocesses the data after acquisition, uses a neural network to obtain similar semantic vocabulary expansion, uses a pre-trained word embedding model to obtain the feature vector of the text, collects data, and captures the semantic information of the word into the feature vector for analysis.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the energy policy element mining and sentiment tendency analysis method described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the energy policy element mining and sentiment tendency analysis method described in any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Part-of-speech and self-attention mechanism fused sentiment tendency classification method and system

    CN110569508A

  • Online public opinion text information sentiment polarity classification processing system and method

    CN111209401A

  • Whole-network big data public opinion monitoring system based on cloud media

    CN118349626A

  • Specific target-oriented social media tweet sentiment analysis method

    US11972218B1