A viewpoint machine reading comprehension method and system based on double matching

By adopting double matching and multi-channel attention mechanisms in the machine reading comprehension model, the global context information of the problem and article is obtained, and the problem that the existing model fails to fully capture the global context of the text is improved.

CN114996401BActive Publication Date: 2025-02-14FUZHOU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210610674.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2025-02-14
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

When existing machine reading comprehension models capture the relationship between documents and problems, they fail to fully collect the global context information of the text, resulting in deviations in the model's prediction results.

Method used

Using a dual-match perspective-based machine reading comprehension method, through the dual-match mechanism and the multi-channel attention mechanism, the global and multi-level context information of the problem and article are obtained, and the information is integrated through the gate mechanism to generate the final perspective evidence. express.

Benefits of technology

Through double matching and multi-way attention mechanisms, the model can more comprehensively capture the viewpoint information in the question and article, improving the accuracy of the reading comprehension model's prediction of the answers to the question.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114996401B_ABST
    Figure CN114996401B_ABST
Patent Text Reader

Abstract

The present invention relates to a method and system for machine reading comprehension of opinion based on dual matching. The system includes: a data preprocessing module preprocesses text data, performs operations such as word segmentation and position information calculation on the data, and maps words to semantic space to obtain text representation; a dual matching module calculates the interactive representation of documents and questions using two matching mechanisms, dynamic and multi-dimensional; a multi-way attention module captures global opinion information from different angles through different attention mechanisms, and obtains multi-way attention representation of documents and questions after splicing; a fusion module uses a gated selection mechanism to summarize the global opinion information and context information of documents and questions to obtain a unified opinion evidence representation; a prediction module uses the opinion evidence representation to predict the answer to the question, and selects the option with the highest probability of being correct as the answer to the question. The present invention can better answer questions based on the text content combined with opinion information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of machine reading comprehension, and in particular to a viewpoint-based machine reading comprehension method and system based on dual matching. Background Art

[0002] Machine reading comprehension aims to enable the model to automatically read and understand the content of a document, and then answer the corresponding questions based on the document. On this basis, the opinion-based reading comprehension model can further correctly judge the opinion tendency of the document and give an answer in documents containing subjective opinions. With the rapid development of Web 2.0, social media, and e-commerce platforms, the number of documents containing subjective information is increasing, and opinion-based reading comprehension research has also received more and more attention in academia and industry.

[0003] Machine reading comprehension technology has developed rapidly in recent years. At present, the research on machine reading comprehension can be divided into three categories: (1) Rule- and script-based methods, which train statistical models through supervised learning to obtain the mapping relationship between documents and questions. This type of method requires the definition of research rules and is not very adaptable to more complex sentences; (2) Machine learning-based methods, which use probability- or context-based matching models to integrate dictionary information as features and then integrate them into traditional machine learning classifiers for prediction. This type of method is restricted by the model's own capabilities and has weak recognition of the correlation information between documents and questions; (3) Deep learning-based methods, which use deep learning methods such as recurrent neural networks to extract text sequence features in an end-to-end manner.

[0004] Existing machine reading comprehension models tend to capture the text matching relationship between fragments when learning the relationship between documents and questions. They fail to fully integrate the contextual information of the text as a whole and lack the capture of global semantic information, which in turn leads to deviations in the model's prediction results. Summary of the invention

[0005] The purpose of the present invention is to provide a method and system for opinion-based machine reading comprehension based on dual matching. The dual matching mechanism can interact with questions and articles from both global and multi-level directions to obtain richer contextual information, and is combined with a multi-way attention mechanism to integrate global opinion information, effectively reason about opinion polarity, and cooperate with a gating mechanism to obtain the final global opinion evidence representation, which is used to predict the answer to the question.

[0006] To achieve the above object, the technical solution of the present invention is: a viewpoint-based machine reading comprehension method based on dual matching, comprising:

[0007] The news article corpus is preprocessed and the BERT pre-trained model is used as the encoder to concatenate opinion tendencies, related documents, and query questions and encode them to obtain the corresponding hidden representations.

