Fine-grained sentiment analysis method, apparatus and storage medium

By constructing a dictionary and utilizing the attention layer and multilayer perceptron network of a pre-trained language representation model for fine-grained sentiment analysis, the problems of coarse granularity and low accuracy in existing technologies are solved, achieving more accurate fine-grained sentiment analysis and improving the market adaptability of product design.

CN115878787BActive Publication Date: 2026-02-06北京中关村科金技术有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210217200.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2026-02-06
Estimated Expiration
2042-03-07

AI Technical Summary

Technical Problem

Current sentiment analysis technologies have relatively coarse granularity and low accuracy, which is particularly limiting in application scenarios without GPU resources.

Method used

By pre-constructing a dictionary, keywords are extracted from text information, and fine-grained sentiment analysis is performed using the attention layer and multilayer perceptron network of a pre-trained language representation model, including word segmentation, association rule analysis, and co-occurrence calculation. A dictionary is constructed, and a pre-trained BERT model is used for fine-grained sentiment analysis.

Benefits of technology

It enables more granular sentiment analysis, improves the accuracy of sentiment analysis, and can effectively perform fine-grained sentiment analysis under different hardware conditions, thus assisting in product design optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115878787B_ABST
    Figure CN115878787B_ABST
Patent Text Reader

Abstract

The application discloses a fine-grained sentiment analysis method and device and a storage medium. The method comprises the following steps: obtaining text information to be subjected to sentiment analysis; extracting at least one keyword from the text information based on a pre-constructed dictionary; inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; and inputting an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of information classification, and in particular to a fine-grained sentiment analysis method and device and storage medium. BACKGROUND

[0002] Fine-grained sentiment analysis is a technology that further analyzes the specific attributes of a subject in text content based on sentiment analysis, and plays an important role in scenarios such as public opinion analysis and dialogue systems. For the insurance industry, a large number of product-related corpora (forums, chats, white papers, etc.) need to be effectively analyzed to improve the product. The algorithm system can reasonably and objectively analyze the subjective evaluation of the product by the customer through limited product-related text, and the system can analyze and infer more fine-grained sentiment values to know the product design department to develop a more market-oriented product marketing plan.

[0003] At present, most multi-label classification models based on XLNet, Longformer, etc. are used for sentiment classification. Although the multi-label classification model based on XLNet, Longformer, etc. has good performance in semantic feature representation, and has many improvements in long text processing compared to the previous Bert model, it can only analyze sentiment based on the granularity of the entire text, and the granularity of sentiment analysis is coarse. And the multi-label classification model based on XLNet, Longformer, etc. has high requirements for hardware devices, which has great limitations in some fields, especially in application scenarios without GPU resources.

[0004] In addition, there are also SVM classification models based on TF_IDF feature representation for sentiment analysis. However, the TF_IDF feature dimension is large and belongs to a sparse vector, which cannot represent the semantic features of the text, resulting in low accuracy of the sentiment analysis result. Moreover, multiple SVM classification models need to be trained, and the computing performance is low.

[0005] In view of the technical problems of coarse granularity of sentiment analysis and low accuracy of sentiment analysis result in the prior art, no effective solution has been proposed so far. SUMMARY

[0006] The embodiments of the present application provide a fine-grained sentiment analysis method, device and storage medium to at least solve the technical problems of coarse granularity of sentiment analysis and low accuracy of sentiment analysis result in the prior art.

[0007] According to an aspect of the embodiments of the present application, a fine-grained sentiment analysis method is provided, including: obtaining text information to be subjected to sentiment analysis; extracting at least one keyword from the text information based on a pre-constructed dictionary; inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; inputting an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword.

[0008] Optionally, before the text information to be subjected to sentiment analysis is obtained, the method further includes: obtaining a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and performing word segmentation processing on the plurality of text data; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule; performing association rule analysis on each of the mined target words, and calculating a co-occurrence degree between any two target words; and constructing the dictionary based on each target word with a co-occurrence degree greater than a preset threshold.

[0009] Optionally, the mining of the target words from the word segmentation results of the word segmentation processing by using the preset new word mining rule includes: performing point-to-point mutual information value calculation on the word segmentation results of the word segmentation processing, and performing first word formation filtering on the word segmentation results by using a first priori knowledge threshold; performing left entropy value and right entropy value calculation on the word segmentation results filtered by the first word formation filtering, and performing second word formation filtering on the word segmentation results filtered by the first word formation filtering by using a second priori knowledge threshold; and inputting the point-to-point mutual information value, the left entropy value and the right entropy value of the word segmentation results filtered by the second word formation filtering as features of each word segmentation into the pre-trained language representation model, and outputting the target words.

