Question and answer pair extraction method, question and answer method, system, equipment and medium

By determining document keywords, paragraph segmentation and keyword strong correlation processing in the Q&A pair extraction method, the problem of limited extraction effect in the prior art is solved, and a full coverage of high-quality Q&A pair extraction is achieved.

CN120104719AActive Publication Date: 2025-06-06CHONGQING CHANGAN AUTOMOBILE CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510585307.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-08
Publication Date
2025-06-06
Estimated Expiration
2045-05-08

AI Technical Summary

Technical Problem

The existing Q&A extraction method has limitations in the extraction effect of the predefined vocabulary list, and it is impossible to extract Q&A pairs that are not related to the predefined vocabulary list.

Method used

By determining the keywords of the original document, the document is segmented and the keyword strongly correlated processing is performed, the target text paragraph is generated, and the Q&A pair extraction model is used to extract the Q&A pair.

Benefits of technology

It realizes high-quality Q&A extraction with full coverage of documents, improving the accuracy and coverage of extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104719A_ABST
    Figure CN120104719A_ABST
Patent Text Reader

Abstract

The invention discloses a question and answer pair extraction method, a question and answer method, a question and answer system, equipment and a medium, and relates to the technical field of intelligent question and answer of a large model. Performing paragraph segmentation on the original document with the corresponding keyword to obtain each first text paragraph; performing keyword strong association processing on the first text paragraph according to a keyword corresponding to the original document to obtain a target text paragraph; and performing question-answer pair extraction on the target text paragraph through a question-answer pair extraction model to obtain a corresponding question-answer pair. By means of the method, full-coverage high-quality question and answer pair extraction of the document is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of intelligent question answering of large models, and in particular to a method for extracting question and answer pairs, a question and answer method, a system, a device and a medium. Background Art

[0002] With the breakthrough of natural language processing (NLP) technology, document question-answering systems based on large models have gradually become the core tool for improving information retrieval efficiency. The most important core part of this question-answering system is the determination of question-answer pairs. Existing question-answer pair extraction methods usually associate business documents with business documents through business-related predetermined vocabulary lists to narrow the scope of question-answer knowledge extraction in order to achieve the purpose of accurately extracting question-answer pairs. However, due to the existence of a predetermined vocabulary list, this method has limited extraction effects and can only extract question-answer pairs that are strongly associated with the predetermined vocabulary list. For some business documents that do not have a predetermined vocabulary list, question-answer pairs cannot be extracted. Summary of the invention

[0003] In view of this, the present invention provides a method for extracting question and answer pairs, a question and answer method, a system, a device and a medium, aiming to extract high-quality question and answer pairs with full coverage of documents.

[0004] In order to achieve the above-mentioned purpose, the first aspect of the embodiment of the present application provides a method for extracting question-answer pairs, the method comprising: Determine the keywords corresponding to the original document; Performing paragraph segmentation on the original document having the corresponding keywords to obtain each first text paragraph; According to the keywords corresponding to the original document, the first text paragraph is subjected to keyword strong association processing to obtain a target text paragraph; The question-answer pair extraction model is used to extract question-answer pairs from the target text paragraph to obtain corresponding question-answer pairs.

[0005] Optionally, performing keyword strong association processing on the first text paragraph according to the keywords corresponding to the original document to obtain the target text paragraph includes: Extracting precise keywords from the first text paragraph; Performing keyword strong association processing on the first text paragraph using precise keywords of the first text paragraph to obtain a corresponding target text paragraph; The first text paragraph from which the corresponding precise keyword is not extracted is subjected to keyword strong association processing by using the keyword corresponding to the original document to obtain the corresponding target text paragraph.

[0006] Optionally, the method further comprises: Perform paragraph segmentation on the original document without corresponding keywords to obtain each target text paragraph; The step of extracting question-answer pairs from the target text paragraph using a question-answer pair extraction model to obtain corresponding question-answer pairs includes: Determine the keyword characteristics of the target text paragraph; Extract question-answer pairs from the target text paragraph with keyword features through a narrow-domain question-answer pair extraction model to obtain the corresponding first question-answer pair; The general question-answer pair extraction model is used to extract question-answer pairs from the target text paragraph that does not have keyword features to obtain a corresponding second question-answer pair.

[0007] Optionally, the method further comprises: Determining a first similarity between the first question-answer pair and a keyword feature in the corresponding target text paragraph; filtering the first question-answer pairs according to the first similarity; determining a second similarity between the second question-answer pair and a second historical question-answer pair; According to the second similarity, a second question-answer pair to be filtered is determined from the second question-answer pair and the historical second question-answer pairs.

[0008] Optionally, segmenting the original document having the corresponding keywords into paragraphs to obtain each first text paragraph includes: Perform paragraph segmentation on the original document with corresponding keywords to obtain each initial text paragraph; Performing recognition processing on the obtained initial text paragraph to determine whether the initial text paragraph has type features corresponding to various paragraph types; Determine the paragraph type corresponding to the type feature of the initial text paragraph as the type of the initial text paragraph, wherein the various paragraph types include at least an enumeration paragraph, a table paragraph, and a picture paragraph; Content extraction is performed on the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to determine a first text paragraph corresponding to the initial text paragraph.

[0009] Optionally, performing content extraction on the initial text paragraph according to an extraction rule corresponding to the type of the initial text paragraph to determine a first text paragraph corresponding to the initial text paragraph includes: Extracting content from the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to obtain a text paragraph to be filtered corresponding to the initial text paragraph; According to the relationship between the word unit number of the text paragraph to be filtered and the word unit threshold, irrelevant fields are filtered on the text paragraph to be filtered to obtain a first text paragraph corresponding to the initial text paragraph.

[0010] Optionally, performing content extraction on the initial text paragraph according to an extraction rule corresponding to the type of the initial text paragraph to obtain a text paragraph to be filtered corresponding to the initial text paragraph includes: In the case where the type of the initial text paragraph includes an enumeration type paragraph, extracting each enumeration text, and associating each extracted enumeration text with the body of the initial text paragraph; In the case where the type of the initial text paragraph includes a table-type paragraph, extracting row data of the table, and determining that the column name of the table is an attribute of the corresponding row data; Associating the extracted line data and line data attributes with the body of the initial text paragraph; In the case where the type of the initial text paragraph includes a picture paragraph, extracting a network address of the picture and associating it with the body of the initial text paragraph; After the extraction of each type of data in the initial text paragraph and the subject association are completed, the text paragraph to be filtered corresponding to the initial text paragraph is obtained.

[0011] Optionally, a narrow domain question-answer pair extraction model is trained, including: Annotating the sample paragraph to be annotated by using the standard question-answer pair of the sample paragraph to obtain a training sample paragraph, wherein the sample paragraph to be annotated is the target text paragraph after strong association processing; Training the initial model using the training sample paragraphs, and evaluating the performance of the trained initial model using standard question-answer pairs of the training sample paragraphs; Based on the evaluation results, determine whether a qualified narrow-domain question-answer pair extraction model has been trained.

