Question generation method and device

By processing unstructured text through named entity recognition and question generation models, questions corresponding to the target answer are generated, solving the problem of low efficiency in processing unstructured document data in existing technologies and achieving accuracy and diversity in question generation.

CN116257612BActive Publication Date: 2026-05-12ALIBABA DAMO (HANGZHOU) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA DAMO (HANGZHOU) TECH CO LTD
Filing Date
2023-01-18
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Most existing question knowledge mining systems use single sentences or dialogue streams as input sources, making it difficult to effectively process unstructured document data, resulting in low efficiency in question generation.

Method used

Phrases are extracted from the text using named entity recognition technology, and phrase tagging information and structure graphs are constructed. Combined with question generation models such as T5 or Transformer models, questions corresponding to the target answer are generated.

Benefits of technology

It improves the accuracy and diversity of question generation for unstructured text data, reduces the cost of manual annotation, and achieves efficient processing of unstructured document data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116257612B_ABST
    Figure CN116257612B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a question sentence generation method and device, wherein the question sentence generation method comprises: obtaining a to-be-processed text and a target answer corresponding to the to-be-processed text; marking a phrase in the to-be-processed text to obtain phrase marking information and a phrase structure diagram; inputting the to-be-processed text, the target answer, the phrase marking information and the phrase structure diagram into a question sentence generation model, wherein the question sentence generation model is used to generate a question sentence corresponding to the to-be-processed text and the target answer; and obtaining a target question sentence output by the question sentence generation model. The unstructured text data is processed, so that the input source is no longer only a single sentence or a dialogue flow, the phrase for generating the target question sentence is determined according to the phrase marking information and the phrase structure diagram, and on the basis of ensuring the accuracy of generating the target question sentence, the diversity of generating the target question sentence is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments in this specification relate to the field of artificial intelligence technology, and in particular to a method for generating questions. Background Technology

[0002] With the development of science and technology, artificial intelligence is widely applied in various fields of life, such as computer science and medicine. Question knowledge mining is one of the core capabilities of intelligent services, which can greatly accelerate the implementation of question-answering services in intelligent services.

[0003] Current question knowledge mining systems mostly use single sentences or dialogue streams as input sources. However, in real-world applications, a large amount of data needs to be processed from unstructured document data. In practice, unstructured document data is primarily used for intelligent understanding of document content, and question knowledge mining based on unstructured document data is rare. Therefore, how to directly perform question knowledge mining on unstructured document data is a problem that urgently needs to be solved. Summary of the Invention

[0004] In view of this, embodiments of this specification provide a method for generating questions. One or more embodiments of this specification also relate to a question generation apparatus, a computing device, a computer-readable storage medium, and a computer program, to address the technical deficiencies existing in the prior art.

[0005] According to a first aspect of the embodiments of this specification, a question generation method is provided, comprising:

[0006] Obtain the text to be processed and the target answer corresponding to the text to be processed;

[0007] Tag phrases in the text to be processed to obtain phrase tagging information and phrase structure diagram;

[0008] The text to be processed, the target answer, the phrase tagging information, and the phrase structure diagram are input into the question generation model, wherein the question generation model is used to generate questions corresponding to the text to be processed and the target answer;

[0009] Obtain the target question output by the question generation model.

[0010] According to a second aspect of the embodiments of this specification, a question generation apparatus is provided, comprising:

[0011] The first acquisition module is configured to acquire the text to be processed and the target answer corresponding to the text to be processed.

[0012] A tagging module is configured to tag phrases in the text to be processed, and obtain phrase tagging information and a phrase structure diagram.

[0013] The input module is configured to input the text to be processed, the target answer, the phrase tagging information, and the phrase structure diagram into the question generation model, wherein the question generation model is used to generate questions corresponding to the text to be processed and the target answer;

[0014] The second acquisition module is configured to acquire the target question output by the question generation model.

[0015] According to a third aspect of the embodiments of this specification, another method for generating questions is provided, including:

[0016] Obtain the text paragraphs for intelligent question answering and the target answers corresponding to those text paragraphs;

[0017] Tag phrases in the text paragraph to obtain phrase tagging information and phrase structure diagram;

[0018] The text paragraph, the target answer, the phrase tagging information, and the phrase structure diagram are input into the question generation model, wherein the question generation model is used to generate a text paragraph and a question corresponding to the target answer for intelligent question answering;

[0019] Obtain the target question output by the question generation model.

[0020] According to a fourth aspect of the embodiments of this specification, another question generation apparatus is provided, comprising:

[0021] The text acquisition module is configured to acquire text paragraphs for intelligent question answering and the target answer corresponding to the text paragraphs;

[0022] A phrase tagging module is configured to tag phrases in the text paragraph to obtain phrase tagging information and a phrase structure diagram.

[0023] The information input module is configured to input the text paragraph, the target answer, the phrase tagging information, and the phrase structure diagram into the question generation model, wherein the question generation model is used to generate a question corresponding to the text paragraph and the target answer for intelligent question answering;

[0024] The question acquisition module is configured to acquire the target question output by the question generation model.

[0025] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0026] Memory and processor;

[0027] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described question generation method.

[0028] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the above-described question generation method.

[0029] According to a seventh aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described question generation method.

[0030] The question generation method provided in this specification includes: obtaining a text to be processed and a target answer corresponding to the text to be processed; marking phrases in the text to be processed to obtain phrase marking information and a phrase structure diagram; inputting the text to be processed, the target answer, the phrase marking information and the phrase structure diagram into a question generation model, wherein the question generation model is used to generate a question corresponding to the text to be processed and the target answer; and obtaining the target question output by the question generation model.

[0031] One embodiment of this specification implements the processing of unstructured text data, so that the input source is no longer just a single sentence or dialogue stream. Based on phrase tagging information and phrase structure graph, the phrases for generating target questions are determined, which improves the diversity of generated target questions while ensuring the accuracy of the generated target questions. Attached Figure Description

[0032] Figure 1 This is a schematic diagram illustrating the application of a question generation method provided in one embodiment of this specification;

[0033] Figure 2 This is a flowchart illustrating a question generation method provided in one embodiment of this specification;

[0034] Figure 3a This is a schematic diagram of a phrase structure provided in one embodiment of this specification;

[0035] Figure 3b This is a schematic diagram of another phrase structure provided in one embodiment of this specification;

[0036] Figure 4 This is a flowchart illustrating the processing steps of a question generation method provided in one embodiment of this specification;

[0037] Figure 5 This is a schematic diagram of the structure of a question generation device provided in one embodiment of this specification;

[0038] Figure 6 This is a flowchart illustrating the application of a question generation method provided in one embodiment of this specification to an intelligent question-answering scenario.

[0039] Figure 7 This is a schematic diagram of the structure of a question generation device provided in one embodiment of this specification, applied to an intelligent question-answering scenario;

[0040] Figure 8 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation

[0041] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.

[0042] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0043] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."

[0044] First, the terms and concepts used in one or more embodiments of this specification will be explained.

[0045] NER: Named Entity Recognition, is a fundamental task in natural language processing that extracts and labels entities from text.

[0046] Transformer: A neural network architecture, essentially an Encoder-Decoder architecture.