[0008] Using the dual matching mechanism, the query question and the text information of the relevant documents are interactively matched to extract the global viewpoint information and semantic information at different levels, and finally obtain the question-inspired document representation and document-inspired question representation;

[0009] Using multi-way attention mechanism and parallel multi-way computing, we learn the polarity of opinions in questions and documents from different perspectives, combining questions with articles and articles with questions, and obtain the interactive representation of documents and questions.

[0010] The learned document-question interaction representation is fused using a gating mechanism to obtain the final opinion evidence representation.

[0011] Combined with the option information encoded by BERT, the correct answer to the query question is predicted after passing through the fully connected layer.

[0012] The present invention also provides a viewpoint-based machine reading comprehension system based on dual matching, including a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the method steps described above can be implemented.

[0013] The present invention also provides a computer-readable storage medium, on which computer program instructions that can be executed by a processor are stored. When the processor executes the computer program instructions, the method steps described above can be implemented.

[0014] Compared with the prior art, the present invention has the following beneficial effects: the present invention utilizes a dynamic and multi-dimensional dual matching mechanism and a multi-way attention mechanism to fully explore the potential opinion information and global semantic information in questions and articles, thereby strengthening the two-way matching between question and answer paragraphs, and better improving the accuracy of answering questions by the reading comprehension model. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a principle block diagram of an embodiment of the present invention. DETAILED DESCRIPTION

[0016] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings.

[0017] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present application. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present application belongs.

[0018] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprise" and / or "include" are used in this specification, it indicates the presence of features, steps, operations, devices, components and / or combinations thereof.

[0019] like Figure 1 As shown, this embodiment provides a viewpoint-based machine reading comprehension method based on dual matching, which specifically includes the following steps:

[0020] Step S1: Data preprocessing module, which performs operations such as word segmentation and position information calculation on the data, and maps the query question and related documents into a low-dimensional semantic space to obtain word vectors;

[0021] Step S2: A dual matching module performs bidirectional matching on query questions and related articles. The query questions and related documents are matched dynamically and multi-dimensionally to obtain a high-dimensional representation rich in opinion information and semantic information, and the two representations are fused to obtain a global representation of the question and document.

[0022] Step S3: A multi-way attention module calculates the attention representations of the query question and related documents respectively based on different attention calculation methods, and concatenates the different attention calculation results to obtain a multi-way attention representation;

[0023] Step S4: A fusion module that integrates context information uses a gating mechanism to integrate and summarize the global opinion information of the query question and related documents to obtain a unified opinion information representation;

[0024] Step S5: The opinion prediction module organizes and analyzes the opinion information representation, performs probability statistics on different opinion tendencies, and outputs the opinion tendency with the highest probability.

[0025] In this embodiment, the data preprocessing module performs operations such as word segmentation and location information calculation on the data, and maps the query question and related documents into a low-dimensional semantic space to obtain word vectors. Specifically:

[0026] The input data of the neural network needs to be converted into vectors for end-to-end training, so the text needs to be vectorized. In order to facilitate data processing and analysis, the present invention first preprocesses the text, removes special characters, punctuation marks, and stop words, maps each word to a corresponding ID according to the vocabulary, and then uses the pre-trained model BERT to calculate the vector representation according to the text ID sequence. The calculation formula is as follows:

