Diversity problem generation method and system based on syntactic dependency graph joint embedding

By using a joint embedding method based on syntactic dependency graphs, the problem of single question generation in existing technologies is solved. Multiple context-dependent questions are generated, which are applicable to education, question answering, and dialogue domains, improving the diversity and efficiency of question generation.

CN116955565BActive Publication Date: 2026-05-22XI AN JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XI AN JIAOTONG UNIV
Filing Date
2023-07-27
Publication Date
2026-05-22

AI Technical Summary

Technical Problem

Existing question generation technologies struggle to generate diverse questions, especially in education, question answering, and dialogue domains, as they cannot effectively leverage context to generate multiple related but different questions.

Method used

We employ a joint embedding method based on syntactic dependency graphs, which constructs syntactic dependency graphs and generates multiple context-dependent questions through an answer selector, a co-attention mechanism encoder, a graph neural network, and a joint embedding representation decoder.

Benefits of technology

It enables the generation of multiple questions related to the context but with different content from a paragraph, improving the diversity of question generation, adapting to the needs of rapidly growing educational content, and reducing the cost of manual writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116955565B_ABST
    Figure CN116955565B_ABST
Patent Text Reader

Abstract

The application discloses a diversity question generation method and system based on syntax dependency graph joint embedding, and the diversity question generation method comprises the following steps: selecting an answer in a context by using an answer selector; encoding the context and the answer by using an encoder based on a co-attention mechanism to obtain a context representation of a perceived answer; constructing a syntax dependency graph of the context in the form of an adjacency matrix, and encoding the syntax dependency graph of the context by using a graph neural network to obtain a context representation of a perceived structure; splicing the context representation of the perceived structure and the context representation of the perceived answer to obtain a joint embedding representation of the context; and decoding the joint embedding representation of the context to obtain a generated question. The application solves the problem of single question generation in the prior art, improves the diversity of question generation, and enables the model to generate multiple questions related to a paragraph context but different in content, so that a one-to-many input-output mode is realized in a two-stage form.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer text processing technology, specifically relating to a method and system for generating diversity questions based on syntactic dependency graph joint embedding. Background Technology

[0002] Question generation technology is an artificial intelligence technique that aims to generate a fluent and context-appropriate question based on a given context and answer. Currently, question generation technology has been widely applied in several fields. Firstly, in education, although manually generated questions are widely used in actual teaching scenarios, the rapid growth of educational content has exceeded the capacity for manual question creation. Therefore, manually creating a large number of high-quality question sets is a time-consuming task requiring significant effort from human domain experts. Question generation technology can help teachers automatically construct more teaching questions to meet teaching needs. Secondly, in the question-answering domain, having sufficient question-answering datasets is crucial for tasks using deep learning models. Despite significant efforts in labeling data, the size of these datasets remains relatively limited due to the high cost and time consumption of labeling. Question generation technology can provide data augmentation for question-answering tasks, alleviating the problem of insufficient question-answering corpora without incurring manual costs. Finally, in the dialogue domain, question generation technology, as an important component of question-answering and dialogue systems, can provide more interactive possibilities, helping the system proactively ask questions and guide the dialogue.

[0003] Current research methods for question generation are mainly divided into two categories: rule-based methods and neural network model-based methods. Rule-based question generation is one of the earliest researched and used methods. It generates corresponding questions based on predefined rules or grammatical rules by analyzing the input text and answers. However, this method requires a large amount of manual design and rule writing, making it difficult to handle complex language expressions and contexts. Furthermore, due to the limitations of the rules, this method also struggles to generate diverse and innovative questions. With the continuous advancement of machine learning and deep learning technologies, the increasing popularity of data-driven learning methods, and the emergence of large-scale datasets, neural network-based question generation methods have gradually become mainstream. The main idea of ​​this method is to use deep neural networks to model the given context and answers, and generate grammatically correct and semantically clear questions by learning the linguistic rules and patterns in the data. However, from a macro perspective, existing research on question generation is largely a one-to-one input-output model. In real-world scenarios, for a long text paragraph, question generation should include multiple possible questions, rather than just one question per paragraph. Therefore, generating diverse questions is more relevant to practical applications because it simulates potential human behavior; for example, people often ask various questions based on their purpose and understanding of the context. Summary of the Invention

[0004] The purpose of this invention is to address the problems in the prior art by providing a method and system for generating diverse questions based on syntactic dependency graph joint embedding, which can generate multiple questions related to the context but with different content from a paragraph context.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] A diversity question generation method based on syntactic dependency graph joint embedding includes the following steps:

[0007] Use the answer selector to select the answer from the context;

[0008] An encoder based on a co-attention mechanism is used to encode the context and the answer to obtain a contextual representation of the perceived answer;

[0009] A syntactic dependency graph of the context is constructed in the form of an adjacency matrix, and a graph neural network is used to encode the syntactic dependency graph of the context to obtain a context representation of the perceptual structure.