[0047] T5: Text-To-Text Transfer Transformer, a large-scale pre-trained language model based on the Transformer architecture, containing an encoder and a decoder.

[0048] Reinforcement learning is a learning process in which an agent learns through trial and error. It uses rewards obtained from interacting with the environment to guide behavior, with the goal of maximizing the reward for the agent. Reinforcement learning differs from supervised learning, mainly in the reinforcement signal. In reinforcement learning, the reinforcement signal provided by the environment is an evaluation of the quality of the action (usually a scalar signal).

[0049] In practical applications, there are often situations where it is necessary to generate corresponding questions based on a piece of text. For example, people can often ask all sorts of questions about a piece of text, and each question has its corresponding answer. However, simply extracting the text content manually would greatly increase the cost of manual extraction and reduce the extraction efficiency.

[0050] Current question generation methods mostly use single sentences or dialogues as input sources to generate questions. However, with the continuous improvement of people's living standards, an increasing amount of unstructured document data requires question generation. Therefore, how to use unstructured document data as source data is a problem that urgently needs to be solved.

[0051] This specification provides a method for generating questions, and also relates to a question generation apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.

[0052] See Figure 1 , Figure 1 This diagram illustrates an application of a question generation method according to an embodiment of this specification. The question generation method provided in this embodiment is applied to a terminal, which may be a laptop, desktop computer, tablet computer, smart device, server, cloud server, distributed server, etc. The specific form of the terminal is not limited in the embodiments provided in this specification. The question generation method provided in this specification extracts phrases from the directly obtained text to be processed using NER technology, marks the extracted phrases to obtain phrase marking information, and then constructs a phrase structure graph based on the semantic relationships between each phrase.

[0053] People can ask all sorts of different questions about a piece of text. Therefore, before extracting phrases from the text, it is necessary to determine a target answer to improve the accuracy of the subsequent generated questions.

[0054] Furthermore, after obtaining the phrase tagging information and phrase structure diagram, the text to be processed, the target answer, the phrase tagging information, and the phrase structure diagram can be directly input into the question generation model. The question generation model processes the obtained information data and outputs the target question corresponding to the text to be processed and the target answer.

[0055] Combination Figure 1 The question generation model comprises an encoder, a phrase classifier, a phrase sampler, a feature fusion unit, and a decoder. After acquiring the text to be processed, the target answer, phrase tagging information, and a phrase structure graph, the encoder first processes these components to obtain at least one initial phrase matrix and a target answer matrix. Then, these matrices are input to the phrase classifier, which processes them and outputs at least one key phrase matrix. Next, the key phrase matrix and phrase structure graph are input to the phrase sampler, which performs phrase sampling based on these matrices to obtain at least one associated phrase matrix. Finally, these matrices are input to the feature fusion unit for feature fusion to obtain at least one target key phrase matrix. Finally, these matrixes are input to the decoder, which generates and outputs the target question corresponding to the text to be processed and the target answer.

[0056] The question generation method provided in this specification extracts and labels phrases in the text to be processed, enabling the question generation model to identify and process phrases in the text based on the phrase labeling information. In order to improve the accuracy of question generation, the question generation model can also sample the extracted phrases through a phrase structure diagram to improve the semantic relevance between the obtained phrases and the target answer, thereby ensuring the accuracy of the target question generated based on the target key phrases.

[0057] See Figure 2 , Figure 2 A flowchart of a question generation method according to an embodiment of this specification is shown, which specifically includes the following steps.

[0058] Step 202: Obtain the text to be processed and the target answer corresponding to the text to be processed.

[0059] Specifically, the text to be processed refers to the acquired text data that needs to be processed to generate the corresponding question. The target answer refers to the answer corresponding to the expected question.

[0060] For example, to generate a corresponding question for the text data “The XX Dance Party is the theme of a series of spoof advertisements in program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si.”, then “The XX Dance Party is the theme of a series of spoof advertisements in program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si.” is the text to be processed. The expected question to be generated for this text data is “Who created the XX Dance Party as the theme of a series of spoof advertisements in a program?” Based on the above text data, the answer is “Zhang San,” so “Zhang San” is the target answer.

[0061] The question generation method provided in this manual requires obtaining the target answer corresponding to the expected question while acquiring the text to be processed, thereby narrowing the range of questions that can be generated from the text to be processed and improving the accuracy of the generated questions.

[0062] Step 204: Tag phrases in the text to be processed to obtain phrase tagging information and phrase structure diagram.

[0063] Phrase tagging information can be understood as the tagging information used to determine each phrase in the text to be processed. The phrase structure graph specifically refers to the semantic structure graph between each phrase in the text to be processed; see [link to documentation] for details. Figure 3a and Figure 3b , Figure 3a and Figure 3b Schematic diagrams of two phrase structure diagrams provided in one embodiment of this specification are shown respectively.

[0064] Combination Figure 3a Let's take a look. Figure 3a This is the phrase structure diagram corresponding to the sentence "The XX Dance Party is the theme of a series of parody advertisements for program A" in the text to be processed above. (By...) Figure 3a It is easy to see that the extracted phrases from the text data “XX Dance Party” are “XX Dance Party”, “is”, “A program”, “a series”, “spoof advertisement”, and “theme”. Based on the semantic structural relationships between each phrase, a hierarchy was constructed as follows: Figure 3a The phrase structure diagram shown.

[0065] Combination Figure 3b Let's take a look. Figure 3b This is the phrase structure diagram corresponding to the sentence "Program A is a late-night live television comedy and variety show created by Zhang San and developed by Li Si" in the text to be processed above. Figure 3b It can be seen that the phrases extracted from this text data are "Program A", "is", "Zhang San", "create", "Li Si", "develop", "late-night live TV comedy", and "variety show", and a structure is constructed based on the semantic relationships between these phrases. Figure 3bThe phrase structure diagram shown.

[0066] Taking the text to be processed as “XX Dance Party is the theme of a series of spoof advertisements for Program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si” as an example, the phrase tagging information is explained.

[0067] As can be seen from the above, the phrases corresponding to the text to be processed are "XX Dance Party", "is", "Program A", "a series", "spoof advertisement", "theme", "Program A", "is", "Zhang San", "create", "Li Si", "develop", "late-night live TV comedy", and "variety show". The phrase tagging information corresponding to "XX Dance Party" is that the 2nd to 9th characters are the characters corresponding to one phrase, and the phrase tagging information corresponding to "a series" is that the 25th to 30th characters are the characters corresponding to one phrase. The phrase tagging information corresponding to other phrases follows the same pattern, and will not be elaborated here.

[0068] The process for obtaining phrase tagging information and phrase structure diagrams can be found in the following implementation:

[0069] In one specific embodiment provided in this specification, phrases in the text to be processed are marked to obtain phrase marking information and a phrase structure diagram, including:

[0070] Named entity recognition is performed on the text to be processed, and phrases in the text to be processed are obtained based on the named entity recognition results.

[0071] Generate corresponding phrase tag information based on the phrases in the text to be processed;

[0072] Construct the corresponding phrase structure diagram based on the semantic relationships between phrases.