[0010] Optionally, the extraction of the at least one keyword from the text information based on the pre-constructed dictionary includes: performing word segmentation processing on the text information; matching the word segmentation results of the text information with each word in the pre-constructed dictionary; and extracting the at least one keyword from the text information according to the matching result.

[0011] Optionally, the inputting of the first feature vector corresponding to the text information and the second feature vector corresponding to each keyword into the attention layer of the pre-trained language representation model includes: inputting the first feature vector corresponding to the text information into a first neural network of the attention layer of the pre-trained language representation model; and inputting an output vector of the first neural network and the second feature vector corresponding to each keyword into a second neural network of the attention layer of the pre-trained language representation model.

[0012] Optionally, the output vector of the attention layer is input into the multi-layer perceptron network of the pre-trained language representation model, comprising: inputting the output vector of the second neural network of the attention layer of the language representation model into the multi-layer perceptron network of the pre-trained language representation model.

[0013] According to another aspect of the embodiments of the present application, a storage medium is also provided, which comprises a stored program, wherein the program is executed by a processor to implement the method described in any one of the above.

[0014] According to another aspect of the embodiments of the present application, a fine-grained sentiment analysis device is also provided, comprising: an acquisition module configured to acquire text information to be subjected to sentiment analysis; a keyword extraction module configured to extract at least one keyword from the text information based on a pre-constructed dictionary; a first processing module configured to input a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; a second processing module configured to input an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; and a sentiment classification module configured to input an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and output a sentiment classification result of each keyword.

[0015] Optionally, the device further comprises a dictionary construction module configured to: acquire a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and perform word segmentation processing on the plurality of text data; mine target words from the word segmentation results of the word segmentation processing by using preset new word mining rules; perform association rule analysis on each of the mined target words, and calculate a co-occurrence degree between any two target words; and construct a dictionary based on each target word whose co-occurrence degree is greater than a preset threshold.

[0016] According to another aspect of the embodiments of the present application, a fine-grained sentiment analysis device is also provided, comprising: a processor; and a memory connected with the processor, configured to provide the processor with instructions for processing the following processing steps: acquiring text information to be subjected to sentiment analysis; extracting at least one keyword from the text information based on a pre-constructed dictionary; inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; inputting an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword.

[0017] In the embodiment of the present application, all keywords contained in the text information to be subjected to sentiment analysis can be extracted through a pre-constructed dictionary. Each keyword is subjected to fine-grained sentiment analysis through a pre-trained language representation model to obtain a sentiment classification result of each keyword. Through the attention layer and the multi-layer perception network of the language representation model, the sentiment value of each part of the text information can be deeply mined, the granularity is more detailed, and the sentiment classification result output by the classifier is more accurate. The technical problems of coarse granularity of sentiment analysis and low accuracy of sentiment analysis result in the prior art are solved. BRIEF DESCRIPTION OF DRAWINGS

[0018] The accompanying drawings, which are included to provide a further understanding of the present application and are incorporated in and constitute a part of this application, illustrate embodiments of the present application and together with the description serve to explain the present application. In the drawings:

[0019] Figure 1 is a hardware structure block diagram of a computing device for implementing the method according to Embodiment 1 of the present application;

[0020] Figure 2 is a flowchart of the fine-grained sentiment analysis method according to the first aspect of Embodiment 1 of the present application;

[0021] Figure 3 is a whole flowchart of the fine-grained sentiment analysis according to Embodiment 1 of the present application in combination with the network layers of the pre-trained language representation model;

[0022] Figure 4 is a schematic diagram of the fine-grained sentiment analysis device according to Embodiment 2 of the present application; and

[0023] Figure 5 is a schematic diagram of the fine-grained sentiment analysis device according to Embodiment 3 of the present application. DETAILED DESCRIPTION

[0024] In order to enable persons skilled in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the scope of protection of the present application.

