Question and answer knowledge base construction method and device, equipment and storage medium

By using a large language model to build a question-answering knowledge base, the problems of high manual cost, low efficiency and poor consistency in traditional methods are solved, and efficient and flexible question-answering knowledge base construction is achieved to meet rapidly changing information needs.

CN118966343APending Publication Date: 2024-11-15PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411101751.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Traditional question-answering knowledge base construction methods rely on manual annotation and rule extraction, which suffer from high labor costs, low efficiency, difficulty in expansion, and poor consistency.

Method used

Large language models (such as GPT-3 and BERT) are used to identify and generate potential questions. Question-answer pairs are constructed by acquiring historical text data, question examples, and reference texts. High-quality target question-answer pairs are then selected to build a question-answer knowledge base.

Benefits of technology

Reduce labor costs, improve data utilization and construction efficiency, enhance the scalability and consistency of the knowledge base, and meet rapidly changing information needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118966343A_ABST
    Figure CN118966343A_ABST
Patent Text Reader

Abstract

The invention relates to a question and answer knowledge base construction method, which comprises the following steps: acquiring historical text data, simultaneously acquiring question examples, and identifying potential questions in the historical text data according to the question examples and a question model; and inputting the potential questions and the reference text into a question model to obtain question answers, and forming an original question-answer pair by the potential questions and the corresponding question answers. And screening out high-quality target question and answer pairs from the original question and answer pairs, and constructing a question and answer knowledge base according to the target question and answer pairs. The question and answer knowledge base is constructed by utilizing the large language model, so that the labor cost can be greatly reduced, the data utilization rate and the construction efficiency are improved, the expansibility and the consistency of the knowledge base can be enhanced, and the information requirement of rapid change is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a method, device, equipment and storage medium for constructing a question-and-answer knowledge base. Background Art

[0002] Question-answering knowledge base plays an important role in knowledge management and information retrieval. With the explosive growth of information, how to efficiently and accurately extract useful knowledge from massive information and manage it effectively has become an urgent problem to be solved. Traditional question-answering knowledge base construction methods mainly rely on manual annotation and rule extraction, which have the following shortcomings:

[0003] High labor costs: Traditional knowledge base construction methods require a lot of manual participation, including question extraction, answer writing, data labeling, etc. These steps are not only time-consuming and labor-intensive, but also require professional knowledge and skills, resulting in high labor costs.

[0004] Inefficiency: Manual processing speed is limited and it is difficult to cope with the processing needs of large-scale data. Especially in today's rapidly growing information volume, relying on manual labeling and review is inefficient and difficult to meet the needs of timely updating and expanding the knowledge base.

[0005] Difficult to expand: Traditional methods usually rely on predefined rules and templates. When faced with new fields or unseen problems, the rules and templates often need to be redesigned, which lacks flexibility and scalability.

[0006] Poor consistency: Due to the subjectivity of manual operations, different labelers may have different understandings and processing methods, resulting in poor consistency and standardization of information in the knowledge base.

[0007] With the development of artificial intelligence and natural language processing technology, large language models (such as GPT-3, BERT, etc.) have performed well in semantic understanding and generation, providing a new solution. These models have strong language understanding and generation capabilities through pre-training of large-scale corpus, and can play an important role in the construction of question-answering knowledge base. Summary of the invention

[0008] The main purpose of the present invention is to provide a question-and-answer knowledge base construction method, device, equipment and storage medium, aiming to solve the technical problem of low data utilization in existing knowledge base construction methods.

[0009] To achieve the above object, the present invention provides a method for constructing a question-answer knowledge base, the method comprising the following steps:

[0010] Acquire historical text data, acquire question examples, and identify potential questions in the historical text data according to the question examples and a question model;

[0011] Inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair;

[0012] A target question-answer pair is determined from the original question-answer pair, and a question-answer knowledge base is constructed according to the target question-answer pair.

[0013] Optionally, the step of obtaining the question example includes:

[0014] Predefine question templates to parse the grammatical structure of sentences in the historical text data;

[0015] The question example is extracted from the historical data according to the question template and the grammatical structure of the sentence.

[0016] Optionally, the step of identifying potential questions in the historical text data according to the question examples and the question model includes:

[0017] Parsing the historical text data using natural language processing technology to obtain grammatical structure and semantic information of each sentence in the historical text data;

[0018] Using the question examples to train the question model, the question model can identify and generate the potential questions;

[0019] The potential question is identified and generated from the historical text data according to the question model and the grammatical structure and semantic information of each sentence.

[0020] Optionally, the step of parsing the historical text data using natural language processing technology includes:

[0021] Preprocessing the historical text data, wherein the preprocessing includes removing special characters and punctuation marks, and sentence separation operations;

[0022] Use natural language processing technology to parse the preprocessed historical text data.

[0023] Optionally, the step of determining a target question-answer pair from the original question-answer pair includes:

[0024] Determine the probability of subsequent text generation and the probability of original text generation for each candidate question-answer pair in the original question-answer pair;

[0025] Determine a high-quality candidate question-answer pair whose original text generation probability is greater than the subsequent text generation probability, and determine the target question-answer pair based on the high-quality candidate question-answer pair.

[0026] Optionally, the step of constructing a question-answer knowledge base according to the target question-answer pair includes:

[0027] Determine synonymous questions with the same semantics in the target question-answer pair, and select the best answer from the answer set corresponding to the synonymous questions;