[0073] The named entity recognition result refers to the recognition result obtained after performing named entity recognition on the text to be processed. Specifically, named entity recognition can be performed using NER technology. Other recognition methods can also be used, but this specification prioritizes NER technology, and the specific method can be determined based on the actual application. By performing named entity recognition on the text to be processed, phrases can be identified and extracted. Therefore, by performing named entity recognition on the text to be processed, phrases can be obtained from the text.

[0074] Because question generation models cannot accurately identify every phrase like humans, for example, the phrase "a series" might be identified by the question generation model as three separate phrases: "a," "series," and "column." Therefore, after extracting phrases from the text to be processed using NER technology, it is also necessary to generate corresponding phrase tagging information based on the extracted phrases so that the question generation model can accurately identify the phrases in the text to be processed.

[0075] Semantic relations specifically refer to the semantic structural relationships between different phrases. For example, in the sentence "The XX dance party is the theme of a series of spoof advertisements for program A," the phrase "XX dance party" is the noun subject of the phrase "is."

[0076] Specifically, named entity recognition is performed on the acquired text to be processed. Based on the named entity recognition results, phrases within the text can be extracted. To ensure that the subsequent question generation model can accurately identify these phrases, the extracted phrases need to be labeled, thus obtaining phrase label information for each phrase. Based on the semantic structural relationships between different phrases, a phrase structure graph is constructed for each phrase. This graph allows for the rapid understanding of the semantic structural relationships between different phrases, and enables the quick retrieval of the required phrases.

[0077] Continuing with the previous example, the text to be processed is “XX Dance Party is the theme of a series of spoof advertisements for Program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si.” Named entity recognition is performed on the text to be processed, yielding the phrases “XX Dance Party,” “is,” “Program A,” “a series,” “spoof advertisements,” “theme,” “Program A,” “is,” “Zhang San,” “created,” “Li Si,” “developed,” “late-night live TV comedy,” and “variety show.” These phrases are then labeled, obtaining the corresponding phrase tagging information. The phrase tagging information for “XX Dance Party” consists of characters from the 2nd to the 9th character, and so on, until each phrase is labeled. Finally, a corresponding phrase structure graph is constructed based on the semantic relationships between different phrases.

[0078] Preferably, this specification constructs sentence-level phrase structure diagrams, that is, one phrase structure diagram is constructed for each sentence. The text to be processed, “The ‘XX Dance Party’ is the theme of a series of spoof advertisements for Program A. Program A is a late-night live television comedy and variety show created by Zhang San and developed by Li Si,” contains two sentences: “The ‘XX Dance Party’ is the theme of a series of spoof advertisements for Program A.” and “Program A is a late-night live television comedy and variety show created by Zhang San and developed by Li Si.” Therefore, the above text to be processed can be used to construct two phrase structure diagrams, as detailed below. Figure 3a and Figure 3b .

[0079] The question generation method provided in this specification obtains phrases from the text to be processed by named entity recognition, and further generates phrase tagging information and phrase structure diagrams for each extracted phrase. This improves processing efficiency and shortens the processing cycle in the subsequent process of generating the target question and the corresponding target answer from the text to be processed using the question generation model.

[0080] Step 206: Input the text to be processed, the target answer, the phrase tagging information, and the phrase structure diagram into the question generation model, wherein the question generation model is used to generate questions corresponding to the text to be processed and the target answer.

[0081] The question generation model refers to a model that generates target questions corresponding to the text to be processed and the target answer based on the text to be processed, the target answer, phrase tagging information, and phrase structure diagram. This model can be a T5 model, a Transformer model, a BART model, etc., and this specification does not limit it.

[0082] In one specific embodiment provided in this specification, the question generation model includes an encoder, a phrase classifier, a phrase sampler, a feature fusion unit, and a decoder;

[0083] The text to be processed, the target answer, the phrase tagging information, and the phrase structure diagram are input into the question generation model, including:

[0084] The text to be processed, the target answer, and the phrase tagging information are input into the encoder to obtain at least one initial phrase matrix and a target answer matrix output by the encoder;

[0085] The at least one initial phrase matrix and the target answer matrix are input into the phrase classifier to obtain at least one key phrase matrix output by the phrase classifier;

[0086] Input the at least one key phrase matrix and the phrase structure graph into the phrase sampler to obtain at least one associated phrase matrix output by the phrase sampler;

[0087] The at least one key phrase matrix and the at least one associated phrase matrix are input into the feature fusion unit to obtain at least one target key phrase matrix output by the feature fusion unit;

[0088] The at least one target key phrase matrix and the target answer matrix are input into the decoder to obtain the target question output by the decoder.

[0089] The initial phrase matrix refers to the matrix corresponding to the phrases in the text to be processed, obtained by inputting the text to be processed and the phrase tag information into the encoder. The target answer matrix refers to the matrix corresponding to the target answer, obtained by inputting the target answer into the encoder.

[0090] It should be noted that, in order to ensure the accuracy of the generated target questions, the embodiments provided in this specification preferably process each initial phrase matrix, key phrase matrix, and related phrase matrix.

[0091] Specifically, the text to be processed, the target answer, and phrase tagging information are input into the encoder. After processing the acquired information, the encoder outputs at least one initial phrase matrix corresponding to the text to be processed and a target answer matrix corresponding to the target answer. For example, if the text to be processed, “XX Dance Party is the theme of a series of spoof advertisements for Program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si,” and the target answer “Zhang San,” along with the phrase tagging information corresponding to the text to be processed, are input into the encoder, then the encoder outputs the initial phrase matrix corresponding to each phrase in the text to be processed and the target answer matrix corresponding to the target answer “Zhang San.”

[0092] A phrase classifier is a classifier used to score each initial phrase matrix based on the target answer matrix. The phrase classifier can classify each initial phrase matrix according to the semantic relationship between the initial phrase matrix and the target answer matrix. Specifically, a key phrase matrix refers to the initial phrase matrix whose scoring results meet preset conditions.

[0093] Specifically, the obtained initial phrase matrix and target answer matrix are input into the phrase classifier. The phrase classifier scores each initial phrase matrix based on the relationship between each initial phrase matrix and the target answer matrix, and outputs the initial phrase matrix whose scoring results meet the preset conditions as the key phrase matrix.

[0094] For example, the initial phrase matrix obtained by the phrase classifier is initial phrase matrix 1, initial phrase matrix 2, initial phrase matrix 3, initial phrase matrix 4, and initial phrase matrix 5, and the target answer matrix is ​​target answer matrix 6. Based on the semantic relationship between each initial phrase matrix and target answer matrix 6, each initial phrase matrix is ​​scored. The score for initial phrase matrix 1 is 0.2, the score for initial phrase matrix 2 is 0.5, the score for initial phrase matrix 3 is 0.3, the score for initial phrase matrix 4 is 0.8, and the score for initial phrase matrix 5 is 0.6. The preset condition is that the score is greater than 0.5, so the key phrase matrices are initial phrase matrix 4 and initial phrase matrix 5.

[0095] The phrase sampler is used to generate a related phrase matrix corresponding to the key phrase matrix through phrase sampling. Specifically, the phrase sampler can be trained using a reinforcement learning training model. The related phrase matrix refers to the phrase matrix that has a semantic structural relationship with the key phrase matrix.