[0012] A second aspect of an embodiment of the present application provides a question-answering method based on a question-answer pair, the method comprising: Extract keywords from the question text; Determine, according to the extracted keywords, a first target question-answer pair corresponding to the question text from a first question-answer pair set, wherein the first question-answer pair in the first question-answer pair set is extracted by a question-answer pair extraction method according to the first aspect of the present application; Based on the first target question-answer pair, answer the question text; According to the question text from which the corresponding keywords are not extracted, determining a second target question-answer pair corresponding to the question text from a second question-answer pair set, wherein the second question-answer pair in the second question-answer pair set is extracted by the question-answer pair extraction method described in the first aspect of the present application; Based on the second target question-answer pair, the question text is answered.

[0013] Optionally, before determining a second target question-answer pair corresponding to the question text from the second question-answer pair set according to the question text from which the corresponding keywords are not extracted, the method further includes: Determining, based on the question text from which the corresponding keyword has not been extracted, a target keyword corresponding to the terminal that initiated the question text; Constructing a new question text according to the question text and the determined target keywords; According to the new question text, determining a first target question-answer pair corresponding to the question text from a first question-answer pair set; The step of determining, based on the question text from which the corresponding keywords are not extracted, a second target question-answer pair corresponding to the question text from a second question-answer pair set includes: In the case where the target keyword corresponding to the terminal that initiated the question text has not been determined, a second target question-answer pair corresponding to the question text is determined from the second question-answer pair set based on the question text from which the corresponding keyword has not been extracted.

[0014] A third aspect of an embodiment of the present application provides a system for extracting question-answer pairs, the system comprising: A first keyword determination module, used to determine keywords corresponding to the original document; A paragraph segmentation module, used to segment the original document having the corresponding keywords into paragraphs to obtain each first text paragraph; A strong association module, used to perform keyword strong association processing on the first text paragraph according to the keywords corresponding to the original document to obtain a target text paragraph; The question-answer pair extraction module is used to extract question-answer pairs from the target text paragraph through a question-answer pair extraction model to obtain corresponding question-answer pairs.

[0015] A fourth aspect of the embodiments of the present application provides a question-answering system based on question-answer pairs, the system comprising: The second keyword extraction module is used to extract keywords from the question text; A first target question-answer pair determination module, configured to determine, based on the extracted keywords, a first target question-answer pair corresponding to the question text from a first question-answer pair set, wherein the first question-answer pair in the first question-answer pair set is extracted by a question-answer pair extraction system provided in the third aspect of the present application; A first answering module, configured to answer the question text based on the first target question-answer pair; A second target question-answer pair determination module, configured to determine, based on a question text from which corresponding keywords have not been extracted, a second target question-answer pair corresponding to the question text from a second question-answer pair set, wherein the second question-answer pair in the second question-answer pair set is extracted by a question-answer pair extraction system according to the third aspect of the present application; The second answering module is used to answer the question text based on the second target question and answer pair.

[0016] A fifth aspect of an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and running on the processor, wherein when the computer program is executed by the processor, the steps in the method for extracting question and answer pairs as described in any one of the first aspects are implemented.

[0017] A sixth aspect of an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the method for extracting question and answer pairs as described in any one of the first aspects are implemented.

[0018] Beneficial Effects A method for extracting question and answer pairs provided in the present application is adopted, and the method includes: determining keywords corresponding to an original document; performing paragraph segmentation on the original document having the corresponding keywords to obtain each first text paragraph; performing keyword strong association processing on the first text paragraph according to the keywords corresponding to the original document to obtain a target text paragraph; performing question and answer pair extraction on the target text paragraph through a question and answer pair extraction model to obtain a corresponding question and answer pair.

[0019] By segmenting the original document with keywords according to a preset segmentation method, and strongly associating the first text paragraph obtained after segmentation with the keyword, it is ensured that each paragraph in the original document has a corresponding keyword, so that when question and answer extraction is performed on the paragraph, corresponding question extraction can be performed on each paragraph. That is, the question extraction method of the present application realizes the extraction of high-quality question and answer pairs covering the entire original document. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a method for extracting question and answer pairs proposed in one embodiment of the present application; Figure 2 is another flow chart of a method for extracting question and answer pairs provided by an embodiment of the present application; Figure 3 is a flow chart of a question-answering method based on question-answer pairs provided in one embodiment of the present application; Figure 4 is a schematic diagram of a system for extracting question and answer pairs provided in an embodiment of the present application; Figure 5 It is a schematic diagram of a question-answering system based on question-answer pairs provided in one embodiment of the present application. DETAILED DESCRIPTION

[0021] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.

[0022] refer to Figure 1 and Figure 2 , Figure 1 is a flow chart of a method for extracting question and answer pairs proposed in an embodiment of the present application. Figure 2 Another flow chart of a method for extracting question-answer pairs, the method comprising the following steps: S11: Determine keywords corresponding to the original document.

[0023] In this embodiment, the original document refers to a series of technical documents about the product written by engineers, such as product manuals, technical specifications, and product instructions, and the original document may include the product model, version, etc. If the product is a vehicle, the original document includes the vehicle series, model, and version of the vehicle.

[0024] In order to generate a large number of accurate question-answer pairs based on the original document, this embodiment sets keywords for the original document. By determining whether the original document contains the keyword, more accurate question-answer pairs can be generated based on the original document. The keyword can be specified by the user or inserted into the original document in advance by the user. If the product in the original document is a vehicle, the keyword corresponding to the original document can be a wider range of vehicle series in the original document.

[0025] S12: Segment the original document with the corresponding keywords into paragraphs to obtain first text paragraphs.

[0026] In this embodiment, if the original document contains corresponding keywords, it indicates that the content in the original document is related to the keywords, and the original document can be further processed to generate question-answer pairs related to the keywords. Specifically, when the original document contains corresponding keywords, the original document is segmented into paragraphs, and the segmentation method can be determined by the staff according to the targeted division of different types of original documents. After the segmentation is completed, multiple paragraphs corresponding to the original document are obtained, and each paragraph is the first text paragraph in this embodiment.

[0027] S13: Perform keyword strong association processing on the first text paragraph according to the keywords corresponding to the original document to obtain a target text paragraph.

[0028] In this embodiment, after a large number of first text paragraphs are obtained by segmenting the original document with the corresponding keywords, each first text paragraph is strongly associated with the keyword corresponding to the original document, that is, the keyword corresponding to the original document is inserted into each first text paragraph. After each first text paragraph is strongly associated with the keyword, a corresponding target text paragraph is obtained, and the target text paragraph corresponding to the first text paragraph is the text paragraph into which the corresponding keyword is inserted.

[0029] S14: Extract question-answer pairs from the target text paragraph using a question-answer pair extraction model to obtain corresponding question-answer pairs.

[0030] In this embodiment, the question-answer pair includes questions and answers, which are used to answer questions raised by users in the large-model question-answering scenario, and the generation of the question-answer pair mainly depends on the question-answer pair extraction model and the target text paragraph. Specifically, the target text paragraph is vectorized using Transformers, and the embedding feature expression of the target paragraph text is input into the question-answer pair extraction model. The question-answer pair extraction model outputs multiple question-answer pairs corresponding to the target text paragraph based on the keywords corresponding to the target text paragraph and the text content in the paragraph. Preferably, the questions in the question-answer pair can be generated accordingly based on the keywords.