[0028] The question-answering knowledge base is constructed according to the optimal answer and the synonymous question.

[0029] Optionally, the step of determining a target question-answer pair from the original question-answer pair includes:

[0030] Performing a preliminary screening of the original question-answer pairs using an automated model, filtering low-quality question-answer pairs according to preset rules, and obtaining intermediate question-answer pairs;

[0031] The accuracy and completeness of the intermediate question-answer pair are evaluated, and when the accuracy and completeness of the intermediate question-answer pair meet preset requirements, the intermediate question-answer pair is used as a target question-answer pair.

[0032] Furthermore, in order to achieve the above-mentioned purpose, the present invention also provides a question-answer knowledge base construction device, the question-answer knowledge base construction device comprising:

[0033] A question recognition module is configured to obtain historical text data, obtain question examples, and recognize potential questions in the historical text data based on the question examples and the question model;

[0034] A question-answer pair generation module, inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair;

[0035] The knowledge base construction module determines a target question-answer pair from the original question-answer pair, and constructs a question-answer knowledge base based on the target question-answer pair.

[0036] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a question and answer knowledge base construction device, which includes a memory, a processor, and a question and answer knowledge base construction program stored in the memory and executable on the processor, and the question and answer knowledge base construction program, when executed by the processor, implements the steps of the question and answer knowledge base construction method as described above.

[0037] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a storage medium, on which a question and answer knowledge base construction program is stored, and when the question and answer knowledge base construction program is executed by a processor, the steps of the question and answer knowledge base construction method as described above are implemented.

[0038] The present invention relates to a method for constructing a question-answer knowledge base, which obtains historical text data and question examples at the same time, and identifies potential questions in the historical text data according to the question examples and question models. Potential questions and reference texts are input into the question model to obtain question answers, and the potential questions and corresponding question answers constitute original question-answer pairs. High-quality target question-answer pairs are then screened out from the original question-answer pairs, and a question-answer knowledge base is constructed based on the target question-answer pairs. The present invention utilizes a large language model to construct a question-answer knowledge base, which can not only significantly reduce labor costs, improve data utilization and construction efficiency, but also enhance the scalability and consistency of the knowledge base to meet rapidly changing information needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 A schematic diagram of the structure of the device hardware operating environment involved in the embodiment of the device for building the question-answer knowledge base of the present invention;

[0040] Figure 2 This is a flow chart of the first embodiment of the method for constructing a question-answer knowledge base of the present invention;

[0041] Figure 3 Schematic diagram of functional modules of a preferred embodiment of the apparatus for constructing a question-and-answer knowledge base of the present invention.

[0042] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0043] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0044] It should be noted that question-answering knowledge base plays an important role in knowledge management and information retrieval. With the explosive growth of information volume, how to efficiently and accurately extract useful knowledge from massive information and manage it effectively has become an urgent problem to be solved. Traditional question-answering knowledge base construction methods mainly rely on manual annotation and rule extraction, which have the following shortcomings:

[0045] High labor costs: Traditional knowledge base construction methods require a lot of manual participation, including question extraction, answer writing, data labeling, etc. These steps are not only time-consuming and labor-intensive, but also require professional knowledge and skills, resulting in high labor costs.

[0046] Inefficiency: Manual processing speed is limited and it is difficult to cope with the processing needs of large-scale data. Especially in today's rapidly growing information volume, relying on manual labeling and review is inefficient and difficult to meet the needs of timely updating and expanding the knowledge base.

[0047] Difficult to expand: Traditional methods usually rely on predefined rules and templates. When faced with new fields or unseen problems, the rules and templates often need to be redesigned, which lacks flexibility and scalability.

[0048] Poor consistency: Due to the subjectivity of manual operations, different labelers may have different understandings and processing methods, resulting in poor consistency and standardization of information in the knowledge base.

[0049] With the development of artificial intelligence and natural language processing technology, large language models (such as GPT-3, BERT, etc.) have performed well in semantic understanding and generation, providing a new solution. These models have strong language understanding and generation capabilities through pre-training of large-scale corpus, and can play an important role in the construction of question-answering knowledge base.

[0050] Based on the above-mentioned defects, the present invention provides a question-answer knowledge base construction device, referring to Figure 1 , Figure 1 A schematic diagram of the structure of the device hardware operating environment involved in the device embodiment scheme for building a question-and-answer knowledge base of the present invention.

[0051] like Figure 1 As shown, the question-and-answer knowledge base construction device may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.

[0052] Those skilled in the art will understand that Figure 1 The hardware structure of the question-and-answer knowledge base construction device shown in the figure does not constitute a limitation on the question-and-answer knowledge base construction device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0053] like Figure 1As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a question-answer knowledge base construction program. The operating system is a program for managing and controlling the question-answer knowledge base construction device and software resources, and supports the operation of the network communication module, the user interface module, the question-answer knowledge base construction program, and other programs or software; the network communication module is used to manage and control the network interface 1004; and the user interface module is used to manage and control the user interface 1003.

[0054] exist Figure 1 In the hardware structure of the question-answer knowledge base construction device shown, the network interface 1004 is mainly used to connect to the backend server and perform data communication with the backend server; the user interface 1003 is mainly used to connect to the client and perform data communication with the client; the processor 1001 can call the question-answer knowledge base construction program stored in the memory 1005 and perform the following operations:

[0055] Acquire historical text data, acquire question examples, and identify potential questions in the historical text data according to the question examples and a question model;

[0056] Inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair;

[0057] A target question-answer pair is determined from the original question-answer pair, and a question-answer knowledge base is constructed according to the target question-answer pair.

[0058] Furthermore, the step of obtaining the question example includes:

[0059] Predefine question templates to parse the grammatical structure of sentences in the historical text data;

[0060] The question example is extracted from the historical data according to the question template and the grammatical structure of the sentence.

[0061] Furthermore, the step of identifying potential questions in the historical text data according to the question examples and the question model includes:

[0062] Parsing the historical text data using natural language processing technology to obtain grammatical structure and semantic information of each sentence in the historical text data;

[0063] Using the question examples to train the question model, the question model can identify and generate the potential questions;

[0064] The potential question is identified and generated from the historical text data according to the question model and the grammatical structure and semantic information of each sentence.

[0065] Furthermore, the step of parsing the historical text data using natural language processing technology includes:

[0066] Preprocessing the historical text data, wherein the preprocessing includes removing special characters and punctuation marks, and sentence separation operations;

[0067] Use natural language processing technology to parse the preprocessed historical text data.

[0068] Furthermore, the step of determining a target question-answer pair from the original question-answer pair includes:

[0069] Determine the probability of subsequent text generation and the probability of original text generation for each candidate question-answer pair in the original question-answer pair;

[0070] Determine a high-quality candidate question-answer pair whose original text generation probability is greater than the subsequent text generation probability, and determine the target question-answer pair based on the high-quality candidate question-answer pair.

[0071] Furthermore, the step of constructing a question-answer knowledge base according to the target question-answer pair includes:

[0072] Determine synonymous questions with the same semantics in the target question-answer pair, and select the best answer from the answer set corresponding to the synonymous questions;

[0073] The question-answering knowledge base is constructed according to the optimal answer and the synonymous question.

[0074] Furthermore, the step of determining a target question-answer pair from the original question-answer pair includes:

[0075] Performing a preliminary screening of the original question-answer pairs using an automated model, filtering low-quality question-answer pairs according to preset rules, and obtaining intermediate question-answer pairs;

[0076] The accuracy and completeness of the intermediate question-answer pair are evaluated, and when the accuracy and completeness of the intermediate question-answer pair meet preset requirements, the intermediate question-answer pair is used as a target question-answer pair.

[0077] The specific implementation of the question-and-answer knowledge base construction device of the present invention is basically the same as the various embodiments of the question-and-answer knowledge base construction method described below, and will not be repeated here.

[0078] The present invention also provides a question-and-answer knowledge base construction method based on the question-and-answer knowledge base construction device.

[0079] Reference Figure 2 , Figure 2 Schematic diagram of the process of the first embodiment of the question-answer knowledge base construction method of the present invention.

[0080] The embodiment of the present invention provides an embodiment of a method for constructing a question-and-answer knowledge base. It should be noted that although a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different from that shown here.

[0081] In various embodiments of the question-answer knowledge base construction method, the execution subject is a question-answer knowledge base construction device.

[0082] The question-answering knowledge base construction method is applied to a question-answering knowledge base construction device, and the question-answering knowledge base construction method includes:

[0083] Step S10, obtaining historical text data, obtaining question examples, and identifying potential questions in the historical text data according to the question examples and the question model;

[0084] Question-answering knowledge base plays an important role in knowledge management and information retrieval. With the explosive growth of information, how to efficiently and accurately extract useful knowledge from massive information and manage it effectively has become an urgent problem to be solved. Traditional question-answering knowledge base construction methods mainly rely on manual annotation and rule extraction, which have the following shortcomings:

[0085] High labor costs: Traditional knowledge base construction methods require a lot of manual participation, including question extraction, answer writing, data labeling, etc. These steps are not only time-consuming and labor-intensive, but also require professional knowledge and skills, resulting in high labor costs.

[0086] Inefficiency: Manual processing speed is limited and it is difficult to cope with the processing needs of large-scale data. Especially in today's rapidly growing information volume, relying on manual labeling and review is inefficient and difficult to meet the needs of timely updating and expanding the knowledge base.

[0087] Difficult to expand: Traditional methods usually rely on predefined rules and templates. When faced with new fields or unseen problems, the rules and templates often need to be redesigned, which lacks flexibility and scalability.

[0088] Poor consistency: Due to the subjectivity of manual operations, different labelers may have different understandings and processing methods, resulting in poor consistency and standardization of information in the knowledge base.

[0089] With the development of artificial intelligence and natural language processing technology, large language models (such as GPT-3, BERT, etc.) have performed well in semantic understanding and generation, providing a new solution. These models have strong language understanding and generation capabilities through pre-training of large-scale corpus, and can play an important role in the construction of question-answering knowledge base.

[0090] The question-and-answer knowledge base construction method in this embodiment is applicable to a device having a question-and-answer knowledge base construction method function.

[0091] In this embodiment, first, a large amount of historical text data is acquired from various sources, and these data may include technical documents, books, articles, product manuals, etc.

[0092] Secondly, obtain question examples, which may be preset. For example, the preset question examples are: "What is artificial intelligence?", "How to install software?", "Why is the sky blue?", "What is the principle of machine learning?", and "What are the applications of big data?".