[0096] Specifically, each key phrase matrix and phrase structure diagram is input into the phrase sampler. The phrase sampler performs phrase sampling on the key phrase matrix based on the phrase structure diagram and outputs the sampled phrase matrix, which is the associated phrase matrix.

[0097] Following the previous example, the key phrase matrix 4 and key phrase matrix 5, along with the phrase structure graph, are input into the phrase sampler. Based on the input phrase structure graph, the phrase sampler determines the phrase structure graphs corresponding to key phrase matrices 4 and 5. Based on the phrase structure graphs corresponding to key phrase matrices 4 and 5, phrase sampling is performed on key phrase matrices 4 and 5 to obtain at least one associated phrase matrix corresponding to key phrase matrices 4 and 5, and then outputs it.

[0098] The feature fusion unit is used to fuse the obtained key phrase matrix and related phrase matrix to obtain the target key phrase matrix.

[0099] Specifically, each key phrase matrix and each associated phrase matrix are input into a feature fusion unit, which performs feature fusion on each key phrase matrix and each associated phrase matrix to obtain at least one target key phrase matrix.

[0100] Finally, each target key phrase matrix and target answer matrix is ​​input into the decoder. The decoder will predict the question corresponding to the text to be processed and the target answer based on the obtained target key phrase matrix and target answer matrix, and output the target question.

[0101] The question generation method provided in this specification performs named entity recognition on the text to be processed, and obtains the phrase tagging information and phrase structure diagram corresponding to the text based on the named entity recognition results. Then, the text to be processed, the phrase tagging information, the phrase structure diagram, and the target answer are input into the question generation model, and the model automatically outputs the target question corresponding to the text to be processed and the target answer. This method enables the generation of questions from unstructured text.

[0102] In one specific embodiment provided in this specification, obtaining at least one initial phrase matrix and a target answer matrix output by the encoder includes:

[0103] Encode the text to be processed and the target answer to obtain the text encoding matrix corresponding to the text to be processed and the target answer matrix corresponding to the target answer.

[0104] The at least one initial phrase matrix is ​​determined in the text encoding matrix based on the phrase tagging information.

[0105] The text encoding matrix refers to the encoded data corresponding to the text to be processed.

[0106] Specifically, after the text to be processed, the target answer, and phrase tagging information are input into the encoder, the encoder encodes the text to be processed and the target answer, thereby obtaining the text encoding matrix corresponding to the text to be processed and the target answer matrix corresponding to the target answer. At least one initial phrase matrix is ​​determined from the text encoding matrix based on the phrase tagging information corresponding to the text to be processed.

[0107] In one specific embodiment provided in this specification, obtaining at least one key phrase matrix output by the phrase classifier includes:

[0108] Determine the semantic association between the at least one initial phrase matrix and the target answer matrix;

[0109] Based on semantic associations, a score is assigned to the at least one initial phrase matrix to obtain the scoring results corresponding to the at least one initial phrase matrix;

[0110] Based on the scoring results corresponding to the at least one initial phrase matrix, the at least one key phrase matrix is ​​determined.

[0111] The semantic association can be understood as the semantic association between the initial phrase matrix and the target answer matrix.

[0112] Specifically, after the phrase classifier obtains the initial phrase matrix and the target answer matrix, it determines the semantic relationship between each initial phrase matrix and the target answer matrix, and scores each initial phrase matrix according to the semantic relationship. Based on the scoring results of different initial phrase matrices, at least one key phrase matrix is ​​determined in at least one initial phrase matrix.

[0113] For example, the input initial phrase matrices are the initial phrase matrices corresponding to the phrases "XX Dance Party," "Program A," and "Variety Show," respectively, and the target answer matrix is ​​the target answer matrix corresponding to the target answer "Zhang San." The phrase classifier determines the semantic association between the initial phrase matrices of "XX Dance Party," "Program A," and "Variety Show" and the target answer matrix of "Zhang San," and scores the three initial phrase matrices. If the score of the initial phrase matrix of "XX Dance Party" is 0.8, the score of the initial phrase matrix of "Program A" is 0.3, and the score of the initial phrase matrix of "Variety Show" is 0.6, then based on the scores of the three initial phrase matrices, the initial phrase matrices of "XX Dance Party" and "Variety Show" are determined as key phrase matrices and output.

[0114] The question generation method provided in this specification inputs an initial phrase matrix, a target answer matrix, and phrase tag information into a phrase classifier. The phrase classifier scores each initial phrase matrix and determines at least one key phrase matrix based on the scoring results, which can improve the accuracy of determining the key phrase matrix.

[0115] Furthermore, in one specific embodiment provided in this specification, determining the at least one key phrase matrix based on the scoring results corresponding to the at least one initial phrase matrix includes:

[0116] The initial phrase matrix corresponding to the scoring results that meet the preset conditions is determined as the key phrase matrix.

[0117] The preset conditions refer to the conditions that the scoring results of the initial phrase matrix must meet. For example, the preset conditions could be that the scoring results of the initial phrase matrix are greater than a preset threshold, or that the scoring results of the initial phrase matrix are greater than or equal to a preset threshold. The preset threshold could be 0.5, 0.6, etc. The specific value of the preset threshold can be set according to the actual application situation, and this manual does not limit it.

[0118] Specifically, after scoring each initial matrix, a corresponding score result will be obtained. If the score result of the initial phrase matrix meets the preset conditions, the initial phrase matrix that meets the preset conditions will be determined as the key phrase matrix.

[0119] For example, if the preset condition is that the score of the initial phrase matrix is ​​greater than 0.6, then the initial phrase matrix with a score greater than 0.6 can be determined as the key phrase matrix.

[0120] In one specific embodiment provided in this specification, obtaining at least one associated phrase matrix output by the phrase sampler includes:

[0121] Determine at least one key phrase corresponding to the at least one key phrase matrix;

[0122] Determine the key phrase structure information corresponding to the at least one key phrase in the phrase structure diagram;

[0123] Determine the associated phrases corresponding to the at least one key phrase based on the structural information of the at least one key phrase;

[0124] At least one associated phrase matrix is ​​determined based on the at least one associated phrase.

[0125] Here, "key phrase" specifically refers to the phrase corresponding to the key phrase matrix. Continuing the previous example, if the key phrase matrix is ​​for "XX Ball," then the key phrase corresponding to the "XX Ball" key phrase matrix is ​​"XX Ball." Key phrase structural information can be understood as the semantic structural information corresponding to the key phrase. Again, using "XX Ball" as an example, the phrase structure diagram corresponding to "XX Ball" is as follows: Figure 3a ,exist Figure 3a In the phrase structure diagram shown, “XX Dance” is the noun subject of the phrase “is”, and only “is” has a semantic structure relationship with “XX Dance”. Therefore, it can be determined that the semantic structure information corresponding to “XX Dance” is that “XX Dance” is the noun subject of the phrase “is”, and only “is” has a semantic structure relationship with “XX Dance”.

[0126] Related phrases are phrases that have a semantic structural relationship with the key phrase and whose scoring results meet preset conditions. For example, "XX dance party" is the key phrase, and related phrases are phrases that are related to the key phrase. Figure 3a It can be seen that only "is" and "XX dance party" have a semantic structure relationship. If the rating result of "is" meets the preset conditions, then "is" is a related phrase of "XX dance party". If the rating result of "is" does not meet the preset conditions, it means that "XX dance party" has no related phrase.

