Document-based Question Generation Method, Apparatus and Server

By performing semantic analysis and association graph generation of multi-level titles of documents, and using preset problem generation models, the problem of inaccurate generation of long documents in the existing technology is solved, and the full text analysis and semantic accuracy of longer documents are improved.

CN115688792BActive Publication Date: 2025-08-05INDUSTRIAL AND COMMERCIAL BANK OF CHINA +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211182177.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-27
Publication Date
2025-08-05
Estimated Expiration
2042-09-27

AI Technical Summary

Technical Problem

In the prior art, based on the problem generation model, only problems with shorter documents can be generated, and answers to longer documents cannot be accurately generated, resulting in poor semantic accuracy of generating problems.

Method used

By obtaining the hierarchical relationship of the multi-level title of the document to be analyzed, semantic analysis processing is performed, semantic correlation diagrams are generated, and a preset problem generation model is used to predict the semantic correlation diagrams to generate target problem information.

Benefits of technology

The full text analysis of longer documents is realized, the semantic accuracy of target problem information is improved, and the problem of poor semantic accuracy of the generation problem is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115688792B_ABST
    Figure CN115688792B_ABST
Patent Text Reader

Abstract

The present application provides a document-based question generation method, device and server, which relates to document processing technology. The method includes: obtaining a document to be analyzed; wherein the document to be analyzed includes multi-level titles, and there is a hierarchical relationship between the multi-level titles. According to the hierarchical relationship of the multi-level titles in the document to be analyzed, the document to be analyzed is semantically parsed to obtain semantic information at each level. According to the semantic information at each level, a semantic association graph of the document to be analyzed is generated. Questions are predicted on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed. The method of the present application improves the semantic accuracy of the target question information and solves the technical problem of poor semantic accuracy of generated questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to document processing technology, and in particular to a document-based question generation method, device and server. Background Art

[0002] At present, in order to better realize question-answering interaction, it is necessary to obtain a question generation model based on the correspondence between documents and their questions.

[0003] In the prior art, a shorter document is usually trained based on a formulated question template to obtain a question generation model for predicting document questions, and questions for the shorter document are generated according to the question generation model.

[0004] However, in the prior art, since only questions of shorter documents can be generated based on the question generation model, accurate questions cannot be generated for longer answers, resulting in poor semantic accuracy of the generated questions. Summary of the Invention

[0005] The present application provides a document-based question generation method, device and server to solve the technical problem of poor semantic accuracy of generated questions.

[0006] In a first aspect, the present application provides a document-based question generation method, comprising:

[0007] Obtaining a document to be analyzed; wherein the document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles;

[0008] Performing semantic parsing on the document to be analyzed according to the hierarchical relationship of the multi-level titles in the document to be analyzed to obtain semantic information at each level;

[0009] Generate a semantic association graph of the document to be analyzed based on the semantic information at each level;

[0010] Question prediction is performed on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed; wherein, the question generation model is trained based on a plurality of preset question-answer pair data, and the answers in the question-answer pair data are documents.

[0011] Furthermore, the semantic parsing process is performed on the document to be analyzed based on the hierarchical relationship of the multi-level titles in the document to be analyzed to obtain semantic information at each level, including:

[0012] Segmenting the document to be analyzed according to the hierarchical relationship of the multi-level titles of the document to be analyzed to obtain text blocks under each level; wherein the text blocks include the title of the level to which the text blocks belong and the text content under the title;

[0013] The text blocks at each level are semantically parsed to obtain the semantic information of the text blocks at each level.

[0014] Furthermore, the semantic parsing process is performed on the text blocks at each level to obtain the semantic information of the text blocks at each level, including:

[0015] Segmenting the title in the text block at each level, and determining a part-of-speech tag and a named entity tag for each segmented word;

[0016] Determine the part-of-speech tags as noun participles and / or named entity tags as core words, and form a title core word set;

[0017] Filtering out a set of sentences containing the core words in the text content;

[0018] The sentences in the sentence set containing the core words are semantically parsed to obtain semantic information of the text blocks at each level; wherein the semantic information includes the part-of-speech tags of the segmented words in the sentences, the named entity tags, the parsed original text containing the segmented words, and the dependency syntactic relationship.

[0019] Furthermore, generating a semantic association graph of the document to be analyzed based on the semantic information at each level includes:

[0020] Based on the semantic information at each level, in the text content at each level, determine other entity tags in the sentence where the core word is located, dependent participles in the sentence where the core word is located that have a dependency syntactic relationship with the core word, and other participles in the sentence where the core word is located;

[0021] The core words of the title core word set are all taken as root nodes and are connected in a directed manner according to the order of appearance in the title. The named entity tags, the other entity tags, and the dependency participles are all taken as first-level nodes, and the edge relationship points to the core words. The other participles that have a dependency syntactic relationship with the named entity tags and / or the other entity tags, and the other participles that have a dependency syntactic relationship with the dependency participles are all taken as second-level nodes to generate a semantic association graph of the document to be analyzed.

[0022] Furthermore, the method further comprises:

[0023] Get multiple documents;

[0024] Performing segmentation and semantic analysis on each of the documents to obtain semantic information of the document; and generating a semantic association graph of the document based on the semantic information of the document;

