Text public opinion analysis method and device, storage medium and computer equipment
Through feature extraction, attribute extraction and opinion extraction network analysis of public opinion text, the problem that existing technology cannot determine targeted evaluation of comments is solved, the granularity and accuracy of public opinion analysis are improved, and the company can improve product quality.
Patent Information
- Application Number
- CN202311642940.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-01
- Publication Date
- 2025-01-14
AI Technical Summary
Existing public opinion analysis techniques can only determine the emotional polarity of the text, and cannot determine which aspect of the game the user comments are targeted, so companies cannot improve the quality of the game in a targeted manner.
Through feature extraction, attribute extraction and opinion extraction networks, we analyze the opinions on different attributes in the public opinion text, generate public opinion information, and improve the granularity and accuracy of the analysis.
A detailed analysis of different attributes and views in the public opinion text has been achieved, helping enterprises to improve their products in a targeted manner and enhance their competitiveness.
Smart Images

Figure CN119311848A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a text public opinion analysis method and device, a storage medium, and a computer device. Background Art
[0002] Public opinion is referred to as public opinion. Public opinion analysis can be understood as the process of conducting in-depth thinking and analysis on the public opinion of a specific issue / topic according to the needs of the issue / topic to obtain relevant conclusions. With the continuous development of the Internet, online public opinions emerge in an endless stream, which brings considerable challenges to public opinion analysis technology.
[0003] In the construction of enterprise public opinion systems, enterprises need to mine user comments on products and improve products based on user comments. Taking the game enterprise public opinion system as an example, for a comment text on a certain game, the current public opinion system can only know the sentiment polarity of the text when conducting public opinion analysis on the text, and cannot determine which aspect of the game the user's comment is about, so the company cannot improve the quality of the game in a targeted manner. How to extract information about different aspects of opinions from the text is an important topic in the field of public opinion analysis. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a text public opinion analysis method and device, storage medium, and computer equipment, which can analyze the opinions expressed in the public opinion text for different attributes, so that the analysis of public opinion is finer in granularity and higher in accuracy, and further assist in analyzing the problems of products involved in the public opinion text, so as to make targeted product improvements and enhance product competitiveness.
[0005] According to one aspect of the present application, a text public opinion analysis method is provided, the method comprising:
[0006] Obtaining a public opinion text to be analyzed, and performing feature extraction on the public opinion text to obtain original text features corresponding to the public opinion text;
[0007] Generate attribute inference text data according to the attribute query statement and the original text features, and extract attributes from the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text;
[0008] For any target attribute information, determine the opinion query statement corresponding to the target attribute information, generate opinion inference text data according to the opinion query statement and the original text features, and extract opinions from the opinion inference text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information;
[0009] The public opinion information of the public opinion text is determined according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
[0010] According to another aspect of the present application, a text public opinion analysis device is provided, the device comprising:
[0011] A feature extraction module is used to obtain the public opinion text to be analyzed, and perform feature extraction on the public opinion text to obtain the original text features corresponding to the public opinion text;
[0012] An attribute extraction module, used to generate attribute inference text data according to the attribute query statement and the original text features, and perform attribute extraction on the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text;
[0013] The opinion extraction module is used to determine the opinion query statement corresponding to any target attribute information, generate opinion inference text data according to the opinion query statement and the original text features, and extract opinions from the opinion inference text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information;
[0014] The public opinion determination module is used to determine the public opinion information of the public opinion text according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
[0015] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned text public opinion analysis method is implemented.
[0016] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned text public opinion analysis method when executing the program.
[0017] By means of the above technical scheme, a method and apparatus for analyzing text public opinion, a storage medium, and a computer device are provided in the embodiments of the present application. First, feature extraction is performed on the public opinion text to be analyzed to obtain the original text feature; secondly, the attribute query statement and the original text feature are spliced into attribute reasoning text data, and the attribute extraction network is used to extract attributes from the attribute reasoning text data to determine at least one target attribute information of the public opinion text; then, for each target attribute information, a corresponding opinion query statement is generated, the opinion query statement and the original text feature are spliced into opinion reasoning text data, and the opinion extraction network is used to extract opinions from the opinion reasoning text data, thereby extracting the target opinion information corresponding to each target attribute information one by one; finally, the public opinion information of the public opinion text is generated using each target attribute information and its corresponding target opinion information. Compared with the current method of performing sentiment polarity analysis on public opinion texts, the embodiments of the present application only require one feature extraction of the public opinion text to analyze the opinions expressed in the public opinion text for different attributes, thereby making the analysis of public opinion more granular and more accurate, and further assisting in analyzing problems of products involved in the public opinion texts, so as to carry out targeted product improvements and enhance product competitiveness.
[0018] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 A flowchart of a text public opinion analysis method provided in an embodiment of the present application is shown;
[0021] Figure 2A A flowchart of another text public opinion analysis method provided in an embodiment of the present application is shown;
[0022] Figure 2B A flowchart of another text public opinion analysis method provided in an embodiment of the present application is shown;
[0023] Figure 2C A schematic diagram of a public opinion graph provided in an embodiment of the present application is shown;
[0024] Figure 2D A schematic diagram of another public opinion graph provided in an embodiment of the present application is shown;
[0025] Figure 3A A schematic diagram of a process for generating a public opinion analysis model provided in an embodiment of the present application is shown;
[0026] Figure 3B A schematic diagram showing a flow chart of another method for generating a public opinion analysis model provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of a process flow of a word segmentation automatic aggregation method provided in an embodiment of the present application is shown;
[0028] Figure 5 A structural schematic diagram of a text public opinion analysis device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0029] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0030] In this embodiment, a text public opinion analysis method is provided. Figure 1 As shown, the method includes:
[0031] Step 101, obtain the public opinion text to be analyzed, and perform feature extraction on the public opinion text to obtain the original text features corresponding to the public opinion text.
[0032] In the case where users express their opinions on different attributes in a public opinion text, the embodiment of the present application can analyze the opinions on various attributes in the public opinion text, rather than simply analyzing the sentiment polarity of the public opinion text. The text public opinion analysis method provided in the embodiment of the present application can derive opinions on different attributes in the public opinion text. For enterprises, the public opinion text about the products provided by the enterprise can analyze the evaluation opinions on different attributes of the products in the public opinion text, so that the enterprise can improve the various attributes of the products in a more targeted manner.
[0033] In the embodiment of the present application, for the public opinion text to be analyzed, data cleaning can be performed first, and feature extraction can be performed on the cleaned public opinion text, and the public opinion text can be converted into a high-dimensional vector to obtain the original text features. For example, the BERT network is used for feature extraction, and each character in the public opinion text is mapped to a 512-dimensional vector space, making full use of information in each dimension.
[0034] Step 102, generating attribute inference text data according to the attribute query statement and the original text features, and performing attribute extraction on the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text.
[0035] In the embodiment of the present application, the attribute extraction network is used to extract the attributes of the text, wherein the attribute query statement is first concatenated with the original text feature to obtain the attribute reasoning text data, and then the attribute reasoning text data is input into the pre-trained attribute extraction network, so that the attribute extraction network uses the attribute query statement in the attribute reasoning text data to determine the type of information to be extracted and extracts at least one target attribute information from the original text feature of the attribute reasoning text data. Taking the public opinion text as a comment text of a certain game as an example, the attributes may include music (including dubbing, soundtrack, sound effects...), gameplay (including playing method, copy, branch line...), picture (including picture quality, painting style, special effects...), content (including lines, plot, script...), etc. For example, the content of the public opinion text is "the dubbing is good, but the picture quality is a bit lame", and the attribute word "dubbing" of the music attribute and the attribute word "picture quality" of the picture attribute can be extracted through the attribute extraction network.
[0036] Step 103, for any target attribute information, determine the opinion query statement corresponding to the target attribute information, generate opinion reasoning text data based on the opinion query statement and the original text features, and extract opinions from the opinion reasoning text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information.
[0037] In the embodiment of the present application, after extracting the target attribute information corresponding to the public opinion text, the opinions expressed in the text for each target attribute can be further extracted, and the opinion extraction network can be used to extract opinions. Among them, for any target attribute information, a viewpoint query sentence corresponding to the target attribute information is first generated, and then the viewpoint query sentence and the original text feature are spliced to obtain the viewpoint reasoning text data, and finally the viewpoint reasoning text is input into the pre-trained viewpoint extraction network, so that the viewpoint extraction network uses the viewpoint query sentence in the viewpoint reasoning text to determine which attribute of opinion needs to be extracted, and extracts the opinion expressed in the public opinion text about the attribute from the original text features of the viewpoint reasoning text data. Still taking the above-mentioned public opinion text content "The dubbing is good, but the picture quality is a bit lame" as an example, the viewpoint extraction network can extract the viewpoint "good" about "dubbing" and the viewpoint "lame" about "picture quality".
[0038] Step 104: Determine the public opinion information of the public opinion text according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
[0039] In an embodiment of the present application, by extracting the target attribute information and target opinion information mentioned above, the various attributes and opinions about the various attributes expressed in the public opinion text can be obtained, and the public opinion information of the public opinion text can be determined accordingly. The public opinion information includes each target attribute information and its corresponding target opinion information.
[0040] By applying the technical solution of this embodiment, first, the public opinion text to be analyzed is subjected to feature extraction to obtain the original text features; secondly, the attribute query statement and the original text features are spliced into attribute reasoning text data, and the attribute extraction network is used to extract attributes from the attribute reasoning text data to determine at least one target attribute information of the public opinion text; then, for each target attribute information, a corresponding opinion query statement is generated, the opinion query statement and the original text features are spliced into opinion reasoning text data, and the opinion extraction network is used to extract opinions from the opinion reasoning text data, thereby extracting the target opinion information corresponding to each target attribute information one by one; finally, the public opinion information of the public opinion text is generated using each target attribute information and its corresponding target opinion information. Compared with the current method of analyzing the sentiment polarity of public opinion text, the embodiment of this application only needs to perform feature extraction on the public opinion text once to analyze the opinions expressed in the public opinion text for different attributes, so that the granularity of the analysis of public opinion is finer and the accuracy is higher, which further helps to analyze the problems of the products involved in the public opinion text, so as to carry out targeted product improvement and enhance product competitiveness.
[0041] Further, as a refinement and expansion of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another text public opinion analysis method is provided, such as Figure 2A As shown, the method includes:
[0042] Step 201, obtaining public opinion text to be analyzed, wherein the public opinion text includes game public opinion text related to the target game crawled from at least one social platform.
[0043] In the embodiment of the present application, taking the public opinion analysis for the target game as an example, the game public opinion text related to the target game can be obtained by crawling data on social platforms, such as crawling data about the target game on game forums, video websites and other platforms. In addition, user comment data on the product can also be collected through the feedback channel set up for the target game product.
[0044] Step 202: extract features from the public opinion text through a feature extraction network to obtain original text features corresponding to the public opinion text.
[0045] In the embodiment of the present application, the public opinion text can be analyzed by the pre-trained public opinion analysis model, and the public opinion analysis model mainly includes a feature extraction network, an attribute extraction network and an opinion extraction network. After the public opinion text is input into the public opinion analysis model, the model uses the feature extraction network to extract features of the public opinion text and extracts the original text features corresponding to the public opinion text.
[0046] Step 203, based on the attribute query statement and the original text features, attribute inference text data is generated, and attributes are extracted from the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text, wherein the target attribute information includes a target attribute word, wherein the target attribute information includes a target attribute word and a target attribute category to which the target attribute word belongs.
[0047] In an embodiment of the present application, after the feature extraction network extracts the original text features corresponding to the public opinion text, the attribute query statement and the original text features are spliced into attribute inference text data, and the attribute inference text data is sent to the attribute extraction network. Attribute extraction is performed through the attribute extraction network. The extracted target attribute information may include the target attribute words contained in the text, and may also include the target attribute category to which the target attribute words belong. For example, the attribute extraction network in the public opinion analysis model is used to extract attribute words in the text and determine the attribute categories corresponding to the attribute words. The public opinion text is "The dubbing is good, but the picture quality is a bit poor", and the attribute query statement can be "evaluation attributes and evaluation categories". The spliced attribute reasoning text data can be "[CLS]Evaluation attributes and evaluation categories[SEP]The dubbing is good, but the picture quality is a bit poor[SEP]", and the attribute extraction network can extract the attribute words involved in "The dubbing is good, but the picture quality is a bit poor" and the categories corresponding to the attribute words in the content between the two "[SEP]" "The dubbing is good, but the picture quality is a bit poor" for the question "Evaluation attributes and evaluation categories" after "[CLS]", that is, the attribute word "dubbing" corresponds to the category "music", and the attribute word "picture quality" corresponds to the category "picture".
[0048] Step 204, for any target attribute information, determine the target attribute word corresponding to the target attribute information, replace the standard attribute word in the opinion inquiry statement template with the target attribute word, obtain the opinion inquiry statement corresponding to the target attribute information, generate opinion reasoning text data according to the opinion inquiry statement and the original text features, and extract opinions from the opinion reasoning text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information, wherein the opinion inquiry statement template is used to indicate the opinion of the standard attribute word, and the target opinion information includes the target opinion word and the emotion category represented by the target opinion word.
[0049] In the embodiment of the present application, after the attribute extraction network extracts the target attribute information corresponding to the public opinion text, the public opinion analysis model can use the opinion extraction network to further extract the opinions expressed for each attribute in the public opinion text. Among them, after the attribute extraction network extracts the target attribute information of the public opinion text, the target attribute information can be fed back to the feature extraction network. The feature extraction network replaces the standard attribute words in the opinion query sentence with the target attribute words based on the target attribute words in each target attribute information, so that the opinion query sentence corresponding to each target attribute information can be obtained, and each opinion query sentence is further spliced with the original text features extracted by the feature extraction network to obtain the opinion reasoning text data corresponding to each target attribute information. For example, if the public opinion text is "The dubbing is good, but the picture quality is a bit poor", the category "music" corresponding to the attribute word "dubbing" and the category "picture" corresponding to the attribute word "picture quality" are extracted, and the opinion reasoning text data includes "[CLS] The opinion of dubbing and the emotion of dubbing [SEP] The dubbing is good, but the picture quality is a bit poor [SEP]" and "[CLS] The opinion of picture quality and the emotion of picture quality [SEP] The dubbing is good, but the picture quality is a bit poor [SEP]". The opinion reasoning text data are further input into the opinion extraction network one by one, and the opinion extraction is performed through the opinion extraction network to extract the target opinion information for each target attribute word. The target opinion information may include the target opinion word for each target opinion attribute word, and may also include the emotion category represented by the target opinion word. Still taking the public opinion text "The dubbing is good, but the picture quality is a bit poor" as an example, for the target attribute word "dubbing", the opinion "good" and the corresponding emotion "positive" can be extracted, and for the target attribute word "picture quality", the opinion "poor" and the corresponding emotion "negative" can be extracted. The final opinion extraction network can output a four-tuple of (attribute word, attribute category, opinion word, opinion emotion) for each input opinion inference text data, for example, the final four-tuples are (dubbing, music, good, positive) and (picture quality, picture, poor, negative).
[0050] In a specific embodiment, Figure 2BAs shown in the figure, for the text "The dubbing is good, but the picture quality is a bit lame", the attribute extraction network marks "dubbing" as BM, IM, and "picture quality" as BP, IP, where M represents Music, P represents Picture, B and I represent the Beginning and inner of the attribute respectively. Here, the attribute label is implicitly included in the higher-dimensional information of the attribute category, that is, as long as the attribute extraction network predicts BM, IM, then the prediction result here must be an attribute under the category of "music". The attribute information labels obtained by this annotation method can indicate the starting position and middle position of each attribute word in the text and the attribute category of each attribute word. Similarly, the opinion extraction network marks "good" as BP, IP, and "lame" as BN, IN, where P represents Positive and N represents Negative, and also hides the "opinion word" under the dimension of "emotion". The opinion information tags obtained by such annotating method can indicate the starting position and middle position of the opinion words with respect to different attribute words in the text as well as the opinion sentiment of the opinion words.
[0051] Step 205, determining the public opinion information of the public opinion text according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
[0052] In the embodiment of the present application, by integrating all target attribute information and its corresponding target opinion information, the public opinion information of the public opinion text can be obtained.
[0053] Step 206, in response to the public opinion map generation instruction, determine the public opinion display items and the public opinion map format indicated by the public opinion map generation instruction, wherein the public opinion display items include at least one of attribute words, attribute categories, opinion words and emotion categories.
[0054] In the embodiment of the present application, after obtaining the public opinion information of the public opinion text, the public opinion information can also be displayed visually. Among them, the user can select the public opinion display project and the form of the public opinion map according to the needs, and issue the target game public opinion map generation instruction. The public opinion display project includes one or more of the attribute words, attribute categories, opinion words, and emotional categories. The form of the public opinion map can be a histogram, a cloud map, etc. In addition, the public opinion map can be drawn in real time based on the public opinion analysis results. For example, an attribute frequency histogram, an attribute-emotion histogram, and an attribute-viewpoint-emotion histogram can be generated in real time, and corresponding sub-maps can be generated according to different emotional tendencies. For example, an attribute cloud map, an attribute-emotion cloud map, and an attribute-viewpoint-emotion cloud map are generated in real time. According to different emotional tendencies, it can also be specifically refined into an attribute-viewpoint-positive cloud map and an attribute-viewpoint-negative cloud map, reflecting the public opinion status of the comment text through different dimensions.
[0055] Step 207, based on the public opinion information of the public opinion text, count the public opinion information to be drawn that matches the public opinion display item, and draw and display the public opinion map in the form of the public opinion map according to the public opinion information to be drawn.
[0056] In the embodiment of the present application, based on the public opinion display item indicated by the target game public opinion map generation instruction, the public opinion information to be drawn related to the public opinion display item is obtained from the public opinion information of the public opinion text corresponding to the target game, and further drawn in the form of the public opinion map indicated by the target game public opinion map generation instruction and visualized. Figure 2C As shown in , it is an attribute-frequency histogram. Figure 2D As shown, this is an attribute-viewpoint cloud diagram.
[0057] The present application also provides a method for generating a public opinion analysis model. Figure 3A As shown, the method includes:
[0058] Step 301, obtaining at least one training sample corresponding to a public opinion analysis model, wherein the public opinion analysis model includes an attribute extraction network and an opinion extraction network, and any training sample includes a first public opinion text sample and a sample label corresponding to the first public opinion text sample, and the sample label includes an attribute word label and an opinion word label corresponding to the first public opinion text sample.
[0059] In the embodiment of the present application, a public opinion analysis model is constructed and a training sample of the model is obtained. The public opinion analysis model mainly includes a feature extraction network, an attribute extraction network and an opinion extraction network. The training sample includes a first public opinion text sample and a corresponding sample label. The sample label includes at least the attribute words contained in the public opinion text sample and the opinion words expressed by the attribute words, that is, the attribute word label and the opinion word label. It can also include the attribute word category corresponding to the attribute word and the opinion emotion corresponding to the opinion word.
[0060] Step 302: extracting sample features corresponding to the first public opinion text sample through a feature extraction network.
[0061] In the present application embodiment, Figure 3B As shown, in the training phase of the public opinion analysis model, for the training of each first public opinion text sample, the feature extraction network only needs to perform feature extraction once.
[0062] Step 303: Generate attribute reasoning sample data according to the attribute query statement and the sample text features, and generate opinion reasoning sample data according to the opinion query statement corresponding to the attribute word label and the sample text features.
[0063] In the present application embodiment, Figure 3B As shown, the attribute extraction network and the opinion extraction network in the public opinion analysis model can be trained synchronously. After the feature extraction network extracts the sample features corresponding to the first public opinion text sample, the sample text features can be spliced based on the fixed attribute query statement to obtain the attribute reasoning sample data corresponding to the sample text. At the same time, the sample text features can be spliced based on the attribute word labels in the first public opinion text sample to obtain the opinion reasoning sample data corresponding to the sample text. Thus, the attribute reasoning sample data and the opinion reasoning sample data are obtained, so that the attribute extraction network and the opinion extraction network can be trained synchronously. In traditional model training technology, multiple task training data are generally aligned, and then mixed into one task data for random discretization. However, data alignment will affect the stability of different tasks. For example, even if the opinion extraction network actually has a good effect, the final prediction result will not meet the training requirements because the attributes predicted by the attribute extraction network are inaccurate. The model training method provided in the embodiment of the present application is different from the traditional method of mixing multi-task data into one task for training. It adopts the "task batch discretization" method to perform multi-task synchronous training, associates different batches of data with different tasks, facilitates data discretization and grasps data flow, and can ensure the stability of training for different tasks, thereby improving model training efficiency.
[0064] Step 304, using the attribute reasoning sample data and the attribute word labels to train the attribute extraction network of the public opinion analysis model, and using the opinion reasoning sample data and the opinion word labels to train the opinion extraction network of the public opinion analysis model.
[0065] In an embodiment of the present application, after determining the attribute reasoning sample data and the opinion reasoning sample data, the attribute extraction network and the opinion extraction network can be trained synchronously until the training requirements of the model are met.
[0066] In the embodiment of the present application, optionally, step 304 specifically includes:
[0067] Step 304-1, constructing a first loss function corresponding to the attribute extraction network and a second loss function corresponding to the opinion extraction network, and determining the model loss function of the public opinion analysis model based on the first loss function and the second loss function, wherein the first loss function is used to calculate a first loss value between the attribute word predicted by the attribute extraction network for the attribute reasoning sample data and the attribute word label, and the second loss function is used to calculate a second loss value between the opinion word predicted by the opinion extraction network for the opinion reasoning sample data and the opinion word label;
[0068] Step 304-2, based on the model loss function, the attribute reasoning sample data, the attribute word label, the opinion reasoning sample data and the opinion word label, the feature extraction network, the attribute extraction network and the opinion extraction network of the public opinion analysis model are synchronously trained.
[0069] In this embodiment, the training of the public opinion analysis model may include the training of the feature extraction network, the attribute extraction network and the opinion extraction network, and each network may be trained synchronously. Among them, the overall model loss function of the public opinion analysis model may be composed of two parts, the first part is the first loss function of the attribute extraction network, and the second part is the second loss function of the opinion extraction network. Specifically, the weights of the first loss function and the second loss function may be preset, and the model loss function may be determined by weighted summing the first loss function and the second loss function. For any first public opinion text sample, the attribute reasoning sample data corresponding to the first public opinion text sample is input into the attribute extraction network, and the attribute extraction network will output the predicted attribute words for the attribute reasoning sample data, and the first loss function is used to calculate the loss value between the predicted attribute words and the attribute word labels in the first public opinion text sample. Similarly, for any first public opinion text sample, the opinion reasoning sample data corresponding to the first public opinion text sample is input into the opinion extraction network, and the opinion extraction network will output the predicted opinion words for the opinion reasoning sample data, and the second loss function is used to calculate the loss value between the predicted opinion words and the opinion word labels in the first public opinion text sample. During the model training process, the training effect of the model can be measured according to the overall loss value of the model loss function. Specifically, the training effects of the feature extraction network and the attribute extraction network can be comprehensively measured according to the first loss value of the first loss function, and the training effects of the feature extraction network and the opinion extraction network can be comprehensively measured according to the second loss value of the second loss function. This allows the feature extraction network, the attribute extraction network, and the opinion extraction network to be continuously parameterized so that the loss value of the final model loss function converges to meet the model training requirements.
[0070] It should be noted that during the model training process, large changes in model parameters often come from large gradient updates. Therefore, in order to avoid parameter degradation and falling into local optimality when using different samples for model training, a gradient clipping rule can also be set in the embodiment of the present application. In one embodiment, a norm update rule is set. When the norm ∥G∥ of the gradient value Gi is greater than the preset threshold C, the norm of the gradient value is calculated and the gradient is updated with the calculated gradient value, wherein the gradient value Gi is updated to (C / ∥G∥) Gi; otherwise, the gradient value Gi is kept unchanged for gradient update. In another embodiment, when the gradient value Gi is greater than the gradient constraint upper limit Gmax, the gradient value Gi is updated with the preset gradient value P and then the gradient is updated; when the gradient value Gi is less than the preset constraint lower limit, the gradient is directly updated with the original gradient value Gi; when the gradient value is between the preset constraint lower limit and the gradient constraint upper limit, the gradient value Gi is updated to Gi 2 / P and then update. Thus, when a large gradient update is generated, the parameter oscillation caused by the large gradient update is alleviated, and the possibility of the model entering the local optimum is reduced, thereby ensuring that the parameters are continuously updated in a stable manner following the direction of reducing the loss function.
[0071] The present application also provides a method for automatic word segmentation aggregation, such as Figure 4 As shown, the method includes:
[0072] Step 401, obtain a second public opinion text sample, perform word segmentation processing on the second public opinion text sample, and sort the word segments obtained by the word segmentation processing into a word list in order of word frequency from high to low.
[0073] Step 402, taking the first-ranked segmentation in the vocabulary as the target segmentation, calculating the similarity between the target segmentation and other segmentations in the vocabulary, aggregating the target segmentation and other segmentations that meet the preset similarity conditions into a segmentation class, and marking the segmentation class as an attribute word class or an opinion word class; wherein any attribute word class includes multiple attribute words under the same attribute category, the opinion word class includes a positive emotion opinion word class and a negative emotion opinion word class, the positive emotion opinion word class includes multiple opinion words describing positive emotions, and the negative emotion opinion word class includes multiple opinion words describing negative emotion types.
[0074] Step 403, delete all the participles in the participle class from the vocabulary, and aggregate the participle classes based on the new vocabulary until there are no remaining participles that can be aggregated in the vocabulary; wherein the attribute extraction network is used to extract attribute words based on the attribute words contained in the attribute word class and determine the attribute category to which the extracted attribute words belong; the opinion extraction network is used to extract opinion words based on the opinion words contained in the opinion word class and determine the sentiment category corresponding to the extracted opinion words.
[0075] Usually, attributes are manually summarized by relevant personnel through small sample sampling. In the process of summarization, technicians will randomly extract a small number of samples. After the summary is completed, they will continue to extract some samples and summarize iteratively. There are two disadvantages here. First, manual summarization requires multiple summarizers to unify the relevant attribute category standards, that is, what kind of entities are counted as the same category; second, manual summarization is time-consuming and laborious. There is a lot of repeated screening costs for multiple sample extractions with the same standard, but if the sampling standard is changed, it will cause data distribution drift.
[0076] The embodiment of the present application proposes a "circular clustering" method when implementing attribute word classification, using semantic vector similarity for cyclic calculations. While avoiding strong manual definition, it uses the semantic information of the attribute itself to automatically cluster related attributes to obtain an attribute set that is more consistent with the text distribution. The specific steps are as follows:
[0077] (1) Segment the second public opinion text sample, and then filter the segmented words to remove some pre-set words that are irrelevant to the attribute words but may appear frequently in the text, such as personal pronouns. Perform frequency statistics on the filtered segmented words, sort them by frequency, and generate a word list.
[0078] (2) Through the semantic vector algorithm, the vector representation of the segmented words can be calculated through models such as skip-grams, c-bow or Elmo. The vector representation can elevate the semantics of the words to a high-dimensional space, and more semantic representations can be obtained compared to simple digital representations.
[0079] (3) Calculate the similarity between the word vectors obtained in (2) in descending order of frequency, such as the cosine value. Assume that the vocabulary list is (perfect, style, wait, dubbing, very good, certain, picture quality, good, keep, sound). By calculating the similarity between the first word "perfect" and the words that follow it one by one, it can be found that the cosine values of the words "perfect", "very good", and "good" are larger. By setting the initialization threshold, they can be aggregated into one category.
[0080] (4) After one round, remove the clustered words and repeat the steps in (3). Finally, (dubbing, sound) can be clustered into one category, and (style, picture quality) can be clustered into another category.
[0081] The above method can solve the problems of bias in manual definition and huge manpower investment, and more reasonably find out attributes and summarize attribute categories.
[0082] Furthermore, the attribute word classes and opinion word classes aggregated in the above manner can be injected into the attribute extraction layer and opinion extraction layer of the public opinion analysis model, so that the attribute extraction layer can mark the attribute word positions based on the attribute words in each attribute word class, and mark the attribute word categories based on the attribute word categories corresponding to each attribute word class, and obtain attribute information fusion labels that can represent the attribute word positions and attribute word categories. Similarly, the opinion extraction layer can mark the opinion word positions based on the opinion words in each opinion word class, and mark the opinion word categories based on the sentiment categories corresponding to each opinion word class, and obtain opinion information fusion labels that can represent the opinion word positions and sentiment categories.
[0083] By applying the technical solution of this embodiment, first, compared with the general public opinion sentiment extraction system, in the data annotation module, the "circular clustering" method is used to realize automatic induction of attributes compared with the manual induction method, thereby saving manpower investment and improving the accuracy of induction. Second, the "task batch discretization" method is adopted to maximize the richness of data distribution in multi-task model training compared with conventional multi-task training. The multi-task training method is used to share feature layer parameters. Compared with single training, the amount of trainable parameters is greatly reduced, thereby effectively reducing the model training time. In addition, the gradient shearing technology is used to stabilize the parameter update, which better ensures the reasonable optimization of the parameters. Third, the joint annotation mechanism can effectively reduce the storage space (memory or video memory) occupied by the deployment, and the public opinion analysis only needs to pass through the feature network once, thereby significantly reducing the reasoning time. Fourth, compared with the general sentiment analysis system, the cloud map and histogram system are used to increase the multi-dimensional and all-round structured display platform.
[0084] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a text public opinion analysis device, such as Figure 5 As shown, the device comprises:
[0085] A feature extraction module is used to obtain the public opinion text to be analyzed, and perform feature extraction on the public opinion text to obtain the original text features corresponding to the public opinion text;
[0086] An attribute extraction module, used to generate attribute inference text data according to the attribute query statement and the original text features, and perform attribute extraction on the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text;
[0087] The opinion extraction module is used to determine the opinion query statement corresponding to any target attribute information, generate opinion inference text data according to the opinion query statement and the original text features, and extract opinions from the opinion inference text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information;
[0088] The public opinion determination module is used to determine the public opinion information of the public opinion text according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
[0089] Optionally, the target attribute information includes target attribute words; and the viewpoint extraction module is further used to:
[0090] The target attribute word corresponding to the target attribute information is determined, and the standard attribute word in the opinion inquiry statement template is replaced with the target attribute word to obtain an opinion inquiry statement corresponding to the target attribute information, wherein the opinion inquiry statement template is used to indicate an inquiry about an opinion on the standard attribute word.
[0091] Optionally, the device further comprises: a model training module, configured to:
[0092] Obtain at least one training sample of a public opinion analysis model, wherein the public opinion analysis model includes an attribute extraction network and an opinion extraction network, and any training sample includes a first public opinion text sample and a sample label corresponding to the first public opinion text sample, and the sample label includes an attribute word label and an opinion word label corresponding to the first public opinion text sample;
[0093] Extracting sample features corresponding to the first public opinion text sample;
[0094] Generating attribute reasoning sample data according to the attribute query sentence and the sample text features, and generating opinion reasoning sample data according to the opinion query sentence corresponding to the attribute word label and the sample text features;
[0095] The attribute extraction network of the public opinion analysis model is trained using the attribute reasoning sample data and the attribute word labels, and the opinion extraction network of the public opinion analysis model is trained using the opinion reasoning sample data and the opinion word labels.
[0096] Optionally, the public opinion analysis model further includes a feature extraction network; and the model training module is further used to:
[0097] Extracting sample features corresponding to the first public opinion text sample through a feature extraction network;
[0098] Accordingly, the feature extraction module is used to:
[0099] The feature extraction network is used to extract features from the public opinion text to obtain original text features corresponding to the public opinion text.
[0100] Optionally, the model training module is further used to:
[0101] Constructing a first loss function corresponding to the attribute extraction network and a second loss function corresponding to the opinion extraction network, and determining the model loss function of the public opinion analysis model based on the first loss function and the second loss function, wherein the first loss function is used to calculate a first loss value between the predicted attribute word of the attribute extraction network for the attribute reasoning sample data and the attribute word label, and the second loss function is used to calculate a second loss value between the predicted opinion word of the opinion extraction network for the opinion reasoning sample data and the opinion word label;
[0102] Based on the model loss function, the attribute reasoning sample data, the attribute word labels, the opinion reasoning sample data and the opinion word labels, the feature extraction network, the attribute extraction network and the opinion extraction network of the public opinion analysis model are synchronously trained.
[0103] Optionally, the device further comprises: a clustering module, configured to:
[0104] Obtain a second public opinion text sample, perform word segmentation processing on the second public opinion text sample, and sort the words obtained by the word segmentation processing into a word list in descending order of word frequency;
[0105] The first-ranked segmentation in the vocabulary is taken as the target segmentation, the similarity between the target segmentation and other segmentations in the vocabulary is calculated, the target segmentation and other segmentations that meet the preset similarity conditions are aggregated into a segmentation class, and the segmentation class is marked as an attribute word class or an opinion word class; wherein any attribute word class includes multiple attribute words under the same attribute category, the opinion word class includes a positive emotion opinion word class and a negative emotion opinion word class, the positive emotion opinion word class includes multiple opinion words describing positive emotions, and the negative emotion opinion word class includes multiple opinion words describing negative emotion types;
[0106] Deleting all the participles in the participle class from the vocabulary, and aggregating the participle classes based on a new vocabulary until there are no remaining participles that can be aggregated in the vocabulary;
[0107] Among them, the attribute extraction network is used to extract attribute words based on the attribute words contained in the attribute word class and determine the attribute category to which the extracted attribute words belong; the opinion extraction network is used to extract opinion words based on the opinion words contained in the opinion word class and determine the emotion category corresponding to the extracted opinion words.
[0108] Optionally, the target attribute information includes a target attribute word and a target attribute category to which the target attribute word belongs, and the target opinion information includes a target opinion word and a sentiment category represented by the target opinion word;
[0109] The device also includes: a public opinion map generation module, which is used to:
[0110] In response to a public opinion map generation instruction, determining a public opinion display item and a public opinion map format indicated by the public opinion map generation instruction, wherein the public opinion display item includes at least one of an attribute word, an attribute category, an opinion word, and an emotion category;
[0111] Based on the public opinion information of the public opinion text, the public opinion information to be drawn that matches the public opinion display item is counted, and according to the public opinion information to be drawn, a public opinion map is drawn and displayed in the form of the public opinion map.
[0112] It should be noted that for other corresponding descriptions of the functional units involved in the text public opinion analysis device provided in the embodiment of the present application, reference can be made to Figures 1 to 4 The corresponding description in the method will not be repeated here.
[0113] The embodiment of the present application also provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. 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, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.
[0114] Those skilled in the art will appreciate that the structure of the above-mentioned computer device is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0115] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0116] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0117] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0118] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0119] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0120] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A text public opinion analysis method, characterized in that: The method comprises: Obtaining a public opinion text to be analyzed, and performing feature extraction on the public opinion text to obtain original text features corresponding to the public opinion text; Generate attribute inference text data according to the attribute query statement and the original text features, and extract attributes from the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text; For any target attribute information, determine the opinion query statement corresponding to the target attribute information, generate opinion inference text data according to the opinion query statement and the original text features, and extract opinions from the opinion inference text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information; The public opinion information of the public opinion text is determined according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
2. The method according to claim 1, characterized in that The target attribute information includes a target attribute word; and determining the opinion query sentence corresponding to the target attribute information further includes: Determine the target attribute word corresponding to the target attribute information, replace the standard attribute word in the opinion inquiry statement template with the target attribute word, and obtain the opinion inquiry statement corresponding to the target attribute information, wherein the opinion inquiry statement template is used to indicate the opinion inquiry about the standard attribute word.
3. The method according to claim 1, characterized in that Before extracting attributes from the attribute inference text data using a pre-trained attribute extraction network, the method further includes: Obtain at least one training sample corresponding to a public opinion analysis model, wherein the public opinion analysis model includes an attribute extraction network and an opinion extraction network, and any training sample includes a first public opinion text sample and a sample label corresponding to the first public opinion text sample, and the sample label includes an attribute word label and an opinion word label corresponding to the first public opinion text sample; Extracting sample features corresponding to the first public opinion text sample; Generating attribute reasoning sample data according to the attribute query sentence and the sample text features, and generating opinion reasoning sample data according to the opinion query sentence corresponding to the attribute word label and the sample text features; The attribute extraction network of the public opinion analysis model is trained using the attribute reasoning sample data and the attribute word labels, and the opinion extraction network of the public opinion analysis model is trained using the opinion reasoning sample data and the opinion word labels.
4. The method according to claim 3, characterized in that The public opinion analysis model further includes a feature extraction network; and extracting sample features corresponding to the first public opinion text sample further includes: Extracting sample features corresponding to the first public opinion text sample through a feature extraction network; Correspondingly, the feature extraction of the public opinion text to obtain the original text features corresponding to the public opinion text further includes: The feature extraction network is used to extract features from the public opinion text to obtain original text features corresponding to the public opinion text.
5. The method according to claim 4, characterized in that The method of using the attribute reasoning sample data and the attribute word labels to train the attribute extraction network of the public opinion analysis model, and using the opinion reasoning sample data and the opinion word labels to train the opinion extraction network of the public opinion analysis model further includes: Constructing a first loss function corresponding to the attribute extraction network and a second loss function corresponding to the opinion extraction network, and determining the model loss function of the public opinion analysis model based on the first loss function and the second loss function, wherein the first loss function is used to calculate a first loss value between the predicted attribute word of the attribute extraction network for the attribute reasoning sample data and the attribute word label, and the second loss function is used to calculate a second loss value between the predicted opinion word of the opinion extraction network for the opinion reasoning sample data and the opinion word label; Based on the model loss function, the attribute reasoning sample data, the attribute word labels, the opinion reasoning sample data and the opinion word labels, the feature extraction network, the attribute extraction network and the opinion extraction network of the public opinion analysis model are synchronously trained.
6. The method according to claim 3, characterized in that Before using the attribute inference sample data and the attribute word labels to train the attribute extraction network of the public opinion analysis model, the method further includes: Obtain a second public opinion text sample, perform word segmentation processing on the second public opinion text sample, and sort the words obtained by the word segmentation processing into a word list in descending order of word frequency; The first-ranked segmentation in the vocabulary is taken as the target segmentation, the similarity between the target segmentation and other segmentations in the vocabulary is calculated, the target segmentation and other segmentations meeting the preset similarity condition are aggregated into a segmentation class, and the segmentation class is marked as an attribute segmentation class or an opinion segmentation class; All the participles in the participle class are deleted from the vocabulary, and the participle classes are aggregated based on a new vocabulary until there are no remaining participles that can be aggregated in the vocabulary.
7. The method according to any one of claims 1 to 6, characterized in that The target attribute information includes a target attribute word and a target attribute category to which the target attribute word belongs, and the target opinion information includes a target opinion word and a sentiment category represented by the target opinion word; After determining the public opinion information of the public opinion text according to the target attribute information and the target viewpoint information corresponding to the target attribute information, the method further includes: In response to a public opinion map generation instruction, determining a public opinion display item and a public opinion map format indicated by the public opinion map generation instruction, wherein the public opinion display item includes at least one of an attribute word, an attribute category, an opinion word, and an emotion category; Based on the public opinion information of the public opinion text, the public opinion information to be drawn that matches the public opinion display item is counted, and according to the public opinion information to be drawn, a public opinion map is drawn and displayed in the form of the public opinion map.
8. A text public opinion analysis device, characterized in that: The device comprises: A feature extraction module is used to obtain the public opinion text to be analyzed, and perform feature extraction on the public opinion text to obtain the original text features corresponding to the public opinion text; An attribute extraction module, used to generate attribute inference text data according to the attribute query statement and the original text features, and perform attribute extraction on the attribute inference text data through a pre-trained attribute extraction network to determine at least one target attribute information corresponding to the public opinion text; The opinion extraction module is used to determine the opinion query statement corresponding to any target attribute information, generate opinion inference text data according to the opinion query statement and the original text features, and extract opinions from the opinion inference text data through a pre-trained opinion extraction network to determine the target opinion information of the public opinion text for the target attribute information; The public opinion determination module is used to determine the public opinion information of the public opinion text according to the target attribute information and the target viewpoint information corresponding to the target attribute information.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.