[0127] Specifically, based on each key phrase matrix output by the phrase sampler, the key phrases corresponding to each key phrase matrix are determined. The key phrase structure information corresponding to each key phrase is determined in the phrase structure graph. Then, based on the key phrase structure information of each key phrase, the associated phrases corresponding to it are determined, and the associated phrase matrix corresponding to each associated phrase is determined.

[0128] Continuing with the previous example, if the key phrase matrix is ​​the "XX Ball" key phrase matrix, then the key phrase corresponding to the "XX Ball" key phrase matrix is ​​"XX Ball". The phrase structure diagram corresponding to "XX Ball" is then determined as follows. Figure 3a As shown, and in the phrase structure diagram corresponding to "XX Dance Party" Figure 3aThe key phrase structure information corresponding to "XX Dance Party" is determined to be that "XX Dance Party" is the noun subject of the phrase "is", and only "is" and "XX Dance Party" have a semantic structural relationship. If the score of "is" meets the preset conditions, the associated phrase corresponding to "XX Dance Party" can be determined as "is", and the key phrase matrix corresponding to "is" can be obtained as the associated phrase matrix.

[0129] The question generation method provided in this specification, after scoring each key phrase matrix, also obtains the related phrases corresponding to the key phrases based on the key phrase structure information of the corresponding key phrases, thereby achieving the diversity of phrases for generating questions while ensuring the accuracy and consistency of the phrases.

[0130] In one specific embodiment provided in this specification, obtaining at least one target key phrase matrix output by the feature fusion processor includes:

[0131] By concatenating at least one key phrase matrix and at least one related phrase matrix, the at least one target key phrase matrix is ​​obtained.

[0132] After each key phrase matrix and each associated phrase matrix are input into the feature fusion unit, the feature fusion unit will concatenate each key phrase matrix and each associated phrase matrix into the corresponding target key phrase matrix.

[0133] By concatenating each key phrase matrix and each associated phrase matrix to obtain the target key phrase matrix, the diversity and richness of phrases used to generate the target question can be achieved, while improving the accuracy of the question.

[0134] The question generation method provided in this manual allows you to directly input the text to be processed, the target answer, phrase tagging information, and phrase structure diagram into the question generation model to process the text without manual annotation, thus reducing labor costs.

[0135] Step 208: Obtain the target question output by the question generation model.

[0136] The target question is the question output by the question generation model that corresponds to the text to be processed and the target answer. The target question includes target key phrases. For example, if the text to be processed is "The 'XX Dance Party' is the theme of a series of spoof advertisements in program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si," and the target answer is "Zhang San," then the target question output by the question generation model could be "The 'XX Dance Party' is the theme of a series of spoof advertisements in a program created by whom?"

[0137] Furthermore, in one specific embodiment provided in this specification, the question generation model is trained using the following method:

[0138] Obtain first sample data and the sample questions corresponding to the first sample data, wherein the first sample data includes sample processing text, sample answer and sample phrase tagging information;

[0139] An initial question generation model is obtained by training based on the sample processed text, the sample answers, the sample phrase tagging information, and the sample questions;

[0140] Obtain the sample phrase structure diagram corresponding to the sample phrase tagging information;

[0141] Based on the sample processed text, the sample answer, the sample phrase tagging information, and the sample phrase structure diagram, the initial question generation model is trained to generate the question generation model.

[0142] The first sample data refers to the sample data obtained from the first sample data set, including sample processing text, sample answers, and sample phrase tagging information, which are the training samples of the question generation model. The first sample data set refers to the set of first sample data obtained by collecting the text content in the sample processing text and sample answers, as well as the sample phrase tagging information obtained by tagging the phrases in the sample processing text. The sample question refers to the actual question corresponding to the first sample data. The sample phrase structure diagram refers to the semantic structure diagram between the various phrases in the sample processing text. The initial question generation model is a question generation model trained based on the first sample data and the sample questions corresponding to the first sample data. The initial question generation model is not used as the final question generation model.

[0143] Specifically, the first sample data and the corresponding sample questions are obtained. An initial question generation model is trained and obtained based on the first sample data and the sample questions. The sample phrase structure diagram corresponding to the sample phrase tagging information is obtained. The initial question generation model is further trained based on the sample processed text, sample answers, sample phrase tagging information, and sample phrase structure diagram to obtain the question generation model.

[0144] In one specific implementation provided in this specification, an initial question generation model is obtained by training based on the sample processed text, the sample answer, the sample phrase tagging information, and the sample question, including:

[0145] The sample processed text, the sample answer, and the sample phrase tagging information are input into the initial question generation model;

[0146] Obtain the predicted question output by the initial question generation model;

[0147] Calculate the loss value of the initial question generation model based on the sample questions and the predicted questions;

[0148] The model parameters of the initial question generation model are adjusted based on the loss value, and the initial question generation model is trained until the training stopping condition is met.

[0149] The predicted question refers to the question output by the initial question generation model when the sample processing text, the sample answer, and the sample phrase tagging information are input into the initial question generation model; the loss value is the difference between the sample question and the predicted question, used to measure the difference between the sample question and the predicted question.

[0150] Specifically, the sample processing text, the sample answers, and the sample phrase tagging information are input into the initial question generation model. This model generates questions corresponding to the sample processing text and sample answers. At this stage, the initial question generation model is not yet fully trained, and there will be discrepancies between the generated predicted questions and the actual sample questions. Therefore, the model parameters of the initial question generation model need to be adjusted accordingly. Specifically, the loss value of the initial question generation model is calculated based on the output predicted questions and sample questions. The loss function used to calculate the loss value can be a 0-1 loss function, a squared loss function, a cross-entropy loss function, etc. In this specification, preferably, the cross-entropy function is selected as the loss function for calculating the loss value. The model parameters of the initial question generation model are adjusted based on the loss value. The adjusted model parameters are then used to continue training the initial question generation model with the next batch of sample processing text, sample answers, and sample phrase tagging information until the model training stops. Specifically, the model training stopping conditions include the model loss value being less than a preset threshold and / or the number of training rounds reaching a preset number of rounds.

[0151] In one specific implementation provided in this specification, taking the model loss value being less than a preset threshold as the training stopping condition as an example, the preset threshold is 0.3. When the model loss value is less than 0.3, the initial question generation model is considered to have completed training.

[0152] In another specific embodiment provided in this specification, taking a preset number of training rounds as the training stopping condition as an example, the preset number of training rounds is 30 rounds. When the training rounds of sample processing text, sample answer and sample phrase tag information reach 30 rounds, the initial question generation model is considered to have completed training.

[0153] In another specific embodiment provided in this specification, two training stopping conditions are set: a preset threshold and a preset number of training rounds. At the same time, the loss value and the number of training rounds are monitored. When either the model loss value or the number of training rounds meets the training stopping condition, the initial question generation model is considered to have completed training.

[0154] The question generation method provided in this specification includes: obtaining a text to be processed and a target answer corresponding to the text to be processed; marking phrases in the text to be processed to obtain phrase marking information and a phrase structure diagram; inputting the text to be processed, the target answer, the phrase marking information and the phrase structure diagram into a question generation model, wherein the question generation model is used to generate a question corresponding to the text to be processed and the target answer; and obtaining the target question output by the question generation model.