[0031] Through the question-answer pair extraction method provided in this embodiment, the original document with keywords is segmented into multiple first text paragraphs, and then the first text paragraphs are strongly associated with the keywords to generate target text paragraphs, so that the obtained target text paragraphs fully cover the content of the original document, and also make the question-answer pairs generated by the target text paragraphs cover the entire original document while improving the quality of the extracted question-answer pairs, that is, to ensure that the extracted question-answer pairs can accurately point to the correct car series, etc.

[0032] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, according to the keywords corresponding to the original document, a keyword strong association process is performed on the first text paragraph to obtain a target text paragraph, including steps S21 to S23: S21: Extract precise keywords from the first text paragraph.

[0033] S22: Perform keyword strong association processing on the first text paragraph using the precise keywords of the first text paragraph to obtain a corresponding target text paragraph.

[0034] S23: Perform keyword strong association processing on the first text paragraph from which the corresponding precise keyword has not been extracted using the keyword corresponding to the original document to obtain the corresponding target text paragraph.

[0035] In this embodiment, in order to extract more accurate question-answer pairs from the target text paragraph, this embodiment also performs more accurate keyword strong association processing on the first text paragraph. Specifically, after the original document is segmented to obtain the first text paragraphs, accurate keyword extraction is performed on each first text paragraph. For example, when the keyword of the original document with the corresponding keyword is car series A, it is determined that the original document has the keyword and is cut into multiple first text paragraphs; if the single first text paragraph obtained by segmentation includes the keyword that the vehicle version with a smaller range than car series A is the luxury version, then "the luxury version of car series A" is used as the accurate keyword of the first text paragraph; if the single first text paragraph obtained by segmentation includes the keyword that the vehicle version with a smaller range than car series A is the basic version, then "the basic version of car series A" is used as the accurate keyword of the first text paragraph.

[0036] In this embodiment, the car series is a wider range of levels than the vehicle version, such as the 2i car series can include the pure electric type of the 2i car series and the hybrid type of the 2i series; the vehicle model is a wider range of levels than the vehicle version, such as the "pure electric type" can include the pure electric luxury version and the pure electric basic version. Preferably, when the user specifies the keywords corresponding to the original document, a wider range of car series or vehicle models can be specified as the keywords corresponding to the original document; when determining the precise keywords of the first text paragraph obtained by segmenting the original document with the corresponding keywords, the determined keywords with a smaller range than the keywords corresponding to the original document can be extracted as the precise keywords of the first text paragraph, and the precise keywords are strongly associated with the first text paragraph, so that the first text paragraph after the strong association can extract a better quality question and answer pair. For example, when the keyword corresponding to the original document is the car series keyword, both the vehicle version and the vehicle model can be used as precise keywords. When the keyword corresponding to the original document is the vehicle model, the vehicle version can be used as a precise keyword.

[0037] In this embodiment, if precise keywords with a smaller range than the keywords corresponding to the original document can be extracted from the first text paragraph, the first text paragraph and the extracted precise keywords are subjected to keyword strong association processing, and the corresponding target text paragraph is obtained after the strong association processing.

[0038] In this embodiment, if precise keywords with a smaller range than the keywords corresponding to the original document are not extracted from the first text paragraph, the keywords corresponding to the original document are strongly associated with the first text paragraph to obtain the corresponding target text paragraph, so as to ensure that each first text paragraph obtained by segmenting the original document can be strongly associated with the keywords, thereby achieving full coverage of the original document while improving the quality of the extracted question and answer pairs, that is, ensuring that the extracted question and answer pairs can accurately point to the vehicle series, or the vehicle model, or the vehicle version, etc.

[0039] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, the method further includes steps S31 to S34: S31: segmenting the original document without corresponding keywords into paragraphs to obtain target text paragraphs.

[0040] S32: extracting question-answer pairs from the target text paragraph using a question-answer pair extraction model to obtain corresponding question-answer pairs, including: determining keyword features of the target text paragraph.

[0041] S33: Extract question-answer pairs from the target text paragraph with keyword features through a narrow-domain question-answer pair extraction model to obtain a corresponding first question-answer pair.

[0042] S34: Extract question-answer pairs from the target text paragraph that does not have keyword features through a general question-answer pair extraction model to obtain a corresponding second question-answer pair.

[0043] In this embodiment, for original documents without corresponding keywords, the corresponding content of the original document will not have specific keywords (such as keywords pointing to car series, keywords pointing to vehicle models, and keywords pointing to vehicle versions). This application will directly segment such original documents into paragraphs without performing any strong keyword association processing. The text paragraphs obtained after paragraph segmentation are the target text paragraphs that can be directly used for question and answer pair extraction.

[0044] In this embodiment, since the text paragraphs used for question-answer pair extraction include target text paragraphs that have been subjected to keyword strong association processing, and also target text paragraphs that have not been subjected to any keyword strong association processing. Therefore, in order to ensure the extraction effect of question-answer pairs, this application provides two question-answer pair extraction models. One is a qualified narrow-domain question-answer pair extraction model obtained by training based on a large number of target text paragraphs that have been subjected to keyword strong association processing; the other is a qualified general question-answer pair extraction model obtained by training based on a large number of target text paragraphs that have not been subjected to any keyword strong association processing. In the case where the target text paragraph belongs to a text paragraph that has been subjected to keyword strong association processing, it is determined that the target text paragraph belongs to a target text paragraph with keyword features. At this time, the target text paragraph with keyword features is subjected to question-answer pair extraction through a targeted narrow-domain question-answer pair extraction model, and multiple first question-answer pairs corresponding to the target text paragraph are obtained. In the case where the target text paragraph belongs to a text paragraph that has not been subjected to keyword strong association processing, it is determined that the target text paragraph belongs to a target text paragraph without keyword features. At this time, the target text paragraph without keyword features is subjected to question-answer pair extraction through a general question-answer pair extraction model, and multiple second question-answer pairs corresponding to the target text paragraph are obtained. For example, if the target text paragraph X is about vehicle seat adjustment without special model or version requirements, then for the target text paragraph X without keyword features, the general question-answer pair extraction model can directly generate relevant second question-answer pairs such as "about how to adjust the seat" from the target text paragraph X.

[0045] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, the method further includes steps S41 to S44: S41: Determine a first similarity between the first question-answer pair and a keyword feature in the corresponding target text paragraph.

[0046] S42: Filter the first question-answer pairs according to the first similarity.

[0047] S43: Determine a second similarity between the second question-answer pair and a second historical question-answer pair.

[0048] S44: Determine, according to the second similarity, a second question-answer pair to be filtered from the second question-answer pair and the historical second question-answer pairs.

[0049] In this embodiment, in order to ensure that the first question and answer pair generated by the narrow-domain question and answer pair extraction model can more accurately fit the content in the target text paragraph, the present application will calculate the similarity between the first question and answer pair and the keyword features in the corresponding target text paragraph to determine the quality of the generated first question and answer pair. If the similarity is high, it indicates that the quality of the first question and answer pair is good, and the first question and answer pair can point to the keyword feature well. If the similarity is low, it indicates that the quality of the first question and answer pair is poor, and the first question and answer pair cannot point to the keyword feature well.

[0050] Specifically, for the generated first question-answer pair, the similarity is calculated between the first question-answer pair and the keyword features in the target text paragraph to which the first question-answer pair belongs, and the first similarity corresponding to the first question-answer pair is obtained. When the first similarity is less than the preset similarity threshold, the quality of the first question-answer pair is determined to be poor, and the first question-answer pair is filtered out; when the first similarity is greater than or equal to the preset similarity threshold, the quality of the first question-answer pair is determined to be good, and the first question-answer pair is retained. The similarity threshold can be set according to the actual scenario and is not specifically limited here.