[0010] By concatenating the contextual representation of the perceptual structure with the contextual representation of the perceptual answer, a joint embedding representation of the context is obtained;

[0011] Decoding the joint embedding representation of the context yields the generated question.

[0012] As a preferred embodiment, the use of an answer selector to select the answer from the context includes:

[0013] Answers are extracted using named entity recognition;

[0014] Use rule matching methods to identify the remaining answer information that cannot be identified by named entities;

[0015] For answer information that still cannot be identified after named entity recognition and rule matching methods, keywords or key phrases are extracted.

[0016] As a preferred approach, when using the rule-matching method to identify the remaining answer information that cannot be identified by named entities, the rules for identifying the answer information include: using the indefinite article "a / an" followed by a noun, using a conjunction with the first letter capitalized, using the definite article "the" followed by a noun, using the conjunctions "or" and "and" followed by a noun, and using the prepositions "by" and "of" followed by a noun.

[0017] As a preferred approach, the step of encoding the context and answer using a co-attention mechanism-based encoder to obtain a contextual representation of the perceived answer includes: segmenting the context and answer into word-level tokens, represented as D = {x1, x2, ..., x...} n} and A={a1,a2,…,a m Each word is represented by a pre-trained GloVe embedding; for words in the context, an answer-labeled embedding is also added; the context and answer embeddings are respectively input into two bidirectional LSTMs to obtain the corresponding initial context representation C0 and initial answer representation A0; to obtain the context representation of the perceived answer, the following operations are performed:

[0018] Calculate an alignment matrix Then, the alignment matrix is ​​normalized along the column and row directions respectively to obtain two attention matrices, S′ = softmax(S) and S″ = softmax(S′), where S′ represents the relevance of each answer word to all context words, and S″ represents the relevance of each context word to all answer words; the context-aware answer representation is updated to A′0 = C0·S′, and the answer-dependent context representation is updated to... The original context representation is concatenated with the answer-dependent context representation, and then encoded using a bidirectional LSTM to obtain the context representation that perceives the answer.

[0019] As a preferred embodiment, the construction of the syntactic dependency graph of the context in the form of an adjacency matrix includes:

[0020] For each single sentence in the context, a syntactic dependency tree is constructed, where each node of the syntactic dependency tree represents a word, and each edge represents a dependency relationship between two words. The steps of constructing the syntactic dependency tree include:

[0021] The input sentence is segmented according to symbols to obtain each word;

[0022] Each word is tagged with its part of speech to determine its part of speech in the sentence;

[0023] Based on the part of speech of each word in the sentence and the positional relationship between them, an initial dependency relation is constructed. In the dependency relation, each word is a node and the relationship between words is an edge.

[0024] Introduce a root node, which is not connected to other words in the dependency relationship, and use it as the root of the entire sentence, so that the sentence structure presents a tree structure.

[0025] Determine the headword in the dependency relationship, which satisfies the following two conditions: a) it is not the root node; b) each word has a dependency relationship with other words in the sentence;

[0026] Determine the type of dependency relationship. Dependency relationship types include subject-verb relationship, verb-object relationship, and attributive-adverbial relationship.

[0027] Construct a syntactic dependency tree for a sentence using its headword and dependency relation type.

[0028] As a preferred embodiment, the construction of the syntactic dependency graph of the context in the form of an adjacency matrix further includes:

[0029] Construct a syntactic dependency graph of the context based on the syntactic dependency tree using the following steps:

[0030] Construct an n×n adjacency matrix N, where n is the number of words in the context, and initialize all elements of the matrix to 0;

[0031] For each word mapped to an element in the matrix, if there is a dependency relationship between the words, the position between them is marked as 1, otherwise it is marked as 0;

[0032] By resolving pronoun references, connections between different sentences in a paragraph are established, spatial structural information is obtained, and sentence associations between paragraphs are realized.

[0033] As a preferred embodiment, the step of encoding the syntactic dependency graph of the context using a graph neural network to obtain a contextual representation of the perceptual structure includes:

[0034] Use the Stanford CoreNLP tool to segment the context, and then segment each word x.i As a node in the syntactic dependency graph, the embedding representation of each node is obtained by GloVe embedding, represented as follows: Then, a set of relations is obtained through syntactic dependency parsing, and the resulting syntactic dependency graph is represented as follows:

[0035] G = (V, E)

[0036] Where V represents the set of nodes, and E represents the set of edges connecting the nodes;

[0037] Calculate the contribution of each target node's neighboring nodes to the target node. Given a target node i and a neighboring node j, Let i be the set of all neighboring nodes of node i. The contribution of each neighboring node is calculated using the following formula:

[0038] e ij =LeakyReLU(a T [Wh x i;Wh xj ])

[0039] In the formula, W and a are learnable parameter matrices; LeakyReLU is a nonlinear activation function; the symbol “;” indicates a vector concatenation operation in the column direction;