[0025] It is to be understood that the terminology "first", "second" and the like used in the specification and the claims of the application as well as the foregoing drawings is merely intended to distinguish between similar objects and not necessarily to describe a particular sequential or chronological order. It is to be understood that the use of such terms as "first", "second" and the like can be interchanged, under appropriate circumstances, with each other, to describe the embodiments of the application disclosed herein. Furthermore, the terms "comprise", "comprising", "has", "having", "includes", "including", "contain", "containing" and any variations thereof are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or apparatus that comprises a list of steps or units can not necessarily be limited to those steps or units that are expressly listed, but can include other not expressly listed steps or units, or steps or units inherent to such process, method, product or apparatus.

[0026] First, some of the nouns or terms that appear in the process of describing the embodiments of the application are explained as follows:

[0027] PMI (Pointwise Mutual Information): used to measure the degree of convergence of a word.

[0028] IE (Information Entropy): left and right adjacent entropy, used to represent the richness of the left and right surrounding words of a word, the higher the richness, the greater the probability of the word becoming a new word in new word discovery.

[0029] BERT (Bidirectional Encoder Representation from Transformers): the main structure is a deep neural network composed of stacked Transformer Encoder layers.

[0030] Longformer: Longformer is a model that can efficiently process long text, which is a pre-training model that solves the problem of long text by using a window mechanism.

[0031] XLNet: XLNet adopts a two-stage model training process, the first stage is the language model pre-training stage, and the second stage is the task data fine-tuning stage; optimization measures (core points) include implementing bidirectional context information (PLM mechanism), implementing long text processing problem (fragment cycle and relative position encoding).

[0032] Embodiment 1

[0033] According to this embodiment, an embodiment of a fine-grained sentiment analysis method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0034] The method embodiments provided in this example can be executed on a server or similar computing device. Figure 1 A hardware block diagram of a computing device for implementing fine-grained sentiment analysis methods is shown. Figure 1 As shown, a computing device may include one or more processors (processors may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), memory for storing data, and transmission devices for communication functions. In addition, it may also include: a display, input / output interfaces (I / O interfaces), a universal serial bus (USB) port (which may be included as one of the ports in the I / O interface), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, a computing device may also include... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0035] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits can be embodied, in whole or in part, in software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits can be a single, independent processing module, or integrated, in whole or in part, into any other element in the computing device. As involved in the embodiments of the present invention, the data processing circuit serves as a processor control mechanism (e.g., selection of a variable resistor termination path connected to an interface).

[0036] The memory can be used to store software programs of application software and modules, such as program instructions / data storage devices corresponding to the fine-grained sentiment analysis method in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implements the fine-grained sentiment analysis method of the application program described above. The memory can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory can further include a memory remotely arranged with respect to the processor, which can be connected to the computing device through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0037] The transmission device is used to receive or send data via a network. Specific examples of the above-mentioned network can include a wireless network provided by a communication provider of the computing device. In one example, the transmission device includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet in a wireless manner.

[0038] The display can be, for example, a touch screen type liquid crystal display (LCD), which can enable a user to interact with the user interface of the computing device.

[0039] It should be noted that in some optional embodiments, the above-mentioned Figure 1 The computing device shown can include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware and software elements. It should be noted that Figure 1 is only an example of a specific embodiment, and is intended to show the types of components that can be present in the above-mentioned computing device.

[0040] Under the above-mentioned operating environment, according to a first aspect of the present embodiment, a fine-grained sentiment analysis method is provided. Figure 2 The flowchart of the method is shown, and with reference to Figure 2 The method includes:

[0041] S202: obtaining text information to be subjected to sentiment analysis;

[0042] In the embodiments of the present application, in combination with Figure 3As shown, the obtained text information to be subjected to sentiment analysis is, for example but not limited to, "I think the one-year personal insurance I bought is too expensive, and in addition, why is there no phone customer service after the compulsory insurance expires?".

[0043] S204: Extract at least one keyword from the text information based on the pre-constructed dictionary.

[0044] Optionally, before obtaining the text information to be subjected to sentiment analysis, the method comprises: obtaining a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and performing word segmentation processing on the plurality of text data; using a preset new word mining rule to mine target words from the word segmentation result of the word segmentation processing; performing association rule analysis on each target word mined, and calculating the co-occurrence degree between any two target words; and constructing a dictionary based on each target word with a co-occurrence degree greater than a preset threshold.