[0051] In this embodiment, for the second question and answer pair randomly generated by the general question and answer pair extraction model, in order to prevent the recording of a large number of repeated second question and answer pairs, after generating the second question and answer pair, the present application calculates the similarity between the generated second question and answer pair and the historical second question and answer pairs generated in the past, obtains the corresponding second similarity, and then determines the second question and answer pair to be filtered based on the second similarity.

[0052] Specifically, when the second similarity between the second question and answer pair currently generated and the second question and answer pair of history generated in the past is less than the preset second similarity threshold, it is determined that the second question and answer pair has a low similarity with the second question and answer pair of history, and the second question and answer pair is retained; when the second similarity between the second question and answer pair currently generated and the second question and answer pair of history generated in the past is greater than or equal to the preset second similarity threshold, it is determined that the second question and answer pair has a high similarity with the corresponding second question and answer pair of history, and at this time, it is necessary to filter one of the second question and answer pair and the second question and answer pair of history. This embodiment compares the confidence when generating the second question and answer pair and the confidence when generating the second question and answer pair of history, and filters the one with lower confidence between the second question and answer pair and the second question and answer pair of history. The second similarity threshold can be set according to the actual scenario and is not specifically limited here.

[0053] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, paragraph segmentation is performed on the original document with corresponding keywords to obtain each first text paragraph, including steps S51 to S53: S51: Segment the original document with corresponding keywords into paragraphs to obtain each initial text paragraph.

[0054] S52: Perform recognition processing on the obtained initial text paragraphs to determine whether there are type characteristics corresponding to various paragraph types in the initial text paragraphs.

[0055] S53: Determine the paragraph type corresponding to the type characteristics of the initial text paragraph as the type of the initial text paragraph, where the various paragraph types at least include enumerated paragraphs, table paragraphs, and picture paragraphs.

[0056] S54: Extract the content of the initial text paragraph through an extraction rule corresponding to the type of the initial text paragraph to determine a first text paragraph corresponding to the initial text paragraph.

[0057] In this embodiment, since the content in the original document is usually complex and diverse, the presentation form of the content may be different for different types of content. For example, the explanatory content about automotive parts may be presented in the form of pictures, and the operation content about different buttons of the car may be presented in the form of tables. Therefore, in this embodiment, in order to more accurately and effectively extract the content, extraction rules are set for different types of content.

[0058] Specifically, after segmenting the original document with corresponding keywords into paragraphs according to a certain segmentation method to obtain each initial text paragraph, then determine the type of the initial text paragraph, such as a table paragraph or a picture paragraph, according to the presentation form of the content involved in the initial text paragraph. Determine the extraction rules corresponding to each type for different types of initial text paragraphs, and extract the content of the corresponding initial text paragraph based on the extraction rules. Generate a first text paragraph corresponding to the initial text paragraph through the extracted content.

[0059] In this embodiment, an optional implementation manner for segmenting the original document with corresponding keywords is as follows: Parse the original document, read the content stream in the original document to identify the grid data, text content, graphic elements, and page information (such as paragraph indentation, blank lines, and delimiters, etc.) of each page in the original document. According to the recognition result, segment the original document through preset rules. The preset rules at least include dividing the content from the continuous text with a first-line indent of 2 characters to the position before the next first-line indent of two characters into one paragraph; dividing the content from the continuous text with a first-line indent of 2 characters to before the blank line or delimiter into one paragraph; dividing the content between two identical specific text intervals into one paragraph; the title characters before the first-line indent of 2 characters (such as "1.", "Two.", " ", etc.) is divided into paragraphs by indenting the first line of the text by 2 characters.

[0060] In this embodiment, an optional implementation method for determining the type of the initial text paragraph obtained by paragraph segmentation is: the type determination method of each initial text paragraph obtained by paragraph segmentation is the same, and an initial text paragraph is used for illustration. The paragraph types involved in the initial text paragraph in this application at least include enumeration paragraphs, table-type paragraphs and picture-type paragraphs. For each paragraph type, the application predefines the type features corresponding to the paragraph type. Then, the initial text paragraph obtained by paragraph segmentation is identified and processed to determine whether the initial text paragraph has a type feature corresponding to a certain or certain paragraph type. When the initial text paragraph is identified to have a type feature corresponding to a certain or certain paragraph type, the certain or certain paragraph type is determined as the type of the initial text paragraph. For example, when the initial text paragraph is identified to have a type feature corresponding to a table-type paragraph, the type of the initial text paragraph is determined to be a table-type paragraph; when the initial text paragraph is identified to have not only a type feature corresponding to a table-type paragraph, but also a type feature corresponding to a picture-type paragraph, the type of the initial text paragraph is determined to belong to both a table-type paragraph and a picture-type paragraph.

[0061] In this embodiment, when an initial text paragraph includes multiple types, content extraction is performed on the initial text paragraph based on multiple extraction rules corresponding to the multiple types, and a first text paragraph corresponding to the initial text paragraph is generated by the extracted content. For example, when the types of the initial text paragraph are both table-type paragraphs and picture-type paragraphs, the extraction rules corresponding to the table-type paragraphs and the extraction rules corresponding to the picture-type paragraphs are simultaneously adopted to extract content from the initial text paragraph, the table content in the initial text paragraph is extracted by the extraction rules corresponding to the table-type paragraphs, and the picture content in the initial text paragraph is extracted by the extraction rules corresponding to the picture-type paragraphs.