[0040] The attention coefficient α is calculated using a normalization operation based on the contribution level. i,j :

[0041]

[0042] By aggregating the k-th layer information of neighboring node j of node i To update the representation of node i at level k+1

[0043]

[0044] In the formula, σ is the nonlinear activation function, and W1 is the parameter matrix;

[0045] After processing by a k-layer GNN encoder, the following contextual representation of the perceptual structure is obtained:

[0046]

[0047] in, This represents the state vector of node i at the k-th layer.

[0048] As a preferred embodiment, the concatenation of the context representation of the perceptual structure with the context representation of the perceived answer to obtain the joint embedding representation of the context includes, according to the following formula, the context representation H of the perceptual structure obtained by the graph neural network encoder.g The context representation C1 of the perceived answer is concatenated with the context representation H to obtain the joint embedding representation H of the context. d :

[0049] H d =[C1;H g ]

[0050] In the formula, the symbol “;” represents a vector concatenation operation in the column direction;

[0051] Decoding the joint embedding representation of the context yields the following generated questions:

[0052] Using a unidirectional LSTM to H d Decode the code and output the word in question. At each step t of the decoder, the hidden layer state is determined by the previous hidden layer state u. t-1 and the previous prediction information y in the output sequence t-1 Results:

[0053] u t =LSTM(u t-1 y t-1 )

[0054] Each time the hidden layer state is updated, the attention score r is calculated by reconsidering all hidden layer state vectors of the input sequence. t :

[0055] r t =H d T W d u t

[0056] In the formula, H d W is a joint embedding representation of the context. d Let u be the parameter matrix. t This represents the hidden state of the decoder at time t.

[0057] Use the Softmax function to evaluate the attention score r. t After normalization, the attention weights for each time step t are obtained:

[0058] a t =softmax(r t )

[0059] By cascading the original decoder hidden layer state vector u at time t... t and the attention-weighted state vector c t The final decoded state at time t is obtained.

[0060] ct =H d ·a t

[0061]

[0062] In the decoding stage, a copying mechanism based on the maximum output pointer and a pointer generation network strategy are used for decoding. The final word generation result is obtained by calculating the probability of copying words from the input and the probability of generating words from the vocabulary.

[0063] The probability P of generating from the vocabulary during the generation process vocab (w) is:

[0064]

[0065] Using the maximum output pointer strategy, when a repeated word appears, only the word with the maximum attention weight is selected for weight allocation, and words that do not appear in the input sequence are assigned a value of negative infinity.

[0066]

[0067] The probability P of copying the original text during the generation process copy (w) is:

[0068] P copy (w) = softmax(W) v sc t )

[0069] Then the probability P of generating the question word gen (w) is:

[0070] P gen (w)=p vocab (w)+p copy (w).

[0071] A diversity question generation system based on syntactic dependency graph joint embedding includes:

[0072] The answer selection module is used to select the answer from the context using an answer selector;

[0073] The context and answer encoding module is used to encode the context and answer using a co-attention mechanism-based encoder to obtain a contextual representation of the perceived answer;

[0074] The syntactic dependency graph construction and encoding module is used to construct the syntactic dependency graph of the context in the form of an adjacency matrix, and to encode the syntactic dependency graph of the context using a graph neural network to obtain the context representation of the perceptual structure.

[0075] The joint embedding representation acquisition module is used to concatenate the context representation of the perceptual structure with the context representation of the perceptual answer to obtain the joint embedding representation of the context;

[0076] The joint embedding representation decoding module is used to decode the joint embedding representation of the context to obtain the generated problem.

[0077] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the diversity problem generation method based on syntactic dependency graph joint embedding.

[0078] Compared with the prior art, the present invention has at least the following beneficial effects:

[0079] This invention uses an answer selector to choose different content from the context as the answer for that context. This answer information refers to continuous text segments within the context. An encoder based on a co-attention mechanism encodes the context and the answer to obtain a contextual representation of the perceived answer. A syntactic dependency graph of the context is constructed in the form of an adjacency matrix, and a graph neural network is used to encode the adjacency matrix to obtain a contextual representation of the perceived structure. By concatenating the contextual representation of the perceived answer with the contextual representation of the perceived structure, a joint embedding representation of the context is obtained. Decoding this joint embedding representation yields the generated question. This invention solves the problem of single question generation in previous methods, improving the diversity of question generation. It allows the model to generate multiple related but different questions for a given paragraph context. Compared to traditional one-to-one input / output models, this invention achieves a one-to-many input / output mode in a two-stage manner, completing the task of generating diverse questions. It can replace manual writing and is more suitable for the rapidly growing trend of educational content. Attached Figure Description

[0080] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.

[0081] Figure 1 Flowchart of a diversity problem generation method based on joint embedding of syntactic dependency graphs according to an embodiment of the present invention;