[0155] One embodiment of this specification implements the processing of unstructured text data, so that the input source is no longer just a single sentence or dialogue stream. Based on phrase tagging information and phrase structure graph, the phrases for generating target questions are determined, which improves the diversity of generated target questions while ensuring the accuracy of the generated target questions.

[0156] The following is in conjunction with the appendix Figure 4 Taking the question generation method provided in this specification as an example in an intelligent question-answering scenario, the question generation method will be further explained. Specifically, Figure 4 The flowchart of a question generation method provided in one embodiment of this specification is shown, which specifically includes the following steps.

[0157] Step 402: Obtain the text to be processed and the target answer corresponding to the text to be processed.

[0158] Specifically, the text to be processed is: “XX Dance Party is the theme of a series of spoof advertisements for Program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si.” and the target answer is “Zhang San”.

[0159] Step 404: Perform named entity recognition on the text to be processed, and obtain the phrases in the text to be processed based on the named entity recognition results.

[0160] Specifically, based on NER technology, the text to be processed, “XX Dance Party is the theme of a series of parody advertisements for Program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si,” is subjected to named entity recognition. Based on the named entity recognition results, the following are obtained: “XX Dance Party,” “is,” “Program A,” “a series,” “parody advertisement,” “theme,” “Program A,” “is,” “Zhang San,” “created,” “Li Si,” “developed,” “late-night live TV comedy,” and “variety show.”

[0161] Step 406: Generate corresponding phrase tag information based on the phrases in the text to be processed, and construct the corresponding phrase structure graph according to the semantic relationship between the phrases.

[0162] Specifically, phrase tag information is generated for each obtained phrase, and a corresponding phrase structure graph is constructed based on the semantic structural relationship between each phrase.

[0163] Step 408: Input the text to be processed, the target answer, and the phrase tagging information into the encoder of the question generation model to obtain at least one initial phrase matrix and target answer matrix output by the encoder.

[0164] Specifically, the text to be processed, “XX Dance Party is the theme of a series of spoof advertisements for Program A. Program A is a late-night live TV comedy and variety show created by Zhang San and developed by Li Si,” along with the target answer “Zhang San,” and the corresponding phrase tagging information, are input into the encoder of the question generation model to obtain the initial phrase matrix corresponding to each phrase output by the encoder and the target answer matrix corresponding to the target answer “Zhang San.”

[0165] Step 410: Input each initial phrase matrix and the target answer matrix into the phrase classifier of the question generation model to obtain at least one key phrase matrix output by the phrase classifier.

[0166] Each initial phrase matrix and the target answer matrix corresponding to "Zhang San" are input into the phrase classifier in the question generation model to obtain at least one key phrase matrix output by the phrase classifier, such as the key phrase matrix of "XX dance party", the key phrase matrix of "is", and the key phrase matrix of "topic".

[0167] Step 412: Input each key phrase matrix and the phrase structure graph into the phrase sampler of the question generation model to obtain at least one associated phrase matrix output by the phrase sampler.

[0168] Specifically, each key phrase matrix and phrase structure graph is input into the phrase sampler in the question generation model to obtain at least one associated phrase matrix output by the phrase sampler, such as the "is" associated phrase matrix, the "topic" associated phrase matrix, and the "a series" associated phrase matrix.

[0169] Step 414: Input each key phrase matrix and each associated phrase matrix into the feature fusion unit of the question generation model to obtain at least one target key phrase matrix output by the feature fusion unit.

[0170] Specifically, each key phrase matrix and each associated phrase matrix are input into the feature fusion unit of the question generation model to obtain at least one target key phrase matrix output by the feature fusion unit.

[0171] Step 416: Input the at least one target key phrase matrix and the target answer matrix into the decoder of the question generation model to obtain the target question output by the decoder.

[0172] Specifically, the obtained target key matrix and target answer are input into the decoder of the question generation model to obtain the target question output by the decoder: "Who created the theme of a series of parody advertisements in a program called 'XX Dance Party'?"

[0173] The question generation method provided in this specification processes unstructured text data, making the input source no longer just a single sentence or dialogue stream. It determines the phrases for generating target questions based on phrase tagging information and phrase structure diagrams, thereby improving the diversity of generated target questions while ensuring accuracy.

[0174] It should be noted that the question generation method provided in the embodiments of this specification can be used in other fields of controllable text generation, such as summarizing, translation and other scenarios. The target questions generated based on the above question generation method can enrich the diversity of generated target questions. In the translation scenario, it can provide users with different translation questions while ensuring translation accuracy, thereby increasing the user's choice and reference value.

[0175] Corresponding to the above method embodiments, this specification also provides embodiments of a question generation apparatus. Figure 5 A schematic diagram of a question generation apparatus according to one embodiment of this specification is shown. Figure 5 As shown, the device includes:

[0176] The first acquisition module 502 is configured to acquire the text to be processed and the target answer corresponding to the text to be processed;

[0177] The tagging module 504 is configured to tag phrases in the text to be processed, and obtain phrase tagging information and phrase structure diagram;

[0178] The input module 506 is configured to input the text to be processed, the target answer, the phrase tagging information, and the phrase structure diagram into the question generation model, wherein the question generation model is used to generate questions corresponding to the text to be processed and the target answer;

[0179] The second acquisition module 508 is configured to acquire the target question output by the question generation model.

[0180] Optionally, the marking module 504 is further configured to:

[0181] Named entity recognition is performed on the text to be processed, and phrases in the text to be processed are obtained based on the named entity recognition results.

[0182] Generate corresponding phrase tag information based on the phrases in the text to be processed;

[0183] Construct the corresponding phrase structure diagram based on the semantic relationships between phrases.

[0184] Optionally, the question generation model includes an encoder, a phrase classifier, a phrase sampler, a feature fusion unit, and a decoder;

[0185] The input module 506 is further configured as follows:

[0186] The text to be processed, the target answer, and the phrase tagging information are input into the encoder to obtain at least one initial phrase matrix and a target answer matrix output by the encoder;

[0187] The at least one initial phrase matrix and the target answer matrix are input into the phrase classifier to obtain at least one key phrase matrix output by the phrase classifier;

[0188] Input the at least one key phrase matrix and the phrase structure graph into the phrase sampler to obtain at least one associated phrase matrix output by the phrase sampler;

[0189] The at least one key phrase matrix and the at least one associated phrase matrix are input into the feature fusion unit to obtain at least one target key phrase matrix output by the feature fusion unit;

[0190] The at least one target key phrase matrix and the target answer matrix are input into the decoder to obtain the target question output by the decoder.

[0191] Optionally, the input module 506 is further configured to:

[0192] Encode the text to be processed and the target answer to obtain the text encoding matrix corresponding to the text to be processed and the target answer matrix corresponding to the target answer.

[0193] The at least one initial phrase matrix is ​​determined in the text encoding matrix based on the phrase tagging information.

[0194] Optionally, the input module 506 is further configured to:

[0195] Determine the semantic association between the at least one initial phrase matrix and the target answer matrix;

[0196] Based on semantic associations, a score is assigned to the at least one initial phrase matrix to obtain the scoring results corresponding to the at least one initial phrase matrix;