[0062] In this embodiment, for an enumeration type paragraph, its corresponding type feature is that any one of the various enumeration symbols appears in the text paragraph, and the texts where the enumeration symbols appear at the same time are adjacent to each other and have the same font size. Among them, the various enumeration symbols at least include bullet points (such as "•", " ”, etc.), numerical numbers (such as “1.”, “(1)”, etc.), letter numbers (such as “a”, “A”, etc.).

[0063] For table paragraphs, the corresponding type feature is that a preset number of vertical and horizontal lines with similar average spacing appear in the text paragraph, and some text with the same font size and font distance are inserted in it. The preset number can be set according to the actual scenario and is not specifically limited here.

[0064] For picture paragraphs, when the original document with corresponding keywords is in PDF format, the corresponding type feature is that the Do operator appears in the text paragraph, and the object type operated by the Do operator is Image. When the original document with corresponding keywords is in word, html format, etc., there are corresponding tags for picture objects. It is possible to directly identify whether the initial text paragraph after paragraph segmentation has the tag corresponding to the picture object, thereby determining whether the initial text paragraph has the type feature corresponding to the picture paragraph. That is, as long as it is identified that the initial text paragraph has the tag corresponding to the picture object, it is determined that the initial text paragraph has the type feature corresponding to the picture paragraph, and then it is determined that the type of the initial text paragraph includes the picture paragraph.

[0065] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, content extraction is performed on the initial text paragraph according to an extraction rule corresponding to the type of the initial text paragraph to determine a first text paragraph corresponding to the initial text paragraph, including steps S61 to S62: S61: extracting content from the initial text paragraph according to an extraction rule corresponding to the type of the initial text paragraph, and obtaining a text paragraph to be filtered corresponding to the initial text paragraph.

[0066] S62: According to the relationship between the word unit number of the text paragraph to be filtered and the word unit threshold, perform irrelevant field filtering on the text paragraph to be filtered to obtain a first text paragraph corresponding to the initial text paragraph.

[0067] In this embodiment, since the amount of data that the question-answer pair extraction model can process at a single time is limited, and the extraction effect of question-answer pairs will be better if the text of a single paragraph is input into the model without further segmentation, the present application further filters invalid information for text paragraphs with a large amount of data obtained by segmentation, so as to ensure the effect of the model on question-answer pair extraction.

[0068] Specifically, according to the extraction rules corresponding to the type of the initial text paragraph, the content of the initial text paragraph is extracted, and after the extraction is completed, the text paragraph to be filtered corresponding to the initial text paragraph is initially obtained. The number of tokens in the text paragraph to be filtered is determined, and the number of tokens can refer to the basic unit Token when the natural language processing model processes text data. The number of tokens in the text paragraph to be filtered is then compared with the set token threshold. In the case that the number of tokens in the text paragraph to be filtered is greater than the token threshold, the irrelevant fields in the text paragraph to be filtered are filtered, and the irrelevant fields include at least stop words, modal particles, punctuation marks, etc. In order to reduce the number of tokens in the text paragraph to be filtered to below the token threshold, the initial text paragraph remaining after the irrelevant field filtering process forms the first text paragraph.

[0069] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, content is extracted from the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to obtain a text paragraph to be filtered corresponding to the initial text paragraph, including steps S71 to S74: S71: When the type of the initial text paragraph includes an enumeration-type paragraph, extract each enumeration text, and associate each extracted enumeration text with the body of the initial text paragraph.

[0070] S72: When the type of the initial text paragraph includes a table-type paragraph, extract the row data of the table, and determine the column names of the table as attributes of the corresponding row data.

[0071] S73: Associating the extracted line data and line data attributes with the body of the initial text paragraph.

[0072] S74: When the type of the initial text paragraph includes a picture paragraph, extract the network address of the picture and associate it with the body of the initial text paragraph.

[0073] S75: After the extraction of each type of data in the initial text paragraph and the subject association are completed, the text paragraph to be filtered corresponding to the initial text paragraph is obtained.

[0074] In this embodiment, the present application provides corresponding extraction rules for different types of initial text paragraphs, including extraction rules for enumeration type paragraphs, extraction rules for table type paragraphs and extraction rules for picture type paragraphs, wherein enumeration type refers to an expression method that clearly lists all possible options. For example, there are only three types of device status: "on, off, and standby". When filling in the device status, you can only choose one of these three to fill in. Filling in the others is invalid. These three answers are the enumeration type about the device status.

[0075] When the type of the initial text paragraph includes an enumeration type paragraph, it indicates that the initial text paragraph involves enumeration content, such as the examples involving several situations. In the case where the initial text paragraph involves enumeration content, this embodiment associates each enumeration text with the main body of the initial text paragraph. The main body of the initial text paragraph refers to the other text content in the initial text paragraph excluding the enumeration content, list content and picture content. Associating the extracted content with the main body of the initial text paragraph refers to splicing the extracted content into the main body of the initial text paragraph.

[0076] When the type of the initial text paragraph includes a table-type paragraph, it indicates that the initial text paragraph involves table content, including the row content of the table and the column content corresponding to the row. In the case where the initial text paragraph involves table content, this embodiment first extracts the content in each row of the table to obtain row data, and then determines the column corresponding to the row based on the correspondence between rows and columns, and determines the column name of the column as the attribute corresponding to the row data of the row. After obtaining the row data and the corresponding row data attributes, the row data and the row data attributes are associated with the main body of the initial text paragraph.

[0077] When the type of the initial text paragraph includes a picture paragraph, it indicates that the initial text paragraph involves picture content. In the case where the initial text paragraph involves picture content, this embodiment extracts the network address of the picture and associates it with the body of the initial text paragraph. In the special case where the picture does not have a network address, the application can also extract the picture, store it to a specified network address, and associate the network address with the body of the initial text paragraph.

[0078] In this embodiment, after the extraction of each data type in a single initial text paragraph is completed and all the extracted data are associated with the body of the single initial text paragraph, the text paragraph to be filtered corresponding to the single initial text paragraph is obtained. For example, if the types of the single initial text paragraph include enumeration paragraphs and picture paragraphs, each enumeration text in the enumeration content of the single initial text paragraph is extracted and associated with the body of the single initial text paragraph, and the network address in the picture content of the single initial text paragraph is extracted and associated with the body of the single initial text paragraph. After all the associations are completed, the text paragraph to be filtered corresponding to the single initial text paragraph is obtained.

[0079] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a method for extracting question-answer pairs. In the method for extracting question-answer pairs, a narrow-domain question-answer pair extraction model is trained, including steps S81 to S83: S81: Annotate the sample paragraph to be annotated by using the standard question-answer pair of the sample paragraph to obtain a training sample paragraph, wherein the sample paragraph to be annotated is the target text paragraph after strong association processing.

[0080] S82: Train the initial model using the training sample paragraphs, and evaluate the performance of the trained initial model using standard question-answer pairs of the training sample paragraphs.

[0081] S83: Determine whether a qualified narrow-domain question-answer pair extraction model has been trained based on the evaluation results.

[0082] This embodiment provides a training method for a narrow domain question-answer pair extraction model. Figure 2 As shown. Specifically, the staff set the corresponding standard question-answer pairs based on the sample paragraphs to be annotated, and annotated the sample paragraphs to be annotated through the standard question-answer pairs. Among them, the sample paragraphs to be annotated refer to the target text paragraphs obtained after strong association processing with keywords. After the standard sample paragraphs are annotated by the standard question-answer pairs, training sample paragraphs are generated, and the training sample paragraphs are used for subsequent initial model training.

[0083] The training sample paragraphs are input into the initial model for model training, and the performance of the trained initial model is evaluated based on the training question-answer pairs output by the initial model and the standard question-answer pairs corresponding to the training sample paragraphs. Specifically, the training question-answer pairs and the standard question-answer pairs output by the initial model are calculated, and the performance of the initial model is evaluated based on the calculation results. If the calculation result is that the calculated value is close to the preset value, the evaluation result is qualified training, and the initial model has been trained as a qualified narrow-domain question-answer pair extraction model. Otherwise, the evaluation result is unqualified training, and a qualified narrow-domain question-answer pair extraction model cannot be obtained.

[0084] In this embodiment, for the narrow-domain question-answer pair extraction model, the full training method is used, and the training parameter train_type of the model is set to full. At the same time, the set keywords are limited to a smaller range to make the training data more accurate. The narrow-domain question-answer pair extraction model trained in this way is more suitable for smaller and more professional question-answer scenarios. For the general question-answer pair extraction model, the incremental fine-tuning form is used, and the training parameter train_type of the model is set to lora. No keywords are specified for fine-tuning. The model trained by this method is more suitable for the extraction of question-answer pairs of general documents, and has a weaker dependence on keywords. At the same time, it is also impossible to extract accurate questions and answers that are strongly related to related words. This application provides an evaluation function during and after model training. During training, the model will randomly extract a preset percentage (such as 30%) of data as a verification set to evaluate the model, and generate an evaluation file to show the accuracy and loss in each epoch. After the training is completed, the user can also upload the verification set and call the evaluation method to manually evaluate the model.

[0085] refer to Figure 3 , Figure 3: is a flowchart of a question-answering method based on question-answer pairs proposed in another embodiment of the present application, the method comprising the following steps: S91: extracting keywords from the question text.

[0086] S92: Based on the extracted keywords, determine a first target question-answer pair corresponding to the question text from a first question-answer pair set, wherein the first question-answer pair in the first question-answer pair set is extracted by a question-answer pair extraction method described in any of the above embodiments.

[0087] S93: Answer the question text based on the first target question-answer pair.

[0088] S94: Based on the question text from which the corresponding keywords have not been extracted, determine a second target question and answer pair corresponding to the question text from a second question and answer pair set, wherein the second question and answer pair in the second question and answer pair set is extracted by a question and answer pair extraction method described in any of the above embodiments.

[0089] S95: Answer the question text based on the second target question-answer pair.

[0090] Based on the question-answer pair provided in the above embodiment, this embodiment applies the question-answer pair to the question scenario input by the user. Specifically, keyword extraction is performed on the question text input by the user. If the keyword corresponding to the question text can be extracted, the first target question-answer pair corresponding to the question text is determined from the first question-answer pair set based on the keyword. Among them, the first question-answer pair set records a large number of first question-answer pairs extracted by the question-answer pair extraction method in the above embodiment. Since the first question and answer is associated with a corresponding keyword, the first question-answer pair corresponding to the keyword can be accurately found through the keyword in the question text, and the first question-answer pair is determined as the first target question-answer pair that fits the question text. Based on the text content in the first target question-answer pair, a corresponding answer is given to the question text input by the user.

[0091] If the corresponding keywords cannot be extracted from the question text, this embodiment will determine the second target question and answer pair that can answer the question text from the second question and answer pair set. Among them, the second question and answer pair set records a large number of second question and answer pairs extracted by the question and answer pair extraction method in the above embodiment. Since there are no corresponding keywords in the second question and answer pair and the question text, the second question and answer pair that is more in line with the question text is screened out from multiple second question and answer pairs through the text content in the question text, and it is determined as the second target question and answer pair. Based on the text content in the second target question and answer pair, a corresponding answer is given to the question text input by the user.

[0092] In combination with the above embodiments, in one implementation, an embodiment of the present invention further provides a question-answering method based on question-answering pairs. In the question-answering method based on question-answering pairs, before determining a second target question-answering pair corresponding to the question text from a second question-answering pair set based on the question text from which the corresponding keywords are not extracted, the method further includes steps S101 to S104: S101: Determine, based on a question text from which no corresponding keyword has been extracted, a target keyword corresponding to a terminal that initiates the question text.

[0093] S102: constructing a new question text according to the question text and the determined target keywords; S103: According to the new question text, determine a first target question-answer pair corresponding to the question text from a first question-answer pair set.

[0094] S104: The method of determining a second target question-answer pair corresponding to the question text from a second question-answer pair set based on a question text from which the corresponding keyword has not been extracted comprises: in the case where a target keyword corresponding to a terminal that initiates the question text has not been determined, determining a second target question-answer pair corresponding to the question text from a second question-answer pair set based on a question text from which the corresponding keyword has not been extracted.

[0095] In this embodiment, the present application takes into account that when users ask technical questions, they usually ask questions related to themselves. Therefore, when the corresponding keywords are not extracted from the question text input by the user, the corresponding target keywords can be determined by the terminal where the user initiates the question text. Specifically, when the user sends a question text through a mobile terminal, the model of the vehicle bound to the mobile terminal is determined, and the model of the vehicle bound to the mobile terminal is determined as the target keyword; when the user sends a question text through a vehicle-mounted terminal, the model of the vehicle where the vehicle-mounted terminal is located is determined as the target keyword. Based on the determined target keyword and the new question text constructed, the new question text is a question text including the target keyword. According to the above steps S91 to S92, the first target question and answer pair that fits the new question text is determined from the first question and answer pair set. If the corresponding target keyword cannot be determined according to the terminal that initiates the question text, the second target question and answer pair corresponding to the question text is still determined from the second question and answer pair set according to the content of the question text from which the corresponding keyword is not extracted.

[0096] Based on the same inventive concept, an embodiment of the present application provides a system for extracting question and answer pairs, referring to Figure 4 , Figure 4 is a schematic diagram of a system for extracting question and answer pairs proposed in an embodiment of the present application, the system comprising: A first keyword determination module 401, used to determine keywords corresponding to the original document; The paragraph segmentation module 402 is used to segment the original document having the corresponding keywords into paragraphs to obtain each first text paragraph; A strong association module 403 is used to perform keyword strong association processing on the first text paragraph according to the keywords corresponding to the original document to obtain a target text paragraph; The question-answer pair extraction module 404 is used to extract question-answer pairs from the target text paragraph using a question-answer pair extraction model to obtain corresponding question-answer pairs.

[0097] In this embodiment, the system also includes a Mysql database, a server, and a Milvus vector database. After the product-related instructions are determined as the original documents for the question-answer pairs to be generated, the format of the original documents is converted into markdown format, and then the original documents are imported into the Mysql database. The database is connected to the server background to facilitate the staff to visualize the original documents in the system, and the target text paragraphs are obtained and saved in the Milvus vector database in the form of embedding data.

[0098] The server is used to manage original documents and question-answer pairs. Users can use it to upload, save, download, and preprocess original documents, and set keywords for original documents. At the same time, after the document generates a question-answer pair, the question-answer pair can also be screened, modified, deleted, and other operations. At the same time, the system also includes a front-end page that interacts with the user, and the keywords corresponding to the original document can be specified by the user through the front-end page. The user can import the original document to be extracted through the import button on the page, use the edit button to modify or edit a certain original document separately, and select the configuration keywords. After completion, the original document is added to the queue to be extracted through single or multiple selections, and extracted in sequence. Users can choose a trained large model to generate question-answer pairs. It is recommended that users select the most appropriate model according to the type of uploaded original documents to improve the quality of generated question-answer pairs. If the generated document is highly professional, using a narrow-domain question-answer pair extraction model and providing keywords will get more accurate answers. On the contrary, for documents with strong generalization and versatility, a general question-answer pair extraction model can be used, and generalized question-answer pairs can be generated without providing keywords. The extracted question-answer pairs are saved in a storage device, and their corresponding original document id, used model, parameters, submitting user, generation time, status, etc. are also saved. The generated question-answer pairs are saved in a Mysql database and will also be displayed on the front-end page for users to view, modify, change status, and perform other operations.

[0099] Optionally, the strong association module 403 includes: An accurate keyword extraction module, used to extract accurate keywords from the first text paragraph; A strong association first submodule is used to perform keyword strong association processing on the first text paragraph through the precise keywords of the first text paragraph to obtain a corresponding target text paragraph; The second strong association submodule is used to perform keyword strong association processing on the first text paragraph from which the corresponding precise keywords have not been extracted, using the keywords corresponding to the original document, to obtain the corresponding target text paragraph.

[0100] Optionally, the system for extracting question-answer pairs further includes: The paragraph segmentation module is used to segment the original document without corresponding keywords to obtain each target text paragraph; The keyword feature determination module is used to extract question-answer pairs from the target text paragraph through the question-answer pair extraction model to obtain corresponding question-answer pairs, including: determining keyword features of the target text paragraph; A first question-answer pair determination module, configured to extract question-answer pairs from a target text paragraph having keyword features by using a narrow-domain question-answer pair extraction model to obtain a corresponding first question-answer pair; The second question-answer pair determination module is used to extract question-answer pairs from a target text paragraph that does not have keyword features through a general question-answer pair extraction model to obtain a corresponding second question-answer pair.

[0101] Optionally, the system for extracting question-answer pairs further includes: A first similarity determination module, used to determine a first similarity between the first question-answer pair and a keyword feature in a corresponding target text paragraph; A first filtering module, configured to filter the first question-answer pairs according to the first similarity; A second similarity determination module, used to determine a second similarity between the second question-answer pair and a second historical question-answer pair; A second filtering module is used to determine a second question-answer pair to be filtered from the second question-answer pair and the historical second question-answer pairs according to the second similarity.

[0102] Optionally, the paragraph segmentation module 402 includes: An initial text paragraph determination module is used to segment the original document with corresponding keywords into paragraphs to obtain each initial text paragraph; An identification processing module is used to perform identification processing on the obtained initial text paragraph to determine whether the initial text paragraph has type features corresponding to various paragraph types; A type determination module, used for determining the paragraph type corresponding to the type feature of the initial text paragraph as the type of the initial text paragraph, wherein the various paragraph types at least include enumeration type paragraphs, table type paragraphs and picture type paragraphs; The paragraph determination module is used to extract content from the initial text paragraph according to an extraction rule corresponding to the type of the initial text paragraph, so as to determine a first text paragraph corresponding to the initial text paragraph.

[0103] Optionally, the paragraph determination module includes: The first paragraph determination submodule is used to extract the content of the initial text paragraph according to the extraction rule corresponding to the type of the initial text paragraph, so as to obtain the text paragraph to be filtered corresponding to the initial text paragraph; The second paragraph determination submodule is used to filter the text paragraph to be filtered by irrelevant fields according to the relationship between the word unit number of the text paragraph to be filtered and the word unit threshold, so as to obtain a first text paragraph corresponding to the initial text paragraph.

[0104] Optionally, the paragraph determination first submodule includes: An enumeration type paragraph extraction module, used for extracting each enumeration text when the type of the initial text paragraph includes an enumeration type paragraph, and associating each extracted enumeration text with the main body of the initial text paragraph; A first table-type paragraph extraction module, used for extracting the row data of the table when the type of the initial text paragraph includes a table-type paragraph, and determining the column name of the table as an attribute of the corresponding row data; A second extraction module for table-like paragraphs, used for associating the extracted row data and row data attributes with the main body of the initial text paragraph; A picture paragraph extraction module, used for extracting the network address of the picture and associating it with the body of the initial text paragraph when the type of the initial text paragraph includes a picture paragraph; The module for determining text paragraphs to be filtered is used to obtain the text paragraphs to be filtered corresponding to the initial text paragraphs after the extraction of each type of data and the main body association in the initial text paragraphs are completed.

[0105] Optionally, the system for extracting question-answer pairs further includes: The first model training module is used to annotate the sample paragraph to be annotated by using the standard question-answer pairs of the sample paragraph to obtain the training sample paragraph, wherein the sample paragraph to be annotated is the target text paragraph after strong association processing; The second model training module is used to train the initial model through the training sample paragraphs, and evaluate the performance of the trained initial model through the standard question-answer pairs of the training sample paragraphs; The third module of model training is used to determine whether a qualified narrow-domain question-answer pair extraction model has been trained based on the evaluation results.

[0106] Based on the same inventive concept, an embodiment of the present application provides a question-answering system based on question-answer pairs, referring to Figure 5 , Figure 5 is a schematic diagram of a question-answering system based on question-answer pairs proposed in an embodiment of the present application, the system comprising: The second keyword extraction module 501 is used to extract keywords from the question text; A first target question-answer pair determination module 502, configured to determine, based on the extracted keywords, a first target question-answer pair corresponding to the question text from a first question-answer pair set, wherein the first question-answer pair in the first question-answer pair set is extracted by a question-answer pair extraction system provided in the third aspect of the present application; A first answering module 503, configured to answer the question text based on the first target question-answer pair; A second target question-answer pair determination module 504 is used to determine, based on the question text from which the corresponding keywords have not been extracted, a second target question-answer pair corresponding to the question text from a second question-answer pair set, wherein the second question-answer pair in the second question-answer pair set is extracted by a question-answer pair extraction system provided by the third aspect of the present application; The second answering module 505 is used to answer the question text based on the second target question and answer pair.

[0107] Optionally, the second target question-answer pair determination module 504 includes: A target keyword determination module, used to determine the target keyword corresponding to the terminal that initiated the question text according to the question text from which the corresponding keyword has not been extracted; A question text construction module, used to construct a new question text according to the question text and the determined target keywords; A first target question-answer pair determination submodule, configured to determine, based on the new question text, a first target question-answer pair corresponding to the question text from a first question-answer pair set; The second target question-answer pair determination submodule is used to determine the second target question-answer pair corresponding to the question text from the second question-answer pair set based on the question text from which the corresponding keywords have not been extracted, including: in the case where the target keyword corresponding to the terminal that initiated the question text has not been determined, determining the second target question-answer pair corresponding to the question text from the second question-answer pair set based on the question text from which the corresponding keywords have not been extracted.

[0108] Based on the same inventive concept, another embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the method for extracting question and answer pairs as described in any of the above embodiments are implemented.

[0109] Based on the same inventive concept, another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for extracting question and answer pairs as described in any of the above embodiments are implemented.

[0110] The present application extracts corresponding question-answer pairs for original documents with corresponding keywords, and also extracts corresponding question-answer pairs for question-answer pairs without corresponding keywords, thereby achieving high-quality question-answer pair extraction with full coverage of original documents. As a result, in question-answer scenarios, the present application can provide more diverse question-answer pairs, and can also better select questions and answers that better meet user needs.

[0111] Those skilled in the art will appreciate that embodiments of the present invention may provide methods, devices, electronic devices, storage media, or computer program products. Therefore, embodiments of the present invention may take the form of complete hardware embodiments, complete software embodiments, or embodiments combining software and hardware. Moreover, embodiments of the present invention may take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0112] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0113] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0114] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0115] In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the previously and subsequently associated objects are in an "or" relationship.