[0082] Figure 2 Distribution percentage of named entities according to embodiments of the present invention;

[0083] Figure 3 A schematic diagram illustrating the construction of the syntactic dependency tree in an embodiment of the present invention;

[0084] Figure 4 A schematic diagram of the model structure of the diversity problem generation method based on syntactic dependency graph joint embedding in this embodiment of the invention. Detailed Implementation

[0085] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, those skilled in the art can obtain other embodiments without creative effort.

[0086] Please see Figure 1 and Figure 4 The diversity problem generation method based on joint embedding of syntactic dependency graphs in this invention includes the following steps:

[0087] Step 1: Use the answer selector to select the answer from the context;

[0088] To ensure the quality and reasonableness of the extracted answers, data analysis was first performed on the large reading comprehension dataset SQuAD1.1. This dataset is one of the standard datasets in the field of natural language processing and is widely used to evaluate and compare models for tasks such as reading comprehension, question answering systems, and question generation. In SQuAD1.1, the answers are all derived from continuous text segments within the article.

[0089] First, the manually labeled answers in the dataset were analyzed using the Stanford CoreNLP tool. The distribution of named entities was as follows: Figure 2 As shown, in the SQuAD dataset, 68.2% of the answers belong to named entities, and 31.8% belong to non-named entities. Analysis reveals that human-annotated answers in articles or paragraphs tend to include proper nouns from named entities as answer information. Therefore, we first extract answers through named entity recognition to improve the quality and reasonableness of the answer selector.

[0090] Secondly, by analyzing the remaining 31.8% of manually annotated answers in the SQuAD dataset that were unrecognizable by named entities, we found that most human-annotated answers followed certain linguistic patterns. As shown in Table 1, these answers typically exhibit the following characteristics: using the indefinite articles "a / an" followed by a noun, using conjunctions with capitalized first letters, using the definite article "the" followed by a noun, using the conjunctions "or" and "and" with a noun, and using the prepositions "by" and "of" with a noun, etc. Therefore, based on these patterns, a rule-based method is used to identify the remaining answer information that named entities cannot recognize, further optimizing the performance of the answer selector.

[0091] Table 1

[0092]

[0093] Finally, even after using named entity recognition and rule matching, some information that humans had labeled as answers still failed to be identified. This information is usually composed of nouns or noun phrases, which have a certain degree of human subjectivity and are difficult to identify and extract according to certain rules. Therefore, the RAKE algorithm is used to extract keywords or key phrases from this information to maximize the performance of the answer extractor.

[0094] Step 2: Use an encoder based on a co-attention mechanism to encode the context and the answer to obtain a contextual representation of the perceived answer;

[0095] First, the context and answer are segmented into word-level tokens, represented as D = {x1, x2, ..., x...}. n} and A={a1,a2,…,a m Each word is represented by a pre-trained GloVe embedding. Additionally, for words in the context, an answer-tagged embedding is appended. The context and answer embeddings are fed into two bidirectional LSTMs respectively to obtain their initial context representations C0 and A0. To obtain the context representation of the perceived answer, the following operations are required:

[0096] First, calculate an alignment matrix. Then, the alignment matrix is ​​normalized along the column and row directions respectively to obtain two attention matrices, S′ = softmax(S) and S″ = softmax(S′), where S′ represents the relevance of each answer word to all context words, and S″ represents the relevance of each context word to all answer words. The context-aware answer representation can be updated to A′0 = C0·S′, and the answer-dependent context representation can be updated to... Finally, to enhance the interaction between context and answer, the original context representation is concatenated with the answer-dependent context representation, and then encoded using a bidirectional LSTM to obtain the context representation that perceives the answer.

[0097] Step 3: Construct the syntactic dependency graph of the context in the form of an adjacency matrix, and use a graph neural network to encode the syntactic dependency graph of the context to obtain the context representation of the perceptual structure;

[0098] For each sentence in the context, a syntactic dependency tree is constructed. Then, each syntactic dependency tree is traversed to construct a syntactic dependency graph of the context, and the relationships between the context sentences are established using the substitution resolution technique. Finally, a graph neural network is used to encode the syntactic dependency graph to obtain a context representation with rich structural information. The specific steps are as follows:

[0099] (a) Constructing a syntactic dependency graph of the context;

[0100] 1. Construct a syntactic dependency tree for each sentence in the context;

[0101] like Figure 3 As shown, a syntactic dependency tree is a tree-like structure that represents the dependency relationships between words in a sentence. Each node in the tree represents a word, and each edge represents a dependency relationship between two words. The specific construction steps are as follows:

[0102] Word segmentation: The input sentence is segmented into individual words based on symbols such as spaces.

[0103] Part-of-speech tagging: Tagging each word for its part of speech, that is, determining the part of speech of each word in the sentence.

[0104] Syntactic analysis: Based on the part of speech of each word in the sentence and the positional relationships between them, an initial dependency relation is constructed. In the dependency relation, each word is treated as a node, and the relationship between words is treated as an edge.

[0105] Introducing the root node: To construct a complete syntactic dependency tree, a root node is needed. The root node is not connected to other words in the dependency relationship; instead, it serves as the root of the entire sentence, making the sentence structure a tree-like structure.

[0106] Determining the headword: In dependency relationships, each word has a headword, which is the word that has a dependency relationship with that word. The headword must meet the following two conditions: a) the headword cannot be the root node; b) every word must have a headword, meaning every word must have a dependency relationship with other words in the sentence.