[0027] [E A ,E Q ,E P =BERTEncoder[A;Q;Pll

[0028] Among them, E A ∈R 3×d ,E Q ∈R n×d ,E P ∈R m×d They correspond to the vector representations of opinion tendency, question, and article respectively, n and m are the number of words in question and document respectively, and d is the dimension of hidden embedding representation;

[0029] In this embodiment, the dual matching module for bidirectional matching of query questions and related articles obtains high-dimensional representations rich in opinion information and semantic information through dynamic matching and multi-dimensional matching of query questions and related documents, and fuses the two representations to obtain a global representation of the question and document. Specifically:

[0030] Use the dynamic matching layer to iteratively update attention, interact with documents and questions, and continuously obtain the opinion information between the two parties, so as to obtain a contextual representation containing global opinion information:

[0031]

[0032]

[0033]

[0034]

[0035]

[0036]

[0037]

[0038]

[0039] The above process obtains the question-inspired article representation. Similarly, the article-inspired question representation can be obtained. [;] means concatenating two vectors, Linear(·) means linear mapping function, LN(·) means layer normalization function, SA(·) means self-attention function, Softmax(·) means activation function. In order to collect the scattered global viewpoint information, this paper iterates the dynamic matching for T layers, and finally obtains the dynamic representation and

[0040] A multi-dimensional matching mechanism is used to calculate the similarity between the question and the related documents, and the context representations at different levels are integrated to extract the global semantic features. Finally, the information is filtered and denoised through a gating mechanism to obtain a multi-dimensional representation. P and O Q :

[0041] M Q =Linear(E Q )

[0042] M P =Linear(E P )

[0043] S=M P (M Q ) T

[0044]

[0045]

[0046]

[0047]

[0048] g P =Linear(C P )

[0049] g Q =Linear(C Q )

[0050] O P =g P M P +(1-g P )C P

[0051] O Q =g Q M Q +(1-g Q )C Q

[0052] where g P and g Q is a coefficient ranging from 0 to 1. Finally, the Attention OverAttention method is used to filter the information twice, and then the global representations q and p of the query question and related documents are obtained by splicing and fusion:

[0053]

[0054]

[0055]

[0056]

[0057]

[0058]

[0059] Where AOA(·) represents the Attention OverAttention method.

[0060] In this embodiment, the multi-way attention module calculates the attention representation of the query question and the related documents respectively based on different attention calculation methods, and splices the different attention calculation results to obtain the multi-way attention representation. Specifically:

[0061] Two different attention functions, Scaled Dot-ProductAttention and MinusAttention, are used to implement the multi-way attention layer, and the parallel multi-head attention mechanism is used to learn the polarity of opinions in questions and articles from different perspectives, combining questions with articles and articles with questions. The calculation formula for ScaledDot-ProductAttention is as follows:

[0062]

[0063] in, i represents the i-th attention head, is a trainable parameter matrix, and the result of concatenating all attention heads is recorded as A S The calculation formula for MinusAttention is as follows:

[0064]

[0065] in, i represents the i-th attention head, is a trainable parameter matrix, and the result of concatenating all attention heads is recorded as A M. Concatenate the results of the two attention mechanisms to get the final attention weight:

[0066] A=[A S ; A M ]

[0067] After bidirectional calculation and maximum pooling operation on A, we get the attention A of the question on the document. Q2P and the document's attention to the problem A P2Q , further enhancing the correlation between the two.

[0068] In this embodiment, the fusion module of the comprehensive context information uses a gating mechanism to integrate and summarize the global opinion information of the query question and related documents to obtain a unified opinion information representation. Q2P and A P2Q Use the gating mechanism to integrate and summarize the information to obtain the final opinion evidence representation r:

[0069] g=σ(A Q2P W Q2P +A P2Q W P2Q )

[0070] r=g*A Q2P +(1-g)*A P2Q

[0071] Where σ represents the Sigmoid activation function, W Q2P , W P2Q is a trainable parameter, and the obtained g∈R d is a gating vector that controls the integration of information in both directions r∈R d .

[0072] In this embodiment, the opinion prediction module organizes and analyzes the opinion information representation, performs probability statistics on different opinion tendencies, and outputs the opinion tendency with the highest probability. Specifically, the opinion tendency of the option is compared and combined with the global opinion information obtained by the model, so that the probability size of each opinion polarity can be obtained:

[0073] c=CS(E A , r)

[0074] S=r*c

[0075]

[0076] Among them, CS(·) represents cosine similarity, and exp(·) represents exponential calculation. The loss function used by the model is the cross entropy function. The prediction accuracy of the model is improved by minimizing the cross entropy loss function. The loss function is defined as follows:

[0077]

[0078] where A′ represents the trainable parameters in the model, is the total number of samples in the training set, j represents the correct opinion tendency of the training sample, P j ,Q j Represents the document and question of the th training sample.

[0079] This embodiment also provides a viewpoint-based machine reading comprehension system based on dual matching, including a memory, a processor, and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the method steps described above can be implemented.

[0080] This embodiment further provides a computer-readable storage medium, on which computer program instructions that can be executed by a processor are stored. When the processor executes the computer program instructions, the method steps described above can be implemented.

[0081] 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 in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0082] 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 process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0083] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.