[0116] The above is a detailed introduction to the question-answer pair extraction method, question-answer method, system, device and medium provided in the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for extracting question-answer pairs, characterized in that: The method comprises: Determine the keywords corresponding to the original document; Performing paragraph segmentation on the original document having the corresponding keywords to obtain each first text paragraph; According to the keywords corresponding to the original document, the first text paragraph is subjected to keyword strong association processing to obtain a target text paragraph; The question-answer pair extraction model is used to extract question-answer pairs from the target text paragraph to obtain corresponding question-answer pairs.

2. A method for extracting question-answer pairs according to claim 1, characterized in that: According to the keywords corresponding to the original document, the first text paragraph is subjected to keyword strong association processing to obtain a target text paragraph, including: Extracting precise keywords from the first text paragraph; Performing keyword strong association processing on the first text paragraph using precise keywords of the first text paragraph to obtain a corresponding target text paragraph; The first text paragraph from which the corresponding precise keyword is not extracted is subjected to keyword strong association processing by using the keyword corresponding to the original document to obtain the corresponding target text paragraph.

3. The method for extracting question-answer pairs according to claim 1, characterized in that: The method further comprises: Perform paragraph segmentation on the original document without corresponding keywords to obtain each target text paragraph; The step of extracting question-answer pairs from the target text paragraph using a question-answer pair extraction model to obtain corresponding question-answer pairs includes: Determine the keyword characteristics of the target text paragraph; Extract question-answer pairs from the target text paragraph with keyword features through a narrow-domain question-answer pair extraction model to obtain the corresponding first question-answer pair; The general question-answer pair extraction model is used to extract question-answer pairs from the target text paragraph that does not have keyword features to obtain a corresponding second question-answer pair.