[0107] Determine the dependency relationship type: In a dependency tree, each edge represents a dependency relationship between two words, and the dependency relationship type needs to be determined. Dependency relationship types include subject-verb, verb-object, and attributive-adverbial relationships, etc.

[0108] Constructing a dependency tree: By determining the headword and the type of dependency relation, a syntactic dependency tree of a sentence can be constructed.

[0109] 2. Construct a syntactic dependency graph of the context based on the syntactic dependency tree;

[0110] After obtaining the syntactic dependency trees for all sentences, we can construct a syntactic dependency graph using their dependency information. Nodes represent words, and edges represent dependency relationships between words. Here, an adjacency matrix is ​​used to represent the syntactic dependency graph. If there is a dependency relationship between words, the position between them is marked as 1; otherwise, it is marked as 0. The specific operations are as follows:

[0111] Construct an n×n adjacency matrix N, where n represents the number of words in the context. Initialize all elements in the matrix to 0.

[0112] For each element in the matrix that maps to a word, if there is a dependency relationship between the words, the position between them is marked as 1; otherwise, it is marked as 0. That is, if the value of the element N[i][j] in the matrix is ​​1, it means that there is a dependency relationship between word i and word j; if the value of N[i][j] is 0, it means that there is no dependency relationship between word i and word j.

[0113] Finally, by resolving pronouns, connections between different sentences in a paragraph are established, resulting in richer spatial structural information at the paragraph level, thereby achieving sentence association between paragraphs.

[0114] (II) Encoding Syntactic Dependency Graphs Using Graph Neural Networks

[0115] Use the Stanford CoreNLP tool to segment the context, and then segment each word x. i As a node in the syntactic dependency graph, the embedding representation of each node is obtained by GloVe embedding, represented as follows: Then, through syntactic dependency parsing, a set of relations can be obtained, ultimately resulting in a syntactic dependency graph representation as follows:

[0116] G = (V, E)

[0117] Where V represents the set of nodes, and E represents the set of edges connecting the nodes.

[0118] To enrich the representation of nodes, it is necessary to calculate the contribution of each node's neighboring nodes to that node. Given a target node i and a neighboring node j, Let i be the set of all neighboring nodes of node i.

[0119] The contribution of adjacent nodes is calculated as follows:

[0120] e ij =LeakyReLU(a T [Wh xi ;Wh xj ])

[0121] In the formula, W and a are learnable parameter matrices; LeakyReLU is a nonlinear activation function; the symbol “;” indicates a vector concatenation operation in the column direction.

[0122] The attention coefficient α is calculated using a normalization operation based on the relevant contribution. i,j :

[0123]

[0124] Information from the k-th layer of neighbor node j of aggregation node i To update the representation of node i at level k+1

[0125]

[0126] In the formula, σ is the nonlinear activation function, and W1 is the parameter matrix.

[0127] After processing by a k-layer GNN encoder, the following state representation is obtained:

[0128]

[0129] in, This represents the state vector of node i at the k-th layer.

[0130] Step 4: By using the contextual representation H of the perceptual structure obtained from the graph neural network encoder... g The context representation C1 of the perceived answer is concatenated with the context representation H to obtain the joint embedding representation H of the context. d :

[0131] H d =[C1;H g ]

[0132] Step 5: Decode the joint embedding representation of the context to obtain the generated question;

[0133] Using a unidirectional LSTM to H d Decode the code and output the word in question. At each step t of the decoder, the hidden layer state is determined by the previous hidden layer state u. t-1 and the previous prediction information y in the output sequence t-1 Results:

[0134] u t =LSTM(u t-1 y t-1 )

[0135] An attention mechanism is used in the decoding process, that is, each time the hidden layer state is updated, the attention score r is calculated by reconsidering all the hidden layer state vectors of the input sequence.t :

[0136] r t =H d T W d u t

[0137] In the formula, H d W is a joint embedding representation of the context. d Let u be the parameter matrix. t This represents the hidden state of the decoder at time t.

[0138] The attention matrix was normalized using the Softmax function to obtain the attention weights at each time step t:

[0139] a t =softmax(r t )

[0140] Finally, by concatenating the original decoder hidden layer state vector u at time t... t and the attention-weighted state vector c t The final decoded state at time t is obtained.