[0025] According to the preset questions corresponding to each of the documents, question-answer pair data are determined; and according to the question-answer pair data and the semantic association graph, question generation training is performed on the initial model to generate a question generation model.

[0026] In a second aspect, the present application provides a document-based question generation device, comprising:

[0027] A first acquisition unit is configured to acquire a document to be analyzed, wherein the document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles;

[0028] A parsing unit, configured to perform semantic parsing on the document to be analyzed according to the hierarchical relationship of the multi-level headings in the document to be analyzed, and obtain semantic information at each level;

[0029] A first generating unit, configured to generate a semantic association graph of the document to be analyzed based on the semantic information at each level;

[0030] A prediction unit is used to perform question prediction on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed; wherein, the question generation model is trained based on multiple preset question-answer pair data, and the answer in the question-answer pair data is a document.

[0031] Furthermore, the parsing unit includes:

[0032] a segmentation module for segmenting the document to be analyzed according to the hierarchical relationship of the multi-level titles of the document to be analyzed to obtain text blocks under each level; wherein the text blocks include the titles of the level to which the text blocks belong and the text content under the titles;

[0033] The parsing module is used to perform semantic parsing on the text blocks at each level to obtain the semantic information of the text blocks at each level.

[0034] Furthermore, the analysis module includes:

[0035] A word segmentation submodule is used to segment the title in the text block at each level and determine the part-of-speech tag and named entity tag of each segmented word;

[0036] A determination submodule is used to determine the part-of-speech tag as a noun participle and / or the named entity tag as a core word, and form a title core word set;

[0037] A filtering submodule, configured to filter out a set of sentences containing the core words from the text content;

[0038] The parsing submodule is used to perform semantic parsing on the sentences containing the core words in the sentence set to obtain semantic information of the text blocks at each level; wherein the semantic information includes the part-of-speech tags of the segmented words in the sentence, the named entity tags, the parsed original text containing the segmented words, and the dependency syntactic relationship.

[0039] Furthermore, the first generating unit includes:

[0040] a determination module for determining, based on the semantic information at each level and in the text content at each level, other entity tags in the sentence containing the core word, dependent participles in the sentence containing the core word that have a dependency syntactic relationship with the core word, and other participles in the sentence containing the core word;

[0041] A generation module is used to take the core words of the title core word set as root nodes and connect them in a directed manner according to the order of appearance in the title, take the named entity tags, the other entity tags, and the dependent participles as first-level nodes, with the edge relationship pointing to the core words, and take the other participles that have a dependency syntactic relationship with the named entity tags and / or the other entity tags, and the other participles that have a dependency syntactic relationship with the dependency participles as second-level nodes to generate a semantic association graph of the document to be analyzed.

[0042] Furthermore, the device further comprises:

[0043] A second acquiring unit, configured to acquire a plurality of documents;

[0044] A second generating unit is configured to perform segmentation and semantic analysis on each of the documents to obtain semantic information of the document; and to generate a semantic association graph of the document based on the semantic information of the document;

[0045] The training unit is used to determine question-answer pair data based on preset questions corresponding to each of the documents; and to perform question generation training on the initial model based on the question-answer pair data and the semantic association graph to generate a question generation model.

[0046] In a third aspect, the present application provides a server comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the method described in the first aspect is implemented.

[0047] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.

[0048] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.

[0049] The present application provides a document-based question generation method, device and server, which obtain a document to be analyzed; wherein the document to be analyzed includes multi-level titles, and there is a hierarchical relationship between the multi-level titles. According to the hierarchical relationship of the multi-level titles in the document to be analyzed, the document to be analyzed is semantically parsed to obtain semantic information at each level. According to the semantic information at each level, a semantic association graph of the document to be analyzed is generated. Questions are predicted on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed; wherein the question generation model is trained based on multiple preset question-answer pair data, and the answers in the question-answer pair data are documents. In this solution, according to the hierarchical relationship of the multi-level titles in the document to be analyzed, the document to be analyzed is semantically parsed to obtain semantic information at each level, and a semantic association graph of the document to be analyzed is generated based on the semantic information at each level. Since the question generation model is trained based on multiple preset question-answer pair data, question prediction processing on the semantic association graph according to the preset question generation model can obtain target question information of the document to be analyzed. Therefore, for longer documents, we can perform semantic parsing on the document and predict and generate target question information through the hierarchical relationship between the multi-level titles of the document, thereby achieving full-text parsing of longer texts, improving the semantic accuracy of the target question information, and solving the technical problem of poor semantic accuracy of generated questions. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0051] Figure 1 A flowchart of a document-based question generation method provided in an embodiment of the present application;

[0052] Figure 2 A flowchart of another document-based question generation method provided in an embodiment of the present application;

[0053] Figure 3 A flowchart of another document-based question generation method provided in an embodiment of the present application;

[0054] Figure 4 A flowchart of another document-based question generation method provided in an embodiment of the present application;

[0055] Figure 5A flowchart of another training problem generation model provided in an embodiment of the present application;

[0056] Figure 6 A schematic diagram of the structure of a document-based question generation device provided in an embodiment of the present application;