[0093] Question examples may also be generated based on predefined question templates and sentence grammatical structures parsed from historical text data. For example, a series of general question templates may be designed based on different application scenarios and fields. These templates may include but are not limited to the following forms: "What is...?", "How to...?", "Why...?", "What is the function of...?", "What is the principle of...?".

[0094] Use x to refer to a specific question, and the question sentences in the text are expressed in the format of "[Q(x)]", for example: ChatGPT is an artificial intelligence chatbot program developed by [Q("Which company developed ChatGPT?")]OpenAI and launched in [Q("When was ChatGPT released?")]November 2022.

[0095] As shown above, Q gives a potential question to ask about the current text, and the following text contains the answer to the question. Through specific instructions and a small number of examples, the large model can be guided to automatically generate potential questions. The steps may include:

[0096] Design instructions for guiding the large model to generate questions. For example, use the instruction "Generate questions related to the following sentence: 'Artificial intelligence is the science of how to make computers simulate human intelligence'." to generate potential questions.

[0097] Provide a small number of question examples to help the large model understand how to generate similar questions. For example, provide "What is artificial intelligence?" as an example.

[0098] Input historical text data, instructions, and examples into the big model to automatically generate potential questions. Let x refer to a specific question, and the question in the text is expressed in the format of "[Q(x)]", for example: ChatGPT is an artificial intelligence chatbot program developed by [Q("Which company developed ChatGPT?")]OpenAI and launched in November 2022.

[0099] As shown above, Q gives a potential question to ask about the current text, and the following text contains the answer to the question. After a small number of examples and the text to be mined are input into the large model, the question in the model output can be automatically identified according to the above format.

[0100] The specific input reference is as follows: Your task is to ask questions about the knowledge points in a text, and the questions you ask need to track the key information in the text. You need to identify the specific question sentence in the format of [Q(x)], where x represents a question sentence. The following are some reference examples:

[0101] Input: AIGC stands for AI Generated Content, which refers to the use of artificial intelligence technology to generate content.

[0102] Output: AIGC stands for AI Generated Content, which means [Q(“What does AIGC mean?”)] uses artificial intelligence technology to generate content.

[0103] Input: Meta, full name Meta Platforms, is an American Internet technology company headquartered in Menlo Park, California, USA. It was founded on February 4, 2004.

[0104] Output: Meta, full name Meta Platforms, is an American Internet technology company headquartered in Menlo Park, California, USA. It was founded on February 4, 2004.

[0105] Step S20, inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair;

[0106] In this embodiment, the identified potential question and reference text are input into the question model to generate corresponding answers to form an original question-answer pair.

[0107] Specific steps may include:

[0108] Determine the question-answer generation model: Generate answers using pre-trained large language models (such as GPT-3, BERT, etc.). These models are trained with a large amount of text data and have strong language understanding and generation capabilities.

[0109] Input potential questions and reference text: Input the generated potential questions and the corresponding reference text into the question-answer pair generation model. The model will generate the corresponding answer based on the reference text.

[0110] Answer generation: The answers generated by the model should be highly relevant to the underlying question and accurately answer the question in the question. Ensure that the generated answers are natural in language and clear in logic.

[0111] Question-answer pair construction: Combine the potential question with the generated answer to form the original question-answer pair. For example, the input is "What is artificial intelligence?" and the reference text "Artificial intelligence is a science that studies how to make computers simulate human intelligence." The answer generated by the model is "Artificial intelligence is a science that studies how to make computers simulate human intelligence.", which ultimately forms the original question-answer pair: Question: "What is artificial intelligence?", Answer: "Artificial intelligence is a science that studies how to make computers simulate human intelligence.".

[0112] Step S30, determining a target question-answer pair from the original question-answer pair, and constructing a question-answer knowledge base based on the target question-answer pair.

[0113] In this embodiment, high-quality target question-answer pairs are screened out from the original question-answer pairs. In the process of screening high-quality question-answer pairs, the target question-answer pairs are determined by calculating the generation probability of each candidate question-answer pair. The generation probability is based on the language model score of the question and answer in the question-answer pair.

[0114] Set the total length of the text to L, the starting position of the question mined from the text by the model to i, and set p M (z n+1 |z 1:n ) means that when the previous context z is given 1:n When the next character z is generated n+1 For a large model, when the content before the question is known, the probability of generating the following text can be expressed as:

[0115] Original generation probability p i :

[0116]

[0117] Among them, p i represents the generation probability of sequence z starting from position i under the language model M, and L is the length of sequence z.

[0118] The probability p of generating a question-answer pair i *:

[0119]

[0120] Among them, p i * represents the generation probability of the sequence z starting from position i in the language model M when it contains the question Q(x) and the answer A(x). For each candidate question-answer pair, when p i <p i*, it means that the question and answer pair helps the big model generate the original document, that is, it provides key information, so the candidate question and answer pair is retained, otherwise it is filtered out. In this way, question and answer pairs with high generation probability and accurate answers can be screened out, thus building a high-quality question and answer knowledge base.

[0121] The present invention relates to a method for constructing a question-answer knowledge base, which obtains historical text data and question examples at the same time, and identifies potential questions in the historical text data according to the question examples and question models. Potential questions and reference texts are input into the question model to obtain question answers, and the potential questions and corresponding question answers constitute original question-answer pairs. High-quality target question-answer pairs are then screened out from the original question-answer pairs, and a question-answer knowledge base is constructed based on the target question-answer pairs. The present invention utilizes a large language model to construct a question-answer knowledge base, which can not only significantly reduce labor costs, improve data utilization and construction efficiency, but also enhance the scalability and consistency of the knowledge base to meet rapidly changing information needs.