[0141] c t =H d ·a t

[0142]

[0143] In the decoding stage, a copying mechanism based on the maximum output pointer and a pointer generation network strategy are used for decoding. This strategy calculates the probability of copying a word from the input and the probability of generating a word from the vocabulary to obtain the final word generation result.

[0144] The probability P of generating from the vocabulary during the generation process vocab (w) is:

[0145]

[0146] When calculating the duplication probability, it's necessary to consider the possibility of word repetition in the input sequence, with some words appearing more frequently. This can lead to a large sum of attention weights for these words, negatively impacting the quality of the generated result and causing some unimportant words to receive excessive weights. To address this issue, a maximum output pointer strategy is used: when a repeated word appears, only the word with the highest attention weight is selected for weight allocation. Simultaneously, words not appearing in the input sequence are assigned a negative infinity value. Specifically, this strategy is implemented as follows:

[0147]

[0148] The probability P of copying the original text during the generation process copy (w) is:

[0149] P copy (w) = softmax(W) v sc t )

[0150] The probability P of generating the final question word gen (w) is represented as:

[0151] P gen (w)=p vocab (w)+p copy (w)

[0152] The following experimental verification demonstrates the performance and effectiveness of the diversity problem generation method based on syntactic dependency graph joint embedding in the embodiments of the present invention.

[0153] Furthermore, this invention uses multiple performance metrics to measure the performance of the answer selector on the SQuAD dataset, including recall, average number of questions per paragraph, and dataset size. For evaluation, manually annotated answers from the SQuAD dataset are used as labeled samples, and the answers extracted by the answer selector are used as prediction samples. Experimental results show that the answer selector proposed in this invention has good performance, validating its effectiveness.

[0154] As shown in Table 2, in the original dataset, each paragraph contained an average of 4.68 questions, and the dataset size was 98,169 entries. After adding Robert-NER-based named entity recognition, the recall rate for exact matching was 0.65, the average number of questions per paragraph was 13.83, and the dataset size expanded to 289,993 entries. After adding rule-based matching, the recall rate for exact matching increased to 0.76, the average number of questions per paragraph was 17.62, and the dataset size expanded to 369,602 entries. After adding keyword extraction based on the RAKE algorithm, the recall rate for exact matching further increased to 0.83, the average number of questions per paragraph was 23.22, and the dataset size expanded to 487,069 entries. Furthermore, under the condition of using fuzzy matching, the combination of NER + rule-based + RAKE algorithms achieved the best performance, with a recall rate as high as 0.92. These data show that adding NER, rules, and the RAKE algorithm to the answer selector can effectively improve the performance of the answer selector, making it more accurate and efficient in extracting multiple different answers, and fully meeting the task requirements for answer extraction.

[0155] Table 2

[0156]

[0157] As shown in Table 3, the experiment compared the performance of different models in terms of diversity. The metrics used included Dist1-par, Dist2-par, Dist3-par, Dist4-par, Self-B3, and Self-B4. Higher scores on Dist1 to Dist4 indicators indicate better diversity in the generated questions, while lower scores on Self-B3 and Self-B4 indicators also represent better diversity. Furthermore, the metric calculation method used in this invention differs from existing methods. Existing methods calculate metrics within a corpus, while this invention calculates them within the set of questions generated for each paragraph, taking the average score of all paragraphs as the final score.

[0158] Table 3

[0159]

[0160] Specifically, this invention selected Beam-3 and Beam-5 as the most basic comparative models. These models generate multiple questions based on different beam searches during the decoding stage of the question generation model, achieving question diversity. Experimental results show that relying solely on beam search to achieve question diversity has limited effectiveness, performing worse than other models across various metrics. Next, this invention selected the S2sa and MT2SAtt models based on seq2seq models, as well as the pre-trained T5 model, as comparative models. Experimental results show that these models outperform the beam search-based models in terms of diversity, but still have certain limitations. Through the above analysis and experimental results, it can be seen that the method proposed in this invention performs excellently across various metrics, especially in Dist1-par, Dist2-par, Self-B3, and Self-B4 metrics. This indicates that the diverse question generation method based on syntactic dependency graph joint embedding of this invention can generate more diverse and unique questions, and can also be distinguished from other models.

[0161] Another embodiment of the present invention proposes a diversity question generation system based on joint embedding of syntactic dependency graphs, comprising:

[0162] The answer selection module is used to select the answer from the context using an answer selector;

[0163] The context and answer encoding module is used to encode the context and answer using a co-attention mechanism-based encoder to obtain a contextual representation of the perceived answer;

[0164] The syntactic dependency graph construction and encoding module is used to construct the syntactic dependency graph of the context in the form of an adjacency matrix, and to encode the syntactic dependency graph of the context using a graph neural network to obtain the context representation of the perceptual structure.