[0057] Figure 7 A schematic diagram of the structure of another document-based question generation device provided in an embodiment of the present application;

[0058] Figure 8 A schematic diagram of the structure of a server provided in an embodiment of the present application.

[0059] The above-mentioned figures illustrate specific embodiments of the present disclosure, which will be described in more detail below. These figures and the textual description are not intended to limit the scope of the present disclosure in any way, but rather to illustrate the concepts of the present disclosure to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0060] Exemplary embodiments are described in detail herein, with examples illustrated in the accompanying drawings. When the following description refers to the drawings, identical numerals in different drawings represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present disclosure.

[0061] In one example, a question generation model is typically trained on short documents based on a specific question template to predict document questions. Questions for shorter documents are then generated based on the question generation model. However, existing techniques only generate questions for shorter documents based on the question generation model. Accurate questions cannot be generated for longer answers, resulting in poor semantic accuracy in the generated questions.

[0062] The present application provides a document-based question generation method, device, and server, which aim to solve the above technical problems in the prior art.

[0063] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0064] Figure 1 A flowchart of a document-based question generation method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0065] 101. Obtain a document to be analyzed; wherein the document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles.

[0066] For example, the execution entity of this embodiment can be a server. First, a document to be tested is obtained. The document to be analyzed includes multiple levels of headings. There is a hierarchical relationship between the multiple levels of headings. Each level of heading contains text content, which is the answer to the target question information to be generated. The text content under some headings can be empty, and this is not limited to this.

[0067] Step 102: Perform semantic parsing on the document to be analyzed based on the hierarchical relationship of the multi-level titles in the document to be analyzed to obtain semantic information at each level.

[0068] For example, based on the hierarchical relationship of the multi-level headings in the document to be analyzed, the server can segment the document to be analyzed to obtain text blocks at each level, and perform semantic analysis on the multiple text blocks in the document to be analyzed to obtain semantic information at each level.

[0069] For example, first input the document into the document format parsing module. Taking the .doc format document as an example, the document to be analyzed is divided into n text blocks with the hierarchical title as the segmentation granularity. If there is no text content between the two levels of titles, the part of the text block is filtered out. The text block is represented by {D0, D1, ...D n} indicates that the text block Di contains the title T of the level to which the text block belongs and the text content S under the title, which together serve as the answer to the question, and the contents in rich text formats such as pictures and tables in the document to be analyzed are filtered. Then, the title T and the text content S of the text block at each level are semantically parsed to obtain a set of title core words including multiple core words at each level. In the text content, a set of sentences containing core words is filtered out, and the sentences containing core words in the sentence set are semantically parsed to obtain the semantic information of the text block. The semantic information includes the part-of-speech tags of the segmented words in the sentence, the named entity tags, the parsed original text containing the segmented words, and the dependency syntactic relationship.

[0070] Step 103: Generate a semantic association graph of the document to be analyzed based on the semantic information at each level.

[0071] For example, the core word Ki in the title core word set obtained after title parsing is first used as the root node in the semantic association graph. The nodes of the semantic association graph are expanded and filtered according to the following strategy:

[0072] 1) Determine other entity tags where the core word Ki appears in the filtered sentences containing the core word;

[0073] 2) determining the dependency participles of the core word Ki that appear in the selected sentences containing the core word and have a dependency syntactic relationship with the core word;

[0074] 3) Determine other participles in the filtered sentences where the core word Ki appears.

[0075] Then, after extracting the above node elements from the relevant sentences in the document to be analyzed, the core words are used as the root nodes, and edge relationships are established with the root nodes in sequence. The edge connections are divided into different levels according to the semantic relevance. The division rules are as follows:

[0076] (1) There are direct edge connections between multiple core words. The direction of the edge is determined by the order in which the core words appear in the title. For example, the order of the edge is from back to front based on the order in which the core words appear in the title. For example, the core word that appears in the first-level title is earlier than the core word that appears in the second-level title. Therefore, the order of the edge is that the core word that appears in the second-level title points to the core word that appears in the first-level title.

[0077] (2) The first-level nodes directly connected to the root node include the related entities of the core word Ki and the dependent participles that have a dependency syntactic relationship with the core word. The edge direction is from the first-level node to the root node;

[0078] (3) The secondary nodes indirectly connected to the root node include other participles in the sentence that have a dependency syntactic relationship with the associated entity of the core word Ki, and other participles in the sentence that have a dependency syntactic relationship with the dependency participle. The direction of the edge is determined by the direction of the syntactic dependency relationship.

[0079] Thus, the construction of the semantic association graph G between the title and the answer is completed, that is, the key semantic information related to the core topic is captured as a whole.

[0080] Step 104: predict questions on the semantic association graph based on a preset question generation model to obtain target question information of the document to be analyzed; wherein the question generation model is trained based on multiple preset question-answer pair data, and the answers in the question-answer pair data are documents.

[0081] For example, since the question generation model is trained based on multiple preset question-answer pair data, the semantic association graph is input into the preset question generation model, and question prediction processing is performed on the semantic association graph based on the preset question generation model to obtain the target question information of the document to be analyzed.

