A problem generation method and device for fusing multiple information

By integrating information from the sentence containing the answer, linguistic features, and question type, this method addresses the semantic deviation problem in existing question generation models, achieving more efficient context relevance and accuracy.

CN116882393BActive Publication Date: 2026-03-31ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-16
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing question generation methods struggle to effectively utilize linguistic features, resulting in semantic deviations from the given context and answer. Furthermore, different types of questions are difficult to generate accurately in terms of semantics and grammar.

Method used

A sequence-to-sequence question generation method based on gating attention fusion is adopted. It combines a pre-trained language model and a CRF layer to fuse information such as the sentence containing the answer, linguistic features, and question type. The answer is encoded through a bidirectional LSTM network and decoded by combining an attention mechanism and a maximum output pointer mechanism.

Benefits of technology

It improves the relevance and accuracy of the question generation model, making the generated questions more relevant to the given context and answers, making deeper use of linguistic feature information, and making question type prediction more accurate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116882393B_ABST
    Figure CN116882393B_ABST
Patent Text Reader

Abstract

The application discloses a kind of problem generation method and device of fusion multi-information, first separately encode paragraph context and the sentence where answer is located, and based on the information of gate attention effectively fusing paragraph context and the sentence where answer is located, generate more relevant question with context and answer.The application is trained recognition network for the task of named entity recognition and the task of part-of-speech tagging, obtains the representation of linguistic feature information and applies to encoder, to help question generation model more effectively utilize linguistic feature information.The method of the application realizes question type prediction by combining answer entity category information in pre-training language model, and applies the predicted question type information to the decoding stage, so that the question type of the generated question is more accurate.The method of the application alleviates the situation that the question generated by the existing method is not highly relevant to the given context and answer, more effectively utilizes the key information in context and deep connection, so as to better generate questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text generation in natural language processing and pre-trained language models, specifically a question generation method that integrates multiple information. Background Technology

[0002] Natural language generation (NLP) is a research area within natural language processing (NLP), aiming to generate natural language text to meet specific communication goals. The generated text can range from a single phrase for answering a question, to a sentence, to a dialogue with multiple turn-based questions and answers, and even a long text explanation. Question generation is a particularly challenging task within NLP, focusing on automatically generating questions from various inputs, such as raw text, databases, or semantic representations. Research on question generation can drive other research in NLP, for example, by enriching training samples through the generation of high-quality questions, thus alleviating the data scarcity problem in scenarios such as automated question answering and dialogue systems. Furthermore, question generation has practical significance for applications in education and healthcare.

[0003] In recent years, neural network-based question generation methods have attracted increasing attention. Most of these methods employ attention-based sequence-to-sequence models, taking paragraph-level context and the answer as input and outputting the question. However, existing question generation methods still face several challenges. For example, semantic drift is unavoidable in the generated results, meaning the generated question's semantics deviate from the given context and answer. Furthermore, existing methods often improve performance by embedding linguistic features, such as named entity recognition and part-of-speech tagging, into the input vector on top of the answer encoding. However, current methods utilizing linguistic features only scratch the surface, failing to capture the dynamic meaning of the tags and fully leveraging the information provided by these features. Moreover, different types of questions differ semantically and grammatically; predicting and generating accurate interrogative words can also contribute to better question generation. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of existing question generation methods, making the generated questions more relevant to the given context and answer. This is achieved by integrating three main aspects of information: First, information about the sentence containing the answer. A sequence-to-sequence question generation method based on gated attention is proposed, focusing more on the information within the sentence containing the answer. Second, linguistic feature information. A linguistic feature information representation method based on a pre-trained language model and CRF is proposed, and this representation is integrated into the question generation model's encoding to utilize linguistic feature information more deeply. Third, question type information. A question type prediction method combining answer entity category information is proposed, making the generated question type more accurate.

[0005] To achieve the above objectives, the present invention adopts the following technical solution: In a second aspect, the present invention provides a method for generating questions by integrating multiple pieces of information, the method comprising the following steps:

[0006] 1) Data Processing: The question generation dataset was acquired and processed, including case conversion, answer location annotation, extraction of the sentence containing the answer, question type extraction, and named entity recognition and part-of-speech tagging for all text. Named entity recognition and part-of-speech tagging datasets were constructed, with BIO annotation used for answer location annotation and named entity annotation. A question type prediction dataset was constructed based on paragraph context, answer entity category, and question type, including eight question types: "what," "who," "how," "when," "which," "where," "why," and "others."