[0197] Based on the scoring results corresponding to the at least one initial phrase matrix, the at least one key phrase matrix is ​​determined.

[0198] Optionally, the input module 506 is further configured to:

[0199] The initial phrase matrix corresponding to the scoring results that meet the preset conditions is determined as the key phrase matrix.

[0200] Optionally, the input module 506 is further configured to:

[0201] Determine at least one key phrase corresponding to the at least one key phrase matrix;

[0202] Determine the key phrase structure information corresponding to the at least one key phrase in the phrase structure diagram;

[0203] Determine the associated phrases corresponding to the at least one key phrase based on the structural information of the at least one key phrase;

[0204] At least one associated phrase matrix is ​​determined based on the at least one associated phrase.

[0205] Optionally, the input module 506 is further configured to:

[0206] By concatenating at least one key phrase matrix and at least one related phrase matrix, the at least one target key phrase matrix is ​​obtained.

[0207] Optionally, the device further includes a training module configured to:

[0208] Obtain first sample data and the sample questions corresponding to the first sample data, wherein the first sample data includes sample processing text, sample answer and sample phrase tagging information;

[0209] An initial question generation model is obtained by training based on the sample processed text, the sample answers, the sample phrase tagging information, and the sample questions;

[0210] Obtain the sample phrase structure diagram corresponding to the sample phrase tagging information;

[0211] Based on the sample processed text, the sample answer, the sample phrase tagging information, and the sample phrase structure diagram, the initial question generation model is trained to generate the question generation model.

[0212] Optionally, the training module is further configured to:

[0213] The sample processed text, the sample answer, and the sample phrase tagging information are input into the initial question generation model;

[0214] Obtain the predicted question output by the initial question generation model;

[0215] Calculate the loss value of the initial question generation model based on the sample questions and the predicted questions;

[0216] The model parameters of the initial question generation model are adjusted based on the loss value, and the initial question generation model is trained until the training stopping condition is met.

[0217] The question generation device provided in this specification includes: a first acquisition module configured to acquire a text to be processed and a target answer corresponding to the text to be processed; a tagging module configured to tag phrases in the text to be processed to obtain phrase tagging information and a phrase structure diagram; an input module configured to input the text to be processed, the target answer, the phrase tagging information and the phrase structure diagram into a question generation model, wherein the question generation model is used to generate a question corresponding to the text to be processed and the target answer; and a second acquisition module configured to acquire the target question output by the question generation model.

[0218] One embodiment of this specification implements the processing of unstructured text data, so that the input source is no longer just a single sentence or dialogue stream. Based on phrase tagging information and phrase structure graph, the phrases for generating target questions are determined, which improves the diversity of generated target questions while ensuring the accuracy of the generated target questions.

[0219] The above is a schematic scheme of a question generation device according to this embodiment. It should be noted that the technical solution of this question generation device and the technical solution of the question generation method described above belong to the same concept. For details not described in detail in the technical solution of the question generation device, please refer to the description of the technical solution of the question generation method described above.

[0220] Furthermore, in conjunction with the appendix Figure 6 Let's take the intelligent question-answering scenario as an example for explanation. Figure 6 The diagram illustrates a scenario application flowchart of a question generation method provided according to an embodiment of this specification, applied to an intelligent question answering scenario, specifically including the following steps.

[0221] Step 602: Obtain the text paragraph for intelligent question answering and the target answer corresponding to the text paragraph.

[0222] Step 604: Mark the phrases in the text paragraph to obtain phrase marking information and phrase structure diagram.

[0223] Step 606: Input the text paragraph, the target answer, the phrase tagging information, and the phrase structure diagram into the question generation model, wherein the question generation model is used to generate the text paragraph and the question corresponding to the target answer for intelligent question answering.

[0224] Step 608: Obtain the target question output by the question generation model.

[0225] This specification provides a question generation method in one embodiment, applied to an intelligent question-answering scenario. By acquiring a text paragraph and a target answer for the intelligent question-answering scenario, the method obtains the corresponding phrases in the text paragraph. In order for the question generation model to accurately identify the corresponding phrases in the text paragraph, the acquired phrases are marked to obtain phrase marking information. Based on the semantic relationship between the phrases, a corresponding phrase structure graph is constructed so that the question generation model can subsequently obtain the target question corresponding to the text paragraph and the target answer.

[0226] This description provides an embodiment that processes unstructured text data, ensuring the accuracy and consistency of the generated target questions while also improving the diversity of the generated target questions.

[0227] The above is an illustrative scheme of a question generation method applied to an intelligent question-answering scenario in this embodiment. It should be noted that the technical solution of this question generation method belongs to the same concept as the technical solution of the question generation method described above. For details not described in detail in the technical solution of the question generation method, please refer to the description of the technical solution of the question generation method described above.

[0228] Corresponding to the above method embodiments, this specification also provides embodiments of a question generation device applied to intelligent question-answering scenarios. Figure 7 This diagram illustrates a structural schematic of a question generation device provided in one embodiment of this specification, applied to an intelligent question-answering scenario. Figure 7 As shown, the device includes:

[0229] The text acquisition module 702 is configured to acquire a text paragraph for intelligent question answering and the target answer corresponding to the text paragraph;

[0230] The phrase tagging module 704 is configured to tag phrases in the text paragraph to obtain phrase tagging information and a phrase structure diagram.

[0231] The information input module 706 is configured to input the text paragraph, the target answer, the phrase tagging information, and the phrase structure diagram into the question generation model, wherein the question generation model is used to generate a text paragraph and a question corresponding to the target answer for intelligent question answering;

[0232] The question acquisition module 708 is configured to acquire the target question output by the question generation model.

[0233] This specification provides a question generation device in one embodiment, applied to an intelligent question-answering scenario. By acquiring a text paragraph and a target answer for the intelligent question-answering scenario, the device obtains the corresponding phrases in the text paragraph. In order for the question generation model to accurately identify the corresponding phrases in the text paragraph, the acquired phrases are marked to obtain phrase marking information. Based on the semantic relationship between the phrases, a corresponding phrase structure graph is constructed so that the question generation model can subsequently obtain the target question corresponding to the text paragraph and the target answer.

[0234] This description provides an embodiment that processes unstructured text data, ensuring the accuracy and consistency of the generated target questions while also improving the diversity of the generated target questions.

[0235] The above is a schematic scheme of a question generation device according to this embodiment. It should be noted that the technical solution of this question generation device and the technical solution of the question generation method described above belong to the same concept. For details not described in detail in the technical solution of the question generation device, please refer to the description of the technical solution of the question generation method described above.

[0236] Figure 8 A structural block diagram of a computing device 800 according to one embodiment of this specification is shown. The components of the computing device 800 include, but are not limited to, a memory 810 and a processor 820. The processor 820 is connected to the memory 810 via a bus 830, and a database 850 is used to store data.

[0237] The computing device 800 also includes an access device 840, which enables the computing device 800 to communicate via one or more networks 860. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 840 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.

[0238] In one embodiment of this specification, the above-described components of the computing device 800 and Figure 8 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 8The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0239] The computing device 800 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 800 can also be a mobile or stationary server.

