A document response method, device, equipment and storage medium
By generating target question-and-answer pairs at the sentence level and utilizing a semantic matching model, the problems of low efficiency and inaccurate responses to unstructured documents are solved, achieving efficient and accurate document responses.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JD DIGITS HAIYI INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2023-08-04
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies for responding to unstructured documents are inefficient and inaccurate, resulting in high computational resource consumption and a poor response experience.
By generating target question-answer pairs at the statement level, a semantic matching model is used to quickly determine the matching question for the current question and respond with an accurate answer.
It improves response efficiency, reduces computing resource consumption, and provides an accurate and efficient response experience.
Smart Images

Figure CN116932727B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to computer technology, and more particularly to a document response method, apparatus, device, and storage medium. Background Technology
[0002] With the rapid development of computer technology, it is often necessary to respond to user questions based on unstructured documents.
[0003] Currently, responses are typically given paragraph by paragraph within a document. For example, the paragraph in the document that is most relevant to the user's question might be used as the answer.
[0004] However, in the process of realizing this invention, the inventors discovered at least the following problems in the prior art:
[0005] Because the document contains a large number of paragraphs, and each paragraph has a large number of words, it requires a lot of computing resources to determine the relevance of each paragraph to the question, which reduces the efficiency of the response. Furthermore, the response paragraphs may contain a lot of redundant information, which cannot accurately answer the question and reduces the response experience. Summary of the Invention
[0006] This invention provides a document response method, apparatus, device, and storage medium to achieve accurate and efficient responses at the statement level, thereby improving response efficiency and experience.
[0007] In a first aspect, embodiments of the present invention provide a document response method, including:
[0008] Retrieve the current questions raised for the unstructured target document;
[0009] Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-and-answer pairs are information at the statement granularity.
[0010] Semantically match the current question with the target question in each target question-answer pair to determine the target question that matches the current question;
[0011] The current question is answered based on the target answer corresponding to the matching target question.
[0012] Secondly, embodiments of the present invention also provide a document response device, comprising:
[0013] The current issue acquisition module is used to acquire the current issue raised for the unstructured target document;
[0014] The target question-answer pair acquisition module is used to acquire multiple target question-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-answer pair are information at the statement granularity.
[0015] The question matching module performs semantic matching between the current question and the target questions in each target question-answer pair to determine the target questions that match the current question.
[0016] The question response module is used to respond to the current question based on the target answer corresponding to the matching target question.
[0017] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0018] One or more processors;
[0019] Memory, used to store one or more programs;
[0020] When the one or more programs are executed by the one or more processors, the one or more processors implement the document response method as provided in any embodiment of the present invention.
[0021] Fourthly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the document response method as provided in any embodiment of the present invention.
[0022] One embodiment of the above invention has the following advantages or beneficial effects:
[0023] By pre-generating multiple target question-and-answer pairs based on unstructured target documents, and ensuring that the target question and answer in each pair are at the sentence level (meaning that the target question at the sentence level is shorter than that of a paragraph), fewer computational resources are needed to semantically match the current question with the target questions in each target question-and-answer pair. This quickly identifies the target question that matches the current question, improving response efficiency. Furthermore, the target answer at the sentence level is the precise answer to the target question, without redundant information. Therefore, based on the target answer corresponding to the matched target question, a precise and efficient response can be provided to the current question, enhancing the response experience. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of a document response method provided in one embodiment of the present invention;
[0026] Figure 2 This is a flowchart of a document response method provided in one embodiment of the present invention;
[0027] Figure 3 This is a flowchart of a document response method provided in one embodiment of the present invention;
[0028] Figure 4 This is a flowchart of a document response method provided in one embodiment of the present invention;
[0029] Figure 5 This is a schematic diagram of the structure of a document response device provided in one embodiment of the present invention;
[0030] Figure 6 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present invention. Detailed Implementation
[0031] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0032] Figure 1 This is a flowchart illustrating a document response method according to an embodiment of the present invention. This embodiment is applicable to situations where user questions are answered based on documents. The method can be executed by a document response device, which can be implemented in software and / or hardware and integrated into an electronic device. Figure 1 As shown, the method specifically includes the following steps:
[0033] S110. Obtain the current issues raised for the unstructured target document.
[0034] The target document can refer to an existing document in the database and / or the latest uploaded document. There can be one or more target documents. An unstructured target document can refer to a document structure that a computer cannot directly process. For example, a target document might be represented using paragraph text rather than a two-dimensional logical table. The current question can be the information about the question currently being asked by the user. The target document contains the answer to the current question.
[0035] Specifically, it can retrieve the user's current question about the target document, so that the answer to the current question can exist in the target document. For example, if the target document is about sports information, it can prompt the user to enter a question about sports information, so that the target document can be used to effectively answer the user's current question.
[0036] S120. Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target questions and target answers in the target question-and-answer pairs are information at the statement granularity.
[0037] The target question-answer pair can be a question-answer pair mined from the target document. Each target question-answer pair includes a target question and a target answer. The target question at the statement level can be a question described using a concise single statement. The target answer at the statement level can also be an answer described using a concise single statement. For example, the target question could be: "What is the height of athlete Zhang San?", and the corresponding target answer could be: "Zhang San's height is 1.9 meters."
[0038] Specifically, the content of the target document can be pre-parsed and semantically refined to generate multiple target question-and-answer pairs at the sentence level, thereby obtaining questions and corresponding answers that closely match the user's questioning intent. These multiple target question-and-answer pairs generated based on the target document's content can be stored in a database, allowing for direct retrieval of all target question-and-answer pairs corresponding to the target document during actual response.
[0039] S130. Perform semantic matching between the current question and the target question in each target question-answer pair to determine the target question that matches the current question.
[0040] Specifically, the current question and the target questions in each target question-answer pair can be input into a semantic matching model for semantic matching. The semantic matching model encodes the input current and target questions, determines the cosine value between the encoded current question vector and the target question vector, and outputs this cosine value as the semantic similarity between the current and target questions. By utilizing the semantic matching model, the semantic similarity between the current question and each target question can be obtained, and the target question with the highest semantic similarity can be identified as the target question that matches the current question.
[0041] It should be noted that, compared to paragraphs, the target questions at the sentence level are shorter. Therefore, when semantically matching the current question with each target question, only less computing resources are needed to quickly determine the target question that matches the current question, thereby improving document response efficiency.
[0042] S140. Based on the target answer corresponding to the matching target question, respond to the current question.
[0043] Specifically, the target answer corresponding to the matching target question can be directly used as the current answer to the current question, thus greatly improving the response speed. Furthermore, the current answer provided is the precise answer to the current question, without any redundant information, allowing users to quickly obtain the answer and enhancing the user response experience.
[0044] The technical solution of this embodiment generates multiple target question-and-answer pairs in advance based on unstructured target documents. Each target question and answer pair contains information at the sentence level. This means that, compared to paragraphs, the target question at the sentence level is shorter, requiring less computational resources to semantically match the current question with the target questions in each target question-and-answer pair. This quickly identifies the target question that matches the current question, improving response efficiency. Furthermore, the target answer at the sentence level is the precise answer to the target question, without redundant information. Therefore, based on the target answer corresponding to the matching target question, a precise and efficient response can be provided to the current question, enhancing the response experience.
[0045] Figure 2 This is a flowchart of a document response method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment describes in detail the process of generating target question-answer pairs. Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.
[0046] See Figure 2 Another document response method provided in this embodiment specifically includes the following steps:
[0047] S210. Aggregate paragraph information with similar content in unstructured target documents to obtain multiple aggregated target paragraph information.
[0048] Here, paragraph information with similar content can refer to paragraphs describing the same topic. Target paragraph information can refer to each paragraph in the target document after paragraph aggregation.
[0049] Specifically, at least two paragraphs with similar content in the target document can be aggregated into one paragraph, and each aggregated target paragraph describes different content.
[0050] For example, S210 may include: obtaining title information in the target document; aggregating the paragraph information under the same title information to obtain multiple aggregated target paragraph information.
[0051] The title information can be divided into long title information and short title information based on the length of the title content, or into first-level title information, second-level title information, and third-level title information based on the hierarchical relationship.
[0052] Specifically, fine-grained paragraph aggregation can be performed on the target document based on the most detailed heading information, such as short headings or bottom-level headings (i.e., the lowest level headings, such as third-level headings). For example, all paragraphs under each short heading can be aggregated into one paragraph to obtain the target paragraph information corresponding to each short heading. Similarly, all paragraphs under each bottom-level heading can be aggregated into one paragraph to obtain the target paragraph information corresponding to each bottom-level heading. By utilizing the position of heading information, paragraph aggregation of similar content can be performed quickly.
[0053] S220. Based on template generation and / or model generation, generate question-answer pairs for each target paragraph information to obtain multiple target question-answer pairs at the sentence level.
[0054] One method for template generation is to use templates to generate target question-and-answer pairs. The templates can be pre-defined based on question-and-answer pair generation rules. For example, target questions at the sentence level can be generated based on a question template and the corresponding title information for each target paragraph. Then, by extracting and abbreviating information from each target paragraph, target answers at the sentence level can be generated.
[0055] The model generation method can be to generate target question-answer pairs using a model. The model can include a pre-trained question-answer pair generation model. For example, a summary generation model can be used to semantically condense the information of each target paragraph to determine the target answer at the sentence level, and a question generation model can be used to generate a question for each target answer at the sentence level to obtain the target question at the sentence level.
[0056] Specifically, question-answer pairs can be generated for each target paragraph solely based on template generation, resulting in multiple template-generated question-answer pairs. Alternatively, question-answer pairs can be generated for each target paragraph solely based on model generation, resulting in multiple model-generated question-answer pairs. Furthermore, question-answer pairs can be generated using both template-generated and model-generated methods, respectively, thereby increasing the diversity of question-answer pair generation and further improving the accuracy of responses. After obtaining multiple target question-answer pairs at the sentence level, all target question-answer pairs corresponding to the target document can be stored in a database for subsequent responses.
[0057] S230. Obtain the current issues raised for the unstructured target document.
[0058] S240. Perform semantic matching between the current question and the target question in each target question-answer pair to determine the target question that matches the current question.
[0059] Specifically, the current question can be semantically matched with the target questions in each target question-answer pair pre-stored in the database, and the target question with the highest semantic similarity can be used as the target question that matches the current question.
[0060] S250. Based on the target answer corresponding to the matching target question, respond to the current question.
[0061] Specifically, the target answer corresponding to the matching target question is returned to the user as the current answer to the current question, thereby enabling document response at the sentence level and improving document response efficiency.
[0062] The technical solution of this embodiment aggregates paragraph information with similar content in unstructured target documents to obtain multiple aggregated target paragraph information. Based on template generation and / or model generation, question-answer pairs are generated for each target paragraph information. This allows for accurate acquisition of multiple target question-answer pairs at the sentence level, enabling subsequent document responses at the sentence level and improving document response efficiency.
[0063] As an optional embodiment, step S220, "generating question-answer pairs for each target paragraph based on the template generation method to obtain multiple target question-answer pairs," may include the following steps S221-S223:
[0064] S221. Based on multiple question generation templates, expand the title information corresponding to each target paragraph information to generate multiple question statements corresponding to each target paragraph information.
[0065] In each question generation template, the variable parameter is the title information. Different question generation templates can generate different question statements for the same title information. For example, the question generation template could be: "What does [title information] mean?" or "How to understand [title information]?"
[0066] Specifically, for each target paragraph, the corresponding heading information, such as short headings or final headings, can be used to generate each question statement for that paragraph, following the question generation format in each question generation template. By utilizing multiple question generation templates, multiple question statements that closely resemble the user's expression can be generated based on the heading information.
[0067] For example, based on the question template, the questions present in each target paragraph information can be identified, and the identified questions can be directly used as the question statements corresponding to the target paragraph information.
[0068] S222. Based on the keyword information in each target paragraph, extract sentences from each target paragraph and generate the answer sentences corresponding to each target paragraph.
[0069] Specifically, for each target paragraph, the frequency of each word in the paragraph can be counted, and words with frequencies greater than a preset frequency can be designated as keywords. The number of keywords contained in each paragraph can also be counted. The paragraph with the most keywords can be selected as the answer statement for that target paragraph. Alternatively, target paragraphs with a keyword count greater than or equal to a preset number can be extracted, simplified, and used to obtain the answer statement for that target paragraph.
[0070] S223. Based on the multiple question and answer statements corresponding to the target paragraph information, determine multiple target question-answer pairs.
[0071] Specifically, the answer statement corresponding to each target paragraph can be used as the answer to the corresponding multiple question statements. For example, a question statement and its corresponding answer statement corresponding to each target paragraph can be used as a target question-answer pair, thereby obtaining multiple target question-answer pairs corresponding to each target paragraph.
[0072] It should be noted that the target questions in the target question-and-answer pairs generated using the template can be expanded versions of the title information, and the target answers can be directly extracted from or abbreviated versions of the statements in the target paragraph information.
[0073] As an optional embodiment, step S220, "generating question-answer pairs for each target paragraph based on the model generation method to obtain multiple target question-answer pairs," may include the following steps S224-S227:
[0074] S224. Input the information of each target paragraph into the pre-trained summary generation model to abbreviate the paragraph and obtain the abbreviated paragraph information.
[0075] The summary generation model can be a model used to summarize and abbreviate paragraph content and extract key information. The summary generation model can be a pre-trained model based on sample data to ensure the accuracy of the model's processing. The summary generation model can be, but is not limited to, a generative pre-trained model.
[0076] Specifically, for each target paragraph, the information can be input into a pre-trained summarization model. The model can abbreviate the input paragraph into semantically concise short sentences and output the abbreviated paragraphs. Based on the output of the summarization model, the corresponding abbreviated paragraph information can be obtained. For example, by using the summarization model, 100 target paragraphs can be condensed into 30 abbreviated paragraphs.
[0077] S225. Based on the part-of-speech information and / or word frequency information of each abbreviated statement in the abbreviated paragraph information, determine multiple target abbreviated statements to be used as answers.
[0078] Specifically, it can analyze the parts of speech (nouns, adjectives, etc.) of each abbreviated phrase in the abbreviated paragraph information, and count the number of nouns and adjectives contained in each abbreviated phrase. It can also count the word frequency of each word in the abbreviated paragraph information, and identify words with frequencies greater than a preset frequency as keywords, and count the number of keywords contained in each abbreviated phrase. Based on the same number of parts of speech and / or keywords, it can filter out multiple target abbreviated phrases that are important and can be used as answers from all abbreviated phrases. For example, abbreviated phrases with a number of nouns or adjectives greater than a preset number can be identified as target abbreviated phrases. Similarly, abbreviated phrases with a number of keywords greater than or equal to a preset number can also be identified as target abbreviated phrases.
[0079] S226. Input the information of each target abbreviation and abbreviation paragraph into the pre-trained question generation model to generate questions and determine the question statement corresponding to each target abbreviation.
[0080] The question generation model can be a network model that automatically generates questions based on semantic information. It can be a pre-trained model based on sample data to ensure accuracy. The question generation model can be, but is not limited to, a generative pre-trained model.
[0081] Specifically, for each target paragraph information, each target abbreviation and abbreviation paragraph information corresponding to the target paragraph information can be input into a pre-trained question generation model. The question generation model can use the input abbreviation paragraph information as context information of the target abbreviation statement for semantic analysis, generate a question statement that matches the answer statement of the target abbreviation statement, and output it. Thus, based on the output of the question generation model, a question statement generated for each target abbreviation statement can be obtained.
[0082] S227. Based on the target abbreviation and question statement, identify multiple target question-answer pairs.
[0083] Specifically, for each target paragraph information, multiple target shortened statements corresponding to the target paragraph information and question statements generated for each target abbreviation statement are obtained. A target shortened statement corresponding to the target paragraph information and the corresponding question statement are taken as a target question-answer pair, thereby obtaining multiple target question-answer pairs corresponding to each target paragraph information.
[0084] It should be noted that the target answer in the target question-answer pair generated by the model can be an answer statement that is semantically abbreviated and condensed from the target paragraph information. The target question is a question statement that is semantically generated based on the target answer, which can enrich the question-answer style and ensure the accuracy of the document response.
[0085] Figure 3 This is a flowchart of a document response method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment optimizes the step of "responding to the current question based on the target answer corresponding to the matching target question". Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.
[0086] See Figure 3 Another document response method provided in this embodiment specifically includes the following steps:
[0087] S310. Obtain the current issues raised for the unstructured target document.
[0088] S320. Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target questions and target answers in the target question-and-answer pairs are information at the statement granularity.
[0089] S330. Perform semantic matching between the current question and the target question in each target question-answer pair to determine the target question that matches the current question.
[0090] S340. Detect whether the semantic similarity between the current question and the matching target question is greater than or equal to a preset similarity. If yes, proceed to step S350; otherwise, proceed to step S360.
[0091] The preset similarity can be set in advance based on business requirements, allowing for the minimum semantic similarity of responses at the statement level.
[0092] S350. The target answer corresponding to the matching target question is used as the current answer to the current question.
[0093] Specifically, when the semantic similarity between the current question and the matching target question is greater than or equal to the preset similarity, the target answer corresponding to the matching target question can be used as the current answer to ensure the accuracy of the response at the sentence level.
[0094] S360. Perform semantic matching between the current question and each paragraph in the target document to determine the paragraph information that matches the current question, and respond to the current question based on the matching paragraph information.
[0095] Specifically, when the semantic similarity between the current question and the matching target question is less than a preset similarity, it indicates that the maximum semantic similarity in the target question-answer pair is also less than the preset similarity, resulting in poor accuracy of responses at the sentence level. In this case, a semantic matching model can be used to semantically match the current question with each paragraph in the target document. For example, the current question and each paragraph in the target document can be input into the semantic matching model for semantic matching. The semantic matching model can encode the input current question and paragraph information, determine the cosine value between the encoded current question vector and the paragraph vector, and output this cosine value as the semantic similarity between the current question and the paragraph information. The paragraph information with the highest semantic similarity can be identified as the paragraph information that matches the current question. The matching paragraph information can be directly used as the current answer corresponding to the current question to respond, thereby achieving document-level responses at the paragraph level and ensuring the accuracy of document responses.
[0096] The technical solution of this embodiment provides a document response at the sentence level when the semantic similarity between the current question and the matching target question is greater than or equal to a preset similarity, and at the paragraph level when the semantic similarity between the current question and the matching target question is less than the preset similarity. This combination of sentence-level and paragraph-level document responses ensures the accuracy of the document response.
[0097] Figure 4 This is a flowchart of a document response method provided by an embodiment of the present invention. Based on the above embodiments, this embodiment optimizes the step "responding to the current question based on matching paragraph information". Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here.
[0098] See Figure 4 Another document response method provided in this embodiment specifically includes the following steps:
[0099] S410. Obtain the current issues raised for the unstructured target document.
[0100] S420. Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target questions and target answers in the target question-and-answer pairs are information at the statement granularity.
[0101] S430. Perform semantic matching between the current question and the target question in each target question-answer pair to determine the target question that matches the current question.
[0102] S440. Detect whether the semantic similarity between the current question and the matching target question is greater than or equal to the preset similarity. If yes, proceed to step S450; otherwise, proceed to step S460.
[0103] S450. The target answer corresponding to the matching target question is used as the current answer to the current question.
[0104] S460. Perform semantic matching between the current question and each paragraph information in the target document to determine the paragraph information that matches the current question.
[0105] S470. Detect whether the semantic similarity between the current question and the matching paragraph information is greater than or equal to the preset similarity. If yes, proceed to step S480; otherwise, proceed to step S490.
[0106] The preset similarity can be set in advance based on business needs, allowing for the minimum semantic similarity at the paragraph level.
[0107] S480. Use the matching paragraph information as the current answer to the current question.
[0108] Specifically, when the semantic similarity between the current question and the matching paragraph information is greater than or equal to the preset similarity, the matching paragraph information can be used as the current answer to ensure the accuracy of the response at the paragraph level.
[0109] S490. Input the current question and the matching paragraph information into the pre-trained reading comprehension model to obtain the target segment information output by the reading comprehension model, and use the target segment information as the current answer to the current question.
[0110] In this context, fragment information is a part of paragraph information. Target fragment information can refer to textual information extracted from paragraph information that is relevant to the question. Compared to paragraph information, fragment information is more precise and does not contain redundant information unrelated to the question. The reading comprehension model can be a Machine Reading Comprehension (MRC) model based on deep neural networks. For example, the reading comprehension model can be obtained by pre-training a pre-trained model using fragment extraction-based reading comprehension. To enable fragment extraction-based reading comprehension learning based on boundary prediction, the reading comprehension model can utilize a multi-layer recurrent neural network and attention mechanism to obtain the context vector representation of each word in the question and document. However, this approach requires significant computational resources and greatly increases the time consumption.
[0111] Specifically, when the semantic similarity between the current question and the matching paragraph information is less than the preset similarity, it indicates that the maximum semantic similarity in the paragraph information is also less than the preset similarity, and the accuracy of the response at the paragraph level is also poor. In this case, the current question and the matching paragraph information can be input into a pre-trained reading comprehension model. The reading comprehension model can extract sentence fragments related to the current question from the matching paragraph information as target fragment information for output. Based on the output of the reading comprehension model, target fragment information matching the current question can be obtained, and the target fragment information can be used as the current answer corresponding to the current question for response, thereby realizing document response at the fragment level and ensuring the accuracy of document response.
[0112] It should be noted that, compared to the method of inputting the current question and target document into the reading comprehension model, which then extracts target fragment information within the scope of the input target document, this embodiment inputs the paragraph information that matches the current question and target document into the reading comprehension model. This allows the reading comprehension model to extract target fragment information only within the scope of the input paragraph information, thereby quickly obtaining the target fragment information and further improving document response efficiency.
[0113] The technical solution of this embodiment, by combining sentence granularity, paragraph granularity and fragment granularity for multi-granular document response, can improve the semantic richness of document response, and also avoid the problems of computational resource consumption and response time increase caused by simply using paragraph response and simply relying on reading comprehension model response, thereby effectively improving response efficiency and further ensuring the accuracy of document response.
[0114] The following are embodiments of the document response device provided in this invention. This device and the document response methods in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the document response device, please refer to the embodiments of the above document response methods.
[0115] Figure 5 This is a schematic diagram of a document response device provided in an embodiment of the present invention. This embodiment is applicable to situations where user questions are answered based on documents. Figure 5 As shown, the device specifically includes: a current question acquisition module 510, a target question-answer pair acquisition module 520, a question matching module 530, and a question response module 540.
[0116] The system includes: a current question acquisition module 510, used to acquire a current question posed to an unstructured target document; a target question-answer pair acquisition module 520, used to acquire multiple target question-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-answer pair are information at the sentence level; a question matching module 530, used to perform semantic matching between the current question and the target question in each target question-answer pair to determine the target question that matches the current question; and a question response module 540, used to respond to the current question based on the target answer corresponding to the matched target question.
[0117] The technical solution of this embodiment generates multiple target question-and-answer pairs in advance based on unstructured target documents. Each target question and answer pair contains information at the sentence level. This means that, compared to paragraphs, the target question at the sentence level is shorter, requiring less computational resources to semantically match the current question with the target questions in each target question-and-answer pair. This quickly identifies the target question that matches the current question, improving response efficiency. Furthermore, the target answer at the sentence level is the precise answer to the target question, without redundant information. Therefore, based on the target answer corresponding to the matching target question, a precise and efficient response can be provided to the current question, enhancing the response experience.
[0118] Optionally, the device further includes: a target question-answer pair generation module;
[0119] The target question-answer pair generation module includes:
[0120] The paragraph aggregation unit is used to aggregate paragraph information with similar content in the target document to obtain multiple aggregated target paragraph information.
[0121] The target question-answer pair generation unit is used to generate question-answer pairs for each target paragraph information based on template generation and / or model generation methods, thereby obtaining multiple target question-answer pairs at the sentence granularity.
[0122] Optionally, paragraph aggregation units are specifically used for:
[0123] Obtain the title information from the target document; aggregate the paragraph information under the same title information to obtain multiple aggregated target paragraph information.
[0124] Optionally, the target question-answer pair generation unit is specifically used for:
[0125] Based on multiple question generation templates, the title information corresponding to each target paragraph information is expanded to generate multiple question statements corresponding to each target paragraph information; based on the keyword information in each target paragraph information, the statement is extracted from each target paragraph information to generate the answer statement corresponding to each target paragraph information; based on the multiple question statements and the answer statements corresponding to the target paragraph information, multiple target question-answer pairs are determined.
[0126] Optionally, the target question-answer pair generation unit is also specifically used for:
[0127] Each target paragraph information is input into a pre-trained summary generation model for paragraph abbreviation to obtain abbreviated paragraph information; based on the part-of-speech information and / or word frequency information in each abbreviated statement in the abbreviated paragraph information, multiple target abbreviated statements are determined as answers; each target abbreviated statement and the abbreviated paragraph information are input into a pre-trained question generation model for question generation to determine the question statement corresponding to each target abbreviated statement; based on the target abbreviated statements and the question statements, multiple target question-answer pairs are determined.
[0128] Optionally, the question response module 540 includes:
[0129] The statement response unit is used to respond by using the target answer corresponding to the matching target question as the current answer corresponding to the current question if the semantic similarity between the current question and the matching target question is greater than or equal to a preset similarity.
[0130] The paragraph response unit is used to perform semantic matching between the current question and each paragraph information in the target document if the semantic similarity between the current question and the matching target question is less than a preset similarity, determine the paragraph information that matches the current question, and respond to the current question based on the matching paragraph information.
[0131] Optionally, a paragraph response unit, specifically used for
[0132] If the semantic similarity between the current question and the matching paragraph information is greater than or equal to a preset similarity, then the matching paragraph information will be used as the current answer to the current question.
[0133] If the semantic similarity between the current question and the matching paragraph information is less than a preset similarity, then the current question and the matching paragraph information are input into a pre-trained reading comprehension model to obtain the target fragment information output by the reading comprehension model, and the target fragment information is used as the current answer corresponding to the current question.
[0134] The document response device provided in the embodiments of the present invention can execute the document response method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the document response method.
[0135] It is worth noting that in the above-described embodiments of the document response device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0136] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Figure 6 A block diagram of an exemplary electronic device 12 suitable for implementing embodiments of the present invention is shown. Figure 6 The electronic device 12 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0137] like Figure 6 As shown, the electronic device 12 is represented in the form of a general-purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0138] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0139] Electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0140] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. Electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 6 Not shown; usually referred to as a "hard drive"). Although Figure 6 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0141] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0142] Electronic device 12 can also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), and with one or more devices that enable a user to interact with electronic device 12, and / or with any device that enables electronic device 12 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 22. Furthermore, electronic device 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of electronic device 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0143] Processing unit 16 executes various functional applications and data processing by running programs stored in system memory 28, such as implementing the steps of a document response method provided in this embodiment, the method including:
[0144] Retrieve the current questions raised for the unstructured target document;
[0145] Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-and-answer pairs are information at the statement granularity.
[0146] Semantically match the current question with the target question in each target question-answer pair to determine the target question that matches the current question;
[0147] The current question is answered based on the target answer corresponding to the matching target question.
[0148] Of course, those skilled in the art will understand that the processor can also implement the technical solutions of the document response method provided in any embodiment of the present invention.
[0149] This embodiment provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the program implements the document response method steps provided in any embodiment of the present invention, the method comprising:
[0150] Retrieve the current questions raised for the unstructured target document;
[0151] Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-and-answer pairs are information at the statement granularity.
[0152] Semantically match the current question with the target question in each target question-answer pair to determine the target question that matches the current question;
[0153] The current question is answered based on the target answer corresponding to the matching target question.
[0154] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0155] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0156] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0157] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0158] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computing device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, the present invention is not limited to any particular combination of hardware and software.
[0159] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A document response method, characterized in that, include: Retrieve the current questions raised for the unstructured target document; Obtain multiple target question-and-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-and-answer pairs are information at the statement granularity. Semantically match the current question with the target question in each target question-answer pair to determine the target question that matches the current question; Based on the target answer corresponding to the matching target question, respond to the current question; Among them, multiple target question-answer pairs are generated based on the target document, including: The paragraph information with similar content in the target document is aggregated to obtain multiple aggregated target paragraph information, wherein the paragraph information with similar content refers to paragraph information that describes the same topic; Based on multiple question generation templates, the title information corresponding to each target paragraph information is expanded to generate multiple question statements corresponding to each target paragraph information; Based on the keyword information in each target paragraph, sentence extraction is performed on each target paragraph to generate the answer sentence corresponding to each target paragraph. Based on the multiple question statements and answer statements corresponding to the target paragraph information, multiple target question-answer pairs are determined.
2. The method according to claim 1, characterized in that, The aggregation of paragraph information with similar content in the target document to obtain multiple aggregated target paragraph information includes: Obtain the title information from the target document; By aggregating the paragraph information under the same title, multiple target paragraph information are obtained.
3. The method according to any one of claims 1-2, characterized in that, The step of responding to the current question based on the target answer corresponding to the matching target question includes: If the semantic similarity between the current question and the matching target question is greater than or equal to a preset similarity, then the target answer corresponding to the matching target question will be used as the current answer corresponding to the current question. If the semantic similarity between the current question and the matching target question is less than a preset similarity, then the current question is semantically matched with each paragraph information in the target document to determine the paragraph information that matches the current question, and the current question is answered based on the matching paragraph information.
4. The method according to claim 3, characterized in that, The process of responding to the current question based on matching paragraph information includes: If the semantic similarity between the current question and the matching paragraph information is greater than or equal to a preset similarity, then the matching paragraph information will be used as the current answer to the current question. If the semantic similarity between the current question and the matching paragraph information is less than a preset similarity, then the current question and the matching paragraph information are input into a pre-trained reading comprehension model to obtain the target fragment information output by the reading comprehension model, and the target fragment information is used as the current answer corresponding to the current question.
5. A document response device, characterized in that, include: The current issue acquisition module is used to acquire the current issue raised for the unstructured target document; The target question-answer pair acquisition module is used to acquire multiple target question-answer pairs pre-generated based on the target document, wherein the target question and target answer in the target question-answer pair are information at the statement granularity. The question matching module performs semantic matching between the current question and the target questions in each target question-answer pair to determine the target questions that match the current question. The question response module is used to respond to the current question based on the target answer corresponding to the matching target question; The target question-answer pair generation module is used to aggregate paragraph information with similar content in the target document to obtain multiple aggregated target paragraph information, wherein the paragraph information with similar content refers to paragraph information describing the same topic; based on multiple question generation templates, the module expands the title information corresponding to each target paragraph information to generate multiple question statements corresponding to each target paragraph information; based on the keyword information in each target paragraph information, the module extracts statements from each target paragraph information to generate answer statements corresponding to each target paragraph information; and based on the multiple question statements and answer statements corresponding to the target paragraph information, multiple target question-answer pairs are determined.
6. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the document response method as described in any one of claims 1-4.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the document response method as described in any one of claims 1-4.
Citation Information
Patent Citations
Smart searching method and device and computer readable memory medium
CN108763529A