[0122] Furthermore, a second embodiment of the method for constructing a question-answer knowledge base of the present invention is proposed. In the above step S10, the step of obtaining a question example includes:

[0123] Step a1, predefine a question template and parse the grammatical structure of the sentence in the historical text data;

[0124] Step a2: extracting the question example from the historical data according to the question template and the grammatical structure of the sentence.

[0125] In this embodiment, a question example is obtained, and one implementation method is:

[0126] First, pre-define question templates. According to different application scenarios and fields, a series of general question templates are designed. These templates may include but are not limited to the following forms: "What is...?", "How to...?", "Why...?", "What is the role of...?", "What is the principle of...?". The purpose of pre-define question templates is to provide a standardized format and structure for subsequent question generation to ensure that the generated questions are consistent and understandable.

[0127] For example:

[0128] What is ...?

[0129] how...?

[0130] Why...?

[0131] What is the purpose of ...?

[0132] What is the principle behind ...?

[0133] Then, the sentence grammatical structure is analyzed, and the historical text data is parsed to identify the main components of each sentence, such as subject, predicate, object, etc. Syntactic parsing can use natural language processing (NLP) technology, such as syntactic analyzer or dependency parser. The syntactic analyzer is used to decompose the sentence and extract the core components such as subject, predicate, object, etc. The dependency parser is used to identify the dependency relationship between the components in the sentence to help understand the structure and meaning of the sentence.

[0134] Finally, a question example is generated based on the question template and the grammatical structure of the sentence. The parsed sentence structure is combined with the predefined question template to extract question examples that match the template from the historical data. For example, given a sentence "Artificial intelligence is a science that studies how to make computers simulate human intelligence." and a question template "What is...?", a question example "What is artificial intelligence?" can be generated. This process can be automated by mapping the grammatical structure of the sentence to the question template to generate standardized question examples.

[0135] The specific method is to input a large amount of historical text data into the natural language processing system. Using the predefined question template, automatically identify and extract sentences that meet the template. Generate a question example based on the template and the parsed sentence structure:

[0136] Input: AIGC stands for AI Generated Content, which refers to the use of artificial intelligence technology to generate content.

[0137] Output: AIGC stands for AI Generated Content, which means [Q(“What does AIGC mean?”)] uses artificial intelligence technology to generate content.

[0138] Input: Meta, full name Meta Platforms, is an American Internet technology company headquartered in Menlo Park, California, USA. It was founded on February 4, 2004.

[0139] Output: Meta, full name Meta Platforms, is an American Internet technology company headquartered in Menlo Park, California, USA. It was founded on February 4, 2004.

[0140] Through the above steps, this embodiment can efficiently extract high-quality question examples from a large amount of historical text data, providing a basis for the subsequent question-answer knowledge base construction. These question examples play a key role in the subsequent question-answer generation and knowledge base construction, ensuring that the generated question-answer pairs are of high quality and high relevance.

[0141] Furthermore, a third embodiment of the method for constructing a question-answer knowledge base of the present invention is proposed. In the above step S10, the step of identifying potential questions in the historical text data according to the question examples and the question model includes:

[0142] Step b1, using natural language processing technology to parse the historical text data to obtain the grammatical structure and semantic information of each sentence in the historical text data;

[0143] Step b2, using the question example to train the question model, so that the question model can identify and generate the potential question;

[0144] Step b3: identifying and generating the potential question from the historical text data according to the question model and the grammatical structure and semantic information of each sentence.

[0145] In this embodiment, the potential questions in the historical text data are identified according to the question examples and the question model. The specific steps may include:

[0146] Parsing historical text data using natural language processing technology: Use natural language processing technology to parse historical text data and obtain the grammatical structure of each sentence. This includes identifying the subject, predicate, object and other components of the sentence, and analyzing the structural relationship of the sentence. In addition to the syntactic structure, the semantic information of the sentence must also be extracted. This includes the meaning of words, the theme and intention of the sentence, etc. Technologies such as Semantic Role Labeling and Named Entity Recognition can be used to obtain this information.

[0147] Train the question model using question examples: Use pre-extracted high-quality question examples as training data to input the question model. Question examples should cover questions of different types and fields to ensure the generalization ability of the model. Through deep learning algorithms (such as BERT, GPT-3, etc.), train the question model to enable it to recognize and generate potential questions. During the training process, the model learns how to generate appropriate questions based on the input text and adjust the structure and content of the questions according to the context.

[0148] Identify and generate potential questions: Apply the trained question model to historical text data. The model identifies possible questions based on the grammatical structure and semantic information of each sentence. Generate potential questions based on the question model. These questions should be highly relevant to the content and context of the original sentence and accurately reflect the core information of the sentence. For example, given a sentence "Artificial intelligence is a science that studies how to make computers simulate human intelligence.", the potential questions that the model may generate include "What is artificial intelligence?", "What is the research direction of artificial intelligence?", etc.

[0149] For example, input sentences from historical text data into the trained question model, and input the sentence: "Quantum computing is a new technology that uses the properties of quantum mechanics for computing."; the generated potential questions are: "What is quantum computing?", "What are the characteristics of quantum computing?", etc.