[0165] The joint embedding representation acquisition module is used to concatenate the context representation of the perceptual structure with the context representation of the perceptual answer to obtain the joint embedding representation of the context;

[0166] The joint embedding representation decoding module is used to decode the joint embedding representation of the context to obtain the generated problem.

[0167] Another embodiment of the present invention also proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the diversity problem generation method based on syntactic dependency graph joint embedding.

[0168] For example, the instructions stored in the memory can be divided into one or more modules / units. These modules / units are stored in a computer-readable storage medium and executed by the processor to complete the diversity problem generation method based on syntactic dependency graph joint embedding of the present invention. The one or more modules / units can be a series of computer-readable instruction segments capable of performing specific functions, which describe the execution process of the computer program in the server.

[0169] The electronic device may be a smartphone, laptop, PDA, or cloud server, among other computing devices. It may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the electronic device may also include more or fewer components, or combinations of certain components, or different components; for example, it may also include input / output devices, network access devices, buses, etc.

[0170] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0171] The memory can be an internal storage unit of the server, such as a hard drive or RAM. Alternatively, it can be an external storage device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, the memory can include both internal and external storage units. The memory is used to store computer-readable instructions and other programs and data required by the server. It can also be used to temporarily store data that has been output or will be output.

[0172] It should be noted that the information interaction and execution process between the above-mentioned module units are based on the same concept as the method embodiment. For details on their specific functions and technical effects, please refer to the method embodiment section. They will not be repeated here.

[0173] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0174] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.

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

[0176] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A method for generating diversity questions based on joint embedding of syntactic dependency graphs, characterized in that, Includes the following steps: Use the answer selector to select the answer from the context; An encoder based on a co-attention mechanism is used to encode the context and the answer to obtain a contextual representation of the perceived answer; A syntactic dependency graph of the context is constructed in the form of an adjacency matrix, and a graph neural network is used to encode the syntactic dependency graph of the context to obtain a context representation of the perceptual structure. By concatenating the contextual representation of the perceptual structure with the contextual representation of the perceptual answer, a joint embedding representation of the context is obtained; Decoding the joint embedding representation of the context yields the generated question; The use of an answer selector to select the answer from the context includes: Answers are extracted using named entity recognition; Use rule matching methods to identify the remaining answer information that cannot be identified by named entities; For answer information that still cannot be identified after named entity recognition and rule matching methods, keywords or key phrases are extracted.

2. The diversity problem generation method based on joint embedding of syntactic dependency graphs according to claim 1, characterized in that, When using the rule-matching method to identify the remaining answer information that cannot be identified by named entities, the rules for identifying the answer information include: using the indefinite article "a / an" followed by a noun, using a conjunction with the first letter capitalized, using the definite article "the" followed by a noun, using the conjunctions "or" and "and" followed by a noun, and using the prepositions "by" and "of" followed by a noun.

3. The diversity problem generation method based on joint embedding of syntactic dependency graphs according to claim 1, characterized in that, The process of encoding the context and answer using a co-attention mechanism-based encoder to obtain a contextual representation of the perceived answer includes: segmenting the context and answer into word-level tokens, represented as follows: and Each word is represented by a pre-trained GloVe embedding; for words in the context, an answer tag embedding is also added; the context and answer embeddings are respectively input into two bidirectional LSTMs to obtain the corresponding initial context representation. and the initial answer representation To obtain a contextual representation of the perceived answer, the following operations are performed: Calculate an alignment matrix Then, the alignment matrix is ​​normalized along the column and row directions respectively to obtain two attention matrices, which are respectively and ,in This indicates the relevance of each answer word to all context words. This represents the relevance of each context word to all answer words; the context-aware answer representation is updated as follows: The context representation, depending on the answer, is updated to The original context representation is concatenated with the answer-dependent context representation, and then encoded using a bidirectional LSTM to obtain the context representation that perceives the answer. .

4. The diversity problem generation method based on joint embedding of syntactic dependency graphs according to claim 1, characterized in that, The syntactic dependency graph for constructing the context in the form of an adjacency matrix includes: For each single sentence in the context, a syntactic dependency tree is constructed, where each node of the syntactic dependency tree represents a word, and each edge represents a dependency relationship between two words. The steps of constructing the syntactic dependency tree include: The input sentence is segmented according to symbols to obtain each word; Each word is tagged with its part of speech to determine its part of speech in the sentence; Based on the part of speech of each word in the sentence and the positional relationship between them, an initial dependency relation is constructed. In the dependency relation, each word is a node and the relationship between words is an edge. Introduce a root node, which is not connected to other words in the dependency relationship, and use it as the root of the entire sentence, so that the sentence structure presents a tree structure. Determine the headword in the dependency relationship, which satisfies the following two conditions: a) it is not the root node; b) each word has a dependency relationship with other words in the sentence; Determine the type of dependency relationship. Dependency relationship types include subject-verb relationship, verb-object relationship, and attributive-adverbial relationship. Construct a syntactic dependency tree for a sentence using its headword and dependency relation type.