[0084] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions 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.

[0085] The above is only a preferred embodiment of the present invention, and does not limit the present invention in other forms. Any technician familiar with the profession may use the above disclosed technical content to change or modify it into an equivalent embodiment with equivalent changes. However, any simple modification, equivalent change and modification made to the above embodiment according to the technical essence of the present invention without departing from the technical solution of the present invention still belongs to the protection scope of the technical solution of the present invention.

Claims

1. A viewpoint-based machine reading comprehension method based on dual matching, characterized in that: include: The news article corpus is preprocessed and the BERT pre-trained model is used as the encoder to concatenate opinion tendencies, related documents, and query questions and encode them to obtain the corresponding hidden representations. Using the dual matching mechanism, the query question and the text information of the relevant documents are interactively matched to extract the global viewpoint information and semantic information at different levels, and finally obtain the question-inspired document representation and document-inspired question representation; Using multi-way attention mechanism and parallel multi-way computing, we learn the polarity of opinions in questions and documents from different perspectives, combining questions with articles and articles with questions, and obtain the interactive representation of documents and questions. The learned document-question interaction representation is fused using a gating mechanism to obtain the final opinion evidence representation. Combined with the option information encoded by BERT, the correct answer to the query question is predicted after passing through the fully connected layer; The BERT pre-trained model is used as an encoder to concatenate opinion tendency, document, and question and encode them to obtain the corresponding hidden representation; specifically: The original text data is segmented and stop words are removed. The relevant documents and query questions are mapped to low-dimensional semantic space to obtain word vectors, and the original document representation P = {p1, p2, ..., p m }, the original problem representation Q = {q1, q2, ..., q n }, and opinion tendency A = {a1, a2, a3}, p i and q j Represent the word vector representation of the i-th word and the j-th word in the relevant documents and query questions respectively, i=1, 2, ..., mj=1, 2, ..., n, m, n are the number of words in the relevant documents and query questions respectively, a1, a2, a3 represent the three opinions of yes, no, and uncertainty respectively; P, Q, A are concatenated and input into the BERT encoder for encoding. The specific calculation formula is as follows: [AND A ,AND Q ,AND P =BERTEncoder[A;Q;P]] Among them, E P is the document representation, E Q For the problem expression, E A To express a point of view; The dual matching mechanism is used to interactively match the text information of the question and the document, extract global viewpoint information and semantic information at different levels, and finally obtain question-inspired document representation and document-inspired question representation, specifically: The document representation E after BERT encoding P and the problem representation E Q , calculate the similarity matrix L between them (i) , after row and column normalization, the weight matrix between relevant documents and query questions is obtained; based on the weight matrix, on the one hand, an iterative dynamic matching mechanism is used to extract the opinion information in relevant documents and query questions, and on the other hand, a multi-dimensional matching mechanism is used to fuse context representations at different levels to extract global semantic features; finally, the AOAReader module is used to calculate the question-inspired document representation and document-inspired question representation by combining the dynamic and multi-dimensional dual matching mechanism information; Use the dynamic matching layer to iteratively update attention, interact with documents and questions, continuously obtain the opinion information between the two parties, and obtain a contextual representation containing global opinion information: The above process obtains the question-inspired article representation, and similarly obtains the article-inspired question representation, where [;] means concatenating two vectors, Linear(·) means linear mapping function, LN(·) means layer normalization function, SA(·) means self-attention function, Softmax(·) means activation function; the dynamic matching is iterated for T layers, and finally the dynamic representation is obtained. and A multi-dimensional matching mechanism is used to calculate the similarity between the question and the related documents, and the context representations at different levels are integrated to extract the global semantic features. Finally, the information is filtered and denoised through a gating mechanism to obtain a multi-dimensional representation. P and O Q : M Q =Linear(E Q ) M P =Linear(E P ) S=M P (M Q ) T g P =Linear(C P ) g Q =Linear(C Q ) O P =g P M P +(1-g P )C P 0 Q =g Q M Q +(1-g Q )C Q where g P and g Q is a coefficient ranging from 0 to 1; finally, the Attention Over Attention method is used to filter the information twice, and then the global representations q and p of the query question and related documents are obtained by splicing and fusion: Where AOA(·) represents the Attention Over Attention method; The multi-way attention mechanism is used with parallel multi-way computing to learn the polarity of opinions in questions and documents from different perspectives, combining questions with articles and articles with questions. Specifically: The Scaled Dot-Product Attention and minus attention mechanisms are used to model the relationship between the relevant documents and query question representations obtained through the dual matching mechanism, and obtain the interaction between the question and the document and the document and the question. On this basis, the multi-head attention mechanism is used to obtain the attention weights from different angles, and the most relevant information between the relevant documents and the query question is extracted through the maximum pooling operation; the calculation formula for Scaled Dot-Product Attention is as follows: in, i represents the i-th attention head, is a trainable parameter matrix, and the result of concatenating all attention heads is recorded as A S ; The calculation formula for minus Attention is as follows: in, i represents the i-th attention head, is a trainable parameter matrix, and the result of concatenating all attention heads is recorded as A M ; Concatenate the results of the two attention mechanisms to get the final attention weight: A=[A S ;A M ] After bidirectional calculation and maximum pooling operation on A, we get the attention A of the question on the document. Q2P and the document's attention to the problem A P2Q , further enhancing the correlation between the two; The gating mechanism fuses the learned document-question interaction representation to obtain the final opinion evidence representation, specifically: The query questions and related text representations obtained after calculation by different attention mechanisms are linearly transformed, and the information in the two interactive directions of document to question and question to document is comprehensively considered using the gating mechanism after activation by the sigmoid function, so as to obtain the final opinion evidence representation for answer prediction; specifically, for the bidirectional representation A Q2P and A P2Q Use the gating mechanism to integrate and summarize the information to obtain the final opinion evidence representation r: g=σ(A Q2P W Q2P +A P2Q W P2Q ) r=g*A Q2P +(1-g)*A P2Q Where σ represents the Sigmoid activation function, W Q2P , W P2Q is a trainable parameter, and the obtained g∈R d is a gating vector that controls the integration of information in both directions r∈R d ; The correct answer to the question is predicted by combining the option information encoded by BERT and passing through the fully connected layer, specifically: The cosine similarity is used to calculate the option encoding information, that is, the opinion tendency representation E A The similarity between the final opinion evidence representation and the obtained vector is normalized using the softmax activation function, and the option corresponding to the maximum probability is the answer to the question; specifically, the opinion tendency of the option is compared and combined with the global opinion information obtained by the model to obtain the probability size of each opinion polarity: c=CS(E A ,r) s=r*c Among them, CS(·) represents cosine similarity, exp(·) represents exponential calculation, and the loss function used by the model is the cross entropy function. The prediction accuracy of the model is improved by minimizing the cross entropy loss function. The loss function is defined as follows: Among them, θ represents the trainable parameters in the model, N is the total number of samples in the training set, and A′ j represents the correct opinion tendency of the jth training sample, P j , Q j Represents the document and question of the jth training sample.

2. A viewpoint machine reading comprehension system based on dual matching, characterized in that: The method comprises a memory, a processor and computer program instructions stored in the memory and capable of being executed by the processor. When the processor executes the computer program instructions, the method steps as claimed in claim 1 can be implemented.

Citation Information

Patent Citations

  • Machine reading comprehension answer obtaining method based on multi-round attention mechanism

    CN110083682A

  • Dynamic coattention network for question answering

    US20180129938A1