[0150] This embodiment can efficiently identify and generate potential questions from historical text data through the above method. These potential questions play a key role in the subsequent question-answer pair generation and knowledge base construction, ensuring that the generated question-answer pairs are of high quality and high relevance.

[0151] Furthermore, a fourth embodiment of the method for constructing a question-answer knowledge base of the present invention is proposed. In the above step b1, the step of parsing the historical text data using natural language processing technology includes:

[0152] Step c1, preprocessing the historical text data, wherein the preprocessing includes removing special characters and punctuation marks, and sentence separation operations;

[0153] Step c2, using natural language processing technology to parse the pre-processed historical text data.

[0154] In this embodiment, preprocessing the historical text data is a key step in the process of identifying and generating potential questions. The preprocessing step can effectively improve the accuracy and efficiency of text parsing.

[0155] Specific steps may include:

[0156] Remove special characters and punctuation: Remove noise from the text, simplify the text structure, and ensure the accuracy of the subsequent parsing process. You can use regular expressions to match and remove special characters and punctuation. This step helps eliminate unnecessary elements in the text, making it easier to parse the language. You can also list common special characters and punctuation and remove them through string replacement functions. For example, remove symbols such as "#", "$", and "%".

[0157] Sentence segmentation: Split the text into independent sentence units so that each sentence can be parsed grammatically and semantically independently. You can use the sentence segmentation tool in the natural language processing toolkit (such as NLTK, spaCy) to perform sentence segmentation. You can also segment sentences based on sentence-ending punctuation (such as period, question mark, exclamation mark), which ensures that each sentence is a complete semantic unit.

[0158] In order to further improve the parsing effect, the preprocessing step may also include the following steps:

[0159] Convert case: Unify the text format to avoid parsing errors caused by different cases. Convert all text to lowercase or uppercase to ensure that there are no matching errors due to different cases during processing.

[0160] Remove stop words: Remove common words that have little impact on semantic parsing (such as "of", "is", "in", etc.) to improve the parsing efficiency and accuracy of the model. Use a stop word list to filter out stop words in the text, which helps simplify the text and highlight important words and phrases.

[0161] Use natural language processing techniques to parse the preprocessed historical text data. Identify the subject, predicate, object, etc. of the sentence, and analyze the structural relationship of the sentence. Extract the semantic information of the sentence, including the meaning of words, the theme and intention of the sentence, etc. Techniques such as Semantic Role Labeling and Named Entity Recognition can be used to obtain this information.

[0162] For example, input historical text data: Example text: "Quantum computing is a new type of technology that uses the characteristics of quantum mechanics for computing."

[0163] Preprocessing steps:

[0164] Remove special characters and punctuation marks: Clean the noise in the text and simplify the structure.

[0165] Sentence splitting operation: Split the text into independent sentence units.

[0166] Convert case: Unify the text format.

[0167] Remove stop words: Remove words that have little impact on semantic parsing.

[0168] Preprocessed text: "Quantum computing is a new type of technology that uses the characteristics of quantum mechanics for computing."

[0169] In this embodiment, through the above steps, the historical text data is comprehensively preprocessed, and the preprocessed text is more concise and standardized, which helps to improve the accuracy and efficiency of parsing.

[0170] Further, a fifth embodiment of the method for constructing the Q&A knowledge base of the present invention is proposed. In the above step S30, the step of determining the target Q&A pair from the original Q&A pairs includes:

[0171] Step d1, determine the probability of generating the subsequent text and the probability of generating the original text for each candidate Q&A pair in the original Q&A pairs;

[0172] Step d2, determining high-quality candidate question-answer pairs whose original text generation probability is greater than the subsequent text generation probability, and determining the target question-answer pair based on the high-quality candidate question-answer pairs.

[0173] In this embodiment, the probability of subsequent text generation and the probability of original text generation of each candidate question-answer pair in the original question-answer pair are first determined. Wherein, the probability of subsequent text generation: the probability of subsequent text generation refers to the probability of generating an answer after a given question. By calculating the probability of generating an answer in a candidate question-answer pair under a given question, the relevance and accuracy of the question-answer pair can be evaluated. The probability of original text generation: the probability of original text generation refers to the probability of generating a question after a given answer. By calculating the probability of generating a question in a candidate question-answer pair under a given answer, the complementarity and completeness of the question-answer pair can be evaluated.

[0174] Among them, the formula for the probability of generating the following text is:

[0175]

[0176] The formula for the original text generation probability is:

[0177]

[0178] Among them, p i represents the probability of generating the answer A(x) given the question Q(x), p i * represents the probability of generating a question Q(x) given the answer A(x).

[0179] After determining the probability, high-quality candidate question-answer pairs whose original text generation probability is greater than the subsequent text generation probability are determined. Specific methods may include:

[0180] Compare generation probabilities: Compare the probability of generating the subsequent text with the probability of generating the original text for each candidate question-answer pair. If the probability of generating the original text is greater than the probability of generating the subsequent text, it means that the question-answer pair has a higher relevance and accuracy in the model generation process.

[0181] Screen high-quality candidate question-answer pairs: retain candidate question-answer pairs whose original text generation probability is greater than the subsequent text generation probability. These high-quality candidate question-answer pairs can better reflect the core content and key information of the text.

[0182] Then, the target question and answer pair is determined based on the high-quality candidate question and answer pairs. The determination method can be to use all the high-quality candidate question and answer pairs as the target question and answer pairs, or to select the high-quality question and answer pairs with the highest generation probability or the top preset ranking as the target question and answer pairs as needed.