[0045] Optionally, using a preset new word mining rule to mine target words from the word segmentation result of the word segmentation processing comprises: calculating the point mutual information value of the word segmentation result of the word segmentation processing, and performing first word formation filtering on the word segmentation result through a first priori knowledge threshold; calculating the left entropy value and the right entropy value of the word segmentation result after the first word formation filtering, and performing second word formation filtering on the word segmentation result after the first word formation filtering through a second priori knowledge threshold; inputting the point mutual information value, the left entropy value and the right entropy value of the word segmentation result after the second word formation filtering as the features of each word segmentation into a pre-trained language representation model, and outputting the target words.

[0046] In the embodiment of the present application, before sentiment analysis is performed, a dictionary needs to be constructed in the corresponding field. Taking the insurance product field as an example, the steps of constructing the dictionary in the insurance product field are as follows:

[0047] (1) Obtain text data in the insurance product field and perform Ngram word segmentation on the text data.

[0048] (2) Use the PI-BERT algorithm to mine new words in the insurance product field. Specifically, first, calculate the PMI value (point mutual information value) of the Ngram word segmentation result, perform word formation filtering (i.e., whether it is a new word in the field) on the word segmentation result through a priori knowledge threshold TS1 (corresponding to the first priori knowledge threshold), then calculate the left and right adjacent entropy values of the word segmentation result, perform word formation filtering through a priori knowledge threshold TS2 (corresponding to the second priori knowledge threshold), and finally input the PMI value, the left entropy value and the right entropy value as the features of the word into the pre-trained model BERT, and perform binary classification prediction to obtain the target words mined by the PI-BERT.

[0049] (3) Based on the target words in step (2), the association rule analysis between the target words is performed, that is, which words are most likely to appear is analyzed through the co-occurrence degree between the target words, TOPK target words are selected according to the co-occurrence degree value, and then manual knowledge auditing is performed to obtain the final target words, that is, aspect words.

[0050] Optionally, based on the pre-constructed dictionary, at least one keyword is extracted from the text information, including: performing word segmentation processing on the text information; matching the word segmentation result of the text information with each vocabulary in the pre-constructed dictionary; and extracting at least one keyword from the text information according to the matching result.

[0051] In the embodiment of the present application, each text information obtained may contain the evaluation of multiple products (aspects). At this time, the vocabulary of each product is the key word (i.e., the analysis object) of sentiment analysis, and a more fine-grained mining strategy is required for this kind of text information to analyze the sentiment tendency conveyed by the text information. Taking the text information "I think the one-year personal insurance I bought is too expensive, in addition, why is there no phone customer service after the compulsory insurance expires?" as an example, first, the text information is subjected to word segmentation processing, then each word is matched with each vocabulary in the constructed dictionary, and finally, according to the matching result, two keywords "personal insurance" and "compulsory insurance" can be extracted from the text information (as shown in Figure 3

[0052] S206: input the first feature vector corresponding to the text information and the second feature vector corresponding to each keyword into the attention layer of the pre-trained language representation model;

[0053] Optionally, inputting the first feature vector corresponding to the text information and the second feature vector corresponding to each keyword into the attention layer of the pre-trained language representation model includes: inputting the first feature vector corresponding to the text information into a first neural network of the attention layer of the pre-trained language representation model; and inputting the output vector of the first neural network and the second feature vector corresponding to each keyword into a second neural network of the attention layer of the pre-trained language representation model.

[0054] In the embodiment of the present application, as shown in Figure 3 , the text information and each keyword are represented by vectors and then input into the attention layer (Attention layer) of the pre-trained language representation model (BERT model). Among them, the first feature vector corresponding to the text information is input into the first neural network (corresponding to the MemoryModule network in Figure 3 ) of the attention layer of the pre-trained language representation model, and the second feature vector corresponding to each keyword is input into the second neural network (corresponding to the FeedForward network in Figure 3 ​the output of the Memory Module network is transmitted to the Content Attention Module network.

[0055] S208: inputting the output vector of the attention layer into the multi-layer perception network of the pre-trained language representation model.

[0056] Optionally, inputting the output vector of the attention layer into the multi-layer perception network of the pre-trained language representation model comprises: inputting the output vector of the second neural network of the attention layer of the language representation model into the multi-layer perception network of the pre-trained language representation model.

[0057] S210: inputting the output vector of the multi-layer perception network into the classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword.

[0058] In the embodiments of the present application, the language representation model is pre-trained. Figure 3 As shown in the figure, the output result of the Content Attention Module network is transmitted to the multi-layer perception network of the pre-trained language representation model (corresponding to the MLP multi-layer perception in Figure 3 ). The output of the perception machine is subjected to probability calculation by the classifier (corresponding to Softmax in Figure 3 ), and finally the sentiment value score for each keyword (aspect) is obtained, and the final sentiment classification results of positive, neutral and negative are obtained.

[0059] Therefore, the fine-grained sentiment analysis method proposed by the present application can extract all keywords contained in the text information to be subjected to sentiment analysis through the pre-constructed dictionary. The pre-trained language representation model is used to perform fine-grained sentiment analysis on each keyword, and the sentiment classification result of each keyword is obtained. Through the attention layer and the multi-layer perception network of the language representation model, the sentiment value of each part of the text information can be deeply mined, which is more detailed in granularity, and the sentiment classification result output by the classifier is more accurate. The technical problems of coarse granularity of sentiment analysis and low accuracy of sentiment analysis result in the prior art are solved.

[0060] In addition, the present application can mine deeper sentiment trends in field text, assist decision makers in formulating clearer and more perfect product design schemes, improve the competitiveness of products in the market, and make the purchase experience of customers more smooth.

[0061] It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all described as a combination of a series of actions, but those skilled in the art should know that the present application is not limited by the order of the described actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0062] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and a necessary general hardware platform, and of course it can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, an optical disk) and includes a plurality of instructions for causing an end device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the method described in each embodiment of the present application.