4. A method for extracting question-answer pairs according to claim 3, characterized in that: The method further comprises: Determining a first similarity between the first question-answer pair and a keyword feature in the corresponding target text paragraph; filtering the first question-answer pairs according to the first similarity; determining a second similarity between the second question-answer pair and a second historical question-answer pair; According to the second similarity, a second question-answer pair to be filtered is determined from the second question-answer pair and the historical second question-answer pairs.

5. The method for extracting question-answer pairs according to claim 1, characterized in that: The original document with the corresponding keywords is segmented into paragraphs to obtain each first text paragraph, including: Perform paragraph segmentation on the original document with corresponding keywords to obtain each initial text paragraph; Performing recognition processing on the obtained initial text paragraph to determine whether the initial text paragraph has type features corresponding to various paragraph types; Determine the paragraph type corresponding to the type feature of the initial text paragraph as the type of the initial text paragraph, wherein the various paragraph types include at least an enumeration paragraph, a table paragraph, and a picture paragraph; Content extraction is performed on the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to determine a first text paragraph corresponding to the initial text paragraph.

6. A method for extracting question-answer pairs according to claim 5, characterized in that: Extracting content from the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to determine a first text paragraph corresponding to the initial text paragraph includes: Extracting content from the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to obtain a text paragraph to be filtered corresponding to the initial text paragraph; According to the relationship between the word unit number of the text paragraph to be filtered and the word unit threshold, irrelevant fields are filtered on the text paragraph to be filtered to obtain a first text paragraph corresponding to the initial text paragraph.