[0007] 2) Acquisition of Linguistic Feature Information and Question Type Information: A linguistic feature representation model is constructed, consisting of a pre-trained language model and a final CRF layer. The pre-trained language model is used to obtain the encoded representation of the input text, and the CRF is used to predict the labels. The linguistic feature representation model is trained on the named entity recognition task and the part-of-speech tag recognition task using the named entity recognition dataset and the part-of-speech tag recognition dataset obtained in step 1), respectively, to obtain the linguistic feature representation models corresponding to named entity recognition and part-of-speech tag recognition. After training, the hidden state of the trained linguistic feature representation model is used as the linguistic feature information representation of named entities or part-of-speech tags. A question type prediction model based on the pre-trained language model is constructed. The input of this prediction model is the paragraph context and the answer entity category information, and the output is the eight question types in step 1).

[0008] 3) Encoding that integrates the information of the sentence containing the answer and linguistic features: The question generation model is an encoder-decoder architecture. This step is the encoding stage of the model, and the encoder uses a bidirectional LSTM. The input of the encoding stage includes three parts: paragraph-level context Q, answer X, and the sentence containing the answer T. First, the word embedding representation of each word in the paragraph is obtained. Then, the word embedding representation, the answer position encoding obtained in step 1), and the linguistic feature representation obtained in step 2) are concatenated to obtain the final word representation. After that, the bidirectional LSTM is used to encode the paragraph context containing the word representation and the sentence containing the answer, respectively, to obtain the paragraph-level hidden representation and the hidden representation of the sentence containing the answer. The paragraph-level hidden representation and the hidden representation of the sentence containing the answer are fused based on the gating attention mechanism. Specifically, first, the attention matching representation is calculated based on the paragraph-level hidden representation and the encoded sentence representation of the answer. Then, the paragraph-level hidden representation is combined with the attention matching representation to form a new attention matching enhanced representation. Finally, the information between the original paragraph hidden representation and the new attention matching enhanced representation is selected through a learnable gating vector to obtain the final paragraph encoding representation.

[0009] 4) Question Generation Model Decoding: This step is the decoding stage of the question generation model. The decoder uses LSTM. Based on the paragraph encoding representation obtained in step 3) and the words previously generated in each decoding step, questions are generated by combining attention mechanism and maximum output pointer mechanism. When generating the first word, the question type prediction model obtained in step 2) is used to calculate the question type. If the predicted question type is "others", it does not affect the decoding process of this step. If it is one of the other seven types, the question type is used as the first generated word.

[0010] 5) Generate questions related to the context and answer: Given a new paragraph-level context and answer, perform the data processing in step 1). Obtain linguistic feature information through a trained linguistic feature representation model and obtain question category information through a trained question type prediction model. Then, input the paragraph context, answer, sentence containing the answer, linguistic feature information representation and question type into the question generation model trained in steps 3) and 4) to finally generate questions related to the context and answer.

[0011] Furthermore, the question generation dataset is the SQuAD1.1 question generation dataset, and natural language processing tools are used to process the SQuAD1.1 question generation dataset. The acquisition of linguistic feature information specifically involves:

[0012] The linguistic feature representation model is trained using a pre-training and fine-tuning approach, employing DistilBERT+CRF. Fine-tuning is performed on two tasks: named entity recognition and part-of-speech tagging. The fine-tuning process involves using a pre-trained DistilBERT model to continue training on the task datasets for both tasks with a small learning rate, adjusting some model parameters. The datasets used are a named entity recognition dataset constructed using BIO annotation and a part-of-speech tagging dataset extracted using natural language processing tools. During training, text input is converted into an encoded representation in the pre-trained language model, and the CRF layer predicts named entity or part-of-speech tags from this encoding. Learning rates are set for both DistilBERT and CRF, and training is conducted for 5 epochs on the datasets. The best-performing named entity recognition and part-of-speech tagging representation models from the test set are retained. In the question generation model encoding stage, the outputs of the DistilBERT parts of the two linguistic representation models are extracted as information representations of named entity recognition or part-of-speech tag features and concatenated into the word embedding representation.

[0013] Furthermore, the acquisition of the problem type information specifically involves:

[0014] The question type prediction model is trained using a pre-training and fine-tuning approach, employing BERT. Fine-tuning is then performed on the question type prediction task. This fine-tuning involves continuing to train the pre-trained BERT model on the task dataset with a smaller learning rate, adjusting some model parameters. The dataset used is a question type prediction dataset consisting of a paragraph context-answer entity category-question type triplet. The model's input includes paragraph context and answer entity category information, and the output is the question type, which includes eight types: "what," "who," "how," "when," "which," "where," "why," and "others." During the decoding phase of the question generation model, the output of the question prediction model serves as the question type for generating the question.

[0015] Furthermore, the encoding that integrates the sentence information containing the answer and the linguistic feature information specifically involves:

[0016] In the question generation dataset, the answer location is labeled using the BIO tagging system, and the sentence containing the answer is extracted separately to construct a paragraph-answer-answer-answer sentence-question quadruple. The input to the question generation model is the paragraph-level context. Answer

[0017] and the sentence containing the answer Where M is the paragraph length, L is the answer text length, and N is the sentence length containing the answer.

[0018] Word vector acquisition: Obtain the word embedding representation w of each word in the paragraph using GloVe. i , where w i Let m be the word embedding representation of the i-th word; by processing the answer position annotation, we obtain the 3D answer position encoding m. i , where m i This represents the answer position encoding for the i-th word; the paragraph text is input into the linguistic feature representation model for named entity recognition and the linguistic feature representation model for part-of-speech tagging, and the output of the DistilBERT part is extracted as the named entity recognition feature n. i and part-of-speech tag features p i Information representation, where n i and p i Let $\mathbf{i}$ represent the named entity recognition feature and part-of-speech tag feature of the $i$-th word, respectively. Concatenating these vectors yields the final word representation $e$. i =[w i m i ;n i ;p i ], where e i This represents the word representation of the i-th word; after obtaining the final word representation, a two-layer bidirectional LSTM network is used to encode the paragraph; for the u-th word in the paragraph, the hidden states in both directions are... and The concatenation of these elements forms the hidden representation of the word; thus, the paragraph-level hidden representation H is obtained through this bidirectional LSTM network. q :

[0019]

[0020]

[0021]

[0022]

[0023] in and Let u be the hidden state of the u-th word in the paragraph in both directions of the LSTM. Let u be the word representation of the u-th word in the paragraph. H is the hidden representation of the u-th word in the paragraph. q M is the hidden representation of the paragraph, and M is the paragraph length.

[0024] The encoding of the sentence containing the answer follows the same operation as paragraph-level encoding, using a bidirectional LSTM network for encoding after obtaining the final word representation; for the j-th word in the sentence containing the answer, the hidden states in both directions are... and The parts are pieced together to form the hidden representation of the word; finally, the hidden representation H of the sentence containing the answer is obtained. t :

[0025]

[0026]

[0027]

[0028]

[0029] in and Let j be the hidden state of the j-th word in the sentence containing the answer in both directions of the LSTM. Let j be the word representation of the j-th word in the sentence containing the answer. H is the hidden representation of the j-th word in the sentence containing the answer. t This represents the hidden representation of the sentence containing the answer, where N is the length of the sentence containing the answer.

[0030] After obtaining the hidden representations of the paragraph and the sentence containing the answer respectively, the two are fused based on a gated attention mechanism; firstly, a matching representation is calculated based on the paragraph-level hidden representation and the encoded sentence containing the answer:

[0031]

[0032]

[0033] Where H q This is a paragraph-level hidden representation. W is the hidden representation of the k-th word in the sentence containing the answer. s It is a trainable weight matrix, s k It is an attention matching representation, which is a weighted sum of the encoding representations of the words in the sentence containing the answer to the corresponding words in the paragraph.

[0034] Then, the paragraph representation is combined with the attention-matching representation to form a new attention-matching enhanced representation; then, through a learnable gating vector, the information between the original paragraph representation and the new attention-matching enhanced representation is selected to obtain the final encoded paragraph representation.

[0035]

[0036]

[0037]

[0038]

[0039] in W is the hidden representation of the l-th word in the paragraph. f It is a trainable weight matrix, f l For the new attention-matched enhanced representation, g l W is a learnable gated vector. g It is a trainable weight matrix, where ⊙ represents the product of corresponding elements of the two matrices. This represents the final representation of the l-th word in the paragraph. M represents the final encoded paragraph, where M is the paragraph length.

[0040] Secondly, the present invention also provides a problem generation apparatus that integrates multiple information, including a memory and one or more processors, wherein the memory stores executable code, and when the processor executes the executable code, it implements the aforementioned problem generation method that integrates multiple information.

[0041] Thirdly, the present invention also provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the aforementioned method for generating a problem that integrates multiple information.

[0042] Compared with the prior art, the advantages of this invention are:

[0043] (1) In addition to utilizing paragraph-level contextual information, it also incorporates information from the sentence containing the answer, enabling the question generation model to pay more attention to the sentence containing the answer when generating questions, and making the generated questions more relevant to the given context and answer.

[0044] (2) In utilizing linguistic feature information, a complex pre-trained model is introduced to mine deeper information from linguistic features. This representation of linguistic features can carry more information, alleviating the shortcomings of traditional methods in terms of information expression ability, thereby helping to improve the performance of the problem generation model.

[0045] (3) By combining answer entity category information in the question type prediction, the question type can be predicted more accurately, thus making the generated questions more reasonable. Attached Figure Description

[0046] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0047] Figure 1 Flowchart for a problem generation method that integrates multiple pieces of information;

[0048] Figure 2 A diagram representing a linguistic feature representation model;

[0049] Figure 3 This is a prediction model for problem types.

[0050] Figure 4 This is a structural diagram of a problem generation device that integrates multiple information according to the present invention. Detailed Implementation

[0051] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0052] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0053] like Figure 1 As shown, the present invention proposes a problem generation method that integrates multiple information, such as... Figure 1 As shown, it mainly includes five stages: data processing, acquisition of linguistic feature information and question type information, encoding that integrates the information of the sentence containing the answer and linguistic feature information, decoding of the question generation model, and testing of the question generation model.

[0054] Data processing is used to obtain the data required for training the entire question generation model. Preprocessing of the original dataset involves case conversion, answer position annotation, extraction of the sentence containing the answer, and question type extraction using a natural language processing toolkit. Then, named entity recognition and part-of-speech tagging datasets are constructed from all texts for training the linguistic feature representation model. Furthermore, a question type prediction dataset is constructed using paragraph context, answer entity categories, and question types for training the question type prediction model. The feature representation model in linguistic feature information acquisition includes... Figure 2As shown, a network using a pre-trained language model and a CRF (Content Rendering Function) is employed. The pre-trained model takes sentence text as input to obtain an encoded representation of the input text. This encoded representation is then fed into the CRF layer to obtain the predicted tags for named entity recognition or part-of-speech tagging. Finally, the hidden representation of the pre-trained model is used as the representation of linguistic feature information. The question type prediction model for question type information acquisition is as follows... Figure 3 As shown, a pre-trained model is used, taking paragraph context and answer entity type as input and outputting question category. The encoding, which integrates the information of the sentence containing the answer and linguistic features, first takes the paragraph-level context, the answer, and the sentence containing the answer as input to obtain word embeddings. Then, the linguistic feature representations are concatenated into the word embeddings. A bidirectional LSTM is used to obtain the paragraph-level hidden representation and the hidden representation of the sentence containing the answer, respectively. A gated attention mechanism is used to fuse the hidden representations of the paragraph and the sentence containing the answer. The question generation model decodes based on the encoded representations and the words previously generated in each decoding step, generating questions by combining attention and maximum output pointer mechanisms. When generating the first word, the method of generating the word is determined based on the question type information. The question generation model tests by processing new paragraph-level context and answer data. Linguistic feature information is obtained through a pre-trained linguistic feature representation model, and question type information is obtained through a question type prediction model. The paragraph context, answer, sentence containing the answer, linguistic feature representations, and question type are then input into the pre-trained question generation model to finally generate a question related to that context and answer.

[0055] In a specific embodiment of the present invention, the above process is used to generate questions, and the specific steps are as follows:

[0056] Step 1: Data Processing. Taking the SQuAD1.1 dataset as an example, each sample in this dataset is a paragraph-answer-question triple, where the answer is a text segment extracted from the paragraph. The dataset is processed using the natural language processing tool spaCy. spaCy can extract named entity recognition labels and part-of-speech tags from the original dataset, and separately extract the sentence containing the answer to construct a paragraph-answer-answer-question quadruple. Using the BIO tagging system, the labeled sequence of the answer position and named entity is obtained, where label B represents the beginning of the answer or named entity, label I represents the middle part of the answer or named entity, and label O represents the part that does not constitute the answer or named entity. The part-of-speech tags are directly used for labeling. Thus, the named entity recognition dataset and the part-of-speech tag recognition dataset are obtained. In addition, the question type is extracted separately and combined with the answer entity type extracted by spaCy to construct a paragraph-answer entity type-question type triple, resulting in a question type prediction dataset.

[0057] For example, in the SQuAD1.1 dataset, there's a paragraph-answer-question data set. The paragraph reads: "In his book, *Humanism* (1997), Tony Davies calls these critics 'humanist anti-humanists'. Critics of antihumanism, most notably J.F. Habermas, counter that while antihumanists may highlight humanism's failure to fulfill its emancipatory ideal, they do not offer an alternative emancipatory project of their own…", the answer is "Tony Davies", and the question is: "who wrote the book *Humanism*?". Another example is a set of question type prediction triples, where the paragraph is the same as above, the answer entity type is "PROPN PROPN" (a proper noun), and the question type is "who". Yet another example is a set of named entity recognition data, where the text is "the widow of McDonald's owner Ray Kroc", and the corresponding named entity recognition annotation is "OOO B-ORG OO B-PERSON I-PERSON". For example, consider a set of part-of-speech tagging data where the text is “The standard home video LaserDisc was 30cm”, and the corresponding part-of-speech tag is “DET ADJ NOUN NOUN NOUN AUX NUM NOUN”.

[0058] Step 2: Obtaining Linguistic Feature Information and Question Type Information. Both the named entity recognition (NENT) and part-of-speech (POS) recognition models are implemented using DistilBERT+CRF. The DistilBERT model can use the uncased version of the DistilBERT base model provided by HuggingFace, which is case-insensitive. The model is fine-tuned for both NENT and POS recognition tasks, using the NENT and POS recognition datasets constructed in Step 1. During training, text input is converted into an encoded representation by DistilBERT, and CRF predicts entity or POS tags from this encoding. Learning rates are set for both DistilBERT and CRF, and training is performed for 5 epochs on the dataset. The annotation results are evaluated using the seqeval library. Finally, the best-performing NENT and POS recognition models on the test set are retained. The question type prediction model is implemented using BERT, specifically the uncased version of the BERT base model provided by HuggingFace, and is trained on the question type prediction task. Train the model on the question type prediction dataset constructed in step one. The input format is "[CLS]……Tony[PROPN]Davies[PROPN]calls these critics……[SEP]" (the entity category is labeled in the answer text, and the ellipsis indicates the omitted part before or after the text). The output is the question type. Train for 5 rounds and retain the question type prediction model with the highest accuracy in predicting question types.

[0059] Step 3: Encoding the sentence containing the answer and linguistic features. The encoder of the question generation model is a bidirectional LSTM. The input of the question generation model includes three parts: paragraph-level context... Answer and the sentence containing the answer Where M is the paragraph length, L is the answer text length, and N is the sentence length containing the answer. The first step is word vector acquisition, using GloVe to obtain the word embedding representation w of each word in the paragraph. i , where w i Let m be the word embedding representation of the i-th word. Then, based on the answer position annotation from step one, we obtain the 3D answer position encoding m. i The text is input into the named entity recognition representation model and the part-of-speech tag recognition representation model in step two, and the output of the DistilBERT part is extracted as the named entity recognition feature n. i and part-of-speech tag features p i Information representation, where m i n i and p iLet $e$ represent the answer position encoding, named entity recognition feature, and part-of-speech tag feature of the $i$-th word, respectively. Concatenating these three feature vectors yields the final word representation $e$. i =[w i m i ;n i ;p i ], where e i This represents the word representation of the i-th word. After obtaining the final word representation, for the u-th word in the paragraph, the hidden states in both directions are... and The concatenation of these elements forms the hidden representation of the word. This is then used to obtain the paragraph-level hidden representation H via a bidirectional LSTM. q As shown in the formula below:

[0060]

[0061]

[0062]

[0063]

[0064] in and Let u be the hidden state of the u-th word in the paragraph in both directions of the LSTM. Let u be the word representation of the u-th word in the paragraph. H is the hidden representation of the u-th word in the paragraph. q M is the hidden representation of the paragraph, and M is the paragraph length.

[0065] The encoding of the sentence containing the answer follows a similar process to paragraph-level encoding, utilizing a bidirectional LSTM network after obtaining the final word representation. For the j-th word in the sentence containing the answer, the hidden states in both directions are... and The parts are then combined to form the hidden representation of the word. Finally, the hidden representation H of the sentence containing the answer is obtained. t As shown in the formula below:

[0066]

[0067]

[0068]

[0069]

[0070] in and Let j be the hidden state of the j-th word in the sentence containing the answer in both directions of the LSTM. Let j be the word representation of the j-th word in the sentence containing the answer. H is the hidden representation of the j-th word in the sentence containing the answer. t is the hidden representation of the sentence containing the answer, and N is the length of the sentence containing the answer.

[0071] After obtaining the hidden representations of the paragraph and the sentence containing the answer respectively, the two are fused based on a gated attention mechanism. First, a matching representation is calculated based on the paragraph-level hidden representation and the encoded representation of the sentence containing the answer:

[0072]

[0073]

[0074] Where H q This is a paragraph-level hidden representation. W is the hidden representation of the k-th word in the sentence containing the answer. s It is a trainable weight matrix, s k It is an attention matching representation, which is a weighted sum of the encoding representations of the words in the sentence containing the answer to the corresponding words in the paragraph.

[0075] The original paragraph representation is then combined with the attention-matching representation to form a new attention-matching enhanced representation. A learnable gating vector is then used to select the information between the original paragraph representation and the new attention-matching enhanced representation, resulting in the final encoded paragraph representation, as shown in the following formula:

[0076]

[0077]

[0078]

[0079]

[0080] in W is the hidden representation of the l-th word in the paragraph. f It is a trainable weight matrix, f l For the new attention-matched enhanced representation, g l W is a learnable gated vector. g It is a trainable weight matrix, where ⊙ represents the product of corresponding elements of the two matrices. This represents the final representation of the l-th word in the paragraph. M represents the final encoded paragraph, where M is the paragraph length.

[0081] Step 4: Decoding the Question Generation Model. The decoder is another two-layer unidirectional LSTM network, incorporating attention and maximum output pointer mechanisms. It generates words based on the representation obtained from the encoder and the order of words generated in each decoding step. The attention mechanism is applied to each decoding step, as shown in the following formula:

[0082]

[0083]

[0084]

[0085]

[0086]

[0087] Where d β This represents the hidden state of the decoder LSTM at decoding step β, while d0 is consistent with the final hidden state of the encoder. β This represents the word generated in decoding step β, w β Indicates y β The corresponding word embedding representation. The original attention score r is calculated using an attention mechanism. β W a and W b These are two trainable weight matrices. The decoder state d... β and context attention vector c β Combine them and use their output as the new decoding state. β The algorithm projects onto a space with a vocabulary size dimension through a linear layer, and then computes the probability distribution of all words in a fixed vocabulary V through a softmax layer. To generate scores.

[0088] The pointer mechanism directly uses the raw attention score of the input paragraph text. And an input vocabulary ω. In each decoding step β, a word is treated as a unique copy target, and the final score of a word is obtained by calculating the maximum score pointing to the same word:

[0089]

[0090] Where q θ and y β Let θ represent the θ-th word in the input and β-th word in the decoding, respectively.

[0091] Then With generated scores splicing We obtain a |V|+|ω| dimensional vector. We then perform a softmax calculation on the concatenated vector and sum the probabilities of words pointing to the same word. The final probability of generating a word is:

[0092]

[0093] When decoding to generate the first word, the question type prediction model in step two is used to obtain the question type. If the predicted question type is "others", it will not affect the above decoding process in step four. If it is one of the other seven types, the question type will be used as the first word to generate the question, and then subsequent decoding will be performed.

[0094] Step 5: For a given new paragraph context and answer, data processing is first performed to obtain the answer location label, the sentence containing the answer, and the answer entity category. Then, a trained linguistic feature representation model is used to obtain named entity recognition and part-of-speech tagging information, and a trained question type prediction model is used to obtain question category information. Next, a trained question generation model encodes the paragraph context, answer, and sentence containing the answer to obtain a final representation that integrates the information from the sentence containing the answer and linguistic information. Finally, in the decoding stage, based on attention and maximum output pointer mechanisms combined with the question type, a question related to the context and answer is generated.

[0095] Corresponding to the aforementioned embodiment of a problem generation method that integrates multiple information, the present invention also provides an embodiment of a problem generation apparatus that integrates multiple information.

[0096] See Figure 4 The present invention provides a problem generation device that integrates multiple information, including a memory and one or more processors. The memory stores executable code, and when the processor executes the executable code, it is used to implement a problem generation method that integrates multiple information as described in the above embodiment.

[0097] An embodiment of the problem generation device integrating multiple information according to the present invention can be applied to any device with data processing capabilities, such as a computer. The device embodiment can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor of any data processing device loading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 4 The diagram shown is a hardware structure diagram of any data processing-capable device, including the problem generation device that integrates multiple information according to the present invention. (Except for...) Figure 4In addition to the processor, memory, network interface, and non-volatile memory shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.

[0098] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0099] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the present invention according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0100] This invention also provides a computer-readable storage medium storing a program thereon, which, when executed by a processor, implements a problem generation method that integrates multiple information as described in the above embodiments.

[0101] The computer-readable storage medium can be an internal storage unit of any data processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device of any data processing device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units and external storage devices of any data processing device. The computer-readable storage medium is used to store the computer program and other programs and data required by the data processing device, and can also be used to temporarily store data that has been output or will be output.

[0102] The above description is merely a preferred embodiment of the present invention. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make many possible variations and modifications to the technical solutions of the present invention using the methods and techniques disclosed above, or modify them into equivalent embodiments with equivalent changes, without departing from the scope of the technical solutions of the present invention. Therefore, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention shall still fall within the protection scope of the technical solutions of the present invention.

Claims

1. A fusion multi-information problem generation method characterized by, The method comprises the following steps: 1) data processing: obtaining question generation data set for processing, including case conversion, annotating answer position, extracting answer sentence, extracting question type, and performing named entity recognition and part-of-speech tagging on all texts, and constructing a named entity recognition data set and a part-of-speech tagging data set, wherein the answer position annotation and the named entity annotation adopt the BIO annotation method; constructing a question type prediction data set according to the paragraph context, the answer entity category and the question type, wherein the question type comprises "what", "who", "how", "when", "which", "where", "why" and "others"; 2) obtaining linguistic feature information and question type information: constructing a linguistic feature representation model, which is composed of a pre-trained language model and a final CRF layer; wherein the pre-trained language model is used to obtain the encoding representation of the input text, and the CRF is used for label prediction; the linguistic feature representation model is trained using the named entity recognition data set and the part-of-speech tagging data set obtained in step 1) for the named entity recognition task and the part-of-speech tagging task, respectively, to obtain the corresponding linguistic feature representation models for named entity recognition and part-of-speech tagging; after the training is completed, the hidden state of the trained linguistic feature representation model is used as the linguistic feature information representation of the named entity or the part-of-speech tag; constructing a question type prediction model based on the pre-trained language model, wherein the input of the prediction model is the paragraph context and the answer entity category information, and the output is the eight question types in step 1); 3) encoding of the fusion of the answer sentence information and the linguistic feature information: the question generation model is a whole encoder-decoder architecture, and this step is the encoding stage of the model, wherein the encoder adopts a bidirectional LSTM; the input of the encoding stage includes three parts, namely the paragraph-level context Q, the answer X and the answer sentence T; first, the word embedding representation of each word in the paragraph is obtained; then, the word embedding representation, the answer position encoding obtained in step 1) and the linguistic feature information representation obtained in step 2) are spliced to obtain the final word representation; then, the bidirectional LSTM is used to encode the paragraph context and the answer sentence containing the word representation, respectively, to obtain the paragraph-level hidden representation and the hidden representation of the answer sentence; the paragraph-level hidden representation and the hidden representation of the answer sentence are fused based on the gated attention mechanism, specifically: first, the attention matching representation is calculated based on the paragraph-level hidden representation and the encoded answer sentence representation; then, the paragraph-level hidden representation and the attention matching representation are combined to form a new attention matching enhanced representation; finally, the information between the original paragraph hidden representation and the new attention matching enhanced representation is selected through a learnable gating vector, so as to obtain the final paragraph encoding representation; 4) Question generation model decoding: This step is the decoding stage of the question generation model, and the decoder uses LSTM; according to the paragraph encoding representation obtained in step 3) and the previously generated words in each decoding step, the question is generated by combining the attention mechanism and the maximum output pointer mechanism; when generating the first word, the question type is calculated by using the question type prediction model obtained in step 2), if the predicted question type is "others", it does not affect the decoding process of this step, if it is the other seven types, the question type is taken as the first generated word; 5) Generating a question related to the context and the answer: Given a new paragraph-level context and an answer, perform data processing in step 1), obtain linguistic feature information through the trained linguistic feature representation model, and obtain question category information through the trained question type prediction model, then input the paragraph context, answer, answer sentence, linguistic feature information representation and question type into the question generation model trained in steps 3) and 4), and finally generate a question related to the context and the answer.

2. The method according to claim 1, wherein The question generation dataset is the SQuAD1.1 question generation dataset, and the SQuAD1.1 question generation dataset is processed using a natural language processing tool.

3. The method according to claim 1, wherein The linguistic feature information acquisition is specifically: The linguistic feature representation model is trained based on a pre-training and fine-tuning mode, and is implemented by using DistilBERT+CRF; the linguistic feature representation model is fine-tuned on two tasks of named entity recognition and part-of-speech tagging, and the fine-tuning process is to use the pre-trained DistilBERT model to continue training on the task dataset for named entity recognition and part-of-speech tagging with a small learning rate, adjust part of the parameters of the model, and the dataset used is a named entity recognition dataset constructed based on the BIO annotation method and a part-of-speech tagging dataset constructed based on the natural language processing tool extraction; the training process converts the text input into a pre-trained language model into an encoding representation, and the CRF layer predicts the label of the named entity or the part of speech from the encoding; The learning rates of the DistilBERT and CRF two parts are set respectively, and the training is performed on the dataset for 5 rounds, and finally the best named entity recognition representation model and part-of-speech tagging representation model in the test set are reserved; in the encoding stage of the question generation model, the output of the DistilBERT part of the above two linguistic representation models is extracted as the information representation of the named entity recognition or part-of-speech tagging feature, and is spliced into the word embedding representation.

4. The method of claim 1, wherein the method is a method of generating a question by fusing multiple information. The question type information acquisition is specifically: The question type prediction model is trained based on a pre-training and fine-tuning mode and is implemented by using BERT; the question type prediction model is fine-tuned on a question type prediction task, the fine-tuning process is that the pre-trained BERT model is used to continue training on the question type prediction task on the task data set with a small learning rate, part of the parameters of the model is adjusted, and the data set used is a question type prediction data set composed of a paragraph context-answer entity category-question type three-tuple; the input of the model is the paragraph context and the answer entity category information, and the output is the question type, wherein the question type includes "what", "who", "how", "when", "which", "where", "why" and "others"; in the decoding stage of the question generation model, the output of the question prediction model is used as the question type of the generated question.

5. The method of claim 1, wherein the method is a multi-information fusion problem generation method. The encoding of the fused answer sentence information and linguistic feature information is specifically: The answer position is marked with a BIO tag system in the question generation dataset, and the sentence where the answer is located is extracted separately to construct a paragraph-answer-sentence where the answer is located-question four tuple, and the input of the question generation model is the paragraph-level context answer and the sentence where the answer is located wherein M is the paragraph length, L is the answer text length, and N is the length of the sentence where the answer is located Word vector acquisition: Obtain the word embedding representation w of each word in the paragraph using GloVe. i , where w i Let m be the word embedding representation of the i-th word; by processing the answer position annotation, we obtain the 3D answer position encoding m. i , where m i This represents the answer position encoding for the i-th word; the paragraph text is input into the linguistic feature representation model for named entity recognition and the linguistic feature representation model for part-of-speech tagging, and the output of the DistilBERT part is extracted as the named entity recognition feature n. i and part-of-speech tag features p i Information representation, where n i and p i Let e ​​represent the named entity recognition feature and part-of-speech tag feature of the i-th word, respectively. Concatenating these vectors yields the final word representation e. i =[w i m i ;n i ;p i ], where e i The word representation of the i-th word; After obtaining the representation of the final word, the paragraph is encoded using a two-layer bidirectional LSTM network; for the u-th word in the paragraph, the hidden states of the two directions are concatenated as the hidden representation of the word; thus the paragraph-level hidden representation H and is obtained through the bidirectional LSTM network. q : wherein and is the hidden state of the u-th word in the paragraph in the LSTM in both directions, is the word representation of the u-th word in the paragraph, is the hidden representation of the u-th word in the paragraph, H q is the hidden representation of the paragraph, M is the paragraph length; The encoding of the answer sentence takes the same operation as the paragraph-level encoding, and also utilizes the bi-directional LSTM network after obtaining the final representation of the words; for the j-th word in the answer sentence, the hidden states of the two directions are concatenated as the hidden representation of the word; finally, the hidden representation H of the answer sentence is obtained and t :​ wherein and is the hidden state of the jth word in the answer containing sentence in the LSTM in both directions, is the word representation of the jth word in the answer containing sentence, is the hidden representation of the jth word in the answer containing sentence, H t is the hidden representation of the answer containing sentence, N is the length of the answer containing sentence; After obtaining the hidden representations of the paragraph and the answer sentence, the two are fused based on a gated attention mechanism; first, the matching representation is calculated based on the paragraph-level hidden representation and the encoded answer sentence representation: where H q is the paragraph-level hidden representation, is the k-th word in the answer sentence, W s is a trainable weight matrix, s k is the attention matching representation, i.e., the weighted sum of the encoded representations in the paragraph corresponding to the words in the answer sentence. Then, the paragraph representation and the attention matching representation are combined to form a new attention matching enhanced representation; then, a learnable gating vector is used to select information between the original paragraph representation and the new attention matching enhanced representation, so as to obtain the final encoded paragraph representation: where is the hidden representation of the l-th word in the paragraph, W f is a trainable weight matrix, f l is the new attention-matching enhanced representation, g l is a learnable gating vector, W g is a trainable weight matrix, and denotes the element-wise product of two matrices, is the final representation of the l-th word in the paragraph, is the final encoded paragraph representation, and M is the paragraph length. 6.A fusion multi-information problem generation apparatus comprising a memory and one or more processors, the memory having stored therein executable code, the apparatus characterized by, The processor executes the executable code to implement the question generation method of fusing multiple information according to any one of claims 1-5.

7. A computer-readable storage medium having stored thereon a program, characterized in that, The program is executed by the processor to implement the question generation method of fusing multiple information according to any one of claims 1-5.

Citation Information

Patent Citations

  • Question generation method based on multi-task joint training

    CN113268561A

  • Method and system for realizing aviation domain knowledge questions and answers

    CN114757184A