[0063] Embodiment 2

[0064] Figure 4 A fine-grained sentiment analysis device 400 according to the present embodiment is shown, which corresponds to the method according to the first aspect of embodiment 1. Referring to Figure 4 As shown, the device 400 comprises: an acquisition module 410 configured to acquire text information to be subjected to sentiment analysis; a keyword extraction module 420 configured to extract at least one keyword from the text information based on a pre-constructed dictionary; a first processing module 430 configured to input a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; a second processing module 440 configured to input an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; and a sentiment classification module 450 configured to input an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and output a sentiment classification result of each keyword.

[0065] Optionally, the device 440 further comprises a dictionary construction module configured to: acquire a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and perform word segmentation processing on the plurality of text data; mine target words from the word segmentation results of the word segmentation processing using a pre-set new word mining rule; perform association rule analysis on each of the mined target words, and calculate the co-occurrence degree between any two target words; and construct a dictionary based on each target word whose co-occurrence degree is greater than a pre-set threshold.

[0066] Optionally, the dictionary construction module is specifically configured to: calculate point-to-point mutual information values of the word segmentation results of the word segmentation processing, and perform first word formation filtering on the word segmentation results by using a first priori knowledge threshold; calculate left entropy values and right entropy values of the word segmentation results filtered by the first word formation filtering, and perform second word formation filtering on the word segmentation results filtered by the first word formation filtering by using a second priori knowledge threshold; input the point-to-point mutual information values, the left entropy values and the right entropy values of the word segmentation results filtered by the second word formation filtering as features of each word segmentation into the pre-trained language representation model, and output target words.

[0067] Optionally, the keyword extraction module 420 is specifically configured to: perform word segmentation processing on the text information; match the word segmentation results of the text information with each word in the pre-constructed dictionary; and extract at least one keyword from the text information according to the matching results.

[0068] Optionally, the first processing module 430 is specifically configured to: input a first feature vector corresponding to the text information into a first neural network of an attention layer of the pre-trained language representation model; and input an output vector of the first neural network and a second feature vector corresponding to each keyword into a second neural network of the attention layer of the pre-trained language representation model.

[0069] Optionally, the second processing module 440 is specifically configured to: input an output vector of the second neural network of the attention layer of the language representation model into a multi-layer perceptron network of the pre-trained language representation model.

[0070] According to the present embodiment, all keywords contained in the text information to be subjected to sentiment analysis can be extracted by using the pre-constructed dictionary. Each keyword can be subjected to fine-grained sentiment analysis by using the pre-trained language representation model, so as to obtain a sentiment classification result of each keyword. The sentiment values of each part of the text information can be deeply mined by using the attention layer and the multi-layer perceptron network of the language representation model, so that the sentiment classification result output by the classifier is more accurate. The technical problems of coarse sentiment analysis granularity and low accuracy of sentiment analysis result in the prior art are solved.

[0071] Embodiment 3