[0240] The processor 820 executes computer-executable instructions, which, when executed by the processor, implement the steps of the above-described question generation method. The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above-described question generation method belong to the same concept. Details not described in detail in the technical solution of the computing device can be found in the description of the technical solution of the above-described question generation method.

[0241] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described question generation method.

[0242] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the question generation method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the question generation method described above.

[0243] An embodiment of this specification also provides a computer program, wherein when the computer program is executed in a computer, it causes the computer to perform the steps of the above-described question generation method.

[0244] The above is an illustrative example of a computer program according to this embodiment. It should be noted that the technical solution of this computer program and the technical solution of the question generation method described above belong to the same concept. Details not described in detail in the technical solution of the computer program can be found in the description of the technical solution of the question generation method described above.

[0245] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0246] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0247] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.

[0248] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0249] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.

Claims

1. A method for generating questions, comprising: Obtain the text to be processed and the target answer corresponding to the text to be processed; Tag phrases in the text to be processed to obtain phrase tagging information and phrase structure diagram; The text to be processed, the target answer, and the phrase tagging information are input into the encoder of the question generation model to obtain at least one initial phrase matrix and a target answer matrix output by the encoder; The at least one initial phrase matrix and the target answer matrix are input into the phrase classifier of the question generation model to obtain at least one key phrase matrix output by the phrase classifier; Input the at least one key phrase matrix and the phrase structure graph into the phrase sampler of the question generation model to obtain at least one associated phrase matrix output by the phrase sampler; The at least one key phrase matrix and the at least one associated phrase matrix are input into the feature fusion unit of the question generation model to obtain at least one target key phrase matrix output by the feature fusion unit; The at least one target key phrase matrix and the target answer matrix are input into the decoder of the question generation model, wherein the question generation model is used to generate questions corresponding to the text to be processed and the target answers; Obtain the target question output by the decoder of the question generation model.

2. The method as described in claim 1, wherein phrases in the text to be processed are marked to obtain phrase marking information and a phrase structure diagram, comprising: Named entity recognition is performed on the text to be processed, and phrases in the text to be processed are obtained based on the named entity recognition results. Generate corresponding phrase tag information based on the phrases in the text to be processed; Construct the corresponding phrase structure diagram based on the semantic relationships between phrases.

3. The method of claim 1, wherein obtaining at least one initial phrase matrix and a target answer matrix output by the encoder comprises: Encode the text to be processed and the target answer to obtain the text encoding matrix corresponding to the text to be processed and the target answer matrix corresponding to the target answer. The at least one initial phrase matrix is ​​determined in the text encoding matrix based on the phrase tagging information.

4. The method of claim 1, wherein obtaining at least one key phrase matrix output by the phrase classifier comprises: Determine the semantic association between the at least one initial phrase matrix and the target answer matrix; Based on semantic associations, a score is assigned to the at least one initial phrase matrix to obtain the scoring results corresponding to the at least one initial phrase matrix; Based on the scoring results corresponding to the at least one initial phrase matrix, the at least one key phrase matrix is ​​determined.

5. The method of claim 4, wherein determining the at least one key phrase matrix based on the scoring results corresponding to the at least one initial phrase matrix includes: The initial phrase matrix corresponding to the scoring results that meet the preset conditions is determined as the key phrase matrix.

6. The method of claim 1, wherein obtaining at least one associated phrase matrix output by the phrase sampler comprises: Determine at least one key phrase corresponding to the at least one key phrase matrix; Determine the key phrase structure information corresponding to the at least one key phrase in the phrase structure diagram; Determine the associated phrases corresponding to the at least one key phrase based on the structural information of the at least one key phrase; At least one associated phrase matrix is ​​determined based on the at least one associated phrase.

7. The method of claim 1, wherein obtaining at least one target key phrase matrix output by the feature fusion processor comprises: By concatenating at least one key phrase matrix and at least one related phrase matrix, the at least one target key phrase matrix is ​​obtained.

8. The method of claim 1, wherein the question generation model is trained using the following method: Obtain the first sample data and the sample questions corresponding to the first sample data, wherein, The first sample data includes sample processing text, sample answers, and sample phrase tagging information; An initial question generation model is obtained by training based on the sample processed text, the sample answers, the sample phrase tagging information, and the sample questions; Obtain the sample phrase structure diagram corresponding to the sample phrase tagging information; Based on the sample processed text, the sample answer, the sample phrase tagging information, and the sample phrase structure diagram, the initial question generation model is trained to generate the question generation model.

9. The method of claim 8, wherein an initial question generation model is trained based on the sample processed text, the sample answer, the sample phrase tagging information, and the sample question, comprising: The sample processed text, the sample answer, and the sample phrase tagging information are input into the initial question generation model; Obtain the predicted question output by the initial question generation model; Calculate the loss value of the initial question generation model based on the sample questions and the predicted questions; The model parameters of the initial question generation model are adjusted based on the loss value, and the initial question generation model is trained until the training stopping condition is met.

10. A method for generating questions, comprising: Obtain the text paragraphs for intelligent question answering and the target answers corresponding to those text paragraphs; Tag phrases in the text paragraph to obtain phrase tagging information and phrase structure diagram; The text paragraph, the target answer, and the phrase tagging information are input into the encoder of the question generation model to obtain at least one initial phrase matrix and a target answer matrix output by the encoder. The at least one initial phrase matrix and the target answer matrix are input into the phrase classifier of the question generation model to obtain at least one key phrase matrix output by the phrase classifier; Input the at least one key phrase matrix and the phrase structure graph into the phrase sampler of the question generation model to obtain at least one associated phrase matrix output by the phrase sampler; The at least one key phrase matrix and the at least one associated phrase matrix are input into the feature fusion unit of the question generation model to obtain at least one target key phrase matrix output by the feature fusion unit; the at least one target key phrase matrix and the target answer matrix are input into the decoder of the question generation model, wherein the question generation model is used to generate text paragraphs for intelligent question answering and questions corresponding to the target answers; Obtain the target question output by the decoder of the question generation model.

11. A question generation device, comprising: The first acquisition module is configured to acquire the text to be processed and the target answer corresponding to the text to be processed. A tagging module is configured to tag phrases in the text to be processed, and obtain phrase tagging information and a phrase structure diagram. An input module is configured to input the text to be processed, the target answer, and the phrase tagging information into the encoder of a question generation model to obtain at least one initial phrase matrix and a target answer matrix output by the encoder; input the at least one initial phrase matrix and the target answer matrix into the phrase classifier of the question generation model to obtain at least one key phrase matrix output by the phrase classifier; input the at least one key phrase matrix and the phrase structure graph into the phrase sampler of the question generation model to obtain at least one associated phrase matrix output by the phrase sampler; input the at least one key phrase matrix and the at least one associated phrase matrix into the feature fusion unit of the question generation model to obtain at least one target key phrase matrix output by the feature fusion unit; and input the at least one target key phrase matrix and the target answer matrix into the decoder of the question generation model, wherein the question generation model is used to generate questions corresponding to the text to be processed and the target answer; The second acquisition module is configured to acquire the target question output by the decoder of the question generation model.

12. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the question generation method according to any one of claims 1 to 10.

13. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the question generation method according to any one of claims 1 to 10.