[0082] In an embodiment of the present application, a document to be analyzed is obtained; wherein, the document to be analyzed includes multi-level titles, and there is a hierarchical relationship between the multi-level titles. According to the hierarchical relationship of the multi-level titles in the document to be analyzed, the document to be analyzed is semantically parsed to obtain semantic information at each level. According to the semantic information at each level, a semantic association graph of the document to be analyzed is generated. Questions are predicted on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed; wherein, the question generation model is obtained by training based on a plurality of preset question-answer pair data, and the answers in the question-answer pair data are documents. In this solution, according to the hierarchical relationship of the multi-level titles in the document to be analyzed, the document to be analyzed is semantically parsed to obtain semantic information at each level, and a semantic association graph of the document to be analyzed is generated based on the semantic information at each level. Since the question generation model is obtained by training based on a plurality of preset question-answer pair data, the target question information of the document to be analyzed can be obtained by performing question prediction on the semantic association graph according to the preset question generation model. Therefore, for longer documents, we can perform semantic parsing on the document and predict and generate target question information through the hierarchical relationship between the multi-level titles of the document, thereby achieving full-text parsing of longer texts, improving the semantic accuracy of the target question information, and solving the technical problem of poor semantic accuracy of generated questions.

[0083] Figure 2 A flowchart of another document-based question generation method provided in an embodiment of the present application is shown as follows: Figure 2 As shown, the method includes:

[0084] Step 201: Acquire multiple documents.

[0085] Illustratively, the server may pre-acquire multiple documents.

[0086] Step 202: Perform segmentation and semantic analysis on each document to obtain the semantic information of the document; and generate a semantic association graph of the document based on the semantic information of the document.

[0087] For example, the server can segment each document to obtain multiple text blocks in each document, and perform semantic parsing on the multiple text blocks in each document to obtain the semantic information of the document, and generate a semantic association graph of the document based on the semantic information of the document. For detailed segmentation and semantic parsing, please refer to Figure 1 Step 102 in the above example generates a semantic association graph of the document, which can be found in Figure 1 Step 103 in the above is not described in detail.

[0088] Step 203: Determine question-answer pair data based on the preset questions corresponding to each document; and perform question generation training on the initial model based on the question-answer pair data and the semantic association graph to generate a question generation model.

[0089] For example, the semantic association graph of the processed document is manually designed based on the title to obtain preset questions as training data, that is, the preset questions corresponding to each text block in the document are determined, and the question-answer pair data is determined based on the preset questions corresponding to each text block in the document. At the same time, according to statistics, the titles of general description document data are concise and have clear goals, and the corresponding question types mainly include: what and how. Therefore, a question type label is added to each designed question, with 0 representing the what type and 1 representing the how type.

[0090] The question generation model is primarily used to accurately generate descriptions of questions corresponding to answers, ensuring that the generated questions can be answered by the answers and possess a certain degree of diversity and value. Therefore, to ensure accuracy, the model primarily uses the Seq2Seq framework (a deep learning technique) to encode the semantic association graph established between titles and answers, and performs multi-task learning training by combining the two tasks of question type prediction and question generation. The training process is as follows:

[0091] 1) Training phase

[0092] ①Encoder

[0093] The encoder uses a Gated Graph Sequence Neural Network (GGNN) to perform a fusion encoding representation of the semantic association graph, assuming the number of nodes in the semantic association graph is n. The GGNN can also be a Graph Attention Network (GAT), a Graph Convolutional Neural Network (GCN), etc., without limitation.

[0094] First, the input of the model is the constructed semantic association graph G = {V, A}, where V represents the node set in the semantic association graph, A represents the edge relationship adjacency matrix of the semantic association graph, and each node is initialized with a d-dimensional vector representation V using the Glove static word vector. n ; Among them, the Glove static word vector is a text semantic coding representation obtained by training a neural network model on a large amount of text data, and can be replaced by a vector representation trained by a similar text semantic coding model, such as word2vec, BERT, etc., without limitation.

[0095] Then, the node feature V nInput into the GGNN network, the information fusion encoding between adjacent nodes is performed according to the adjacency matrix relationship, and the node feature output by the network is V n ';

[0096] Finally, the updated node feature V n 'Input to the fully connected layer and perform graph-level feature extraction and fusion through MaxPooling, converting the n node feature vectors into a graph encoding vector V g , V g It represents the core semantic information of the entire semantic association graph and serves as the output of the encoder.

[0097] ②Decoder

[0098] The decoder involves two tasks: one is to predict question generation through long short-term memory (LSTM) sequence decoding, and the other is to predict question type based on the question generation prediction results. The LSTM can also be replaced by other types of sequential recurrent neural network algorithms, such as recurrent neural networks (RNNs) and GRUs, without limitation.

[0099] The problem generation task is to convert the encoder output V g and the initial decoded characters of the preset question <s>As the input of the decoder at time 0, and predict the first word in the preset question. The training process adopts the teacher forcing training mode, so at the second moment, V g The first word of the question is used as the input at the second moment to predict the second word in the question, and so on. The maximum decoding length of question generation is set to 20, and question generation prediction is automatically terminated after 20 rounds of iteration.

[0100] For the question type prediction task, during the question generation task, the decoding vector of the LSTM network is copied and stored at each time step. After completing 20 rounds of question generation prediction, the 20 decoding vectors are classified and predicted through a fully connected layer and a normalized exponential function (softmax) to predict and obtain the question type.

[0101] ③Multi-task joint learning

[0102] When jointly learning the two tasks of question generation and question type prediction in the decoding stage, the cross entropy loss Lqgen and the binary cross entropy loss Lqtype are used as the loss functions respectively. By setting the weight ɑ, the weighted sum of the two loss functions is used as the loss function of the entire network for model parameter optimization training, and finally a question generation model is generated.

[0103] Therefore, we use a heuristic approach to construct a semantic association graph at the word / entity level between the title and the long answer content, extract the core semantic scope of the question, predict the question type based on the part-of-speech statistics of the graph nodes, and then use a graph convolutional network-based joint variational autoencoder encoding method to combine semantic encoding with question type encoding to input into the LSTM sequence decoder for question generation. This has the following advantages:

[0104] 1. Constructing a semantic association graph between titles and answers based on heuristic rules helps extract the core semantic information of long answers and reduce the impact of redundant information on question generation.

[0105] 2. Determining the question type helps constrain the angle of question generation, avoid generating incorrect questions that cannot be answered, and improve the controllability of generation.

[0106] Therefore, semantic encoding based on graph neural networks indirectly integrates the dependency syntactic information of title-related sentences in the answer, assists the model in learning the syntactic format, enriches the encoding information, and is beneficial to the accuracy of question generation.

[0107] Step 204: Obtain the document to be analyzed; wherein the document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles.

[0108] For example, this step can be referred to Figure 1 Step 101 in the above description will not be repeated.

[0109] Step 205: Segment the document to be analyzed according to the hierarchical relationship of the multi-level titles of the document to be analyzed to obtain text blocks under each level; wherein the text block includes the title of the level to which the text block belongs and the text content under the title.

[0110] For example, the server can use the hierarchical title as the segmentation granularity to segment the document to be analyzed into n text blocks. If there is no text content between two levels of titles, the text block is filtered out. The text block is represented by {D0, D1, ... D n } indicates that the text block Di contains the title T of the level to which the text block belongs and the text content S under the title, which together serve as the answer generated by the question.

[0111] Step 206: Perform semantic analysis on the text blocks at each level to obtain semantic information of the text blocks at each level.

[0112] In one example, the title in the text block at each level is segmented, and the part-of-speech tag and named entity tag of each segmented word are determined; the segmented words with the part-of-speech tag as a noun and / or the named entity tag are determined as core words, and a set of title core words is formed; in the main text content, a set of sentences containing core words is filtered out; the sentences containing core words in the sentence set are semantically parsed to obtain the semantic information of the text block at each level; wherein the semantic information includes the part-of-speech tag of the segmented words in the sentence, the named entity tag, the parsed original text containing the segmented words, and the dependency syntactic relationship.

[0113] Exemplarily, the server mainly uses the StanfordCoreNLP tool to perform lexical and syntactic analysis on the title T and chapter content S in the text block D, wherein the StanfordCoreNLP tool is a natural language lexical, syntactic and named entity analysis tool, which can be replaced by other natural language lexical, syntactic and named entity analysis tools, and there is no limitation on this. Title parsing is to segment T and obtain the part-of-speech tag and / or named entity tag of each word in the title, and then determine the segmentation and / or named entity tag of the noun as the core word, and form a title core word set K, wherein the part-of-speech tag refers to the segmentation being a noun or a verb, etc., and the named entity tag refers to the place name, the type to which the place name belongs, etc., and there is no limitation on this. Answer parsing first filters the answer content S, extracts several sentence sets Sk that are directly related to the core words of the title, that is, the sentences in which the core words in the title core word set K appear, and performs part-of-speech, named entity and dependency syntax analysis on these sentences. Each sentence is parsed into a feature combination of the original text after word segmentation, part-of-speech tags, named entity tags, and dependency syntax relationship tags, that is, the feature combination of the original text after word segmentation, part-of-speech tags, named entity tags, and dependency syntax relationship tags is semantic information.

[0114] Step 207: Based on the semantic information at each level, in the text content at each level, determine other entity tags in the sentence where the core word is located, dependency participles in the sentence where the core word is located that have a dependency syntactic relationship with the core word, and other participles in the sentence where the core word is located.

[0115] For example, the server can use the core word Ki in the title core word set obtained after title parsing as the root node in the semantic association graph. The node expansion and screening of the semantic association graph are performed according to the following strategy:

[0116] 1) Determine other entity tags where the core word Ki appears in the filtered sentences containing the core word;

[0117] 2) determining the dependency participles of the core word Ki that appear in the selected sentences containing the core word and have a dependency syntactic relationship with the core word;

[0118] 3) Determine other participles in the filtered sentences where the core word Ki appears.

[0119] Step 208: The core words of the title core word set are all taken as root nodes and are connected in a directed manner according to the order of appearance in the title. The named entity tags, other entity tags, and dependency participles are all taken as first-level nodes, and the edge relationship points to the core words. The other participles that have a dependency syntactic relationship with the named entity tags and / or other entity tags, and the other participles that have a dependency syntactic relationship with the dependency participles are all taken as second-level nodes to generate a semantic association graph of the document to be analyzed.

[0120] For example, the server may extract the above node elements from the relevant sentences in the document to be analyzed, take the core words as the root nodes, and establish edge relationships with the root nodes in sequence. The edge connections are divided into different levels according to semantic relevance. The division rules are as follows:

[0121] (1) There are direct edge connections between multiple core words. The direction of the edge is determined by the order in which the core words appear in the title. For example, the order of the edge is from back to front based on the order in which the core words appear in the title. For example, the core word that appears in the first-level title is earlier than the core word that appears in the second-level title. Therefore, the order of the edge is that the core word that appears in the second-level title points to the core word that appears in the first-level title.

[0122] (2) The first-level nodes directly connected to the root node include the related entities of the core word Ki and the dependent participles that have a dependency syntactic relationship with the core word. The edge direction is from the first-level node to the root node;

[0123] (3) The secondary nodes indirectly connected to the root node include other participles in the sentence that have a dependency syntactic relationship with the associated entity of the core word Ki, and other participles in the sentence that have a dependency syntactic relationship with the dependency participle. The direction of the edge is determined by the direction of the syntactic dependency relationship.

[0124] Thus, the construction of the semantic association graph G between the title and the answer is completed, that is, the key semantic information related to the core topic is captured as a whole.

[0125] Step 209: perform question prediction on the semantic association graph according to a preset question generation model to obtain core semantic information of the semantic association graph, and determine the core semantic information as target question information of the document to be analyzed; wherein the question generation model is trained based on multiple preset question-answer pair data, and the answer in the question-answer pair data is the document.

[0126] Exemplarily, since the question generation model is trained based on multiple documents and standard question information corresponding to multiple documents, in the prediction stage, the semantic association graph is input into the preset question generation model as the input of the encoder, and in the decoding stage, only the question generation module is used to generate questions, and the core semantic information of the semantic association graph is obtained, and the core semantic information is determined as the target question information of the document to be analyzed.

[0127] In an embodiment of the present application, multiple documents are obtained. Each document is segmented and semantically parsed to obtain the semantic information of the document; and a semantic association graph of the document is generated based on the semantic information of the document. According to the preset questions corresponding to each document, question-answer pair data is determined; and based on the question-answer pair data and the semantic association graph, the initial model is trained to generate questions to generate a question generation model. The document to be analyzed is obtained; wherein, the document to be analyzed includes multi-level titles, and there is a hierarchical relationship between the multi-level titles. According to the hierarchical relationship of the multi-level titles of the document to be analyzed, the document to be analyzed is segmented to obtain text blocks at each level; wherein, the text blocks include the title of the level to which the text block belongs and the text content under the title. The text blocks at each level are semantically parsed to obtain the semantic information of the text blocks at each level. According to the semantic information at each level, in the text content at each level, other entity tags in the sentence where the core word is located, dependency participles in the sentence where the core word is located that have a dependency syntactic relationship with the core word, and other participles in the sentence where the core word is located are determined. The core words of the title core word set are all taken as root nodes and are connected in a directed manner according to the order of appearance in the title. The named entity tags, other entity tags, and dependency segmentation words are all taken as first-level nodes, with the edge relationship pointing to the core word. The other segmentation words that have a dependency syntactic relationship with the named entity tags and / or other entity tags, and the other segmentation words that have a dependency syntactic relationship with the dependency segmentation words are all taken as second-level nodes to generate a semantic association graph of the document to be analyzed. Questions are predicted on the semantic association graph according to a preset question generation model to obtain the core semantic information of the semantic association graph, and the core semantic information is determined to be the target question information of the document to be analyzed; wherein the question generation model is trained based on multiple preset question-answer pair data, and the answer in the question-answer pair data is the document. Therefore, for longer documents, the document can be semantically parsed and the target question information can be predicted and generated through the multi-level titles of the document and the hierarchical relationship between the multi-level titles, thereby achieving full-text parsing of longer texts, improving the semantic accuracy of the target question information, and solving the technical problem of poor semantic accuracy of generated questions.

[0128] For example, Figure 3 A flowchart of another document-based question generation method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the process includes parsing the document format of document D and obtaining the text block set {D1, D2...D n }, D i ={T i , S i }, where T i Indicates the title of the i-th text block, S i Represents the main content of the i-th text block. Then, the StanfordCoreNLP tool is used to perform semantic analysis (i.e., lexical and syntactic analysis, etc.) on the title T and chapter content S in the text block D, and T i Nouns / entities in S i Entity / dependency syntactic relations in .

[0129] For example, Figure 4 A flowchart of another document-based question generation method provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the process includes according to T i Nouns / entities in S i The entity / dependency syntactic relationship in is constructed based on the heuristic graph construction rules to build the semantic association graph G.

[0130] For example, Figure 5 A flow chart of another training problem generation model provided in an embodiment of the present application, such as Figure 5 As shown in the figure, the process includes word vector conversion of the semantic association graph G, fusion encoding of the semantic association graph through the gated graph sequence neural network GGNN, output of the graph encoding vector according to MaxPooling and the fully connected layer, sequence decoding, prediction of the question type, cross entropy loss Lqgen and binary cross entropy loss Lqtype.

[0131] Figure 6 A schematic diagram of the structure of a document-based question generation device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the device includes:

[0132] The first acquisition unit 31 is configured to acquire a document to be analyzed. The document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles.

[0133] The parsing unit 32 is used to perform semantic parsing on the document to be analyzed according to the hierarchical relationship of the multi-level titles in the document to be analyzed, and obtain semantic information at each level.

[0134] The first generating unit 33 is configured to generate a semantic association graph of the document to be analyzed according to the semantic information at each level.

[0135] The prediction unit 34 is used to predict questions on the semantic association graph based on a preset question generation model to obtain target question information of the document to be analyzed; wherein the question generation model is trained based on multiple preset question-answer pair data, and the answer in the question-answer pair data is the document.

[0136] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.

[0137] Figure 7 A schematic diagram of another document-based question generation device provided in an embodiment of the present application, Figure 6 Based on the embodiment shown, Figure 7 As shown, the parsing unit 32 includes:

[0138] The segmentation module 321 is used to segment the document to be analyzed according to the hierarchical relationship of the multi-level titles of the document to be analyzed, and obtain text blocks under each level; wherein the text block includes the title of the level to which the text block belongs and the text content under the title.

[0139] The parsing module 322 is used to perform semantic parsing on the text blocks at each level to obtain semantic information of the text blocks at each level.

[0140] In one example, the parsing module 322 includes:

[0141] The word segmentation submodule 3221 is used to segment the title in the text block at each level and determine the part-of-speech tag and named entity tag of each segmented word;

[0142] The determination submodule 3222 is used to determine the participles with the part-of-speech tag of noun and / or the named entity tag as core words, and form a title core word set.

[0143] The filtering submodule 3223 is used to filter out a set of sentences containing core words in the text content.

[0144] The parsing submodule 3224 is used to perform semantic parsing on the sentences containing core words in the sentence set to obtain the semantic information of the text blocks at each level; wherein the semantic information includes the part-of-speech tags of the segmented words in the sentence, the named entity tags, the parsed original text containing the segmented words, and the dependency syntactic relationship.

[0145] In one example, the first generating unit 33 includes:

[0146] The determination module 331 is used to determine, based on the semantic information at each level, other entity tags in the sentence where the core word is located, dependent participles in the sentence where the core word is located that have a dependency syntactic relationship with the core word, and other participles in the sentence where the core word is located in the main text content at each level.

[0147] Generate module 332, which is used to take the core words of the title core word set as root nodes and connect them in a directed manner according to the order of appearance in the title, take the named entity tags, other entity tags, and dependency participles as first-level nodes, with the edge relationship pointing to the core words, and take other participles that have dependency syntactic relationships with the named entity tags and / or other entity tags, and other participles that have dependency syntactic relationships with the dependency participles as second-level nodes to generate a semantic association graph of the document to be analyzed.

[0148] In one example, the apparatus further includes:

[0149] The second acquiring unit 41 is configured to acquire multiple documents.

[0150] The second generating unit 42 is configured to perform segmentation and semantic analysis on each document to obtain semantic information of the document; and to generate a semantic association graph of the document based on the semantic information of the document.

[0151] The training unit 43 is used to determine question-answer pair data based on the preset questions corresponding to each document; and to perform question generation training on the initial model based on the question-answer pair data and the semantic association graph to generate a question generation model.

[0152] The device of this embodiment can execute the technical solution in the above method. Its specific implementation process and technical principles are the same and will not be repeated here.

[0153] Figure 8 A schematic diagram of the structure of a server provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the server includes: a memory 51 and a processor 52.

[0154] The memory 51 stores computer programs that can be executed on the processor 52 .

[0155] The processor 52 is configured to execute the method provided in the above embodiments.

[0156] The server further includes a receiver 53 and a transmitter 54. The receiver 53 is used to receive instructions and data sent by an external device, and the transmitter 54 is used to send instructions and data to the external device.

[0157] An embodiment of the present application also provides a non-temporary computer-readable storage medium, which, when the instructions in the storage medium are executed by the processor of the server, enables the server to execute the method provided in the above embodiment.

[0158] An embodiment of the present application also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of the server can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the server executes the solution provided by any of the above embodiments.

[0159] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.

[0160] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.< / s>

Claims

1. A document-based question generation method, characterized in that: include: Obtaining a document to be analyzed; wherein the document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles; Performing semantic parsing on the document to be analyzed according to the hierarchical relationship of the multi-level titles in the document to be analyzed to obtain semantic information at each level; Generate a semantic association graph of the document to be analyzed based on the semantic information at each level; Question prediction is performed on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed; wherein, the question generation model is trained based on a plurality of preset question-answer pair data, and the answers in the question-answer pair data are documents.

2. The method according to claim 1, characterized in that The step of performing semantic parsing on the document to be analyzed based on the hierarchical relationship of the multi-level titles in the document to be analyzed to obtain semantic information at each level includes: Segmenting the document to be analyzed according to the hierarchical relationship of the multi-level titles of the document to be analyzed to obtain text blocks under each level; wherein the text blocks include the title of the level to which the text blocks belong and the text content under the title; The text blocks at each level are semantically parsed to obtain the semantic information of the text blocks at each level.

3. The method according to claim 2, characterized in that The semantic parsing process is performed on the text blocks at each level to obtain the semantic information of the text blocks at each level, including: Segmenting the title in the text block at each level, and determining a part-of-speech tag and a named entity tag for each segmented word; Determine the part-of-speech tags as noun participles and / or named entity tags as core words, and form a title core word set; Filtering out a set of sentences containing the core words in the text content; The sentences in the sentence set containing the core words are semantically parsed to obtain semantic information of the text blocks at each level; wherein the semantic information includes the part-of-speech tags of the segmented words in the sentences, the named entity tags, the parsed original text containing the segmented words, and the dependency syntactic relationship.

4. The method according to claim 3, characterized in that Generating a semantic association graph of the document to be analyzed based on the semantic information at each level includes: Based on the semantic information at each level, in the text content at each level, determine other entity tags in the sentence where the core word is located, dependent participles in the sentence where the core word is located that have a dependency syntactic relationship with the core word, and other participles in the sentence where the core word is located; The core words of the title core word set are all taken as root nodes and are connected in a directed manner according to the order of appearance in the title. The named entity tags, the other entity tags, and the dependency participles are all taken as first-level nodes, and the edge relationship points to the core words. The other participles that have a dependency syntactic relationship with the named entity tags and / or the other entity tags, and the other participles that have a dependency syntactic relationship with the dependency participles are all taken as second-level nodes to generate a semantic association graph of the document to be analyzed.

5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Get multiple documents; Performing segmentation and semantic analysis on each of the documents to obtain semantic information of the document; and generating a semantic association graph of the document based on the semantic information of the document; According to the preset questions corresponding to each of the documents, question-answer pair data are determined; and according to the question-answer pair data and the semantic association graph, question generation training is performed on the initial model to generate a question generation model.

6. A document-based question generation device, characterized in that: include: A first acquisition unit is configured to acquire a document to be analyzed, wherein the document to be analyzed includes multiple levels of titles, and there is a hierarchical relationship between the multiple levels of titles; A parsing unit, configured to perform semantic parsing on the document to be analyzed according to the hierarchical relationship of the multi-level headings in the document to be analyzed, and obtain semantic information at each level; A first generating unit, configured to generate a semantic association graph of the document to be analyzed based on the semantic information at each level; A prediction unit is used to perform question prediction on the semantic association graph according to a preset question generation model to obtain target question information of the document to be analyzed; wherein, the question generation model is trained based on multiple preset question-answer pair data, and the answer in the question-answer pair data is a document.

7. The device according to claim 6, characterized in that The parsing unit includes: a segmentation module for segmenting the document to be analyzed according to the hierarchical relationship of the multi-level titles of the document to be analyzed to obtain text blocks under each level; wherein the text blocks include the titles of the level to which the text blocks belong and the text content under the titles; The parsing module is used to perform semantic parsing on the text blocks at each level to obtain the semantic information of the text blocks at each level.

8. The device according to claim 7, characterized in that The parsing module includes: A word segmentation submodule is used to segment the title in the text block at each level and determine the part-of-speech tag and named entity tag of each segmented word; A determination submodule is used to determine the part-of-speech tag as a noun participle and / or the named entity tag as a core word, and form a title core word set; A filtering submodule, configured to filter out a set of sentences containing the core words from the text content; The parsing submodule is used to perform semantic parsing on the sentences containing the core words in the sentence set to obtain semantic information of the text blocks at each level; wherein the semantic information includes the part-of-speech tags of the segmented words in the sentence, the named entity tags, the parsed original text containing the segmented words, and the dependency syntactic relationship.

9. The device according to claim 8, characterized in that The first generating unit includes: a determination module for determining, based on the semantic information at each level and in the text content at each level, other entity tags in the sentence containing the core word, dependent participles in the sentence containing the core word that have a dependency syntactic relationship with the core word, and other participles in the sentence containing the core word; A generation module is used to take the core words of the title core word set as root nodes and connect them in a directed manner according to the order of appearance in the title, take the named entity tags, the other entity tags, and the dependent participles as first-level nodes, with the edge relationship pointing to the core words, and take the other participles that have a dependency syntactic relationship with the named entity tags and / or the other entity tags, and the other participles that have a dependency syntactic relationship with the dependency participles as second-level nodes to generate a semantic association graph of the document to be analyzed.

10. The device according to any one of claims 6 to 9, characterized in that: The device further comprises: A second acquiring unit, configured to acquire a plurality of documents; A second generating unit is configured to perform segmentation and semantic analysis on each of the documents to obtain semantic information of the document; and to generate a semantic association graph of the document based on the semantic information of the document; The training unit is used to determine question-answer pair data based on preset questions corresponding to each of the documents; and to perform question generation training on the initial model based on the question-answer pair data and the semantic association graph to generate a question generation model.

11. A server, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 5 when executed by a processor.

13. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 5 when executed by a processor.

Citation Information

Patent Citations

  • Structural analysis method and system for judicial documents

    CN111145052A

  • Enterprise-level question and answer updating method and system based on language model

    CN113934818A