Opinion extraction method, device and equipment
Through the perspective extraction method based on the pre-trained machine reading comprehension MRC model, the problem is constructed and iteratively generates training data, which solves the problems of poor portability and time-consuming and labor-intensive existing perspective extraction methods, and achieves a more efficient and portable perspective extraction effect .
Patent Information
- Application Number
- CN202110235366.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-03
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-03-03
AI Technical Summary
The existing perspective extraction processing methods are poorly portable and time-consuming.
The perspective extraction method based on pre-trained machine reading comprehension MRC model is adopted to generate training data iteratively by constructing problems, improve model effect, and perform better under small data sets and transfer learning.
It improves the portability and efficiency of the viewpoint extraction method, reduces the dependence on a large number of labeled corpus, and reduces the cost of artificial feature engineering.
Smart Images

Figure CN115033685B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology application technology, and in particular to a viewpoint extraction method, device and equipment. Background Art
[0002] Today, with the Internet everywhere, the amount of information resources on the Internet has increased dramatically. Although the massive amount of information resources has brought us great convenience, it also often confuses us. With the emergence and popularization of online information models where more and more users create and share content, the content and form of online media are becoming increasingly rich, and there are more and more articles and speeches with personal opinions. The content in these texts often reflects the opinions of individual users. Mining these opinions of users has great practical commercial value and is widely used in consumer decision-making, public opinion analysis and other fields. Therefore, how to extract opinions from these texts has become a research hotspot in current Internet intelligent information processing.
[0003] There are two main types of opinion extraction methods at present: one is the semantic rule-based method, and the other is the machine learning and deep learning-based method. Among them, the rule-based method needs to rely on manual extraction of rules, which has poor portability and low recall rate; the machine learning-based method mainly relies on feature engineering, and feature engineering analysis requires a lot of manpower. The deep learning-based method requires a large amount of annotated corpus, but the annotation of large quantities of corpus is time-consuming and labor-intensive. Summary of the invention
[0004] The purpose of the present invention is to provide a method, device and equipment for extracting opinions, so as to solve the problems that the existing opinion extraction processing methods have poor portability and are time-consuming and labor-intensive.
[0005] In order to achieve the above object, the present invention provides a viewpoint extraction method, comprising:
[0006] Get the first text to be extracted;
[0007] Based on a pre-trained machine reading comprehension (MRC) model, extracting opinions from the first text to obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text;
[0008] The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample.
[0009] Before obtaining the first text to be extracted, the method further includes:
[0010] Obtaining the evaluation object, evaluation words, and sentiment polarity categories corresponding to the evaluation object in the text sample;
[0011] Obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words;
[0012] Obtaining a second training data set according to at least one second question constructed from the sentiment polarity category corresponding to the evaluation object;
[0013] Model training is performed based on the first training data set and the second training data set to obtain the MRC model.
[0014] Wherein, obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words includes:
[0015] The evaluation object and the evaluation word are classified according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer;
[0016] Constructing questions for the N first question types respectively to obtain N first questions;
[0017] For each first question, extract the starting position and the ending position of at least one of the evaluation object and the evaluation word corresponding to the first question in the text sample, and use them as the answer to the corresponding first question;
[0018] The generated N training data triples are determined as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
[0019] Among them, the first type of question type constructs questions using the interpretation description method corresponding to the first type of question type.
[0020] The step of obtaining a second training data set according to at least one second question constructed based on the sentiment polarity category corresponding to the evaluation object includes:
[0021] Based on the sentiment polarity category corresponding to the evaluation object, M second-category question types for constructing questions are obtained, where M≥1 and M is a positive integer;
[0022] Constructing questions for the M second question types respectively to obtain M second questions;
[0023] For each second question, an answer corresponding to the second question is preset;
[0024] The generated M training data triples are determined as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
[0025] The method of extracting opinions from the first text based on the pre-trained machine reading comprehension MRC model to obtain target evaluation objects, target evaluation words and target sentiment polarity categories corresponding to the first text includes:
[0026] Inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object;
[0027] Obtaining the target evaluation object and the target evaluation word corresponding to the first text according to the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text;
[0028] According to the category label corresponding to the target evaluation object, a target sentiment polarity category corresponding to the category label is obtained.
[0029] The present invention also provides a viewpoint extraction device, comprising:
[0030] A first acquisition module, used to acquire a first text to be extracted;
[0031] An opinion extraction module, used to extract opinions from the first text based on a pre-trained machine reading comprehension (MRC) model, and obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text;
[0032] The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample.
[0033] The present invention also provides a viewpoint extraction device, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, and the processor is used to perform the following operations:
[0034] Get the first text to be extracted;
[0035] Based on a pre-trained machine reading comprehension (MRC) model, extracting opinions from the first text to obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text;
[0036] The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample.
[0037] Wherein, the processor is further used for:
[0038] Obtaining the evaluation object, evaluation words, and sentiment polarity categories corresponding to the evaluation object in the text sample;
[0039] Obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words;
[0040] Obtaining a second training data set according to at least one second question constructed from the sentiment polarity category corresponding to the evaluation object;
[0041] Model training is performed based on the first training data set and the second training data set to obtain the MRC model.
[0042] Wherein, the processor is further used for:
[0043] The evaluation object and the evaluation word are classified according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer;
[0044] Constructing questions for the N first question types respectively to obtain N first questions;
[0045] For each first question, extract the starting position and the ending position of at least one of the evaluation object and the evaluation word corresponding to the first question in the text sample, and use them as the answer to the corresponding first question;
[0046] The generated N training data triples are determined as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
[0047] Among them, the first type of question type constructs questions using the interpretation description method corresponding to the first type of question type.
[0048] Wherein, the processor is further used for:
[0049] Based on the sentiment polarity category corresponding to the evaluation object, M second-category question types for constructing questions are obtained, where M≥1 and M is a positive integer;
[0050] Constructing questions for the M second question types respectively to obtain M second questions;
[0051] For each second question, an answer corresponding to the second question is preset;
[0052] The generated M training data triples are determined as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
[0053] Wherein, the processor is further used for:
[0054] Inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object;
[0055] Obtaining the target evaluation object and the target evaluation word corresponding to the first text according to the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text;
[0056] According to the category label corresponding to the target evaluation object, a target sentiment polarity category corresponding to the category label is obtained.
[0057] The present invention also provides a viewpoint extraction device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; when the processor executes the program, the viewpoint extraction method described above is implemented.
[0058] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the opinion extraction method as described above.
[0059] The above technical solution of the present invention has at least the following beneficial effects:
[0060] In an embodiment of the present invention, a first text to be extracted is obtained; based on a pre-trained MRC model, opinions are extracted from the first text to obtain target evaluation objects, target evaluation words and target sentiment polarity categories corresponding to the first text; wherein the MRC model is obtained based on a first training data set and a second training data set, the first training data set includes at least one first question constructed by evaluation objects and evaluation words in text samples, answers to at least one first question and text samples, and the second training data set includes at least one second question constructed by sentiment polarity categories corresponding to the evaluation objects, answers to at least one second question and text samples, in this way, by constructing questions, training data can be iteratively generated to achieve the purpose of enhancing data and improving model effects, and the MRC model obtained by constructing questions can perform better under small data sets and transfer learning, and the model is portable. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 A schematic diagram showing a flow chart of a method for extracting opinions according to an embodiment of the present invention;
[0062] Figure 2 A schematic diagram showing the MRC model training process according to an embodiment of the present invention;
[0063] Figure 3 A schematic diagram showing an application example of the MRC model according to an embodiment of the present invention;
[0064] Figure 4 A schematic diagram showing a module of a viewpoint extraction device according to an embodiment of the present invention;
[0065] Figure 5 A schematic diagram showing the structure of a viewpoint extraction device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0066] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0067] The present invention aims to solve the problems that the prior art opinion extraction processing methods have poor portability and are time-consuming and labor-intensive, and provides an opinion extraction method, device and equipment.
[0068] like Figure 1 FIG. 1 is a flow chart of a method for extracting opinions provided by an embodiment of the present invention. The method may include:
[0069] Step 101, obtaining a first text to be extracted;
[0070] In this step, generally, the first text carries the user's personal opinion. The first text can be obtained through a web crawler. Specifically, the first text can be a text taken from a preset opinion output platform, for example, the first text can be a text from a certain network forum, a text taken from a certain user's blog, or a text in a product review area in a certain shopping software, which is not specifically limited here.
[0071] Step 102: extract opinions from the first text based on a pre-trained machine reading comprehension MRC model to obtain target evaluation objects, target evaluation words and target sentiment polarity categories corresponding to the first text; wherein the MRC model is trained based on a first training data set and a second training data set, the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question and the text sample.
[0072] In this step, in one example, the first text is specifically: The interface of this APP is very beautiful. Among them, "interface" is the evaluation object to be extracted, and "beautiful" is the evaluation word to be extracted. At the same time, it is also necessary to determine the user's emotional polarity category for the evaluation object "interface", that is, to determine whether the user's emotional polarity for the evaluation object "interface" is positive, negative or neutral.
[0073] Here, the MRC model used to extract the opinions of the text is obtained by constructing two types of questions for training. By constructing questions, training data can be iteratively generated to achieve the purpose of enhancing data and improving the model effect. Specifically, the MRC model is obtained by training the model through a first data training set generated by a first question constructed for the evaluation object and evaluation words in the text sample, and a second data training set generated by a second question constructed for the sentiment polarity category corresponding to the evaluation object.
[0074] The opinion extraction method of the embodiment of the present invention obtains a first text to be extracted; based on a pre-trained MRC model, extracts opinions from the first text to obtain target evaluation objects, target evaluation words and target sentiment polarity categories corresponding to the first text; wherein the MRC model is obtained based on a first training data set and a second training data set, the first training data set includes at least one first question constructed by evaluation objects and evaluation words in text samples, answers to at least one first question and text samples, and the second training data set includes at least one second question constructed by sentiment polarity categories corresponding to the evaluation objects, answers to at least one second question and text samples, so that by constructing questions, training data can be iteratively generated to achieve the purpose of enhancing data and improving model effects, and the MRC model obtained by constructing questions can perform better under small data sets and transfer learning, and the model is portable.
[0075] As an optional implementation, before step 101, the method of the embodiment of the present invention may further include:
[0076] Obtaining the evaluation object, evaluation words, and sentiment polarity categories corresponding to the evaluation object in the text sample;
[0077] In this step, first, a large amount of text is obtained through data collection. Here, the speech text of users on the Internet can be crawled by a web crawler. After that, the large amount of text obtained is preprocessed to obtain text samples. Here, the preprocessing of the text may include filtering out irrelevant text, segmenting the text, etc. Finally, all the evaluation objects, evaluation words and sentiment polarity classification labels in the text sample are annotated, which can be used as the training data required by the MRC framework.
[0078] Obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words;
[0079] Obtaining a second training data set according to at least one second question constructed from the sentiment polarity category corresponding to the evaluation object;
[0080] Model training is performed based on the first training data set and the second training data set to obtain the MRC model.
[0081] Based on this, as an optional implementation, obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation word may specifically include:
[0082] The evaluation object and the evaluation word are classified according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer;
[0083] Here, optionally, the preset types are evaluation objects, positive evaluation words, negative evaluation words, dynamic evaluation words, and negative words. That is, the evaluation objects are classified into a separate category, and the evaluation words are classified according to the sentiment polarity.
[0084] Constructing questions for the N first question types respectively to obtain N first questions;
[0085] Here, questions can be constructed for different types of first-category questions, and the first question is denoted as Q(y).
[0086] Optionally, the first type of question type constructs questions using a paraphrase description method corresponding to the first type of question type.
[0087] In one example, for each question Q(y) of the first type of question, multiple rounds of question-answering are implemented as follows:
[0088] Question 1: Evaluation object: Which evaluation object is mentioned in the article, such as function, interface, performance, service, content, etc.
[0089] After obtaining the answer A1 to question 1, proceed to questions 2, 3, and 4.
[0090] Question 2: Positive evaluation words: Find the corresponding positive evaluation words for A1, that is, commendatory words, expressing affirmation, pleasure, happiness, and positive emotions towards A1, such as beautiful, efficient, convenient, and beautiful.
[0091] Question 3: Negative sentiment words: Find the corresponding negative evaluation words for A1, that is, derogatory words, expressing negation, sadness, anger, and negative emotions towards A1, such as single, ugly, inefficient, poor, etc.
[0092] Question 4: Dynamic sentiment words: Find the dynamic sentiment words corresponding to A1, that is, words that do not have sentiment polarity when appearing alone, such as high, low, big, small, fast, slow, etc.
[0093] After getting the answers A2, A3, and A4 for questions 2, 3, and 4, proceed to question 5. Question 5 requires asking questions for each sentiment word in A2, A3, and A4 respectively:
[0094] Question 5: Negative words: Find the corresponding negative words for A2 / A3 / A4, that is, words that express antonyms or different opinions, such as not, not, no, non, etc.
[0095] From this, we can see that opinion extraction based on the MRC framework can indirectly increase the amount of data in text samples. Assuming that a text contains n opinions, and each opinion contains an average of m constructible types y, then a text can be expanded n*m times, which is equivalent to data enhancement.
[0096] For each first question, extract the starting position and the ending position of at least one of the evaluation object and the evaluation word corresponding to the first question in the text sample, and use them as the answer to the corresponding first question;
[0097] Here, for example, for question 1 in the above example, the starting position and the ending position of the evaluation object in the text sample are extracted and used as the answer to question 1.
[0098] The generated N training data triples are determined as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
[0099] Here, the training data triplet can be represented as (Q(y), A(y), Paragraph).
[0100] As an optional implementation, obtaining a second training data set according to at least one second question constructed by the sentiment polarity category corresponding to the evaluation object may specifically include:
[0101] Based on the sentiment polarity category corresponding to the evaluation object, M second-category question types for constructing questions are obtained, where M≥1 and M is a positive integer;
[0102] Here, for each sentiment polarity category, the second type of question type is recorded as type c.
[0103] It should be noted that the traditional text classification method treats the category label as a simple subscript. For example, for the text "This movie is really good", the corresponding category label is {1: positive, 0: neutral, -1: negative}. After the model calculates the text, it outputs 1, 0 or -1, representing the classification result. The traditional text classification method ignores the semantics of "positive", "neutral" and "negative", resulting in semantic waste. To solve this problem, the embodiment of the present invention uses the category semantic description as the Question when performing sentiment classification based on the MRC framework. Specifically, the semantic description of the category label (positive, neutral, negative) is used as the Question.
[0104] Constructing questions for the M second question types respectively to obtain M second questions;
[0105] Optionally, the second question type constructs questions using a category semantic description method corresponding to the second question type.
[0106] In other words, the question is constructed using category semantic description, that is, each category (positive, neutral, negative) is semantically described as follows:
[0107] 1) Positive: The affirmative, pleasant, happy, and positive emotions that arise when needs are met. Positive emotions are empowering and can improve people's ability to move.
[0108] 2) Negativity: Negative, sad, angry, and negative emotions that arise when needs are not met. Negative emotions are debilitating and reduce people's ability to move.
[0109] 3) Neutral: without any emotional color, neutral description, unbiased, neither positive nor negative emotion.
[0110] For each second question, an answer corresponding to the second question is preset;
[0111] Here, for each second question Q(c), the answer Answer is designed as a classification result, denoted as A(c). For example, a binary label Binary Label (YES or NO) is used to indicate whether it is the current category.
[0112] The generated M training data triples are determined as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
[0113] Here, the training data triplet can be represented as (Q(c), A(c), Paragraph).
[0114] It should be noted that, in this embodiment, when sentiment classification is performed based on the MRC framework, the category semantic description is used as Question, and the answer Answer is the classification result. Afterwards, together with the original text (here refers to the text sample), a training data triple (Q(c), A(c), Paragraph) is obtained to provide input for subsequent MRC model training and reasoning. For the training of this subtask, the model outputs a probability value, representing the possibility that the current text belongs to this category, and the category with the largest probability value is taken as the classification result Answer, so that the semantic information provided by the category itself can be fully utilized.
[0115] The above implementation divides opinion extraction into two subtasks, including evaluation object and evaluation word extraction, and sentiment polarity classification. For the two subtasks, the question, answer, and original text (here refers to the text sample) required by the MRC framework are constructed to form a triple (Question, Answer, Paragraph). Then the MRC model is constructed and the MRC model is trained using the triple. The overall process can be referred to Figure 2 .
[0116] As an optional implementation, step 102 of the method, based on a pre-trained machine reading comprehension MRC model, extracting opinions from the first text to obtain target evaluation objects, target evaluation words, and target sentiment polarity categories corresponding to the first text may include:
[0117] Inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object;
[0118] Obtaining the target evaluation object and the target evaluation word corresponding to the first text according to the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text;
[0119] According to the category label corresponding to the target evaluation object, a target sentiment polarity category corresponding to the category label is obtained.
[0120] In one example, BERT is used as the main model of MRC to concatenate questions and texts. The BERT model is then used for subsequent evaluation objects, evaluation word extraction, and sentiment classification. Figure 3 shown.
[0121] When inputting the BERT model, add a special symbol [CLS] before the Tok of Question, add a [SEP] after it, and then put the Tok of Paragraph at the end, expressed as {[CLS],q(1),…,q(m),[SEP],p(1),…,p(n)}.
[0122] For the evaluation object and evaluation word extraction tasks, the above-mentioned first type of question type and multi-round question-answering format are adopted. The model outputs the spans corresponding to the evaluation object and evaluation word in the original Paragraph, that is, the starting position and ending position in the text.
[0123] For the sentiment polarity classification task, the second type of question type is used to design questions, that is, the descriptive semantic information of the sentiment polarity category. At the same time, the CLS label output by Bert in the figure is used for classification, and the Binary Label (YES or NO) is output as the classification result.
[0124] The opinion extraction method of the embodiment of the present invention obtains a first text to be extracted; based on a pre-trained MRC model, extracts opinions from the first text to obtain target evaluation objects, target evaluation words and target sentiment polarity categories corresponding to the first text; wherein the MRC model is obtained based on a first training data set and a second training data set, the first training data set includes at least one first question constructed by evaluation objects and evaluation words in text samples, answers to at least one first question and text samples, and the second training data set includes at least one second question constructed by sentiment polarity categories corresponding to the evaluation objects, answers to at least one second question and text samples, so that by constructing questions, training data can be iteratively generated to achieve the purpose of enhancing data and improving model effects, and the MRC model obtained by constructing questions can perform better under small data sets and transfer learning, and the model is portable.
[0125] like Figure 4 As shown, an embodiment of the present invention further provides a viewpoint extraction device, the device comprising:
[0126] A first acquisition module 401 is used to acquire a first text to be extracted;
[0127] The opinion extraction module 402 is used to extract opinions from the first text based on the pre-trained machine reading comprehension MRC model to obtain the target evaluation object, target evaluation word and target sentiment polarity category corresponding to the first text;
[0128] The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample.
[0129] Optionally, the viewpoint extraction device further includes:
[0130] The second acquisition module is used to obtain the evaluation object, evaluation words and sentiment polarity categories corresponding to the evaluation object in the text sample;
[0131] A first processing module, configured to obtain a first training data set according to at least one first question constructed by the evaluation object and the evaluation words;
[0132] A second processing module, configured to obtain a second training data set according to at least one second question constructed by the sentiment polarity category corresponding to the evaluation object;
[0133] A model training module is used to perform model training based on the first training data set and the second training data set to obtain the MRC model.
[0134] Optionally, the first processing module includes:
[0135] A first classification unit is used to classify the evaluation object and the evaluation word according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer;
[0136] A first question construction unit, used to construct questions for the N first question types respectively, to obtain N first questions;
[0137] A first processing unit is used to extract, for each first question, a starting position and an ending position of at least one of an evaluation object and an evaluation word corresponding to the first question in the text sample, and use the starting position and the ending position as an answer to the first question;
[0138] The second processing unit is used to determine the generated N training data triples as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
[0139] Optionally, the first type of question type constructs questions using a paraphrase description method corresponding to the first type of question type.
[0140] Optionally, the second processing module includes:
[0141] The second classification unit is used to obtain M second-category question types for constructing questions based on the sentiment polarity category corresponding to the evaluation object, where M≥1 and M is a positive integer;
[0142] A second question construction unit is used to construct questions for the M second question types respectively to obtain M second questions;
[0143] A third processing unit, configured to preset an answer corresponding to each second question;
[0144] The fourth processing unit is used to determine the generated M training data triples as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
[0145] Optionally, the opinion extraction module 402 includes:
[0146] A viewpoint extraction unit, used for inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object;
[0147] A fifth processing unit, configured to obtain a target evaluation object and a target evaluation word corresponding to the first text according to a starting position and an ending position of the target evaluation object and the target evaluation word corresponding to the first text;
[0148] The sixth processing unit is used to obtain a target sentiment polarity category corresponding to the category label according to the category label corresponding to the target evaluation object.
[0149] The opinion extraction device of the embodiment of the present invention obtains a first text to be extracted; based on a pre-trained MRC model, the opinion is extracted from the first text to obtain a target evaluation object, a target evaluation word and a target sentiment polarity category corresponding to the first text; wherein the MRC model is obtained based on a first training data set and a second training data set, the first training data set includes at least one first question constructed by evaluation objects and evaluation words in text samples, answers to at least one first question and text samples, and the second training data set includes at least one second question constructed by sentiment polarity categories corresponding to the evaluation objects, answers to at least one second question and text samples, so that by constructing questions, training data can be iteratively generated to achieve the purpose of enhancing data and improving model effects, and the MRC model obtained by constructing questions can perform better under small data sets and transfer learning, and the model is portable.
[0150] It should be noted here that the above-mentioned device provided in the embodiment of the present invention can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as the method embodiment in this embodiment will not be described in detail here.
[0151] In order to better achieve the above goals, Figure 5 As shown, an embodiment of the present invention further provides a viewpoint extraction device, including a processor 500 and a transceiver 510, wherein the transceiver 510 receives and sends data under the control of the processor, and the processor 500 is used to perform the following process:
[0152] Get the first text to be extracted;
[0153] Based on a pre-trained machine reading comprehension (MRC) model, extracting opinions from the first text to obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text;
[0154] The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample.
[0155] Optionally, the processor 500 is further configured to:
[0156] Obtaining the evaluation object, evaluation words, and sentiment polarity categories corresponding to the evaluation object in the text sample;
[0157] Obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words;
[0158] Obtaining a second training data set according to at least one second question constructed from the sentiment polarity category corresponding to the evaluation object;
[0159] Model training is performed based on the first training data set and the second training data set to obtain the MRC model.
[0160] Optionally, the processor 500 is further configured to:
[0161] The evaluation object and the evaluation word are classified according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer;
[0162] Constructing questions for the N first question types respectively to obtain N first questions;
[0163] For each first question, extract the starting position and the ending position of at least one of the evaluation object and the evaluation word corresponding to the first question in the text sample, and use them as the answer to the corresponding first question;
[0164] The generated N training data triples are determined as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
[0165] Optionally, the first type of question type constructs questions using a paraphrase description method corresponding to the first type of question type.
[0166] Optionally, the processor 500 is further configured to:
[0167] Based on the sentiment polarity category corresponding to the evaluation object, M second-category question types for constructing questions are obtained, where M≥1 and M is a positive integer;
[0168] Constructing questions for the M second question types respectively to obtain M second questions;
[0169] For each second question, an answer corresponding to the second question is preset;
[0170] The generated M training data triples are determined as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
[0171] Optionally, the processor 500 is further configured to:
[0172] Inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object;
[0173] Obtaining the target evaluation object and the target evaluation word corresponding to the first text according to the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text;
[0174] According to the category label corresponding to the target evaluation object, a target sentiment polarity category corresponding to the category label is obtained.
[0175] The opinion extraction device of the embodiment of the present invention obtains a first text to be extracted; based on a pre-trained MRC model, the opinion is extracted from the first text to obtain a target evaluation object, a target evaluation word and a target sentiment polarity category corresponding to the first text; wherein the MRC model is obtained based on a first training data set and a second training data set, the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to at least one first question and a text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to at least one second question and a text sample, so that by constructing questions, training data can be iteratively generated to achieve the purpose of enhancing data and improving model effects, and the MRC model obtained by constructing questions can perform better under small data sets and transfer learning, and the model is portable.
[0176] An embodiment of the present invention also provides a point of view extraction device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the various processes in the above-mentioned point of view extraction method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they will not be described here.
[0177] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, each process in the above-mentioned viewpoint extraction method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not described here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0178] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0179] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A device that specifies functions in one or more processes and / or one or more blocks.
[0180] 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 work in a specific manner, so that the instructions stored in the computer-readable storage medium produce a paper product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0181] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that the computer or other programmable device executes a series of operating steps to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0182] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for extracting opinions, characterized in that: include: Get the first text to be extracted; Based on a pre-trained machine reading comprehension (MRC) model, extracting opinions from the first text to obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text; The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample; The pre-trained machine reading comprehension MRC model is used to extract opinions from the first text to obtain target evaluation objects, target evaluation words, and target sentiment polarity categories corresponding to the first text, including: Inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object; Obtaining the target evaluation object and the target evaluation word corresponding to the first text according to the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text; According to the category label corresponding to the target evaluation object, a target sentiment polarity category corresponding to the category label is obtained.
2. The method according to claim 1, characterized in that Before obtaining the first text to be extracted, the method further includes: Obtaining the evaluation object, evaluation words, and sentiment polarity categories corresponding to the evaluation object in the text sample; Obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words; Obtaining a second training data set according to at least one second question constructed from the sentiment polarity category corresponding to the evaluation object; Model training is performed based on the first training data set and the second training data set to obtain the MRC model.
3. The method according to claim 2, characterized in that The step of obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words includes: The evaluation object and the evaluation word are classified according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer; Constructing questions for the N first question types respectively to obtain N first questions; For each first question, extract the starting position and the ending position of at least one of the evaluation object and the evaluation word corresponding to the first question in the text sample, and use them as the answer to the corresponding first question; The generated N training data triples are determined as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
4. The method according to claim 3, characterized in that The first type of question type constructs questions using a paraphrase description method corresponding to the first type of question type.
5. The method according to claim 2, characterized in that: The step of obtaining a second training data set according to at least one second question constructed based on the sentiment polarity category corresponding to the evaluation object includes: Based on the sentiment polarity category corresponding to the evaluation object, M second-category question types for constructing questions are obtained, where M≥1 and M is a positive integer; Constructing questions for the M second question types respectively to obtain M second questions; For each second question, an answer corresponding to the second question is preset; The generated M training data triples are determined as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
6. A viewpoint extraction device, characterized in that: include: A first acquisition module, used to acquire a first text to be extracted; An opinion extraction module, used to extract opinions from the first text based on a pre-trained machine reading comprehension MRC model, to obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text; The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample; The opinion extraction module comprises: A viewpoint extraction unit, configured to input the first text into the MRC model, obtain the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object; A fifth processing unit, configured to obtain a target evaluation object and a target evaluation word corresponding to the first text according to a starting position and an ending position of the target evaluation object and the target evaluation word corresponding to the first text; The sixth processing unit is used to obtain a target sentiment polarity category corresponding to the category label according to the category label corresponding to the target evaluation object.
7. A viewpoint extraction device, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, characterized in that: The processor is configured to perform the following operations: Get the first text to be extracted; Based on a pre-trained machine reading comprehension (MRC) model, extracting opinions from the first text to obtain a target evaluation object, a target evaluation word, and a target sentiment polarity category corresponding to the first text; The MRC model is trained based on a first training data set and a second training data set, wherein the first training data set includes at least one first question constructed by evaluation objects and evaluation words in a text sample, an answer to the at least one first question, and the text sample, and the second training data set includes at least one second question constructed by a sentiment polarity category corresponding to the evaluation object, an answer to the at least one second question, and the text sample; The processor is further configured to: Inputting the first text into the MRC model, obtaining the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text, and the category label corresponding to the target evaluation object; Obtaining the target evaluation object and the target evaluation word corresponding to the first text according to the starting position and the ending position of the target evaluation object and the target evaluation word corresponding to the first text; According to the category label corresponding to the target evaluation object, a target sentiment polarity category corresponding to the category label is obtained.
8. The viewpoint extraction device according to claim 7, characterized in that: The processor is further configured to: Obtaining the evaluation object, evaluation words, and sentiment polarity categories corresponding to the evaluation object in the text sample; Obtaining a first training data set according to at least one first question constructed by the evaluation object and the evaluation words; Obtaining a second training data set according to at least one second question constructed from the sentiment polarity category corresponding to the evaluation object; Model training is performed based on the first training data set and the second training data set to obtain the MRC model.
9. The viewpoint extraction device according to claim 8, characterized in that: The processor is further configured to: The evaluation object and the evaluation word are classified according to preset types to obtain N first-category question types for constructing questions, where N≥1 and N is a positive integer; Constructing questions for the N first question types respectively to obtain N first questions; For each first question, extract the starting position and the ending position of at least one of the evaluation object and the evaluation word corresponding to the first question in the text sample, and use them as the answer to the corresponding first question; The generated N training data triples are determined as the first training data set, wherein each training data triplet includes a first question, an answer corresponding to the first question, and the text sample.
10. The viewpoint extraction device according to claim 9, characterized in that: The first type of question type constructs questions using a paraphrase description method corresponding to the first type of question type.
11. The viewpoint extraction device according to claim 8, characterized in that: The processor is further configured to: Based on the sentiment polarity category corresponding to the evaluation object, M second-category question types for constructing questions are obtained, where M≥1 and M is a positive integer; Constructing questions for the M second question types respectively to obtain M second questions; For each second question, an answer corresponding to the second question is preset; The generated M training data triples are determined as the second training data set, wherein each training data triplet includes a second question, an answer corresponding to the second question, and the text sample.
12. A viewpoint extraction device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; characterized in that: When the processor executes the program, the opinion extraction method according to any one of claims 1 to 5 is implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the opinion extraction method as described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Viewpoint mining method, device and device
CN109299457A
Data processing method and device based on artificial intelligence and electronic equipment
CN111813961A