5. The diversity problem generation method based on joint embedding of syntactic dependency graphs according to claim 4, characterized in that, The construction of the context's syntactic dependency graph in the form of an adjacency matrix also includes: Construct a syntactic dependency graph of the context based on the syntactic dependency tree using the following steps: Construct an n×n adjacency matrix N, where n is the number of words in the context, and initialize all elements of the matrix to 0; For each word mapped to an element in the matrix, if there is a dependency relationship between the words, the position between them is marked as 1, otherwise it is marked as 0; By resolving pronoun references, connections between different sentences in a paragraph are established, spatial structural information is obtained, and sentence associations between paragraphs are realized.

6. The diversity problem generation method based on joint embedding of syntactic dependency graphs according to claim 1, characterized in that, The process of encoding the syntactic dependency graph of the context using a graph neural network to obtain the contextual representation of the perceptual structure includes: Use the Stanford CoreNLP tool to segment the context, and then segment each word. As a node in the syntactic dependency graph, the embedding representation of each node is obtained by GloVe embedding, represented as follows: Then, a set of relations is obtained through syntactic dependency parsing, and the resulting syntactic dependency graph is represented as follows: in, Represents a set of nodes. This represents the set of edges connecting all nodes; Calculate the contribution of each target node's neighboring nodes to the target node, given a target node. and an adjacent node , ∈ ( ), ( ) is a node i The set of all neighboring nodes, and the contribution of adjacent nodes is calculated by the following formula: In the formula, , It is a learnable parameter matrix; This is a non-linear activation function; the symbol ";" indicates a vector concatenation operation in the column direction. The attention coefficient is calculated using a normalization operation based on the contribution level. : Through aggregation nodes i neighboring nodes j The k Layer information To update the number k +1 layer nodes i The representation of : In the formula, It is a non-linear activation function. For parameter matrices; After processing by a k-layer GNN encoder, the following contextual representation of the perceptual structure is obtained: in, Represents a node i In the k The state vector of the layer.

7. The diversity problem generation method based on joint embedding of syntactic dependency graphs according to claim 1, characterized in that, The step of concatenating the context representation of the perceptual structure with the context representation of the perceived answer to obtain the joint embedding representation of the context includes, according to the following formula, combining the context representation of the perceptual structure obtained by the graph neural network encoder. Contextual representation of perceived answers Perform a concatenation operation to obtain a joint embedding representation of the context. : In the formula, the symbol ";" represents a vector concatenation operation in the column direction; Decoding the joint embedding representation of the context yields the following generated questions: Using a unidirectional LSTM pair Decode the code and output the word in question. At each step t of the decoder, the hidden layer state is determined by the previous hidden layer state. and the previous prediction information in the output sequence Results: Each time the hidden layer state is updated, the attention score is calculated by reconsidering all hidden layer state vectors of the input sequence. : In the formula, For the context of the joint embedding representation, For parameter matrices, This represents the hidden state of the decoder at time t. Attention score was calculated using the Softmax function. After normalization, the attention weights for each time step t are obtained: By cascading the original decoder hidden layer state vector at time t and the attention-weighted state vector The final decoded state at time t is obtained. : In the decoding stage, a copying mechanism based on the maximum output pointer and a pointer generation network strategy are used for decoding. The final word generation result is obtained by calculating the probability of copying words from the input and the probability of generating words from the vocabulary. The probability of generating from the vocabulary during the generation process for: Using the maximum output pointer strategy, when a repeated word appears, only the word with the maximum attention weight is selected for weight allocation, and words that do not appear in the input sequence are assigned a value of negative infinity. The probability of copying the original text during the generation process. for: Then the probability of generating the question word for: 。 8. A diversity question generation system based on joint embedding of syntactic dependency graphs, characterized in that, include: The answer selection module is used to select the answer from the context using an answer selector; The use of an answer selector to select the answer from the context includes: Answers are extracted using named entity recognition; Use rule matching methods to identify the remaining answer information that cannot be identified by named entities; For answer information that still cannot be identified after name entity recognition and rule matching methods, keywords or key phrases are extracted. The context and answer encoding module is used to encode the context and answer using a co-attention mechanism-based encoder to obtain a contextual representation of the perceived answer; The syntactic dependency graph construction and encoding module is used to construct the syntactic dependency graph of the context in the form of an adjacency matrix, and to encode the syntactic dependency graph of the context using a graph neural network to obtain the context representation of the perceptual structure. The joint embedding representation acquisition module is used to concatenate the context representation of the perceptual structure with the context representation of the perceptual answer to obtain the joint embedding representation of the context; The joint embedding representation decoding module is used to decode the joint embedding representation of the context to obtain the generated problem.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the diversity problem generation method based on syntactic dependency graph joint embedding as described in any one of claims 1 to 7.