CN114298157A - Short text sentiment classification method, medium and system based on public sentiment big data analysis - Google Patents
Short text sentiment classification method, medium and system based on public sentiment big data analysis Download PDFInfo
- Publication number
- CN114298157A CN114298157A CN202111480111.3A CN202111480111A CN114298157A CN 114298157 A CN114298157 A CN 114298157A CN 202111480111 A CN202111480111 A CN 202111480111A CN 114298157 A CN114298157 A CN 114298157A
- Authority
- CN
- China
- Prior art keywords
- text
- model
- comment
- classification
- vector
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Machine Translation (AREA)
Abstract
The invention discloses a short text sentiment classification method, medium and system based on public sentiment big data analysis, belonging to the field of text classification, and the method comprises the following steps: converting a text and comment text vector set obtained by the vector obtaining model and a subject list obtained by the neural network multi-label classification model into input samples in a single subject + text + comment text format; constructing a capsule network model based on an independent topic attention machine system as an emotion classification model, designing a loss function of the model according to the topic weight, and taking the input sample as the input of the model; and inputting the text to be predicted into the emotion classification model for emotion label prediction, and finishing emotion classification of the comment short text. The text sentiment classification model is a capsule network added with an independent topic attention mechanism, can capture abundant text features and corresponding sentiment labels in comment short text vectors according to different topic classifications, extracts sentiment features in short text characters more effectively, and is higher in sentiment classification accuracy.
Description
Technical Field
The invention belongs to the field of text classification of natural language processing, and particularly relates to a capsule network college public opinion comment short text sentiment classification method based on self-semantic expansion and attention.
Background
With the development of society and the progress of the internet, a large number of netizens publish text information on a social media platform every day, and colleges and universities are concerned social units, and once public opinions appear, the public opinions are easy to become the focus of disputes. The comment information under the public sentiment implies the sentiment information of netizens for a certain thing. Therefore, whether the emotion of netizens can be automatically and accurately identified in the current network environment has important significance for maintaining the network environment, controlling public opinions of colleges and universities and constructing a harmonious campus. The conventional sentiment analysis focuses on the analysis of the text of the public sentiment, neglects the effective attention to the comment, is usually short and small, shows different text semantic characteristics along with different topics of the public sentiment, but contains a large number of key attitudes of netizens to a specific public sentiment event, and is closely related to the development of the public sentiment attitude. Therefore, the traditional text sentiment classification method is difficult to acquire the accurate sentiment of the public sentiment comments.
A short text sentiment analysis method aiming at public sentiment big data is not provided in the past, and the method realizes sentiment classification by extracting the subject of the text content, expanding the short text corpus information of the public sentiment comment by combining the subject and the text with the comment, and constructing a capsule network based on a self-subject attention mechanism by different weights of different subjects. The emotion classification problem of the short text of the public sentiment big data is better solved.
Disclosure of Invention
The present invention is directed to solving the above problems of the prior art. A short text sentiment classification method, medium and system based on public sentiment big data analysis are provided. The technical scheme of the invention is as follows:
a short text sentiment classification method based on public sentiment big data analysis comprises the following steps:
101. converting a text and comment text vector set obtained by the vector obtaining model and a subject vector set obtained by the neural network multi-label classification model into input samples in a single subject + text + comment text format; the vector acquisition model refers to any one of a vector space model VSM, a word frequency inverse text model TF/IDF, a word vector model word2vec and a pre-training model BERT; the neural network multi-label classification model refers to any one of a traditional recurrent neural network model RNN, a traditional time series model LSTM and a traditional convolutional neural network model CNN.
102. Constructing a capsule network model based on a self-theme attention mechanism as an emotion classification model of public opinion comments, designing a loss function of the model according to theme weight, and taking the input sample as the input of the model;
103. and inputting the text to be predicted into the emotion classification model for emotion label prediction, and finishing emotion classification of the comment short text.
Further, the step 101 converts the text and comment text vector set obtained by the vector obtaining model and the subject vector set obtained by the neural network multi-label classification model into an input sample in a single-subject + text + comment text format, specifically:
inputting public opinion texts and comment data into a vector acquisition model for preprocessing coding, so that each word in an original text has corresponding characteristic representation in a vector space; each text is represented by X ═ X1,x2,...,xmWhere m denotes a text length, and the comment text is Y ═ Y1,y2,...,ylL represents the comment text length, and when the short text is commented, the value of l is smaller than the value of m;
inputting the preprocessed public opinion text into a neural network multi-label classification model to obtain a theme vector set of each corpus, wherein each theme text is represented as T ═ T { (T)11,t12,...t1a,t21,t22,...,t2b,t21,tk1,...,tkqK is the number of the topics of a certain public sentiment text, and a and b … q are the word number lengths of different topics;
focusing on the subject by averaging, the sample vector is denoted X*={∑(t1,...t1a)/a,x1,x2,...xm,y1,y2,...,ylQ is the number of topics, m is the length of the number of words of the text, and l is the length of the comment text; for a comment text, the number of input samples is n, and n represents the number of subjects to which the text belongs.
Further, the 102 constructs a capsule network model based on a self-topic attention mechanism as an emotion classification model for public opinion comments, designs a loss function of the model according to topic weights, and takes the input sample as an input of the model, specifically:
and constructing a capsule network model based on an independent topic attention machine mechanism, and distinguishing an input capsule into a topic and other two parts. Iterating dynamic routing through a learning matrix based on a viewpoint invariant relation between a part of self-topic attention and the whole body, multiplying the input capsule by the learning result matrix of the dynamic routing to serve as a self-feature extraction layer, and calculating and updating a capsule vector upsilon and a corresponding routing b parameter:
where r is the number of layers of the capsule network, biAttention weight parameter for the ith vector, initial random initial matrix, qi,ki,υiFor the attention parameter, determined by the dot product of the input capsule and a parameter b, arParameters are calculated for the capsule network raw route.
The output capsules v are then concatenated together and input into a feed forward network FFN, which consists of three linear transformations, wherein the activation function is Sigmod,
x denotes a text vector, b1,b2,b3,W1,W2,W3Respectively expressed as weight parameters and parameter matrixes, randomly initialized and iteratively trained by a feedback neural network.
The input capsule of the next layer is obtained via the compression function, the output dimension is not changed by extrusion, only the length is changed:
further, the method for designing the loss function of the model according to the theme weight specifically comprises the following steps:
adopting a cross entropy loss function as an emotion judgment task, and increasing corresponding weight according to a theme:
a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a short text sentiment classification method based on public sentiment big data analysis according to any one of the above.
A multi-label text classification system based on public opinion big data analysis, comprising:
the coding module: the public opinion text and comment data are respectively input into a vector acquisition model and coded into a public opinion text vector set and a comment data text vector set; a topic vector set acquisition module: the system comprises a user interface, a;
a conversion module: the input sample is used for converting the public opinion texts, the comment texts and the corresponding theme list into a single theme + text + comment text format;
and (3) emotion classification model: the capsule network model is used for constructing a capsule network model based on an attention mechanism and is used as an emotion classification model for public opinion comments; taking the input sample as the input of a capsule network model;
a prediction module: and the method is used for inputting the text to be predicted into the capsule network model to predict the emotion label, and finishing the emotion classification of the comment short text.
The invention has the following advantages and beneficial effects:
the invention adopts the self-linguistic expansion and the attention-based capsule network to solve the problem of short text sentiment classification of public opinion comments in colleges and universities, and the short text comments are recoded by analyzing the text subjects of the public opinions, so that the short text comments have the subject characteristics and are favorable for sentiment analysis. And secondly, analyzing text connotations through a capsule network based on an attention mechanism, and adding richer context-related corpus information for model training. A short text sentiment analysis method aiming at public opinion big data is not provided in the past, and the method realizes sentiment classification by extracting the subject of the text content, expanding the short text corpus information of the public opinion comments by combining the subject and the text with the comments, and constructing a capsule network based on a self-subject attention mechanism according to different weights of different subjects, thereby greatly improving the sentiment classification accuracy of the public opinion comment short text information data in colleges and universities.
The innovation points are as follows:
1. for public opinion short text, a theme + text + comment is constructed as an input sample
2. The improvement of the dynamic routing of the original capsule network integrates a multi-head self-attention mechanism
And improving the loss function, and associating the comment emotion prediction result with the importance of the theme.
Drawings
FIG. 1 is an overall flow chart of the preferred embodiment of the present invention;
FIG. 2 is an illustration of converting public opinion textual information descriptions and corresponding topic lists of colleges and universities into input samples according to the present invention;
fig. 3 is a diagram of a network architecture of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described in detail and clearly with reference to the accompanying drawings. The described embodiments are only some of the embodiments of the present invention.
The technical scheme for solving the technical problems is as follows:
as shown in FIG. 1, a method for classifying sentiment of public opinion comments in short texts in colleges and universities based on self-semantic expansion and multi-head attention. The method comprises the following steps: inputting public opinion texts and comment data into a vector acquisition model and coding the model into a text vector set; inputting the text vector set into an LSTM to construct a multi-label theme classification model and obtain a theme vector set; converting the text and the comment text and the corresponding subject list into an input sample in a single subject + text + comment text format; taking the input sample as a text emotion classification model to be input to obtain a classification model; and inputting the text to be predicted into the model to predict the emotion label, and finishing short text emotion classification.
A capsule network college public opinion comment short text sentiment classification method based on self-meaning expansion and attention comprises the following steps:
101. converting a text and comment text vector set obtained by the vector obtaining model and a subject vector set obtained by the neural network multi-label classification model into input samples in a single subject + text + comment text format; the vector acquisition model refers to any one of a vector space model VSM, a word frequency inverse text model TF/IDF, a word vector model word2vec and a pre-training model BERT (Chinese); the neural network multi-label classification model refers to any one of a traditional recurrent neural network model RNN, a traditional time series model LSTM and a traditional convolutional neural network model CNN.
102. Constructing a capsule network model based on a self-theme attention mechanism as an emotion classification model of public opinion comments, designing a loss function of the model according to theme weight, and taking the input sample as the input of the model;
103. and inputting the text to be predicted into the emotion classification model for emotion label prediction, and finishing emotion classification of the comment short text.
Further, the step 101 converts the text and comment text vector set obtained by the vector obtaining model and the subject vector set obtained by the neural network multi-label classification model into an input sample in a single-subject + text + comment text format, specifically:
inputting public opinion texts and comment data into a vector acquisition model for preprocessing coding, so that each word in an original text has corresponding characteristic representation in a vector space; each text is represented by X ═ X1,x2,...,xmWhere m denotes a text length, and the comment text is Y ═ Y1,y2,...,ylL represents the comment text length, and when the short text is commented, the value of l is smaller than the value of m;
inputting the preprocessed public opinion text into a neural network multi-label classification model to obtain a theme vector set of each corpus, wherein each theme text is represented as T ═ T { (T)11,t12,...t1a,t21,t22,...,t2b,t21,tk1,...,tkqK is the number of the topics of a certain public sentiment text, and a and b … q are the word number lengths of different topics;
focusing on the subject by averaging, the sample vector is denoted X*={∑(t1,...t1a)/a,x1,x2,...xm,y1,y2,...,ylQ is the number of topics, m is the length of the number of words of the text, and l is the length of the comment text; for a comment text, the number of input samples is n, and n represents the number of subjects to which the text belongs.
Further, the 102 constructs a capsule network model based on a self-topic attention mechanism as an emotion classification model for public opinion comments, designs a loss function of the model according to topic weights, and takes the input sample as an input of the model, specifically:
and constructing a capsule network model based on an independent topic attention machine mechanism, and distinguishing an input capsule into a topic and other two parts. Iterating dynamic routing through a learning matrix based on a viewpoint invariant relation between a part of self-topic attention and the whole body, multiplying the input capsule by the learning result matrix of the dynamic routing to serve as a self-feature extraction layer, and calculating and updating a capsule vector upsilon and a corresponding routing b parameter:
where r is the number of layers of the capsule network, biAttention weight parameter for the ith vector, initial random initial matrix, qi,ki,υiFor the attention parameter, determined by the dot product of the input capsule and a parameter b, arParameters are calculated for the capsule network raw route.
The output capsules v are then concatenated together and input into a feed forward network FFN, which consists of three linear transformations, wherein the activation function is Sigmod,
x denotes a text vector, b1,b2,b3,W1,W2,W3Respectively expressed as weight parameters and parameter matrixes, randomly initialized and iteratively trained by a feedback neural network.
The input capsule of the next layer is obtained via the compression function, the output dimension is not changed by extrusion, only the length is changed:
further, the method for designing the loss function of the model according to the theme weight specifically comprises the following steps:
adopting a cross entropy loss function as an emotion judgment task, and increasing corresponding weight according to a theme:
and inputting the text to be predicted into the emotion classification model for emotion label prediction, and finishing emotion classification of the comment short text.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above examples are to be construed as merely illustrative and not limitative of the remainder of the disclosure. After reading the description of the invention, the skilled person can make various changes or modifications to the invention, and these equivalent changes and modifications also fall into the scope of the invention defined by the claims.
Claims (6)
1. A short text sentiment classification method based on public sentiment big data analysis is characterized by comprising the following steps:
101. converting a text and comment text vector set obtained by the vector obtaining model and a subject vector set obtained by the neural network multi-label classification model into input samples in a single subject + text + comment text format; the vector acquisition model refers to any one of a vector space model VSM, a word frequency inverse text model TF/IDF, a word vector model word2vec and a pre-training model BERT; the neural network multi-label classification model refers to any one of a traditional recurrent neural network model RNN, a traditional time series model LSTM and a traditional convolutional neural network model CNN;
102. constructing a capsule network model based on a self-theme attention mechanism as an emotion classification model of public opinion comments, designing a loss function of the model according to theme weight, and taking the input sample as the input of the model;
103. and inputting the text to be predicted into the emotion classification model for emotion label prediction, and finishing emotion classification of the comment short text.
2. The method for classifying short text sentiments based on public opinion big data analysis according to claim 1, wherein the step 101 converts a text and comment text vector set obtained by a vector obtaining model and a topic vector set obtained by a neural network multi-label classification model into an input sample in a single topic + text + comment text format, specifically:
inputting public opinion texts and comment data into a vector acquisition model for preprocessing coding, so that each word in an original text has corresponding characteristic representation in a vector space; each text is represented by X ═ X1,x2,...,xmWhere m denotes a text length, and the comment text is Y ═ Y1,y2,...,ylL represents the comment text length, and when the short text is commented, the value of l is smaller than the value of m;
inputting the preprocessed public opinion text into a neural network multi-label classification model to obtain a theme vector set of each corpus, wherein each theme text is represented as T ═ T { (T)11,t12,...t1a,t21,t22,...,t26,t21,tk1,…,tkqK is the number of the topics of a certain public sentiment text, and a and b … q are the word number lengths of different topics;
focusing on the subject by averaging, the sample vector is denoted X*={∑(t1,...t1a)/a,x1,x2,...xm,y1,y2,...,ylQ is the number of topics, m is the length of the number of words of the text, and l is the length of the comment text; for a comment text, the number of input samples is n, and n represents the number of subjects to which the text belongs.
3. The method as claimed in claim 1, wherein the 102 constructs a capsule network model based on a self-topic attention mechanism as an emotion classification model of public opinion comments, designs a loss function of the model according to topic weights, and uses the input samples as the input of the model, specifically:
and constructing a capsule network model based on an independent topic attention machine mechanism, and distinguishing an input capsule into a topic and other two parts. Iterating the dynamic routing through a learning matrix based on a viewpoint invariant relation between a part of self-subject attention and the whole, multiplying the input capsule by the learning result matrix of the dynamic routing to serve as a self-feature extraction layer, and calculating and updating a capsule vector v and a corresponding routing b parameter:
where r is the number of layers of the capsule network, biAttention weight parameter for the ith vector, initial random initial matrix, qi,ki,viFor the attention parameter, determined by the dot product of the input capsule and a parameter b, arCalculating parameters for the capsule network original route;
the output capsules v are then concatenated together and input into a feed forward network FFN, which consists of three linear transformations, wherein the activation function is Sigmod,
x denotes a text vector, b1,b2,b3,W1,W2,W3Respectively expressed as weight parameters and parameter matrixes, randomly initialized and iteratively trained by a feedback neural network.
The input capsule of the next layer is obtained via the compression function, the output dimension is not changed by extrusion, only the length is changed:
4. the method for short text sentiment classification based on public sentiment big data analysis according to claim 2, wherein the method for short text sentiment classification based on public sentiment big data analysis is characterized in that a loss function of the model is designed according to theme weight, and specifically comprises the following steps:
adopting a cross entropy loss function as an emotion judgment task, and increasing corresponding weight according to a theme:
and inputting the text to be predicted into the emotion classification model for emotion label prediction, and finishing emotion classification of the comment short text.
5. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the method for short text sentiment classification based on public sentiment big data analysis according to any one of claims 1 to 4.
6. A multi-label text classification system based on public opinion big data analysis is characterized by comprising:
the coding and converting module: converting a text and comment text vector set obtained by the vector obtaining model and a subject vector set obtained by the neural network multi-label classification model into input samples in a single subject + text + comment text format;
and (3) emotion classification model: constructing a capsule network model based on a self-theme attention mechanism as an emotion classification model for public opinion comments, designing a loss function of the model according to theme weight, and taking the input sample as the input of the capsule network model;
a prediction module: and the method is used for inputting the text to be predicted into the capsule network model to predict the emotion label, and finishing the emotion classification of the comment short text.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111480111.3A CN114298157A (en) | 2021-12-06 | 2021-12-06 | Short text sentiment classification method, medium and system based on public sentiment big data analysis |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111480111.3A CN114298157A (en) | 2021-12-06 | 2021-12-06 | Short text sentiment classification method, medium and system based on public sentiment big data analysis |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114298157A true CN114298157A (en) | 2022-04-08 |
Family
ID=80965133
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111480111.3A Pending CN114298157A (en) | 2021-12-06 | 2021-12-06 | Short text sentiment classification method, medium and system based on public sentiment big data analysis |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114298157A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114791951A (en) * | 2022-05-13 | 2022-07-26 | 青岛文达通科技股份有限公司 | Emotion classification method and system based on capsule network |
CN115952291A (en) * | 2023-03-14 | 2023-04-11 | 山东大学 | Financial public opinion classification method and system based on multi-head self-attention and LSTM |
CN116821502A (en) * | 2023-06-30 | 2023-09-29 | 武汉大学 | Public opinion hotspot-based data management method and system |
-
2021
- 2021-12-06 CN CN202111480111.3A patent/CN114298157A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114791951A (en) * | 2022-05-13 | 2022-07-26 | 青岛文达通科技股份有限公司 | Emotion classification method and system based on capsule network |
CN115952291A (en) * | 2023-03-14 | 2023-04-11 | 山东大学 | Financial public opinion classification method and system based on multi-head self-attention and LSTM |
CN115952291B (en) * | 2023-03-14 | 2023-07-18 | 山东大学 | Financial public opinion classification method and system based on multi-head self-attention and LSTM |
CN116821502A (en) * | 2023-06-30 | 2023-09-29 | 武汉大学 | Public opinion hotspot-based data management method and system |
CN116821502B (en) * | 2023-06-30 | 2024-03-08 | 武汉大学 | Public opinion hotspot-based data management method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109933664B (en) | Fine-grained emotion analysis improvement method based on emotion word embedding | |
Yeomans et al. | The politeness Package: Detecting Politeness in Natural Language. | |
CN112711953B (en) | Text multi-label classification method and system based on attention mechanism and GCN | |
CN112818861B (en) | Emotion classification method and system based on multi-mode context semantic features | |
CN114298157A (en) | Short text sentiment classification method, medium and system based on public sentiment big data analysis | |
CN111767368B (en) | Question-answer knowledge graph construction method based on entity link and storage medium | |
CN111046941B (en) | Target comment detection method and device, electronic equipment and storage medium | |
CN110597961B (en) | Text category labeling method and device, electronic equipment and storage medium | |
CN112131350A (en) | Text label determination method, text label determination device, terminal and readable storage medium | |
Shilpa et al. | Sentiment analysis using deep learning | |
CN111695591B (en) | AI-based interview corpus classification method, AI-based interview corpus classification device, AI-based interview corpus classification computer equipment and AI-based interview corpus classification medium | |
CN112364624B (en) | Keyword extraction method based on deep learning language model fusion semantic features | |
CN113128557B (en) | News text classification method, system and medium based on capsule network fusion model | |
CN111914061B (en) | Radius-based uncertainty sampling method and system for text classification active learning | |
CN112667782A (en) | Text classification method, device, equipment and storage medium | |
CN113011126A (en) | Text processing method and device, electronic equipment and computer readable storage medium | |
CN112131345A (en) | Text quality identification method, device, equipment and storage medium | |
CN117216535A (en) | Training method, device, equipment and medium for recommended text generation model | |
CN113934835B (en) | Retrieval type reply dialogue method and system combining keywords and semantic understanding representation | |
CN113535912B (en) | Text association method and related equipment based on graph rolling network and attention mechanism | |
Das | A multimodal approach to sarcasm detection on social media | |
CN111143515B (en) | Text matching method and device | |
CN117131155A (en) | Multi-category identification method, device, electronic equipment and storage medium | |
Li et al. | [Retracted] Deep Unsupervised Hashing for Large‐Scale Cross‐Modal Retrieval Using Knowledge Distillation Model | |
Uttarwar et al. | Artificial intelligence based system for preliminary rounds of recruitment process |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |