Method and device for generating paragraph set, reasoning method and device

By filtering and constructing paragraph graphs from document databases, generating paragraph sets and scoring reasoning paths, the problem of efficiency and accuracy in extracting evidence content in the existing technology is solved, and the effect of answer prediction is improved.

CN113779203BActive Publication Date: 2024-09-17BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010518041.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-09
Publication Date
2024-09-17
Estimated Expiration
2040-06-09

AI Technical Summary

Technical Problem

Existing technologies are difficult to efficiently and accurately extract evidence content related to questions from large amounts of text data, causing the accuracy and efficiency of the answer prediction process to be affected, and valuable information may be lost.

Method used

By filtering out documents related to the question from the document database and constructing a paragraph graph, the document is split into paragraphs, a paragraph set is generated, candidate paragraphs are screened and reasoning paths are scored, and finally the answer prediction model is input to obtain the answer interval.

Benefits of technology

It achieves efficient and accurate acquisition of paragraph sets related to the question, avoids information loss, provides a high-quality data basis for answer prediction, and improves the accuracy and efficiency of the reasoning process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113779203B
    Figure CN113779203B
Patent Text Reader

Abstract

The embodiments of the present application provide a method and apparatus for generating a paragraph set, a reasoning method and apparatus, a computing device, and a computer-readable storage medium, so as to efficiently, accurately, and comprehensively obtain evidence content that is sufficiently relevant to the content of the question from a large amount of text data, avoid losing valuable information, and provide a high-quality data basis for subsequent answer predictions, so as to improve the accuracy and efficiency of the reasoning process during subsequent answer predictions. The method for generating a paragraph set includes: obtaining a document set related to the question from a document database; constructing a paragraph graph based on the document set, wherein the paragraph graph includes multiple paragraph levels, the paragraph level includes multiple paragraphs from the document set, and the paragraphs in the paragraph level are related to the content of at least one paragraph in the next paragraph level; obtaining all paragraphs in the paragraph graph to generate a paragraph set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and apparatus for generating a paragraph set, a reasoning method and apparatus, a computing device, and a computer-readable storage medium. Background Art

[0002] Sentence relationship judgment is one of the four major tasks in the field of natural language processing, which includes reading comprehension question answering. In real scenarios, the answers to many questions are distributed in multiple texts, and sometimes there is little (or no) overlapping vocabulary between the text that generates the answer and the question. Therefore, many tasks require reasoning through evidence scattered in multiple text fragments. At the same time, before reasoning, the text that needs to be processed is usually long. If it is not handled well, a lot of valuable information may be lost, thus affecting the inference effect.

[0003] When a question is input into a question-answering system, the machine may easily find the answer in a text. However, in many cases, the answer may be hidden in a pile of text, and even humans need to go through rigorous reasoning and analysis to get the correct answer. Therefore, there is an urgent need for an evidence extraction method and reasoning method that can efficiently, accurately and comprehensively obtain evidence content that is sufficiently relevant to the content of the question from a large amount of text data, avoid losing valuable information, and provide a high-quality data foundation for subsequent answer predictions, so as to improve the accuracy and efficiency of the reasoning process during subsequent answer predictions. Summary of the invention

[0004] In view of this, embodiments of the present application provide a method and apparatus for generating a paragraph set, a reasoning method and apparatus, a computing device, and a computer-readable storage medium to address the technical deficiencies in the prior art.

[0005] An embodiment of the present application discloses a method for generating a paragraph set, comprising: obtaining a document set related to a question from a document database; constructing a paragraph graph based on the document set, wherein the paragraph graph includes multiple paragraph levels, the paragraph level includes multiple paragraphs from the document set, and the paragraphs in the paragraph level are related to the content of at least one paragraph in the next paragraph level; obtaining all paragraphs in the paragraph graph to generate a paragraph set.

[0006] The embodiment of the present application discloses a reasoning method, including: obtaining a paragraph set based on the method for generating a paragraph set as described above; screening the paragraph set to obtain multiple candidate paragraphs related to the content of the question, and generating an initial candidate paragraph set based on the multiple candidate paragraphs; calculating the reasoning path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the reasoning path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph; scoring the multiple reasoning paths, and selecting the reasoning path with the highest path score as the optimal path; and inputting the optimal path into an answer prediction model to obtain an answer interval.

[0007] An embodiment of the present application discloses an apparatus for generating a paragraph set, comprising: a screening module, configured to obtain a document set related to a question from a document database; a paragraph graph construction module, configured to construct a paragraph graph based on the document set, wherein the paragraph graph includes multiple paragraph levels, the paragraph level includes multiple paragraphs from the document set, and the paragraphs in the paragraph level are related to the content of at least one paragraph in the next paragraph level; and a paragraph set acquisition module, configured to acquire all paragraphs in the paragraph graph to generate a paragraph set.

[0008] The embodiment of the present application discloses an inference device, including: a paragraph set generation module, configured to obtain a paragraph set based on the method for generating a paragraph set as described above; a candidate paragraph set generation module, configured to screen the paragraph set to obtain multiple candidate paragraphs related to the content of the question, and generate an initial candidate paragraph set based on the multiple candidate paragraphs; an inference path acquisition module, configured to calculate the inference path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the inference path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph; a path scoring module, configured to perform path scoring on multiple inference paths, and select the inference path with the highest path score as the optimal path; and an answer prediction module, configured to input the optimal path into an answer prediction model to obtain an answer interval.

[0009] An embodiment of the present application discloses a computing device, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein when the processor executes the instructions, the steps of any method for generating a paragraph set or reasoning method as described above are implemented.

[0010] An embodiment of the present application discloses a computer-readable storage medium storing computer instructions, wherein the instructions, when executed by a processor, implement the steps of any of the above methods for generating a paragraph set or the reasoning method.

[0011] The method and apparatus for generating a paragraph set, the reasoning method and apparatus, the computing device, and the computer-readable storage medium provided in the present application can screen out documents that are sufficiently relevant to the content of a question from a document database by means of document screening, and split the documents in the document set into paragraphs by means of constructing a paragraph graph. This can efficiently, accurately, and comprehensively obtain a paragraph set that is sufficiently relevant to the content of the question, and effectively avoid the loss of valuable information, thereby providing a high-quality data foundation for subsequent answer predictions and improving the effect of answer predictions. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 is a block diagram showing a structure of a computing device 100 according to an embodiment of the present specification;

[0013] Figure 2 is a schematic flow chart showing a method for generating a paragraph set according to an embodiment of the present specification;

[0014] Figure 3 is a schematic diagram showing the structure of a paragraph diagram provided according to an embodiment of this specification;

[0015] Figure 4 is a schematic flow chart showing the generation of a document set based on multiple documents in a method for generating a paragraph set according to another embodiment of the present specification;

[0016] Figure 5 is a schematic flow chart showing construction of a paragraph graph based on a document set in a method for generating a paragraph set according to another embodiment of the present specification;

[0017] Figure 6 is a schematic flow chart showing a reasoning method based on a paragraph set according to an embodiment of the present application;

[0018] Figure 7 FIG. 1 is a diagram showing the reasoning method based on paragraph sets according to an embodiment of the present application at the tth time step in the candidate paragraph set P. st Select a paragraph in p i A schematic flow chart of

[0019] Figure 8 is a schematic diagram of the structure of a device for generating a paragraph set provided in an embodiment of the present application;

[0020] Fig. 9 It is a schematic diagram of the structure of an inference device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0021] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0022] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

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

[0024] First, the terms involved in one or more embodiments of the present invention are explained.

[0025] DrQA: An open-domain question answering (QA) system based on Wikipedia.

[0026] CMNS: A commonly used entity linking system, a tool used for entity linking.

[0027] BERT: A pre-trained model of a multi-layer bidirectional transformer encoder based on fine-tuning.

[0028] BERT ranker: A paragraph ranking method based on the BERT model. This scheme is used for document ranking.

[0029] transformer-XH: A text representation method or tool.

[0030] In the present application, a method and device for generating a paragraph set are provided. This specification also provides a reasoning method and a reasoning device based on a paragraph set, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0031] Figure 1 1 is a block diagram showing a structure of a computing device 100 according to an embodiment of the present specification. The components of the computing device 100 include but are not limited to a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and a database 150 is used to store data.

[0032] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0033] In one embodiment of the present specification, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 1 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.

[0034] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.

[0035] The processor 120 may execute Figure 2 Steps in the method shown. Figure 2 2 is a schematic flow chart showing a method for generating a paragraph set according to an embodiment of the present specification, including steps 202 to 206.

[0036] Step 202: Obtain a document set related to the question from a document database.

[0037] Specifically, the document database can be screened to obtain multiple documents related to the content of the question, and a document set can be generated based on the multiple documents. The document database is the data source for generating the paragraph set. The document database can be generated by user collection or a third-party database, such as the document database of Wikipedia. This application does not limit the source of the document database.

[0038] In one embodiment of the present specification, the relevance between the documents in the document database and the content of the question can be calculated, and based on the calculated result of the relevance, the document can be selected from the document database. For example, at least one document with the highest relevance to the content of the question can be screened out from the document database as a document set. For example, the document retriever, one of the two core components of the DrQA system, can be used, the goal of which is to narrow the search space and quickly find the most relevant documents in the massive documents in the document database. For each question, at least one (for example, 100, the preset number can be appropriately increased or decreased as needed) document can be screened out, denoted as D dr . In one embodiment of the present specification, the calculation result of the relevance to the content of the question can be obtained in the following manner: calculate the product of the term frequency-inverse document frequency (TF-IDF) weight of the question's term (token) and the term frequency-inverse document frequency weight of the document in the document database, and use the value of the product to represent the calculation result of the relevance. Because TF-IDF measures the importance of a word to a document, if some words are important to both the question and the document, then it can be considered that the relevance between this question and these documents is relatively important. In this way, the screening rule actually executed is to use the document retriever of the DrQA system to obtain the top k documents most relevant to the question based on the product of the TF-IDF weight of the token of question q and the TF-IDF weight of the document.

[0039] In another embodiment of the present specification, the entity vocabulary in the question and the entity vocabulary included in the document database can also be relevance calculated, and based on the calculation result of the relevance, the document corresponding to the entity vocabulary is selected from the document database. For example, the entity vocabulary in the question and the entity vocabulary included in the document database are relevance calculated to obtain at least one entity vocabulary with the highest relevance score; and the document corresponding to at least one entity vocabulary with the highest relevance score is screened out from the document database as a document set. For example, the CMNS entity linking system can be used, based on the relevance between the entity vocabulary in the question q and the entity vocabulary in the documents of the document database (such as calculating the cosine correlation, etc., and the relevance calculation method can be adjusted according to the actual scenario requirements). Find out the documents corresponding to the 3-5 entities with the highest scores to form a document set D CMNS .

[0040] In another embodiment of this specification, the D obtained by the above two methods can also be dr and D CMNS The union is taken as the document set, so that the document set can cover the documents related to the problem more comprehensively.

[0041] Step 204: construct a paragraph graph based on the document set, wherein the paragraph graph includes multiple paragraph levels, each paragraph level includes multiple paragraphs from the document set, and each paragraph in a paragraph level is related to the content of at least one paragraph in a next paragraph level.

[0042] Specifically, the documents in the document set can be considered as documents that are sufficiently relevant to the content of the question, but they cannot directly generate a paragraph set, and they cannot directly predict the answer. Since the answer prediction is based on the text content in paragraphs, it is necessary to construct a paragraph graph for the paragraphs of the documents in the active document set, and generate a paragraph set based on the paragraph graph.

[0043] Each node in the paragraph graph corresponds to a paragraph in the document set, and the relationship between multiple paragraph levels in the paragraph graph represents the content-related relationship between paragraphs. Figure 3 In the paragraph graph structure shown, p5, p13 and p25 constitute the first paragraph level, wherein p15 and p7 of the second paragraph level include the same keywords as p5, and therefore p5 is related to p15 and p7.

[0044] Step 206: Obtain all paragraphs in the paragraph graph to generate a paragraph set.

[0045] Specifically, all paragraphs in the paragraph graph can be considered as paragraphs that are sufficiently relevant to the content of the question. Therefore, all paragraphs in the paragraph graph are generated into a paragraph set, which can serve as the data basis for subsequent answer prediction.

[0046] In one embodiment of the present specification, in order to facilitate tracing, the paragraphs in the paragraph set may be randomly numbered.

[0047] It can be seen that this application uses document screening to filter out documents that are sufficiently relevant to the content of the question from the document database, and splits the documents in the document set into paragraphs by constructing a paragraph graph. This can efficiently, accurately and comprehensively obtain a set of paragraphs that are sufficiently relevant to the content of the question, and effectively avoid losing valuable information, providing a high-quality data foundation for subsequent answer predictions and improving the effect of answer prediction.

[0048] In one embodiment of the present application, the processor 120 may also execute Figure 4 Steps in the method shown. Figure 4It is a schematic flow chart showing the generation of a document set based on multiple documents in a method for generating a paragraph set according to another embodiment of the present specification, including steps 402 to 408.

[0049] Specifically, before constructing a paragraph graph based on a document set, the process of generating a document set based on a plurality of documents may further specifically include:

[0050] Step 402: Sort the documents selected from the document database based on the degree to which the documents selected from the document database are related to the content of the question.

[0051] In one embodiment of the present specification, the degree of relevance to the content of the question can be obtained in the following manner: a relevance score to the content of the question is obtained based on a scoring model (eg, a BERT model), and the relevance score is used to characterize the degree of relevance to the content of the question.

[0052] In one embodiment of the present application, the D obtained by the above two methods can be dr and D CMNS Find the union and get the new document set D conc Considering the semantic relationship between sentences in a document, BERT ranker is used to analyze the document set D. conc BERTranker is a document ranking method based on BERT. The input of BERT is the question and D conc The combination of each document in BERT is added, and a linear layer (softmax function) is added to the last layer of BERT to score the relevance of the documents. The role of softmax is to map the output of BERT to [0, 1], so that each document will have a corresponding score value between 0 and 1. This value is used to sort the documents, and then D is sorted according to the score. conc Sort the documents in .

[0053] Step 404: Expand the document that is ranked first to obtain multiple expanded documents.

[0054] It should be understood that the degree of relevance to the content of the question can also be represented by other methods besides the BERT model to achieve sorting. For example, the Transformer-XH model can also be used to obtain the relevance score to the content of the question, and the relevance score is used to represent the degree of relevance to the content of the question. This application does not limit this.

[0055] For D conc For example, when the data of the document actually comes from Wikipedia, the at least one document ranked first can be found through the hyperlink of Wikipedia to expand the document set D.ex For example, if a document docA (from at least one of the selected documents) is linked to by document docB or links to another document docC, then docB and docC are filtered out and put into document set D. ex middle.

[0056] Step 406: rank the previously ranked document and the multiple extended documents together based on the degree to which the document and the multiple extended documents are related to the content of the question.

[0057] Specifically, we can use BERT ranker to ex With D conc At least one document with the highest score is selected to participate in the scoring ranking.

[0058] Step 408: Generate a document set based on the documents ranked first.

[0059] For example, at least one document with a top score is selected by sorting, and thus constitutes the document set DTop, which is used to construct a paragraph graph in the subsequent process.

[0060] In one embodiment of the present application, the processor 120 may also execute Figure 5 Steps in the method shown. Figure 5 It is a schematic flow chart showing construction of a paragraph graph based on a document set in a method for generating a paragraph set according to another embodiment of the present specification.

[0061] Specifically, the process of constructing a paragraph graph based on a document set may specifically include the following steps 502 to 506:

[0062] Step 502: Sort the paragraphs in the document set according to the degree to which each paragraph in the document set is relevant to the content of the question.

[0063] Based on question q, BERT ranker is used to rank each paragraph in the document set.

[0064] Step 504: at least one paragraph that is ranked first is used as the first paragraph level.

[0065] Select at least paragraphs with the highest score as the first paragraph level. For example Figure 3 As shown, the three paragraphs with the highest scores are taken as the first paragraph level, and the three paragraphs are connected by undirected edges.

[0066] Step 506: From the remaining paragraphs in the document set, obtain paragraphs related to the content of the paragraphs in the first paragraph level to form a second paragraph level.

[0067] Specifically, paragraphs related to the facts or entities in the paragraphs at the first paragraph level are selected from the remaining paragraphs in the document set as the second paragraph level, and then undirected edges are used to represent the correspondence between the paragraphs at the two levels. The nodes connected to each node in the first paragraph level are also connected by undirected edges. Figure 3 As shown, the dotted line represents the fact or entity connection relationship, for example, the paragraphs P7, P15, etc. that have the same entity or fact as the paragraph P5 are connected by a dotted line. Figure 3 As shown, paragraphs including the same keywords as the paragraphs in the first paragraph level can be obtained from the remaining paragraphs in the document set to form a second paragraph level.

[0068] Put all the paragraphs in the constructed graph into a set, which is used as the final generated paragraph set, denoted as P all In one embodiment of the present application, the paragraph set P all The paragraphs in the text are randomly numbered to facilitate tracing back each paragraph in the subsequent reasoning process.

[0069] In another embodiment of this specification, Figure 1 The processor 120 in the embodiment may also execute Figure 6 Steps in the method shown. Figure 6 It is a schematic flowchart showing a paragraph set-based reasoning method according to an embodiment of the present application, including steps 602 to 610.

[0070] Step 602: Obtain a paragraph set based on the paragraph set generation method provided in the above-mentioned embodiment.

[0071] The method for generating a paragraph set has been described in detail in the previous embodiment description, and will not be repeated here.

[0072] Step 604: Screen the paragraph set to obtain multiple candidate paragraphs related to the content of the question, and generate an initial candidate paragraph set based on the multiple candidate paragraphs.

[0073] Specifically, based on question q and paragraph set P all Generate an initial candidate paragraph set P s1 , we can use the product of the TF-IDF weight of the token of question q and the TF-IDF weight of the paragraph as the screening rule, and select the paragraphs with the highest scores to generate the initial candidate paragraph set P s1 .

[0074] Step 606: Calculate the reasoning path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the reasoning path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph.

[0075] In one embodiment of the present specification, each time step selects a paragraph from the candidate paragraph set, and time step t represents the tth selection of a paragraph, and each time step generates a new candidate paragraph set. The first time step is to select from the initial selected paragraph set. Figure 7 As shown, at the tth time step, in the candidate paragraph set P st Select a paragraph in p i Specifically, it may include:

[0076] Step 702: Calculate the correlation between the candidate paragraphs in the candidate paragraph set corresponding to a time step and the selected candidate paragraphs, and determine the candidate paragraph with the highest correlation.

[0077] Calculate the probability of a candidate paragraph being selected in the candidate paragraph set corresponding to a time step. Probability calculation is to add a sigmoid layer after transformer-XH to obtain the probability value of each paragraph being selected in the candidate paragraph. s1 The probability of each candidate paragraph being selected is calculated, and the paragraph pi with the largest probability is regarded as the beginning of the reasoning path.

[0078] Step 704: Determine other candidate paragraphs related to the candidate paragraph with the greatest relevance, and form a candidate paragraph set corresponding to the next time step.

[0079] Specifically, we build a candidate paragraph set P s2 , P s2 The paragraphs in are determined based on the paragraph pi selected last time, that is, all the paragraphs connected to pi are put into the candidate paragraph set P corresponding to the next time step. s2 middle.

[0080] Then continue to calculate P s2 The probability of each paragraph being selected in the initial candidate paragraph set is calculated, that is, steps 702 and 704 are executed in a loop, and then the next candidate paragraph set is constructed, and the loop continues until the termination symbol [EOE] is encountered, that is, the construction of an inference path is completed. The termination symbol [EOE] can be pre-set in the initial candidate paragraph set to indicate the termination of the inference path.

[0081] Step 608: Path scoring is performed on the multiple reasoning paths, and the reasoning path with the highest path score is selected as the best path.

[0082] In one embodiment of the present specification, the process of scoring multiple reasoning paths may include: calculating the product of the degree of relevance of all candidate paragraphs in the reasoning path to the content of the question, and using the product to represent the path score of the reasoning path. Specifically, after B reasoning paths are constructed, such as E = {E1, E2, ..., E B}, where E1 can be expressed as E1 = {p i ,...,p k}. At this time, it is necessary to score multiple reasoning paths. The score calculation of the path is obtained by multiplying the probabilities of all paragraphs in the path being selected. It is necessary to select the most likely path from B paths. In one embodiment of the present application, the above process of obtaining the reasoning path can be completed based on a model. The training data of the model can be a question q and a paragraph set P all The training process of the model is the same as the process described in the above steps 702 and 704, and the loss function used by the model is the cross entropy loss function. The specific training process of the model will not be repeated.

[0083] Step 610: Input the best path into the answer prediction model to obtain the answer interval.

[0084] Choose the best path E best After that, it can be assumed that the answer to the question exists in the paragraphs in the path, and the selected paragraphs in the path and the question q can be used as the input of the BERT model to obtain the answer interval. The specific calculation process of the answer interval can be referred to the content disclosed in Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. InNAACL, 2019, which will not be repeated here.

[0085] In one embodiment of the present application, when fine-tuning the BERT model for obtaining the answer interval, a start vector S and an end vector E may be introduced. best For each paragraph in the text, we use the BERT model to fine-tune the probability that each word in the paragraph may be the starting position and the ending position of the answer interval. We select the maximum value of the product of the probabilities of the starting position and the ending position, and the content between the starting position and the ending position is the answer interval.

[0086] Figure 8 Schematic diagram of the structure of a device for generating a paragraph set provided in an embodiment of the present application. Figure 8 As shown, the device 80 for generating a paragraph set includes:

[0087] A screening module 801 is configured to obtain a document set related to the question from a document database;

[0088] A paragraph graph construction module 802 is configured to construct a paragraph graph based on the document set, wherein the paragraph graph includes a plurality of paragraph levels, the paragraph level includes a plurality of paragraphs from the document set, and the paragraphs in the paragraph level are related to the content of at least one paragraph in the next paragraph level;

[0089] The paragraph set acquisition module 803 is configured to acquire all paragraphs in the paragraph graph to generate a paragraph set.

[0090] This application uses document screening to filter out documents that are sufficiently relevant to the content of the question from the document database, and splits the documents in the document set into paragraphs by constructing a paragraph graph. This can efficiently, accurately and comprehensively obtain a set of paragraphs that are sufficiently relevant to the content of the question, and effectively avoid losing valuable information, providing a high-quality data foundation for subsequent answer predictions and improving the effect of answer prediction.

[0091] In an embodiment of the present application, the screening module 801 is further configured as follows:

[0092] Calculating the relevance between the documents in the document database and the content of the question, and selecting a document from the document database based on the calculation result of the relevance; and / or

[0093] The relevance between the entity vocabulary in the question and the entity vocabulary included in the document database is calculated, and based on the calculation result of the relevance, the document corresponding to the entity vocabulary is selected from the document database.

[0094] In an embodiment of the present application, the screening module 801 is further configured to obtain the calculation result of the relevance through the following steps:

[0095] The product of the term frequency-inverse text frequency index weight of the term in the problem is calculated and the term frequency-inverse text frequency index weight of the document in the document database is multiplied, and the value of the product is used to represent the calculation result of the relevance.

[0096] In an embodiment of the present application, the screening module 801 is further configured as follows:

[0097] ranking the documents selected from the document database based on the degree to which the documents selected from the document database are relevant to the content of the question;

[0098] Expand the document that is sorted first to obtain multiple extended documents;

[0099] Based on the relevance of the document and the multiple extended documents to the content of the question, the at least one document ranked first and the multiple extended documents are ranked together;

[0100] Generate a document set based on the top-ranked documents.

[0101] In an embodiment of the present application, the paragraph diagram construction module 802 is further configured as follows:

[0102] Sort the paragraphs in the document set according to how relevant each paragraph is to the content of the question;

[0103] Set at least one of the preceding paragraphs as the first paragraph level;

[0104] Among the remaining paragraphs in the document set, paragraphs related to the contents of the paragraphs in the first paragraph level are obtained to form a second paragraph level.

[0105] In an embodiment of the present application, obtaining paragraphs related to the content of paragraphs in the first paragraph level to form a second paragraph level includes:

[0106] Among the remaining paragraphs in the document set, the paragraphs whose contents include the same keywords as the paragraphs in the first paragraph level are obtained to form a second paragraph level.

[0107] Fig. 9 is a schematic diagram of the structure of an inference device provided in an embodiment of the present application. Fig. 9 As shown, the reasoning device 90 includes:

[0108] The paragraph set generating module 901 is configured to obtain a paragraph set based on the method for generating a paragraph set as described above;

[0109] A candidate paragraph set generating module 902 is configured to screen the paragraph set to obtain a plurality of candidate paragraphs related to the content of the question, and generate an initial candidate paragraph set based on the plurality of candidate paragraphs;

[0110] The reasoning path acquisition module 903 is configured to calculate the reasoning path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the reasoning path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph;

[0111] A path scoring module 904 is configured to score the multiple reasoning paths and select the reasoning path with the highest path score as the best path;

[0112] The answer prediction module 905 is configured to input the best path into the answer prediction model to obtain the answer interval.

[0113] This application uses document screening to filter out documents that are sufficiently relevant to the content of the question from the document database, and splits the documents in the document set into paragraphs by constructing a paragraph graph. This can efficiently, accurately and comprehensively obtain a set of paragraphs that are sufficiently relevant to the content of the question, and effectively avoid losing valuable information, providing a high-quality data foundation for subsequent answer predictions and improving the effect of answer prediction.

[0114] In an embodiment of the present application, the reasoning path acquisition module 903 is further configured as follows:

[0115] Calculate the relevance between the candidate paragraphs in the candidate paragraph set corresponding to a time step and the selected candidate paragraphs, and determine the candidate paragraph with the greatest relevance;

[0116] Other candidate paragraphs related to the candidate paragraph with the greatest relevance are determined to form a candidate paragraph set corresponding to the next time step.

[0117] In one embodiment of the present application, path scoring is performed on multiple reasoning paths, including:

[0118] The product of the degree to which all candidate paragraphs in the reasoning path are related to the content of the question is calculated, and the product is used to represent the path score of the reasoning path.

[0119] In one embodiment of the present application, the degree of relevance to the content of the question is obtained in the following manner:

[0120] A relevance score to the content of the question is obtained based on the scoring model, and the relevance score is used to represent the degree of relevance to the content of the question.

[0121] An embodiment of the present application further provides a computing device, including a memory, a processor, and computer instructions stored in the memory and executable on the processor. When the processor executes the instructions, the following method steps for generating a paragraph set are implemented:

[0122] Screening the document database to obtain multiple documents related to the content of the question, and generating a document set based on the multiple documents;

[0123] Building a paragraph graph based on the document set, wherein the paragraph graph includes a plurality of paragraph levels, the paragraph levels include a plurality of paragraphs from the document set, and the paragraphs in each paragraph level are related to the content of at least one paragraph in the next paragraph level; and

[0124] Get all the paragraphs in the paragraph graph to generate a paragraph set.

[0125] In an embodiment of the present application, a document set related to a question is obtained from a document database, including:

[0126] Calculating the relevance between the documents in the document database and the content of the question, and selecting a document from the document database based on the calculation result of the relevance; and / or

[0127] The relevance between the entity vocabulary in the question and the entity vocabulary included in the document database is calculated, and based on the calculation result of the relevance, the document corresponding to the entity vocabulary is selected from the document database.

[0128] In an embodiment of the present application, the calculation result of the correlation is obtained by the following steps:

[0129] The product of the term frequency-inverse text frequency index weight of the term in the problem is calculated and the term frequency-inverse text frequency index weight of the document in the document database is multiplied, and the value of the product is used to represent the calculation result of the relevance.

[0130] In an embodiment of the present application, a document set is generated based on multiple documents, including:

[0131] Rank the multiple documents based on how relevant the documents are to the content of the question;

[0132] Expand at least one document that is ranked first to obtain multiple expanded documents;

[0133] Based on the relevance of the document and the multiple extended documents to the content of the question, the at least one document ranked first and the multiple extended documents are ranked together;

[0134] A document set is generated based on at least one document that is ranked first.

[0135] In one embodiment of the present application, a paragraph graph is constructed based on a document set, including:

[0136] Sort the paragraphs in the document set according to how relevant each paragraph is to the content of the question;

[0137] Set at least one of the preceding paragraphs as the first paragraph level;

[0138] Among the remaining paragraphs in the document set, paragraphs related to the contents of the paragraphs in the first paragraph level are obtained to form a second paragraph level.

[0139] In an embodiment of the present application, obtaining paragraphs related to the content of paragraphs in the first paragraph level to form a second paragraph level includes:

[0140] Among the remaining paragraphs in the document set, the paragraphs whose contents include the same keywords as the paragraphs in the first paragraph level are obtained to form a second paragraph level.

[0141] An embodiment of the present application further provides a computing device, including a memory, a processor, and computer instructions stored in the memory and executable on the processor. When the processor executes the instructions, the following steps of the reasoning method are implemented:

[0142] Obtain a paragraph set based on the method for generating a paragraph set as described above;

[0143] Screening the paragraph set to obtain multiple candidate paragraphs related to the content of the question, and generating an initial candidate paragraph set based on the multiple candidate paragraphs;

[0144] Calculating a reasoning path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the reasoning path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph;

[0145] Scoring multiple reasoning paths, and taking the reasoning path with the highest path score as the best path;

[0146] The optimal path is input into the answer prediction model to obtain the answer interval.

[0147] In one embodiment of the present application, calculating the reasoning path corresponding to each candidate paragraph in the candidate paragraph set includes:

[0148] Calculate the relevance between the candidate paragraphs in the candidate paragraph set corresponding to a time step and the selected candidate paragraphs, and determine the candidate paragraph with the greatest relevance;

[0149] Other candidate paragraphs related to the candidate paragraph with the greatest relevance are determined to form a candidate paragraph set corresponding to the next time step.

[0150] In one embodiment of the present application, path scoring is performed on multiple reasoning paths, including:

[0151] The product of the degree to which all candidate paragraphs in the reasoning path are related to the content of the question is calculated, and the product is used to represent the path score of the reasoning path.

[0152] In one embodiment of the present application, the degree of relevance to the content of the question is obtained in the following manner:

[0153] A relevance score to the content of the question is obtained based on the scoring model, and the relevance score is used to represent the degree of relevance to the content of the question.

[0154] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the method for generating a paragraph set as described above.

[0155] The above is a schematic scheme of the computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the method for generating a paragraph set are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the method for generating a paragraph set.

[0156] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the paragraph set-based reasoning method as described above.

[0157] The above is a schematic scheme of the computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned paragraph set-based reasoning method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the above-mentioned paragraph set-based reasoning method.

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

[0159] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0160] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0161] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is limited only by the claims and their full scope and equivalents.

Claims

1. A method for generating a paragraph set, characterized in that: include: Obtaining a document set related to the question from a document database, wherein the documents in the document set are documents related to the question; According to the degree of relevance of each paragraph in the document set to the content of the question, the paragraphs in the document set are sorted; at least one paragraph ranked first is used as a first paragraph level; among the remaining paragraphs in the document set, paragraphs related to the content of the paragraphs in the first paragraph level are obtained to form a second paragraph level, and a paragraph graph is generated, wherein the paragraph graph includes multiple paragraph levels, and the paragraph levels include multiple paragraphs from the document set; All paragraphs in the paragraph graph are obtained to generate the paragraph set.

2. The method according to claim 1, characterized in that: The step of obtaining a document set related to the question from a document database includes: Calculating the relevance between the documents in the document database and the content of the question, and selecting a document from the document database based on the calculation result of the relevance; and / or The entity vocabulary in the question and the entity vocabulary included in the document database are relevance calculated, and based on the calculation result of the relevance, the document corresponding to the entity vocabulary is selected from the document database.

3. The method according to claim 2, characterized in that The calculation result of the correlation is obtained by the following steps: The product of the word frequency-inverse text frequency index weight of the term in the question and the word frequency-inverse text frequency index weight of the document in the document database is calculated, and the value of the product is used to represent the calculation result of the relevance.

4. The method according to claim 2, characterized in that: The step of obtaining a document set related to the question from the document database further includes: ranking the documents selected from the document database based on the degree to which the documents selected from the document database are related to the content of the question; Expand the document that is sorted first to obtain multiple extended documents; Based on the degree to which the document and the multiple extended documents are related to the content of the question, the document ranked first and the multiple extended documents are ranked together; The document set is generated based on the documents that are ranked first.

5. The method according to claim 1, characterized in that The step of acquiring paragraphs related to the contents of the paragraphs in the first paragraph level to form a second paragraph level includes: Among the remaining paragraphs in the document set, paragraphs whose contents include the same keywords as those of the paragraphs in the first paragraph level are obtained to form the second paragraph level.

6. A method of reasoning, characterized in that include: Acquire the paragraph set based on the method according to any one of claims 1 to 5; Screening the paragraph set to obtain multiple candidate paragraphs related to the content of the question, and generating an initial candidate paragraph set based on the multiple candidate paragraphs; Calculating a reasoning path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the reasoning path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph; Performing path scoring on the multiple reasoning paths, and selecting the reasoning path with the highest path score as the best path; The optimal path is input into the answer prediction model to obtain the answer interval.

7. The method according to claim 6, characterized in that The calculating the reasoning path corresponding to each candidate paragraph in the candidate paragraph set includes: Calculating the relevance between the candidate paragraphs in the candidate paragraph set corresponding to a time step and the selected candidate paragraphs, and determining the candidate paragraph with the greatest relevance; Other candidate paragraphs related to the candidate paragraph with the greatest relevance are determined to form the candidate paragraph set corresponding to the next time step.

8. The method according to claim 6, characterized in that The performing path scoring on the plurality of reasoning paths comprises: The product of the degree to which all candidate paragraphs in the reasoning path are respectively related to the content of the question is calculated, and the product is used to represent the path score of the reasoning path.

9. The method according to claim 8, characterized in that The degree of relevance to the content of the question is obtained as follows: A relevance score to the content of the question is obtained based on a scoring model, and the relevance score is used to represent the degree of relevance to the content of the question.

10. A device for generating a paragraph set, characterized in that: include: A screening module is configured to obtain a document set related to the question from a document database, wherein the documents in the document set are documents related to the question; A paragraph graph construction module is configured to sort the paragraphs in the document set according to the degree to which each paragraph in the document set is related to the content of the question; take at least one paragraph ranked first as a first paragraph level; obtain paragraphs related to the content of the paragraphs in the first paragraph level from the remaining paragraphs in the document set to form a second paragraph level, and generate a paragraph graph, wherein the paragraph graph includes multiple paragraph levels, and the paragraph levels include multiple paragraphs from the document set; The paragraph set acquisition module is configured to acquire all paragraphs in the paragraph graph to generate the paragraph set.

11. An inference device, characterized in that: include: A paragraph set generation module, configured to obtain the paragraph set based on the method according to any one of claims 1 to 5; A candidate paragraph set generating module is configured to screen the paragraph set to obtain a plurality of candidate paragraphs related to the content of the question, and generate an initial candidate paragraph set based on the plurality of candidate paragraphs; an inference path acquisition module, configured to calculate an inference path corresponding to each candidate paragraph in the initial candidate paragraph set, wherein the inference path includes the corresponding candidate paragraph and at least one other candidate paragraph related to the corresponding candidate paragraph; A path scoring module is configured to score the multiple reasoning paths and select the reasoning path with the highest path score as the best path; The answer prediction module is configured to input the optimal path into the answer prediction model to obtain the answer interval.

12. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the instructions, the steps of the method described in any one of claims 1-5 or 6-9 are implemented.

13. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method described in any one of claims 1-5 or 6-9 are implemented.