Opinion extraction method, electronic device, and computer-readable storage medium
By adaptively generating training negative samples, the accuracy of the opinion extraction model is improved and the labeling cost is reduced, solving the problem of low model accuracy caused by insufficient labeled data in existing technologies.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN CLOUD INTEGRAL TECH CO LTD
- Filing Date
- 2023-05-16
- Publication Date
- 2026-05-29
AI Technical Summary
Existing viewpoint extraction methods suffer from limitations in accuracy due to the limited amount of labeled data, and the labeling cost is also high.
By generating extraction results based on the information extraction model, training negative samples for aspect word classification model, sentiment classification model and category and sentiment pairing recognition model are adaptively generated to increase training data to improve the recognition accuracy of the model, or to reduce the number of positive sample training data to save labeling costs.
This improves the recognition accuracy of the opinion extraction device, reduces annotation costs, or reduces the amount of positive training data while maintaining the same accuracy.
Smart Images

Figure CN116501880B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of opinion extraction technology, and more particularly to an opinion extraction method, electronic device, and computer-readable storage medium. Background Technology
[0002] With the rapid development of internet platforms such as social networking and e-commerce, more and more users are sharing their opinions online. A large number of user comments contain opinions and sentiments. Fine-grained opinion mining and sentiment analysis of these comments can yield more valuable information, which is significant for consumers, businesses, and governments. For example, extracting positive or negative feedback from consumers on various aspects of a product (e.g., price, quality, after-sales service, delivery service) from a product review can help businesses better understand consumer attitudes and opinions towards their products or services.
[0003] Currently, commonly used opinion extraction techniques fall into two main categories. (1) Unsupervised learning methods: First, sentences or phrases containing aspect words and opinion words are extracted using part-of-speech tagging, rule or template matching, and then sentiment classification is performed using a sentiment dictionary. This method can extract opinions from texts in specific domains by manually writing rules or templates, thereby quickly finding relevant sentences or phrases. However, this method requires rewriting rules or templates for new text domains, and the design of rules or templates may have a certain degree of subjectivity, resulting in generally poor final results. (2) Supervised learning methods: Supervised learning algorithms, such as convolutional neural networks (CNN), long short-term memory networks (LSTM), sequence-to-sequence models (Seq2Seq), and Transformers, are used to extract aspect words and opinion words from texts, and then the extracted aspect words are classified, the opinion words are sentiment-classified, and the two are paired. This method can automatically learn patterns from training data without manually writing rules or templates. It can adapt to new text domains and only requires retraining the model. Moreover, for some complex text features, it can automatically learn higher-level feature representations and performs relatively well. However, this method requires a large amount of labeled data, and the labeled data needs to be of a certain quality, which is quite labor-intensive and resource-intensive. Moreover, when the amount of labeled data is limited, the accuracy of the model is limited by the amount of labeled data. Summary of the Invention
[0004] To address the technical problem that the accuracy of existing opinion extraction methods is limited by the amount of labeled data, this invention provides an opinion extraction method, an electronic device, and a computer-readable storage medium.
[0005] The technical solution of this invention is implemented as follows:
[0006] This invention provides an opinion extraction method applied to an opinion extraction device. The opinion extraction device includes an information extraction model, an aspect word classification model, a sentiment classification model, and a category and sentiment pairing recognition model. The information extraction model is used to extract aspect words and opinion words from the text to be extracted. The aspect word classification model is used to determine the category of the aspect words. The sentiment classification model is used to determine the sentiment polarity of the opinion words. The category and sentiment pairing recognition model is used to associate the category of the aspect words with the sentiment polarity of the opinion words to determine the opinion information in the text to be extracted. The process includes: obtaining the extraction results of the information extraction model in the opinion extraction device after processing the positive sample training data; generating training negative samples for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the extraction results; training the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the positive sample training data and the generated training negative samples; and processing the text to be extracted using the trained opinion extraction device to obtain opinion information from the text to be extracted.
[0007] In one embodiment, obtaining the extraction result of the information extraction model in the opinion extraction device after processing the positive sample training data includes: preprocessing the positive sample training data to form a preset pattern; and using a training sequence labeling model to extract aspect words and opinion words from the positive sample training data in the preset pattern to obtain the extraction result.
[0008] In one embodiment, generating training negative samples for the aspect word classification model in the opinion extraction device based on the extraction result includes: obtaining aspect words in the extraction result; filtering the labeled parts of the aspect words; and using the filtered aspect words as training negative samples for the aspect word classification model.
[0009] In one embodiment, generating training negative samples for the sentiment classification model in the opinion extraction device based on the extraction results includes: obtaining opinion words from the extraction results; filtering the labeled parts of the opinion words; and using the filtered opinion words as training negative samples for the sentiment classification model.
[0010] In one embodiment, generating training negative samples for the category and sentiment pairing recognition model in the opinion extraction device based on the extraction results includes: obtaining aspect words and opinion words in the extraction results; calculating the Cartesian product based on the aspect words and opinion words to obtain all pairings of the aspect words and opinion words; filtering out the labeled pairings among all pairings; and using the filtered pairings as training negative samples for the category and sentiment pairing recognition model.
[0011] In one embodiment, training the aspect word classification model in the opinion extraction device based on the positive sample training data and the generated training negative samples includes: for single-label classification aspect words, adding another category to the training negative samples and constructing a corresponding one-hot vector; training the aspect word classification model in the opinion extraction device based on the positive sample training data and the constructed one-hot vector; for multi-label classification aspect words, setting the label corresponding to the training negative sample as a 0 vector; and training the aspect word classification model in the opinion extraction device based on the positive sample training data and the set 0 vector.
[0012] In one embodiment, training the sentiment classification model in the opinion extraction device based on the positive sample training data and the generated training negative samples includes: for single-label classified opinion words, adding another category to the training negative samples and constructing a corresponding one-hot vector; training the sentiment classification model in the opinion extraction device based on the positive sample training data and the constructed one-hot vector; for multi-label classified opinion words, setting the label corresponding to the training negative sample as a 0 vector; and training the sentiment classification model in the opinion extraction device based on the positive sample training data and the set 0 vector.
[0013] In one embodiment, the category and sentiment pairing recognition model in the opinion extraction device is trained based on the positive sample training data and the generated training negative samples, including: calculating the Cartesian product based on the category of aspect words and the sentiment polarity of opinion words in the training negative samples; using the Cartesian product as the category of the pairing model to construct a multi-class classification model; and training the category and sentiment pairing recognition model based on the multi-class classification model.
[0014] This invention also provides an electronic device, including: a processor and a memory for storing a computer program capable of running on the processor; wherein, when the processor runs the computer program, it performs the steps of any of the above methods.
[0015] This invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above methods.
[0016] The opinion extraction method, electronic device, and computer-readable storage medium provided in this invention are applied to an opinion extraction device. The opinion extraction device includes an information extraction model, an aspect word classification model, a sentiment classification model, and a category-sentiment pairing recognition model. The information extraction model is used to extract aspect words and opinion words from the text to be extracted. The aspect word classification model is used to determine the category of the aspect words. The sentiment classification model is used to determine the sentiment polarity of the opinion words. The category-sentiment pairing recognition model is used to associate the category of the aspect words with the sentiment polarity of the opinion words to determine the opinion in the text to be extracted. The method includes: obtaining the extraction result of the information extraction model in the opinion extraction device after processing the positive sample training data; generating training negative samples for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the extraction result; training the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the positive sample training data and the generated training negative samples; and processing the text to be extracted using the trained opinion extraction device to obtain opinion information in the text to be extracted. The solution provided by this invention generates training negative samples for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model based on the extraction result of the information extraction model. This increases the training data for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model, thereby improving the recognition accuracy of the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model, and thus improving the recognition accuracy of the opinion extraction device. Alternatively, while ensuring the same accuracy, the amount of positive sample training data can be reduced, saving annotation costs. Attached Figure Description
[0017] Figure 1 This is a flowchart illustrating the viewpoint extraction method according to an embodiment of the present invention;
[0018] Figure 2 This is a schematic diagram of the viewpoint extraction training framework based on negative sampling according to an embodiment of the present invention;
[0019] Figure 3 This is a schematic diagram of the viewpoint extraction process based on negative sampling in an embodiment of the present invention;
[0020] Figure 4 This is an internal structural diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0021] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.
[0022] This invention provides an opinion extraction method applied to an opinion extraction device. The opinion extraction device includes an information extraction model, an aspect word classification model, a sentiment classification model, and a category-sentiment pairing recognition model. The information extraction model is used to extract aspect words and opinion words from the text to be extracted. The aspect word classification model is used to determine the category of the aspect words. The sentiment classification model is used to determine the sentiment polarity of the opinion words. The category-sentiment pairing recognition model is used to associate the category of the aspect words with the sentiment polarity of the opinion words to determine the opinion information in the text to be extracted, such as... Figure 1 As shown, the method includes:
[0023] Step 101: Obtain the extraction result of the information extraction model in the opinion extraction device after processing the positive sample training data;
[0024] Step 102: Based on the extraction results, generate training negative samples for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device;
[0025] Step 103: Train the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the positive sample training data and the generated training negative samples;
[0026] Step 104: Use the trained opinion extraction device to process the text to be extracted and obtain opinion information from the text to be extracted.
[0027] The opinion extraction method in this embodiment is applied to an opinion extraction device, which includes four models: an information extraction model, an aspect word classification model, a sentiment classification model, and a category and sentiment pairing recognition model, which respectively perform the following four sub-tasks. (1) Information extraction model: Extract aspect words describing products or services from the text, such as "price" and "quality"; and opinion words, such as "expensive" and "durable". (2) Aspect word classification model: Classify the extracted aspect words, such as classifying "price", "price range", and "cost-effectiveness" into the same category for business applications. (3) Sentiment classification model: Classify the extracted opinion words into sentiments, that is, classify them into positive, negative, or neutral sentiment polarities, such as "expensive" into negative and "durable" into positive. (4) Category and sentiment pairing recognition model: By associating aspect word categories with opinion sentiments, the specific sentiment polarity of each aspect word category can be inferred, thereby helping enterprises understand the advantages and disadvantages of their own products or services.
[0028] The opinion extraction method proposed in this embodiment mainly generates suitable negative samples based on the analysis results of the first sub-task (i.e., the task performed by the information extraction model) to increase the training data of the subsequent three sub-tasks (i.e., the tasks performed by the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model, respectively). This improves the opinion extraction accuracy of the model obtained through training and enhances the training effect, or reduces the labeled training data for the subsequent three sub-tasks and reduces the labeling cost.
[0029] In one embodiment, obtaining the extraction result of the information extraction model in the opinion extraction device after processing the positive sample training data includes:
[0030] The positive sample training data is preprocessed to form a preset pattern.
[0031] The training sequence labeling model is used to extract aspect words and opinion words from positive sample training data of a preset pattern to obtain the extraction results.
[0032] In this embodiment, the main task of the information extraction model is to extract aspect terms and opinion terms from the positive sample training data. Specifically, this information extraction can be accomplished by training a sequence labeling model.
[0033] Specifically, before using the sequence labeling model for processing, the positive sample training data can be preprocessed first.
[0034] Here, we first assume that the given positive sample training dataset for opinion extraction is D = {(xi, yi)}, where xi is the i-th training data, for example: "It moisturizes very well, but the price is a bit expensive.", and yi is the corresponding four-tuple annotation data <aspect word, category of aspect word, opinion word, sentiment classification of opinion word>, for example <moisturizing, efficacy, very good, positive>, <price, cost, a bit expensive, negative>. It is important to note that each four-tuple annotation data also represents the pairing relationship between "aspect word category" and "sentiment classification".
[0035] First, preprocess the positive sample training data into BIO mode (or similar modes, such as BIOLU, BIOES, etc.), where B represents the beginning, I represents the interior, and O represents other. For example, based on the example above, we can obtain:
[0036] Output Labels BA IA BC IC O O BA IA BC IC IC O Input data Save wet very good , but price grid have point expensive 。
[0037] Alternatively, after applying word segmentation, we can obtain:
[0038] Label BA BC O O BA BC IC O word Moisturizing very good , but price A little expensive 。
[0039] In this tag, the prefix "BIO" indicates the BIO pattern, and the suffixes A and C indicate the aspect word, respectively. In other words, BA indicates the beginning of the aspect word, IA indicates the content within the aspect word, BC indicates the beginning of the opinion word, IC indicates the content within the opinion word, and O indicates other.
[0040] After preprocessing the positive sample training data into BIO mode, aspect terms and opinion terms can be extracted from the positive sample training data using a sequence labeling model. Common supervised learning methods can be employed, such as training Conditional Random Fields (CRF), Long Short-Term Memory Networks (LSTM), Transformers, or transfer learning large language models. Since aspect terms are usually nouns and opinion terms are usually adjectives, existing part-of-speech tagging models can achieve good results. In particular, fine-tuning the large language model using a small number of samples based on transfer learning can achieve very high accuracy rates for aspect term and opinion term extraction, exceeding 98%. Therefore, this embodiment does not generate negative samples during the training process of the information extraction model. Instead, it utilizes the analysis results of the information extraction model to increase the training samples for the subsequent three sub-tasks, thereby improving the opinion extraction accuracy of the model obtained through training and enhancing the training effect, or reducing the labeled training data for the subsequent three sub-tasks and reducing labeling costs. Since opinion extraction is a multi-task learning process, improving the accuracy of the subsequent three sub-tasks can further promote the improvement of the accuracy of the information extraction task.
[0041] In one embodiment, generating training negative samples for the aspect word classification model in the opinion extraction device based on the extraction result includes:
[0042] Obtain the aspect terms from the extraction results;
[0043] Filter out the labeled portions of the aforementioned terms;
[0044] The filtered aspect terms are used as negative training samples for the aspect term classification model.
[0045] In this embodiment, the specific process of generating negative samples for aspect word classification is as follows: Using the extraction results of the information extraction model on the positive sample training data, aspect words are obtained, and the labeled aspect words (positive samples) are filtered out. The remaining aspect words are used as negative samples. For example, for the training data "It's very moisturizing, but the price is a bit expensive.", the information extraction aspect words are assumed to be "moisturizing" and "but". Then, the positive samples already labeled are filtered out, i.e., "moisturizing", and the remaining "but" are used as negative samples. This indicates that the information extraction model cannot correctly distinguish this negative sample at this moment, and it can be used to train the aspect word classification model to improve the recognition ability.
[0046] In one embodiment, generating negative training samples for the sentiment classification model in the opinion extraction device based on the extraction results includes:
[0047] Extract opinion terms from the extraction results;
[0048] Filter out the highlighted parts of the opinion terms;
[0049] The filtered opinion words are used as negative training samples for the sentiment classification model.
[0050] Similarly, in this embodiment, the specific process of generating negative samples for sentiment classification is as follows: Using the extraction results of the information extraction model on the positive sample training data, opinion words are obtained, and the labeled opinion words (positive samples) are filtered out. The remaining opinion words are used as negative samples. For example, for the training data "It's very moisturizing, but the price is a bit expensive.", the extracted opinion words are assumed to be: "very good," "a bit," and "expensive." Then, the positive samples already labeled, i.e., "very good," are filtered out, leaving "a bit" and "expensive" as negative samples. This also reflects that the information extraction model cannot correctly identify these negative samples at this moment, which can be used to train the sentiment classification model for opinion words, improving the recognition ability.
[0051] In one embodiment, generating training negative samples for the category and sentiment pairing recognition model in the opinion extraction device based on the extraction result includes:
[0052] Obtain aspect terms and opinion terms from the extraction results;
[0053] Based on the aspect term and the view term, calculate the Cartesian product to obtain all pairs of the aspect term and the view term;
[0054] Filter all pairs that have been labeled.
[0055] The filtered pairings are used as negative training samples for the category and emotion pairing recognition model.
[0056] In this embodiment, the specific process of generating negative samples for category and sentiment pairing is as follows: The aspect words and opinion words extracted by the information extraction model from the positive sample training data are obtained, and then the Cartesian product is calculated to obtain all pairings. Based on the above example, the pairing results can be: <moisturizing, very good>, <moisturizing, a little>, <moisturizing, expensive>, <but, very good>, <but, a little>, <but, expensive>. Then, the positive samples already labeled, i.e., <moisturizing, very good>, are filtered out, and the remaining 5 pairings are used as negative samples to train the category and sentiment pairing model, improving accuracy.
[0057] In one embodiment, training the aspect word classification model in the opinion extraction device based on the positive sample training data and the generated training negative samples includes:
[0058] For single-label classification of aspect words, a new category is added to the training negative samples, and a corresponding one-hot vector is constructed; the aspect word classification model in the opinion extraction device is trained based on the positive sample training data and the constructed one-hot vector;
[0059] For multi-label classification of aspect words, the label corresponding to the training negative sample is set as a 0 vector; the aspect word classification model in the opinion extraction device is trained based on the positive sample training data and the set 0 vector.
[0060] In this embodiment, a corresponding aspect term classification model can be trained based on the type of aspect term. Specifically, if an aspect term belongs to a single-label classification (i.e., an aspect term can only belong to one category), an additional category is added for negative samples, and a corresponding one-hot vector is constructed. If an aspect term belongs to a multi-label classification (i.e., an aspect term can belong to multiple categories), the label corresponding to the negative sample is a 0 vector. The training process after adding negative samples is the same as before, and various supervised learning models can be selected.
[0061] In one embodiment, training the sentiment classification model in the opinion extraction device based on the positive sample training data and the generated training negative samples includes:
[0062] For single-label categorized opinion words, a new category is added to the training negative samples, and a corresponding one-hot vector is constructed; the sentiment classification model in the opinion extraction device is trained based on the positive sample training data and the constructed one-hot vector;
[0063] For multi-label classification of opinion terms, the label corresponding to the training negative sample is set as a 0 vector; the sentiment classification model in the opinion extraction device is trained based on the positive sample training data and the set 0 vector.
[0064] In this embodiment, a corresponding sentiment classification model can be trained based on the type of opinion word. Specifically, if the opinion word belongs to a single-label classification (i.e., one opinion word can only belong to one category), an additional category is added for negative samples, and a corresponding one-hot vector is constructed. If the opinion word belongs to a multi-label classification (i.e., one opinion word can belong to multiple categories), the label corresponding to the negative sample is a 0 vector. The training process after adding negative samples is the same as before, and various supervised learning models can be selected.
[0065] In one embodiment, training the category and sentiment pairing recognition model in the opinion extraction device based on the positive sample training data and the generated training negative samples includes:
[0066] Calculate the Cartesian product based on the category of aspect words and the sentiment polarity of opinion words in the training negative samples;
[0067] Using the Cartesian product as the category of the pairing model, a multi-class classification model is constructed;
[0068] The category and sentiment matching recognition model is trained based on the multi-class classification model.
[0069] In this embodiment, if the pairing model is a two-class classification (i.e., whether the pairing is correct), the labeled data is used as positive samples, and the negatively sampled data is used as negative samples. If the pairing model needs to consider category, sentiment, and pairing accuracy simultaneously, the Cartesian product of the aspect word category and the sentiment category is calculated and used as the category of the pairing model to construct a multi-class classification model. For example, assuming the aspect word categories are "efficacy" and "cost," and the sentiment categories are "positive" and "negative," their Cartesian products are "efficacy-positive," "efficacy-negative," "cost-positive," and "cost-negative," then the pairing model has a total of 4 categories. Similarly, the training process after adding negative samples is the same as before, and various supervised learning models can be selected.
[0070] As can be seen from the above, in this embodiment, the viewpoint extraction training framework based on negative sampling is as follows: Figure 2 As shown, it is mainly divided into the following parts:
[0071] Part 1: Information Extraction. This includes (1) Preprocessing data; and (2) Training the sequence labeling model.
[0072] Part Two: Negative Sampling. This includes: (1) negative samples for sampling word classification; (2) negative samples for sampling sentiment classification; and (3) negative samples for sampling category and sentiment pairing.
[0073] Part Three: Training the Model Based on Positive and Negative Samples. This includes: (1) training an aspect-based word classification model; (2) training a sentiment classification model; and (3) training a pairing model between categories and sentiments.
[0074] Based on the above training framework diagram, see Figure 3 The negative sampling process in this embodiment is as follows:
[0075] The positive sample training data is processed using an information extraction model to obtain extraction results, including aspect terms and opinion terms. Based on the extraction results, a negative sampling algorithm is used to obtain negative samples for aspect term classification, sentiment classification, and category-sentiment pairing. These negative samples, along with the positive sample training data, are then used to train the aspect term classification model, sentiment classification model, and category-sentiment pairing model, thereby improving the model training performance.
[0076] The negative sampling method in this embodiment, compared with the prior art, mainly includes two important features:
[0077] (1) Adaptiveness: Unlike simple random sampling or frequency-based sampling, where the sample probability distribution is static, the scheme in this embodiment performs negative sampling based on the analysis results of the first subtask (i.e., information extraction), which is closely related to the current input samples and model parameters. Furthermore, as the input samples and model parameters are updated and changed during training, the sample probability distribution behind the negative sampling also changes dynamically, i.e., it has adaptability.
[0078] Informative: Negative samples selected through random sampling or frequency-based sampling typically have low information content, meaning the difference between negative and positive samples is obvious, and current models can already distinguish between the two types of samples well. This embodiment, based on the analysis results of the first subtask (i.e., information extraction), selects negative samples with high information content—those most easily confused with given positive samples—to encourage the model to continue learning to distinguish between the two types of samples, thereby improving the model's recognition ability.
[0079] This embodiment improves the training model's performance by increasing the training data through negative sampling, given a certain amount of labeled training data. Alternatively, while maintaining the same performance, negative sampling can reduce the amount of labeled training data, thus saving labeling costs.
[0080] The opinion extraction method provided in this invention is applied to an opinion extraction device, which includes an information extraction model, an aspect word classification model, a sentiment classification model, and a category and sentiment pairing recognition model. The information extraction model is used to extract aspect words and opinion words from the text to be extracted. The aspect word classification model is used to determine the category of the aspect words. The sentiment classification model is used to determine the sentiment polarity of the opinion words. The category and sentiment pairing recognition model is used to associate the category of the aspect words with the sentiment polarity of the opinion words to determine the opinion information in the text to be extracted. The method includes... The method includes: obtaining the extraction results of the information extraction model in the opinion extraction device after processing the positive sample training data; generating training negative samples for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the extraction results; training the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device based on the positive sample training data and the generated training negative samples; and processing the text to be extracted using the trained opinion extraction device to obtain opinion information in the text to be extracted. The solution provided by this invention generates training negative samples for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model based on the extraction results of the information extraction model. This increases the training data for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model, thereby improving the recognition accuracy of the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model, and thus improving the recognition accuracy of the opinion extraction device. Alternatively, while ensuring the same accuracy, the number of positive sample training data can be reduced, saving annotation costs.
[0081] To implement the method of the embodiments of the present invention, the present invention also provides a computer program product, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the above-described method.
[0082] Based on the hardware implementation of the above-described program model, and in order to implement the method of the embodiments of the present invention, the embodiments of the present invention also provide an electronic device (computer device). Specifically, in one embodiment, the computer device may be a terminal, and its internal structure diagram may be as follows. Figure 4As shown. The computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05, and a memory (not shown) connected via a system bus. The processor A01 provides computing and control capabilities. The memory includes internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 stored in the non-volatile storage medium A06. The network interface A02 is used for communication with external terminals via a network connection. When the computer program is executed by the processor A01, it implements the method of any of the above embodiments. The display screen A04 can be a liquid crystal display or an electronic ink display. The input device A05 can be a touch layer covering the display screen, a button, trackball, or touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0083] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0084] The device provided in the embodiments of the present invention includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it implements the method of any of the above embodiments.
[0085] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0086] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0087] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0088] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0089] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0090] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0091] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0092] It is understood that the memory in the embodiments of the present invention can be volatile memory or non-volatile memory, or both. Specifically, non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable types of memories.
[0093] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0094] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for extracting viewpoints, characterized in that, An opinion extraction device is applied, comprising an information extraction model, an aspect word classification model, a sentiment classification model, and a category-sentiment pairing recognition model; wherein, the information extraction model is used to extract aspect words and opinion words from the text to be extracted; the aspect word classification model is used to determine the category of the aspect words; the sentiment classification model is used to determine the sentiment polarity of the opinion words; and the category-sentiment pairing recognition model is used to associate the category of the aspect words with the sentiment polarity of the opinion words to determine the opinion information in the text to be extracted, the method comprising: Obtain the extraction result of the information extraction model in the opinion extraction device after processing the positive sample training data; Based on the extraction results, training negative samples are generated for the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device; Based on the positive sample training data and the generated training negative samples, the aspect word classification model, the sentiment classification model, and the category and sentiment pairing recognition model in the opinion extraction device are trained. The trained opinion extraction device is used to process the text to be extracted to obtain opinion information from the text. The process of generating training negative samples for the aspect word classification model in the opinion extraction device based on the extraction results includes: Obtain the aspect terms from the extraction results; Filter out the labeled parts of the aforementioned terms; The filtered aspect words are used as negative training samples for the aspect word classification model; The process of generating negative training samples for the sentiment classification model in the opinion extraction device based on the extraction results includes: Extract opinion terms from the extraction results; Filter out the highlighted parts of the opinion terms; The filtered opinion words are used as negative training samples for the sentiment classification model. Specifically, based on the extraction results, generating training negative samples for the category and sentiment pairing recognition model in the opinion extraction device includes: Obtain aspect terms and opinion terms from the extraction results; Based on the aspect term and the view term, calculate the Cartesian product to obtain all pairs of the aspect term and the view term; Filter all pairs that have been labeled. The filtered pairings are used as negative training samples for the category and emotion pairing recognition model.
2. The method according to claim 1, characterized in that, The step of obtaining the extraction result of the information extraction model in the opinion extraction device after processing the positive sample training data includes: The positive sample training data is preprocessed to form a preset pattern. The training sequence labeling model is used to extract aspect words and opinion words from positive sample training data of a preset pattern to obtain the extraction results.
3. The method according to claim 1, characterized in that, The aspect word classification model in the opinion extraction device is trained based on the positive sample training data and the generated training negative samples, including: For single-label classification of aspect words, a new category is added to the training negative samples, and a corresponding one-hot vector is constructed; the aspect word classification model in the opinion extraction device is trained based on the positive sample training data and the constructed one-hot vector; For multi-label classification of aspect words, the label corresponding to the training negative sample is set as a 0 vector; the aspect word classification model in the opinion extraction device is trained based on the positive sample training data and the set 0 vector.
4. The method according to claim 1, characterized in that, The sentiment classification model in the opinion extraction device is trained based on the positive sample training data and the generated negative training samples, including: For single-label categorized opinion words, a new category is added to the training negative samples, and a corresponding one-hot vector is constructed; the sentiment classification model in the opinion extraction device is trained based on the positive sample training data and the constructed one-hot vector; For multi-label classification of opinion terms, the label corresponding to the training negative sample is set as a 0 vector; the sentiment classification model in the opinion extraction device is trained based on the positive sample training data and the set 0 vector.
5. The method according to claim 1, characterized in that, The category and sentiment pairing recognition model in the opinion extraction device is trained based on the positive sample training data and the generated negative training samples, including: Calculate the Cartesian product based on the category of aspect words and the sentiment polarity of opinion words in the training negative samples; Using the Cartesian product as the category of the pairing model, a multi-class classification model is constructed; The category and sentiment matching recognition model is trained based on the multi-class classification model.
6. An electronic device, characterized in that, include: A processor and memory for storing computer programs that can run on the processor; wherein, When the processor is used to run the computer program, it performs the steps of the method according to any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.