[0183] Through the above steps, this embodiment can filter out high-quality target question-answer pairs from the original question-answer pairs, ensuring that the content in the question-answer knowledge base is accurate and highly relevant. These target question-answer pairs can better meet the user's query needs and improve the practicality and reliability of the knowledge base.

[0184] Furthermore, a sixth embodiment of the method for constructing a question-answer knowledge base of the present invention is proposed. In the above step S30, the step of constructing a question-answer knowledge base according to the target question-answer pair includes:

[0185] Step e1, determining synonymous questions with the same semantics in the target question-answer pair, and selecting the best answer from the answer set corresponding to the synonymous questions;

[0186] Step e2, constructing the question-answering knowledge base according to the optimal answer and the synonymous question.

[0187] In this embodiment, a question-answer knowledge base is constructed according to the target question-answer pair, and the specific steps may include:

[0188] First, determine the synonymous questions with the same semantics in the target question-answer pair, and use natural language processing technology to identify synonymous questions with the same or similar semantics in the target question-answer pair. These synonymous questions may differ in expression, but their semantic content is consistent. Perform cluster analysis on the questions in the target question-answer pair, and classify the questions with the same semantics into one category. By calculating the semantic similarity between questions, questions with the same semantics are identified. For example, the questions "What is blockchain?" and "What is the definition of blockchain?" in the target question-answer pair are identified as synonymous questions through semantic analysis.

[0189] Then, the best answer is selected from the answer set corresponding to the synonymous question, and the quality of multiple answers corresponding to the synonymous question is evaluated to select the best answer. The evaluation criteria include the accuracy, completeness, conciseness and relevance of the answer. By comparing the content, information content and expression of different answers, the answer that can best answer the synonymous question is selected.

[0190] The process of selecting the best answer may include:

[0191] Behavioral data collection: Collect user behavioral data when using the question-and-answer knowledge base, including click-through rate, number of likes, length of stay, etc.

[0192] Comprehensive scoring: Based on the collected user behavior data, multiple answers to synonymous questions are comprehensively scored. The scoring criteria may include the click-through rate, number of likes, and length of stay of the answer.

[0193] Sorting and selecting the best answer: Sort multiple answers according to their comprehensive scores and select the answer with the highest score as the best answer.

[0194] For example, collect user behavior data: the answer A corresponding to the question "What is machine learning?" has a click-through rate of 85%, 250 likes, and an average stay time of 2.5 minutes. The answer B corresponding to the question "What is the definition of machine learning?" has a click-through rate of 75%, 200 likes, and an average stay time of 2 minutes. Score answers A and B based on click-through rate, likes, and stay time. Answer A has the highest score, so choose answer A as the best answer.

[0195] After determining the optimal answer, build a question-answer knowledge base based on the optimal answer. The specific steps may include:

[0196] Integrate synonymous questions and optimal answers: Combine the identified synonymous questions with the optimal answers to form the final question-answer pair.

[0197] Knowledge base entry: Enter the constructed question-answer pairs into the question-answer knowledge base. Ensure that the storage format of the question-answer pairs in the knowledge base is consistent to facilitate subsequent retrieval and use.

[0198] After the knowledge base is built, it can be continuously updated and optimized. For example, user feedback and behavior data can be continuously collected, and the question-answer pairs in the knowledge base can be regularly evaluated and optimized. Based on new user data and feedback, the question recognition model and answer generation model can be regularly updated to ensure the real-time and accuracy of the question-answer knowledge base.

[0199] Through the above steps, this embodiment can efficiently identify synonymous questions, select the best answer, and build a high-quality question-answer knowledge base. The knowledge base built in this way can better meet the query needs of users and provide accurate and comprehensive information.

[0200] Furthermore, a seventh embodiment of the method for constructing a question-answer knowledge base of the present invention is proposed. In the above step S30, the step of determining a target question-answer pair from the original question-answer pair includes:

[0201] Step f1, using an automated model to preliminarily screen the original question-answer pairs, filtering low-quality question-answer pairs according to preset rules, and obtaining intermediate question-answer pairs;

[0202] Step f2, evaluating the accuracy and completeness of the intermediate question-answer pair. When the accuracy and completeness of the intermediate question-answer pair meet preset requirements, the intermediate question-answer pair is used as the target question-answer pair.

[0203] In this embodiment, a pre-trained automated model is used to perform a preliminary screening of the original question-answer pairs. The model can be evaluated based on the language features, relevance, and matching of the question and answer. Low-quality question-answer pairs are filtered out according to preset rules. These rules may include: low semantic matching between the question and answer; the answer is too short or too long; the question or answer contains obvious grammatical errors or incomplete information.

[0204] After preliminary screening and filtering, the question-answer pairs are marked as intermediate question-answer pairs and enter the next evaluation stage.

[0205] Evaluate the accuracy and completeness of the intermediate question-answer pairs: Evaluate the accuracy of the intermediate question-answer pairs to ensure that the answers can accurately answer the questions. The evaluation can be done by combining automatic model evaluation and manual review. Check the completeness of the intermediate question-answer pairs to ensure that the answer information is comprehensive and does not miss key content. The completeness evaluation can include the coverage and detail of the answer.

[0206] According to the preset accuracy and completeness requirements, the intermediate question-answer pairs are finally evaluated. When the intermediate question-answer pairs meet the preset requirements, they are used as target question-answer pairs. The finalized target question-answer pairs are entered into the question-answer knowledge base to ensure that the storage format of the question-answer pairs in the knowledge base is consistent, which is convenient for subsequent retrieval and use.

[0207] Through the above steps, this embodiment can filter out high-quality target question-answer pairs from the original question-answer pairs, ensuring that the content in the question-answer knowledge base is accurate and highly relevant. These target question-answer pairs can better meet the user's query needs and improve the practicality and reliability of the knowledge base.

[0208] The invention also provides a question-answer knowledge base construction device.

[0209] Reference Figure 3 , Figure 3 This is a functional module diagram of the first embodiment of the question-answer knowledge base construction device of the present invention. The question-answer knowledge base construction device comprises:

[0210] A question recognition module is configured to obtain historical text data, obtain question examples, and recognize potential questions in the historical text data based on the question examples and the question model;

[0211] A question-answer pair generation module, inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair;

[0212] The knowledge base construction module determines a target question-answer pair from the original question-answer pair, and constructs a question-answer knowledge base based on the target question-answer pair.

[0213] In addition, an embodiment of the present invention further provides a storage medium.

[0214] The storage medium stores a question-and-answer knowledge base construction program, which, when executed by the processor, implements the steps of the question-and-answer knowledge base construction method as described above.

[0215] The specific implementation of the storage medium of the present invention is basically the same as the various embodiments of the above-mentioned question-and-answer knowledge base construction method, and will not be repeated here.

[0216] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.

[0217] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0218] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.

[0219] 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 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 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 device including the elements.

[0220] The above are only various implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for constructing a question-answer knowledge base, characterized in that: The question-answer knowledge base construction method comprises the following steps: Acquire historical text data, acquire question examples, and identify potential questions in the historical text data according to the question examples and a question model; Inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair; A target question-answer pair is determined from the original question-answer pair, and a question-answer knowledge base is constructed according to the target question-answer pair.

2. The method for constructing a question-answer knowledge base according to claim 1, wherein: The steps of obtaining the question examples include: Predefine question templates to parse the grammatical structure of sentences in the historical text data; The question example is extracted from the historical data according to the question template and the grammatical structure of the sentence.

3. The method for constructing a question-answer knowledge base according to claim 1, wherein: The step of identifying potential questions in the historical text data according to the question examples and the question model comprises: Parsing the historical text data using natural language processing technology to obtain grammatical structure and semantic information of each sentence in the historical text data; Using the question examples to train the question model, the question model can identify and generate the potential questions; The potential question is identified and generated from the historical text data according to the question model and the grammatical structure and semantic information of each sentence.

4. The method for constructing a question-answer knowledge base according to claim 3, wherein: The step of parsing the historical text data using natural language processing technology includes: Preprocessing the historical text data, wherein the preprocessing includes removing special characters and punctuation marks, and sentence separation operations; Use natural language processing technology to parse the preprocessed historical text data.

5. The method for constructing a question-answer knowledge base according to claim 1, wherein: The step of determining a target question-answer pair from the original question-answer pair comprises: Determine the probability of subsequent text generation and the probability of original text generation for each candidate question-answer pair in the original question-answer pair; Determine a high-quality candidate question-answer pair whose original text generation probability is greater than the subsequent text generation probability, and determine the target question-answer pair based on the high-quality candidate question-answer pair.

6. The method for constructing a question-answer knowledge base according to claim 1, wherein: The step of constructing a question-answer knowledge base according to the target question-answer pair comprises: Determine synonymous questions with the same semantics in the target question-answer pair, and select the best answer from the answer set corresponding to the synonymous questions; The question-answering knowledge base is constructed according to the optimal answer and the synonymous question.

7. The method for constructing a question-answer knowledge base according to claim 1, wherein: The step of determining a target question-answer pair from the original question-answer pair comprises: Performing a preliminary screening of the original question-answer pairs using an automated model, filtering low-quality question-answer pairs according to preset rules, and obtaining intermediate question-answer pairs; The accuracy and completeness of the intermediate question-answer pair are evaluated, and when the accuracy and completeness of the intermediate question-answer pair meet preset requirements, the intermediate question-answer pair is used as a target question-answer pair.

8. A question-answer knowledge base construction device, characterized in that: The question-answer knowledge base construction device comprises: A question recognition module is configured to obtain historical text data, obtain question examples, and recognize potential questions in the historical text data based on the question examples and the question model; A question-answer pair generation module, inputting the potential question and the reference text into the question model to obtain a question answer, wherein the potential question and the question answer constitute an original question-answer pair; The knowledge base construction module determines a target question-answer pair from the original question-answer pair, and constructs a question-answer knowledge base based on the target question-answer pair.

9. A question-answer knowledge base construction device, characterized in that: The question and answer knowledge base construction device includes a memory, a processor, and a question and answer knowledge base construction program stored in the memory and executable on the processor. When the question and answer knowledge base construction program is executed by the processor, the steps of the question and answer knowledge base construction method according to any one of claims 1 to 7 are implemented.

10. A storage medium, characterized in that: The storage medium stores a question-and-answer knowledge base construction program, which, when executed by a processor, implements the steps of the question-and-answer knowledge base construction method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Question and answer pair data set generation method and device and question and answer model

    CN120596646A