[0072] Figure 5 A fine-grained sentiment analysis device 500 according to the present embodiment is shown, which corresponds to the method according to the first aspect of embodiment 1. Reference is made to Figure 5As shown, the apparatus 500 comprises: a processor 510; and a memory 520 connected with the processor 510, for providing the processor 510 with instructions to process the following processing steps: obtaining text information to be subjected to sentiment analysis; extracting at least one keyword from the text information based on a pre-constructed dictionary; inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; inputting an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword.

[0073] Optionally, before obtaining the text information to be subjected to sentiment analysis, the method comprises: obtaining a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and performing word segmentation processing on the plurality of text data; mining target words from the word segmentation results of the word segmentation processing using a preset new word mining rule; performing association rule analysis on each of the mined target words, and calculating the co-occurrence degree between any two target words; and constructing a dictionary based on each target word whose co-occurrence degree is greater than a preset threshold.

[0074] Optionally, mining target words from the word segmentation results of the word segmentation processing using a preset new word mining rule comprises: calculating the pointwise mutual information value of the word segmentation results of the word segmentation processing, and performing first word formation filtering on the word segmentation results by a first priori knowledge threshold; calculating the left entropy value and the right entropy value of the word segmentation results after the first word formation filtering, and performing second word formation filtering on the word segmentation results after the first word formation filtering by a second priori knowledge threshold; inputting the pointwise mutual information value, the left entropy value and the right entropy value of the word segmentation results after the second word formation filtering as features of each word segmentation into a pre-trained language representation model, and outputting target words.

[0075] Optionally, extracting at least one keyword from the text information based on a pre-constructed dictionary comprises: performing word segmentation processing on the text information; matching the word segmentation results of the text information with each word in the pre-constructed dictionary; and extracting at least one keyword from the text information according to the matching result.

[0076] Optionally, inputting the first feature vector corresponding to the text information and the second feature vector corresponding to each keyword into the attention layer of the pre-trained language representation model comprises: inputting the first feature vector corresponding to the text information into a first neural network of the attention layer of the pre-trained language representation model; and inputting the output vector of the first neural network and the second feature vector corresponding to each keyword into a second neural network of the attention layer of the pre-trained language representation model.

[0077] Optionally, the output vector of the attention layer is input into the multi-layer perception network of the pre-trained language representation model, comprising: inputting the output vector of the second neural network of the attention layer of the language representation model into the multi-layer perception network of the pre-trained language representation model.

[0078] Therefore, according to the embodiment, all keywords contained in the text information to be subjected to sentiment analysis can be extracted through the pre-constructed dictionary. The fine-grained sentiment analysis is performed on each keyword through the pre-trained language representation model to obtain the sentiment classification result of each keyword. The sentiment value of each part of the text information can be deeply mined through the attention layer and the multi-layer perception network of the language representation model, which is more detailed in granularity and makes the sentiment classification result output by the classifier more accurate. The technical problems of coarse granularity of sentiment analysis and low accuracy of sentiment analysis result in the prior art are solved.

[0079] The above embodiment numbers of the application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0080] In the above embodiments of the application, the description of each embodiment has its own emphasis, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0081] In several embodiments provided in the present application, it should be understood that the disclosed technical content can be implemented by other ways. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be through some interface, indirect coupling or communication connection between units or modules, which can be electrical or other forms.

[0082] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment scheme.

[0083] In addition, each functional unit in each embodiment of the application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of software functional unit.

[0084] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present application. The aforementioned storage medium includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0085] The above is only the preferred embodiment of the present application, it should be pointed out that, for those skilled in the art, without departing from the principles of the present application, can make a number of improvements and refinements, these improvements and refinements should also be considered as the protection scope of the present application.

Claims

1. A fine-grained sentiment analysis method characterized by, The method comprises the following steps: obtaining text information to be subjected to sentiment analysis; extracting at least one keyword from the text information based on a pre-constructed dictionary; inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; inputting an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword; Before obtaining the text information to be subjected to sentiment analysis, the method comprises the following steps: obtaining a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and performing word segmentation processing on the plurality of text data; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule; performing association rule analysis on each target word mined, and calculating a co-occurrence degree between any two target words; constructing a dictionary based on each target word whose co-occurrence degree is greater than a preset threshold; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule, which comprises the following steps: calculating a point-to-point mutual information value of the word segmentation results of the word segmentation processing, and performing first word formation filtering on the word segmentation results by using a first priori knowledge threshold; calculating a left entropy value and a right entropy value of the word segmentation results filtered by the first word formation filtering, and performing second word formation filtering on the word segmentation results filtered by the first word formation filtering by using a second priori knowledge threshold; inputting the point-to-point mutual information value, the left entropy value and the right entropy value of the word segmentation results filtered by the second word formation filtering as features of each word segmentation into a pre-trained language representation model, and outputting target words.

2. The method of claim 1, wherein, The method of extracting at least one keyword from the text information based on a pre-constructed dictionary comprises the following steps: performing word segmentation processing on the text information; matching the word segmentation results of the text information with each word in the pre-constructed dictionary; extracting at least one keyword from the text information according to the matching result.

3. The method of claim 1, wherein, The method of inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model comprises the following steps: inputting the first feature vector corresponding to the text information into a first neural network of the attention layer of the pre-trained language representation model; inputting an output vector of the first neural network and the second feature vector corresponding to each keyword into a second neural network of the attention layer of the pre-trained language representation model.

4. The method of claim 3, wherein, The method of inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model comprises the following step:

5. A storage medium, characterized by inputting the output vector of the second neural network of the attention layer of the language representation model into the multi-layer perceptron network of the pre-trained language representation model.

6. A fine-grained sentiment analysis apparatus characterized by, The storage medium comprises a stored program, wherein the program is executed by a processor to perform the method of any one of claims 1 to 4. The method comprises the following steps: an obtaining module, configured to obtain text information to be subjected to sentiment analysis; a keyword extraction module, configured to extract at least one keyword from the text information based on a pre-constructed dictionary; The first processing module is configured to input the first feature vector corresponding to the text information and the second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; The second processing module is configured to input an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; The sentiment classification module is configured to input an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and output a sentiment classification result of each keyword; Before obtaining the text information to be subjected to sentiment analysis, the method comprises: obtaining a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and performing word segmentation processing on the plurality of text data; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule; performing association rule analysis on each of the mined target words, and calculating a co-occurrence degree between any two target words; constructing a dictionary based on each target word whose co-occurrence degree is greater than a preset threshold; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule, comprising: performing point mutual information value calculation on the word segmentation results of the word segmentation processing, and performing first word formation filtering on the word segmentation results by using a first priori knowledge threshold; performing left entropy value and right entropy value calculation on the word segmentation results filtered by the first word formation filtering, and performing second word formation filtering on the word segmentation results filtered by the first word formation filtering by using a second priori knowledge threshold; inputting the point mutual information value, the left entropy value and the right entropy value of the word segmentation results filtered by the second word formation filtering as features of each word segmentation into a pre-trained language representation model, and outputting target words.

7. A fine-grained sentiment analysis apparatus characterized by, comprise: a processor; and a memory connected with the processor, configured to provide the processor with instructions for processing the following processing steps: obtaining text information to be subjected to sentiment analysis; extracting at least one keyword from the text information based on a pre-constructed dictionary; inputting a first feature vector corresponding to the text information and a second feature vector corresponding to each keyword into an attention layer of a pre-trained language representation model; inputting an output vector of the attention layer into a multi-layer perceptron network of the pre-trained language representation model; inputting an output vector of the multi-layer perceptron network into a classifier of the pre-trained language representation model, and outputting a sentiment classification result of each keyword; Before obtaining the text information to be subjected to sentiment analysis, the method comprises: obtaining a plurality of text data belonging to the same field as the text information to be subjected to sentiment analysis, and performing word segmentation processing on the plurality of text data; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule; performing association rule analysis on each of the mined target words, and calculating a co-occurrence degree between any two target words; constructing a dictionary based on each target word whose co-occurrence degree is greater than a preset threshold; mining target words from the word segmentation results of the word segmentation processing by using a preset new word mining rule, comprising: performing point mutual information value calculation on the word segmentation results of the word segmentation processing, and performing first word formation filtering on the word segmentation results by using a first priori knowledge threshold; The left entropy value and the right entropy value of the first word formation filtered word segmentation result are calculated, and the first word formation filtered word segmentation result is second word formation filtered through a second prior knowledge threshold; The point mutual information value, the left entropy value and the right entropy value of the second word formation filtered word segmentation result are input into a pre-trained language representation model as features of each word segmentation, and a target vocabulary is output.

Citation Information

Patent Citations

  • Text sentiment classification method and device, electronic equipment and storage medium

    CN111930940A

  • Method for sentiment classification and sentiment classification model training method and device

    CN113806541A