7. A method for extracting question-answer pairs according to claim 6, characterized in that: Extracting content from the initial text paragraph using an extraction rule corresponding to the type of the initial text paragraph to obtain a text paragraph to be filtered corresponding to the initial text paragraph, including: In the case where the type of the initial text paragraph includes an enumeration type paragraph, extracting each enumeration text, and associating each extracted enumeration text with the body of the initial text paragraph; In the case where the type of the initial text paragraph includes a table-type paragraph, extracting row data of the table, and determining that the column name of the table is an attribute of the corresponding row data; Associating the extracted line data and line data attributes with the body of the initial text paragraph; In the case where the type of the initial text paragraph includes a picture paragraph, extracting a network address of the picture and associating it with the body of the initial text paragraph; After the extraction of each type of data in the initial text paragraph and the subject association are completed, the text paragraph to be filtered corresponding to the initial text paragraph is obtained.

8. The method for extracting question-answer pairs according to claim 1, characterized in that: Training the narrow domain question-answer pair extraction model includes: Annotating the sample paragraph to be annotated by using the standard question-answer pair of the sample paragraph to obtain a training sample paragraph, wherein the sample paragraph to be annotated is the target text paragraph after strong association processing; Training the initial model using the training sample paragraphs, and evaluating the performance of the trained initial model using standard question-answer pairs of the training sample paragraphs; Based on the evaluation results, determine whether a qualified narrow-domain question-answer pair extraction model has been trained.

9. A question-answering method based on question-answer pairs, characterized in that: The method comprises: Extract keywords from the question text; According to the extracted keywords, determining a first target question-answer pair corresponding to the question text from a first question-answer pair set, wherein the first question-answer pair in the first question-answer pair set is extracted by a question-answer pair extraction method according to any one of claims 1 to 8; Based on the first target question-answer pair, answer the question text; According to the question text from which the corresponding keywords are not extracted, determining a second target question-answer pair corresponding to the question text from a second question-answer pair set, wherein the second question-answer pair in the second question-answer pair set is extracted by a question-answer pair extraction method according to any one of claims 1 to 8; Based on the second target question-answer pair, the question text is answered.

10. A question-answering method based on question-answer pairs according to claim 9, characterized in that: Before determining a second target question-answer pair corresponding to the question text from a second question-answer pair set according to the question text from which the corresponding keywords are not extracted, the method further includes: Determining, based on the question text from which the corresponding keyword has not been extracted, a target keyword corresponding to the terminal that initiated the question text; Constructing a new question text according to the question text and the determined target keywords; According to the new question text, determining a first target question-answer pair corresponding to the question text from a first question-answer pair set; The step of determining, based on the question text from which the corresponding keywords are not extracted, a second target question-answer pair corresponding to the question text from a second question-answer pair set includes: In the case where the target keyword corresponding to the terminal that initiated the question text has not been determined, a second target question-answer pair corresponding to the question text is determined from the second question-answer pair set based on the question text from which the corresponding keyword has not been extracted.

11. A system for extracting question-answer pairs, characterized in that: The system comprises: A first keyword determination module, used to determine keywords corresponding to the original document; A paragraph segmentation module, used to segment the original document having the corresponding keywords into paragraphs to obtain each first text paragraph; A strong association module, used to perform keyword strong association processing on the first text paragraph according to the keywords corresponding to the original document to obtain a target text paragraph; The question-answer pair extraction module is used to extract question-answer pairs from the target text paragraph through a question-answer pair extraction model to obtain corresponding question-answer pairs.

12. A question-answering system based on question-answer pairs, characterized in that: The system comprises: The second keyword extraction module is used to extract keywords from the question text; a first target question-answer pair determination module, configured to determine, based on the extracted keywords, a first target question-answer pair corresponding to the question text from a first question-answer pair set, wherein the first question-answer pair in the first question-answer pair set is extracted by a question-answer pair extraction system according to claim 11; A first answering module, configured to answer the question text based on the first target question-answer pair; A second target question-answer pair determination module, configured to determine, based on a question text from which corresponding keywords have not been extracted, a second target question-answer pair corresponding to the question text from a second question-answer pair set, wherein the second question-answer pair in the second question-answer pair set is extracted by a question-answer pair extraction system according to claim 11; The second answering module is used to answer the question text based on the second target question and answer pair.

13. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and running on the processor, wherein when the computer program is executed by the processor, the steps in the method for extracting question and answer pairs as described in any one of claims 1 to 8 are implemented.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the method for extracting question-answer pairs as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Question and answer knowledge extraction method and device and computer readable storage medium

    CN111737437A

  • Question and answer matching method and device, electronic equipment and storage medium

    CN117633180A

  • Question and answer pair generation method, computer equipment and storage medium

    CN117633190A

  • Question and answer pair generation method, electronic equipment, storage medium and computer program product

    CN119271774A

  • Real-time voice stream and text dialogue interaction system based on large language model

    CN119539076A