Natural language question answering method, system, device and electronic device
By classifying and targeting user problems, using BERT-sotfmax, BERT-BiLSTM-CRF and Seq2Seq models, the problem of time-consuming and inefficient query results in the subject knowledge graph is solved, and the rapid and efficient generation of question-and-answer results is achieved, meeting the multi-angle needs of users.
Patent Information
- Application Number
- CN202210471027.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-28
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2042-04-28
AI Technical Summary
The existing subject knowledge graph contains a large amount of course attribute information and course question information, which makes it time-consuming and inefficient to query the Q&A results.
The preset BERT-sotfmax model is used to classify user questions, the BERT-BiLSTM-CRF model is used to obtain the target entity and candidate relationship, and the question-answer results are generated by the Seq2Seq model of the preset BERT encoder and soft-copy mechanism decoder are used to process the question-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer question-and-answer
It quickly and efficiently provides users with required knowledge points and course exercises, improves the flexibility and reliability of natural language processing, and meets users' multi-angle needs.
Smart Images

Figure CN114896380B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language question answering technology, and in particular to a natural language question answering method, system, device and electronic equipment. Background Art
[0002] With the development of knowledge graph technology and Internet technology, using learning resources and educational resources to sort out subject knowledge frameworks and construct knowledge graphs can help students understand the connections between knowledge points in various courses and quickly and comprehensively grasp the key points of course knowledge. Therefore, intelligent question-answering systems based on subject knowledge graphs have emerged.
[0003] In related technologies, intelligent question-answering systems based on subject knowledge graphs do not require the mastery of complex database query languages. Instead, they interact with knowledge graphs through natural language to query question-answering results that match user questions from subject knowledge graphs, such as querying the key knowledge points and practice questions required by users.
[0004] However, since the existing subject knowledge graph contains a large amount of course attribute information and a large amount of course title information, directly querying the question and answer results from the knowledge graph not only takes a long time, but also has a low efficiency in obtaining the question and answer results. Summary of the Invention
[0005] The present invention provides a natural language question-answering method, system, device and electronic device to solve the defects in the prior art that it is time-consuming and inefficient to obtain question-answering results directly from a subject knowledge graph containing a large amount of course attribute information and a large amount of course title information, thereby achieving the purpose of quickly and efficiently providing users with the required knowledge points, course exercises or chatting and interacting with users.
[0006] The present invention provides a natural language question answering method, comprising:
[0007] Classify user questions and obtain target classification results;
[0008] Based on the target classification result, the user question is processed by knowledge question answering, question question answering, or casual chat dialogue processing to obtain a question answer result of the user question;
[0009] The question and answer results are displayed on the interactive interface.
[0010] According to a natural language question answering method provided by the present invention, classifying user questions to obtain target classification results includes:
[0011] Use the preset BERT-sotfmax model to calculate the target classification probability corresponding to different classification labels of user questions;
[0012] Based on the target classification probability, a target classification result is determined.
[0013] According to a natural language question answering method provided by the present invention, the method performs knowledge question answering processing on the user question based on the target classification result to obtain the question answering result of the user question, including:
[0014] When it is determined that the target classification result indicates that the user question belongs to the knowledge question answering category, a preset BERT-BiLSTM-CRF model is used to obtain a target entity output in the user question with a preset sequence annotation;
[0015] Based on pre-stored subject knowledge graph data, determine the target candidate relationship with the highest semantic similarity to the target entity;
[0016] Generate a target query statement based on the target candidate relationship and the target entity;
[0017] The question and answer results corresponding to the target query statement are retrieved from the subject knowledge graph data.
[0018] According to a natural language question-answering method provided by the present invention, the question-answering processing of the user question based on the target classification result to obtain the question-answering result of the user question includes:
[0019] When it is determined that the target classification result indicates that the user question belongs to the question-answering category, a preset question-answering model is used to generate a user action label text for the user question;
[0020] Based on the user action label text and pre-stored course topic data, obtaining a system action label text corresponding to the user action label text;
[0021] Based on the system action label text, generate a question-and-answer result in natural language form;
[0022] Among them, the user action label includes a first placeholder label for providing a first slot and a second placeholder for inquiring about a second slot, and the preset question-answering model includes a model obtained by training a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder using a question-answering sample dataset.
[0023] According to a natural language question-answering method provided by the present invention, performing a casual conversation process on the user question based on the target classification result to obtain a question-answering result of the user question includes:
[0024] When it is determined that the target classification result indicates that the user question belongs to the chat dialogue category, a preset Seq2Seq model is used to generate a question-and-answer result that matches the user question;
[0025] Among them, the preset Seq2Seq model is used to predict the corresponding question and answer results after learning the user questions using the trained recurrent neural network and attention mechanism.
[0026] According to a natural language question answering method provided by the present invention, the training process of the preset BERT-sotfmax model includes:
[0027] Obtaining a classification sample data set and classification labels, wherein the classification sample data set includes knowledge question sample data, topic question sample data, and chat sentence sample data, and the classification labels include knowledge question and answer, topic question and answer, and chat dialogue;
[0028] Selecting the classification labels corresponding to the classification sample data set to form a positive sample set, and randomly selecting the classification labels for the classification sample data set to form a negative sample set;
[0029] The positive sample set and the negative sample set are used to train a BERT model containing a bidirectional Transformer encoder and a softmax encoder to obtain a preset BERT-sotfmax model.
[0030] According to a natural language question answering method provided by the present invention, the training process of the preset BERT-BiLSTM-CRF model includes:
[0031] Acquire knowledge question sample data, where the knowledge question sample data has been preprocessed and carries entity labels;
[0032] The initial BERT-BiLSTM-CRF model is trained using the knowledge question sample data to obtain a preset BERT-BiLSTM-CRF model.
[0033] According to a natural language question answering method provided by the present invention, the training process of the preset question answering model includes:
[0034] Determine a question-answering dialogue mode, and construct a question-answering dialogue template based on the question-answering dialogue mode;
[0035] Based on the question-and-answer dialogue template, a question-and-answer sample set is generated, wherein each question-and-answer sample in the question-and-answer sample set includes a first sample placeholder label providing a first sample slot, a second sample placeholder querying a second sample slot, and a system sample placeholder corresponding to the second sample placeholder;
[0036] Using the question-answering sample set, a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder is trained to obtain a preset question-answering model.
[0037] According to a natural language question answering method provided by the present invention, the training process of the preset Seq2Seq model includes:
[0038] Acquire a chat conversation sample data set, where the chat conversation sample data set includes conversation sample data collected by the interface and a conversation sample set actually collected;
[0039] The chat conversation sample dataset is used to train a Seq2Seq model containing a recurrent neural network and an attention mechanism to obtain a preset Seq2Seq model.
[0040] According to a natural language question-answering method provided by the present invention, after displaying the question-answering result on the interactive interface, the method further includes:
[0041] In response to the information that the requirements are not met in the feedback of the question and answer results, the user is instructed to interact with the teaching assistant.
[0042] The present invention also provides a natural language question-answering system, comprising:
[0043] A webpage interaction module is used to receive user questions on the interactive interface;
[0044] The dialogue management module is used to classify the user questions, obtain target classification results, and based on the target classification results, perform knowledge question and answer processing, question question and answer processing or chat dialogue processing on the user questions to obtain the question and answer results of the user questions, and then display the question and answer results on the interactive interface.
[0045] The present invention also provides a natural language question-answering device, comprising:
[0046] Classification unit, used to classify user questions and obtain target classification results;
[0047] A processing unit, configured to perform knowledge question-answering processing, question-answering processing, or casual conversation processing on the user question based on the target classification result, to obtain a question-answering result for the user question;
[0048] The display unit is used to display the question and answer results on an interactive interface.
[0049] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the natural language question-answering method described above is implemented.
[0050] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the natural language question-answering methods described above.
[0051] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements any of the above-described natural language question-answering methods.
[0052] The present invention provides a natural language question-answering method, system, device, and electronic device, wherein the natural language question-answering method first classifies user questions to obtain target classification results, and then, based on the target classification results, performs knowledge question-answering processing, question question-answering processing, or chat dialogue processing on the user questions to obtain the question-answering results of the user questions, and displays the question-answering results on the interactive interface. In this way, targeted processing based on the target classification results of user questions solves the defects of the related art in that it is time-consuming and inefficient to directly query question-answering results from a subject knowledge graph containing a large amount of course attribute information and a large amount of course title information, and achieves the purpose of quickly and efficiently providing users with the required knowledge points, course exercises, or chatting and interacting with users, meeting the multi-angle needs of users, thereby effectively improving the flexibility and reliability of processing natural language. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the technical solutions in the present invention or the prior art, a brief introduction is given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0054] Figure 1 This is one of the flow charts of the natural language question answering method provided by the present invention;
[0055] Figure 2 Schematic diagram of the processing flow of the preset BERT-sotfmax model provided by the present invention;
[0056] Figure 3 This is a schematic diagram of the processing flow of the preset BERT-BiLSTM-CRF model provided by the present invention;
[0057] Figure 4 It is a schematic diagram of the processing flow of the preset question-answering model provided by the present invention;
[0058] Figure 5 A schematic diagram of the structure of the natural language question answering system provided by the present invention;
[0059] Figure 6 Schematic diagram of the structure of the natural language question-answering device provided by the present invention;
[0060] Figure 7 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0061] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.
[0062] With the development of knowledge graph technology and internet technology, utilizing learning and educational resources, organizing subject knowledge frameworks, and constructing knowledge graphs can help students understand the connections between knowledge points across courses and quickly and comprehensively grasp the key points of course knowledge. Therefore, intelligent question-answering systems based on subject knowledge graphs have emerged. They are a special way to retrieve information from subject knowledge graphs, eliminating the need to master complex database query languages and allowing interaction with knowledge graphs through natural language.
[0063] While existing intelligent question-answering methods based on subject knowledge graphs can be categorized into three main categories: semantic parsing-based, information retrieval-based, and deep learning-based methods, current subject knowledge graphs not only include a wealth of course attribute information, such as instructors, online course learning website resources, chapters to which knowledge points belong, and detailed descriptions, but also include a wealth of course question information, such as example questions, exercises, midterm and final exam questions, and postgraduate entrance exam questions. Consequently, conversations within subject-based educational scenarios encompass a wide range of topics, encompassing tasks like knowledge point queries and question recommendations. They can also involve casual conversations without specific objectives, allowing for free switching between multiple tasks and frequent information sharing across multiple questions. Therefore, within the context of subject knowledge graphs, capturing user intent, parsing questions, obtaining correct answers, and achieving high-quality multi-round question answering remain significant challenges and promising prospects.
[0064] Based on this, the present invention provides a natural language question answering method, system, device and electronic device. Figure 1-Figure 7 The present invention describes a natural language question-answering method, system, device, and electronic device. The natural language question-answering method may be performed by a natural language question-answering system, which may be an intelligent robot and have at least data processing, data storage, model training, information transmission and reception, and information display functions. The present invention does not limit the specific form of the natural language question-answering system.
[0065] In the present invention, when the execution subject of the natural language question answering method is a natural language question answering system, it can refer to the following Figure 1 The flowchart of the natural language question answering method is as follows: Figure 1 As shown, the natural language question answering method includes the following steps:
[0066] Step 110: Classify the user questions to obtain target classification results.
[0067] The user question can be text information input by the user on the interactive interface of the natural language question-answering system, or can be text information displayed on the interactive interface after parsing the user's voice. This is not specifically limited here.
[0068] Specifically, the natural language question-answering system can first classify a user question to determine whether it falls into the knowledge question-answering, problem question-answering, or casual conversation category, thereby obtaining a target classification result. In other words, the target classification result indicates whether the user question falls into one of the following categories: knowledge question-answering, problem question-answering, or casual conversation.
[0069] Step 120: Based on the target classification result, the user question is processed into a knowledge question and answer process, a question and answer process, or a chat dialogue process to obtain a question and answer result of the user question.
[0070] Specifically, the natural language question-answering system processes user questions in a targeted manner based on the target classification results. That is, when the target classification result indicates that the user question belongs to the knowledge question-answering category, the user question can be processed for knowledge question-answering; when the target classification result indicates that the user question belongs to the question-answering category, the user question can be processed for question-answering; when the target classification result indicates that the user question belongs to the chat conversation category, the user question can be processed for chat conversation; thereby obtaining the question-answering results of the user question. For example, when the user question is "Introduce Fourier transform", the question-answering results may include an explanation of the principle of Fourier transform; when the user question is "Recommend a multiple-choice question on narrowband filters", the question-answering results may include the multiple-choice question number of narrowband filters; when the user question is "The final exam is coming soon", the question-answering results may include "Study hard".
[0071] Step 130: Display the question and answer results on the interactive interface.
[0072] Specifically, when the natural language question and answer system obtains the question and answer results of the user's questions after targeted processing, the question and answer results can be displayed on the interactive interface for the user to view. The display method of the question and answer results on the interactive interface may include but is not limited to scrolling display, sliding display, etc.
[0073] The natural language question-answering method provided by the present invention first classifies user questions to obtain target classification results, and then, based on the target classification results, performs knowledge question-answering processing, question-answering processing, or chat dialogue processing on the user questions to obtain the question-answering results of the user questions, and displays the question-answering results on the interactive interface. In this way, targeted processing based on the target classification results of user questions is carried out, which solves the defects of the related art in that it is time-consuming and inefficient to directly query question-answering results from a subject knowledge graph containing a large amount of course attribute information and a large amount of course title information. It achieves the purpose of quickly and efficiently providing users with the required knowledge points, course exercises, or chatting and interacting with users, meeting the multi-angle needs of users, thereby effectively improving the flexibility and reliability of natural language processing.
[0074] Optionally, the implementation process of step 110 may include:
[0075] First, the preset BERT-sotfmax model is used to calculate the target classification probabilities corresponding to different classification labels of user questions; then, based on the target classification probabilities, the target classification results are determined.
[0076] Specifically, such as Figure 2 As shown in the figure, the user question is converted into N different participles and represented as [Tok1]~[TokN], the classification label is converted into M different participles and represented as [Tok1]~[TokM], and the starting character [CLS] added at the beginning of the sentence and the special character [SEP] added between N different participles and M different participles to indicate separation are determined. Then, [CLS], [Tok1]~[TokN], [SEP] and [Tok1]~[TokM] are input into the preset BERT-sotfmax model. After the expected calculation and multi-layer bidirectional Transformer encoding processing are performed by the trained BERT model, the target classification vector C of the user question as the classification label is output, and the target classification vector C is input into the trained softmax encoder for target classification probability calculation. That is, the trained softmax encoder combines the target classification vector C and formula (1) to calculate the target classification probability P of the user question as the classification label. When the classification labels include knowledge Q&A, task Q&A, and casual conversation, the number of target classification probabilities calculated is three. The larger the target classification probability P, the higher the likelihood that the user's question corresponds to the corresponding classification label. This process can also be considered as identifying the user's hidden intent based on the user's question, that is, determining whether the user wants to "knowledge Q&A," "task Q&A," or "casual conversation" based on the user's hidden intent.
[0077] P=softmax(W*C+b) (1)
[0078] Among them, softmax is the classification operation function of the softmax encoder, W and b are different parameters in the preset BERT-sotfmax model.
[0079] Based on this, when the classification labels include knowledge Q&A, question Q&A, and casual conversation, the "knowledge Q&A" classification label and the user question can be input into the preset BERT-sotfmax model to calculate the target classification probability that the user question is "knowledge Q&A"; the "question Q&A" classification label and the user question can be input into the preset BERT-sotfmax model to calculate the target classification probability that the user question is "question Q&A"; and the "casual conversation" classification label and the user question can be input into the preset BERT-sotfmax model to calculate the target classification probability that the user question is "casual conversation". Then, based on the maximum probability among the three target classification probabilities, the target classification result is determined. The classification label corresponding to the maximum probability among the three target classification probabilities is the target classification result. For example, the user question "Introduce the Fourier transform" is likely to be classified into the knowledge Q&A category, while the user question "Recommend a Fourier transform question" is likely to be classified into the question Q&A category.
[0080] The natural language question answering method provided by this invention achieves the goal of quickly and efficiently determining the category to which a user question belongs by using a pre-defined BERT-sotfmax model to calculate the corresponding classification probabilities for different classification labels. This allows for subsequent targeted feedback on the user's question and answer results. Furthermore, the classification probabilities calculated by combining BERT technology and sotfmax logistic regression technology are more accurate and reliable, effectively ensuring the accuracy and stability of the target classification results.
[0081] Optionally, in step 120, based on the target classification result, a knowledge question answering process is performed on the user question to obtain a question answering result of the user question, including:
[0082] First, when it is determined that the target classification result represents that the user question belongs to the knowledge question and answer category, the preset BERT-BiLSTM-CRF model is used to obtain the target entity output in the user question with a preset sequence annotation; then, based on the pre-stored subject knowledge graph data, the target candidate relationship with the highest semantic similarity to the target entity is determined; further based on the target candidate relationship and the target entity, a target query statement is generated; finally, the question and answer result corresponding to the target query statement is retrieved from the subject knowledge graph data.
[0083] Specifically, when it is determined that the target classification result indicates that the user question belongs to the knowledge question answering category, in order to avoid noise interference, the user question can be preprocessed to remove other special characters such as "#@¥$&%" contained in the user question, and the preprocessing method may include but is not limited to regular matching. Then, the preprocessed user question and the starting character [CLS] added at the beginning of the sentence are input into the preset BERT-BiLSTM-CRF model, such as Figure 3 As shown in the figure, the preprocessed user question "Introduce the Fourier transform" and [CLS] are input into the preset BERT-BiLSTM-CRF model. The target text feature vector of the user question is first obtained through the trained BERT model, and the target hidden semantic features in the target text feature vector are learned through the trained bidirectional long short-term memory neural network (BiLSTM). Finally, the target hidden semantic features are decoded with the help of the trained conditional random field (CRF) to obtain the target entity of the user question. The target entity is output as a "BIO" sequence annotation, that is, the first character of the target entity is labeled as B, the remaining continuation of the target entity is labeled as I, and the remaining characters of the user question except the labeled target entity are labeled as O. For example, when the preprocessed user question "Introduce the Fourier transform" is processed by the preset BERT-BiLSTM-CRF model, the target entity "Fourier transform" can be obtained as a "BIO" sequence annotation.
[0084] Then, in order to improve the accuracy of the candidate relationships related to the target entity, the target entity can be first subjected to entity disambiguation processing, that is, the target entity is linked to the corresponding entity in the pre-stored subject knowledge graph data through an alias dictionary. For example, "Fourier transform" includes multiple aliases such as "Fourier transform" and "Fourier transform". In this way, multiple candidate relationships related to the target entity are obtained, such as the chapter to which it belongs, the knowledge introduction, and other candidate relationships. Among them, the alias dictionary can include but is not limited to obtaining information through Baidu Encyclopedia, textbook information extraction, and manual collection and annotation, and is not specifically limited here.
[0085] Furthermore, the semantic similarity between the user question and each candidate relationship is calculated, and based on multiple semantic similarities, the target candidate relationship with the highest relevance to the user question is determined, that is, the candidate relationship with the greatest semantic similarity. For example, when the user question is "Introduce Fourier transform", among multiple candidate relationships, the target candidate relationship with the highest semantic similarity probability is calculated to be "Knowledge introduction".
[0086] Finally, based on the target candidate relationship and target entity, a target query statement is generated to retrieve the subject knowledge graph data. The subject knowledge graph data is a neo4j database, and the target query statement can be a knowledge base query statement, that is, a cypher query statement. The question and answer results corresponding to the target query statement are retrieved from the subject knowledge graph data, such as the answer to the user's question.
[0087] The natural language question-answering method provided by the present invention generates a target query statement by using a preset BERT-BiLSTM-CRF model to obtain the target entity's target candidate relationship and target entity in the subject knowledge graph data, and retrieves the question-answer result corresponding to the target query statement from the subject knowledge graph data. This combination of BERT technology, BiLSTM technology, and CRF technology can improve the accuracy of the obtained question-answering results, thereby also improving the efficiency of obtaining the question-answering effect.
[0088] Optionally, in step 120, based on the target classification result, a knowledge question answering process is performed on the user question to obtain a question answering result of the user question, including:
[0089] First, when it is determined that the target classification result represents that the user question belongs to the question and answer category, a preset question and answer model is used to generate a user action label text for the user question; then, based on the user action label text and pre-stored course question data, a system action label text corresponding to the user action label text is obtained; finally, based on the system action label text, a question and answer result in natural language form is generated; wherein, the user action label includes a first placeholder label providing a first slot and a second placeholder asking for a second slot, and the preset question and answer model includes a model obtained by using a question and answer sample data set to train a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder.
[0090] Among them, the user action label text is the text generated using the user action label, and the user action label can include two types: provide (inform) and ask (request). The system action label text is the text generated using the system action label, and the system action label can include inform_value, recommend, and no_offer. inform_value means that the value of the second slot being asked is informed to the user, recommend means feedback of questions that match the user's question, and no_offer means informing the user that no questions that meet the user's question are found. The first slot can include subjects, test points (or knowledge points), question types and difficulty. The second slot can include answers and numbers. The first placeholder label indicates that the first slot has been filled with a string, and the second placeholder label indicates that the second slot has not been filled with a string.
[0091] Specifically, the pre-set question-answering model includes a trained BERT encoder and a trained soft-copy mechanism decoder. When the target classification result indicates that the user question belongs to the question-answering category, the user question is input into the pre-set question-answering model. The trained BERT encoder in the pre-set question-answering model is used to parse the user question into a text representation vector. For example, the trained BERT encoder first understands the user intent based on the user question and parses the text representation vector based on the user intent. The trained soft-copy mechanism decoder is used to generate a user action label text using the information provided or queried in the text representation vector, such as [question + request + difficulty + ?]. Furthermore, based on pre-stored course question data, a system action label text corresponding to the user action label text is determined. Specifically, the system action label text is the response to the second slot in the user action label text. For example, if the user question is "Recommend a simple multiple-choice question about narrowband filters," its user action labels can be [question + information + test point + narrowband filter], [question + information + question type + multiple-choice question], [question + information + difficulty + simple], and [question + request + number + ?]. ], the corresponding system action label is "[question+recommendation+number+123]", and the question-answering result outputted in natural language with this system action label is "OK, here I found the question numbered 123 for you." Because the preset question-answering model is a Seq2Seq model trained with a sample question-answering dataset using a BERT encoder and a soft-copy mechanism decoder, question-answering results with different system action labels can be obtained for different user action labels in user questions. For example, difficulty levels can include but are not limited to easy, medium, and difficult; question types can include but are not limited to multiple-choice, fill-in-the-blank, and true-or-false questions; and test points can include one or more test points.
[0092] It should be noted that if Figure 4 As shown in , if the user question is not the first round of question answering, the second slot can include difficulty, answer and number, and the preset question answering model is a model obtained by training a Seq2Seq model containing a soft-copy mechanism decoder and a BERT sub-model using a question answering sample set constructed using multiple rounds of question answering data. At this time, the preset question answering model can first understand the user intention of this round based on the results of the previous round of question answering, the status of the previous round of question answering and the user questions of this round, and extract the target entity and its target attribute from the user intention of this round, and determine the user action label text of this round. For example, the user question of this round is "How difficult is this question?" and the result of the previous round of question answering is "Okay, here I found the number for you. 123" and the question-and-answer status of the previous round is "[question+recommend+number+123]", the extracted target entity of this round is "question" and its target attribute is "difficulty", and the corresponding user action label text of this round is "[question+recommend+difficulty+?"; further, based on the user intention of this round, the question-and-answer status of the previous round is updated from the two action dimensions of adding constraints and asking slot values to obtain the question-and-answer status of this round. Adding constraints can represent other first slots newly added on the basis of the question-and-answer status of the previous round, and asking slot values can be asking for the values of other newly added first slots. The question-and-answer status of the previous round represents the system action label text of the previous round. For example, when the current round's user question is "How difficult is this question?" and the first slot provided by the previous round's user question is the test point, question type, and number, the added constraint for this round's user question is difficulty, and the query slot value is the difficulty value. The difficulty value is used to characterize whether the corresponding question is easy, medium, or difficult. When the previous round's question-answering status is "[question+recommend+number+123]," the updated question-answering status for this round is "[question+recommend+difficulty+?"]." Finally, based on the current round's question-answering status and the current round's user intent, the current round's system action label text corresponding to the current round's user action label text is determined from the pre-stored course question data. For example, the current round's system action label text can be "[question+inform_value+difficulty+difficulty]," and the current round's question-answering result generated based on the current round's system action label text can be "This question is difficult." For example, when the question-answering process is four rounds, the question-answering process shown in Table 1 can be obtained.
[0093] Table 1
[0094]
[0095]
[0096] The natural language question-answering method provided by the present invention, when processing user questions, obtains a question-answering result that matches the user question by using the user action label and course question data obtained by using a preset question-answering model. Since the user action label includes a first slot that has been filled and a second operation to be filled, and the question-answering result carries a system action label corresponding to the user action label, the question-answering result obtained is a reply to the second slot, thereby improving the pertinence of the question recommendation. In addition, since the preset question-answering model is a model obtained by training the initial language model using a question-answering sample set constructed using multiple rounds of question-answering data, when the obtained user action labels are different, the corresponding question-answering results will also be different, thereby improving the flexibility of the question recommendation model and the richness of the content.
[0097] Optionally, in step 120, based on the target classification result, a chat dialogue is performed on the user question to obtain a question-and-answer result of the user question, including:
[0098] First, when it is determined that the target classification result represents that the user question belongs to the chat dialogue category, a preset Seq2Seq model is used to generate a question and answer result that matches the user question; wherein, the preset Seq2Seq model is used to use the trained recurrent neural network and attention mechanism to learn the user question and then predict the corresponding question and answer result.
[0099] Specifically, when it is determined that the user question belongs to the chat dialogue category, the user question can be input into the preset Seq2Seq model for learning. The preset Seq2Seq model includes a preset encoder and a preset decoder. The preset encoder is a trained encoder and has a recurrent neural network learning function and an attention mechanism function. The preset decoder is a trained decoder and has a recurrent neural network learning function. When the user question enters the preset Seq2Seq model, it is first converted into a hidden layer vector using the trained recurrent neural network and attention mechanism through the preset encoder to obtain a group of hidden layer vectors, and the group of hidden layer vectors is represented as a text vector matrix c, c = q(h0,...,h t ), subscript t is an integer greater than 0, q is a linear transformation, h0,...,h t Represents t+1 different hidden layer vectors, and each hidden layer vector represents the semantic information of the corresponding word in the user question. Then the text vector matrix c is input into the preset decoder. The preset decoder uses a trained recurrent neural network and combines the t-1th decoding state vector s t-1 Decode the text vector matrix c and get the tth decoding state vector. The initial decoding state vector s0 is the starting fixed vector until the decoding output "_EOS" represents the end of the decoding operation. At this time, t+1 different decoding state vectors s0,...,st , and finally for t+1 different decoding state vectors s0,...,s t By performing linear conversion, the question-answering results that match the user's questions can be predicted and output in natural language form.
[0100] The natural language question-answering method provided by the present invention ensures the content richness and response accuracy of the chat dialogue by using a preset Seq2Seq model when processing user questions for casual conversation. In addition, since the preset Seq2Seq model is used to output the corresponding question-answering results after learning user questions using a trained recurrent neural network and attention mechanism, the accuracy and reliability of the obtained question-answering results can be further improved.
[0101] Optionally, the training process of the preset BERT-sotfmax model includes:
[0102] First, a classification sample data set and classification labels are obtained, wherein the classification sample data set includes knowledge question sample data, question question sample data and chat sentence sample data, and the classification labels include knowledge questions and answers, question questions and answers and chat dialogues; then, the classification labels are selected corresponding to the classification sample data set to form a positive sample set, and the classification labels are randomly selected for the classification sample data set to form a negative sample set; finally, the positive sample set and the negative sample set are used to train a BERT model containing a bidirectional Transformer encoder and a softmax encoder to obtain a preset BERT-sotfmax model.
[0103] Specifically, for a classification sample dataset, when positive samples include knowledge question sample data and knowledge questions and answers, question question sample data and question questions and answers, and casual chat sentence sample data and casual chat questions and answers, negative samples include knowledge question sample data and question questions and answers, casual chat questions and answers, question question sample data and knowledge questions and answers, and casual chat sentence sample data and knowledge questions and question questions and answers. In other words, each positive sample corresponds to two negative samples. Based on this, when a classification sample dataset includes a large amount of knowledge question sample data, question question sample data, and casual chat sentence sample data, positive and negative sample sets can be constructed in this manner, with the positive sample set including multiple positive samples and the negative sample set including multiple negative samples.
[0104] Then, based on the positive sample set and the negative sample set, the BERT model containing the bidirectional Transformer encoder and the softmax encoder are trained until the trained BERT model and the softmax encoder can minimize the cross entropy loss function. The training stops, thereby obtaining the preset BERT-sotfmax model corresponding to the time when the training stops.
[0105] The natural language question answering method provided by the present invention determines a preset BERT-sotfmax model for classifying user questions by training a BERT model containing a bidirectional Transformer encoder and a softmax encoder through a positive sample set and a negative sample set consisting of a classification sample data set and classification labels. The combination of Transformer encoding technology, softmax encoding technology and BERT encoding technology can improve the targeted classification, thereby improving the reliability of obtaining question and answer results.
[0106] Optionally, the training process of the preset BERT-BiLSTM-CRF model includes:
[0107] First, knowledge question sample data is obtained, where the knowledge question sample data has been preprocessed and carries entity labels. Second, the initial BERT-BiLSTM-CRF model is trained using the knowledge question sample data to obtain a preset BERT-BiLSTM-CRF model.
[0108] Specifically, when the initial BERT-BiLSTM-CRF model includes an initial BERT sub-model, an initial BiLSTM sub-model, and an initial CRF sub-model, multiple knowledge question sample data are obtained, each knowledge question sample data is preprocessed and carries an entity label, that is, each knowledge question sample data can be denoised by special symbols to remove special characters such as "#@¥$&%", and each knowledge question sample data after denoising carries a corresponding entity label. For example, when the knowledge question sample data after denoising is "Introduce Fourier transform", the entity label it carries is "Fourier transform"; then, with the training objective of maximizing the log-likelihood function or minimizing the negative log-likelihood function, the multiple knowledge question sample data are input into the initial BERT-BiLSTM-CRF model for training, that is, the initial BERT sub-model extracts a text feature vector, the initial BiLSTM sub-model learns the text feature vector output by the initial BERT sub-model, and the initial CRF sub-model decodes the hidden semantic features output by the initial BiLSTM sub-model. The training is stopped when the training result reaches the training target, and the preset BERT-BiLSTM-CRF model corresponding to the training stop is obtained.
[0109] The natural language question answering method provided by the present invention determines the BERT-BiLSTM-CRF model used for knowledge question answering of user questions by training an initial BERT-BiLSTM-CRF model using preprocessed knowledge question sample data carrying entity labels. By combining BERT technology, BiLSTM technology and CRF technology, the accuracy of knowledge question answering processing can be improved, thereby ensuring the reliability of the question answering results.
[0110] Optionally, the training process of the preset question answering model includes:
[0111] First, a question-answering dialogue mode is determined, and a question-answering dialogue template is constructed based on the question-answering dialogue mode; secondly, a question-answering sample set is generated based on the question-answering dialogue template, and each question-answering sample in the question-answering sample set includes a first sample placeholder label providing a first sample slot, a second sample placeholder querying a second sample slot, and a system sample placeholder corresponding to the second sample placeholder; finally, the question-answering sample set is used to train a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder to obtain a preset question-answering model.
[0112] Specifically, for question and answer processing, the question and answer dialogue mode that covers user needs as much as possible is first manually defined, that is, a structured action interaction group. The question and answer dialogue mode can include three modes. Mode 1 is: the user asks questions based on the test points. After the natural language question and answer system recommends the questions, the user successively asks about the difficulty and answers of the recommended questions, and then asks new questions based on the new test points. The natural language question and answer system recommends new questions again; Mode 2 is: the user asks questions based on the question type and difficulty. After the natural language question and answer system recommends questions, the user successively asks about the test points and answers. Then the user indicates that another question is recommended based on the same test points provided, and the natural language question and answer system recommends new questions again; Mode 3 is: after the user provides the test points, the natural language question and answer system indicates that no questions that meet the test points are found, and requests the user to re-specify the test points. After the user provides the new test points, the natural language question and answer system recommends questions.
[0113] Secondly, for each question-and-answer dialogue mode, a question-and-answer dialogue template is constructed accordingly, and then a specific question-and-answer sample set is generated in batches. The question-and-answer dialogue template is a natural language statement that replaces a specific value with a preset placeholder. For example, when the question-and-answer dialogue template is "Recommend a multiple-choice question of [test point]", "[test point]" is a preset placeholder, which can be replaced by different knowledge points such as "Fourier transform" and "filter" to form a question-and-answer sample set containing multiple question-and-answer samples. Each question-and-answer sample includes a first sample placeholder label that provides a first sample slot, a second sample placeholder that inquires about a second sample slot, and a system sample placeholder corresponding to the second sample placeholder. The first sample slot may include a subject, test point (or knowledge point), question type, and difficulty. The second sample slot may include an answer, a number, and a difficulty value, and the difficulty value is used to characterize whether the corresponding question is simple, medium, or difficult. The first sample placeholder label indicates that the first sample slot has been filled with a string, and the second sample placeholder label indicates that the second sample slot has not been filled with a string. The system sample placeholder is the response reply to the corresponding second sample slot.
[0114] Finally, the Seq2Seq model containing the BERT encoder and the soft-copy mechanism decoder is trained using the question-answering sample set until the corresponding preset question-answering model is obtained at the end of training.
[0115] The natural language question and answer method provided by the present invention generates a question and answer sample set through a question and answer dialogue model automatically constructed through a question and answer dialogue mode, and uses the question and answer sample set to determine a preset question and answer model for question and answer processing in a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder. In this way, the reliability of question and answer processing can be ensured by combining the soft-copy mechanism and the BERT encoder, and the preset question and answer model will become more flexible as the content richness and diversity of the question and answer sample set increase, thereby better meeting user needs.
[0116] Optionally, the training process of the preset Seq2Seq model includes:
[0117] First, a chat conversation sample dataset is obtained, where the chat conversation sample dataset includes conversation sample data collected by the interface and a conversation sample set actually collected. Then, the chat conversation sample dataset is used to train a Seq2Seq model containing a recurrent neural network and an attention mechanism to obtain a preset Seq2Seq model.
[0118] Specifically, when a Seq2Seq model with a recurrent neural network and an attention mechanism includes an encoder with an attention mechanism and a recurrent neural network, and a decoder with a recurrent neural network, short text conversation data can be collected from a web interface to obtain interface-collected conversation sample data; short text conversation data can also be collected from the actual use of the natural language question-answering system to obtain an actual collected conversation sample set. The Seq2Seq model with a recurrent neural network and an attention mechanism is then trained using the casual conversation sample dataset until the corresponding preset Seq2Seq model is obtained at the end of training.
[0119] The natural language question-answering method provided by the present invention obtains a preset Seq2Seq model for casual conversation processing by training a Seq2Seq model containing a recurrent neural network and an attention mechanism using conversation sample data collected by an interface and a set of conversation samples actually collected. The combination of the recurrent neural network and the attention mechanism can improve the accuracy of casual conversation processing, thereby effectively improving the accuracy and reliability of the predicted question-answering results.
[0120] Optionally, after step 130, the method further includes:
[0121] In response to the information that the requirements are not met in the feedback of the question and answer results, the user is instructed to interact with the teaching assistant.
[0122] Specifically, when the question-and-answer responses displayed on the natural language question-and-answer system do not meet the user's needs, the user can be instructed to interact with the teaching assistant, such as by instructing the user to click the "artificial teaching assistant" button to enter the artificial teaching assistant mode and obtain the required information by interacting with the teaching assistant. For example, the interaction process between the user and the teaching assistant can be realized by using the method of automated email sending and parsing received emails; wherein, automated email sending can use the built-in smtplib and email packages in Python to instruct the user to log in to the mailbox SMTP server to edit the email content, including information such as the user name and the questions to be asked, thereby generating an email and sending the email to the teaching assistant's mailbox. When the teaching assistant receives the email, he uses the built-in poplib package in Python to log in to the POP3 server to read the email and parse the content, and give a corresponding reply. The reply given can be returned to the interactive interface for display or stored.
[0123] It should be noted that the natural language question-answering system can store subject knowledge graph data, course question data, and question-answering sample sets used to train Seq2Seq models containing BERT encoders and soft-copy mechanism decoders. It can also store historical question-answering data. Historical question-answering data includes each round of user questions and their answer results, so as to facilitate subsequent organization of user questions and analysis of the performance of the natural language question-answering system. Historical question-answering data also includes log information of users using the natural language question-answering system and is stored in a MySQL database.
[0124] The natural language question-answering method provided by the present invention, in response to unsatisfactory question-answering results, instructs the user to enter the manual teaching assistant mode to interact with the teaching assistant to obtain the desired satisfactory results, thereby further improving the functional diversity and flexibility and reliability of the natural language question-answering system.
[0125] Reference Figure 5 , the present invention provides a natural language question answering system, Figure 5 In the natural language question answering system, the system includes:
[0126] A webpage interaction module is used to receive user questions on the interactive interface;
[0127] The dialogue management module is used to classify the user questions, obtain target classification results, and based on the target classification results, perform knowledge question and answer processing, question question and answer processing or chat dialogue processing on the user questions to obtain the question and answer results of the user questions, and then display the question and answer results on the interactive interface.
[0128] Specifically, the natural language question-answering system also includes a human teaching assistant module, which is the entrance for users to enter the dialogue management module. That is, after the user enters the user question in the human teaching assistant module and it is processed by the dialogue management module, the user can read the corresponding question-answer response from the interactive interface of the web interaction module.
[0129] The natural language question answering system also includes a data storage module for storing subject knowledge graph data, course question data, question answering sample sets for training Seq2Seq models containing BERT encoders and soft-copy mechanism decoders, and historical question answering data.
[0130] The specific process of the dialogue management module classifying user questions and performing knowledge question and answer processing, question question and answer processing, or chat dialogue processing on user questions can be compared with the aforementioned method embodiment and will not be repeated here.
[0131] Reference Figure 6 The present invention provides a natural language question-answering device. Figure 6In the natural language question answering device 600, the natural language question answering device 600 includes:
[0132] The classification unit 610 is used to classify the user questions and obtain target classification results;
[0133] A processing unit 620 is configured to perform knowledge question answering, question question answering, or casual conversation processing on the user question based on the target classification result to obtain a question answering result for the user question;
[0134] The display unit 630 is used to display the question and answer results on an interactive interface.
[0135] Optionally, the classification unit 610 can be specifically used to use a preset BERT-sotfmax model to calculate the target classification probabilities corresponding to different classification labels of user questions; and determine the target classification results based on the target classification probabilities.
[0136] Optionally, the processing unit 620 can be specifically used to determine that when the target classification result represents that the user question belongs to the knowledge question and answer category, use the preset BERT-BiLSTM-CRF model to obtain the target entity output in the user question with a preset sequence annotation; based on pre-stored subject knowledge graph data, determine the target candidate relationship with the highest semantic similarity to the target entity; based on the target candidate relationship and the target entity, generate a target query statement; and retrieve the question and answer result corresponding to the target query statement from the subject knowledge graph data.
[0137] Optionally, the processing unit 620 can also be specifically used to determine that when the target classification result represents that the user question belongs to the question and answer category, use a preset question and answer model to generate a user action label text for the user question; based on the user action label text and pre-stored course question data, obtain a system action label text corresponding to the user action label text; based on the system action label text, generate a question and answer result in natural language form; wherein, the user action label includes a first placeholder label providing a first slot and a second placeholder asking for a second slot, and the preset question and answer model includes a model obtained by using a question and answer sample data set to train a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder.
[0138] Optionally, the processing unit 620 can also be specifically used to determine that when the target classification result represents that the user question belongs to a chat dialogue category, use a preset Seq2Seq model to generate a question and answer result that matches the user question; wherein, the preset Seq2Seq model is used to use a trained recurrent neural network and attention mechanism to learn the user question and then predict the corresponding question and answer result.
[0139] Optionally, the device also includes a training unit, which is specifically used to obtain a classification sample data set and classification labels, wherein the classification sample data set includes knowledge question sample data, question question sample data and chat sentence sample data, and the classification labels include knowledge questions and answers, question questions and answers and chat dialogues; the classification labels are selected corresponding to the classification sample data set to form a positive sample set, and the classification labels are randomly selected for the classification sample data set to form a negative sample set; the positive sample set and the negative sample set are used to train the BERT model containing a bidirectional Transformer encoder and a softmax encoder to obtain a preset BERT-sotfmax model.
[0140] Optionally, the training unit can also be used to obtain knowledge question sample data, which is preprocessed and carries entity labels; use the knowledge question sample data to train the initial BERT-BiLSTM-CRF model to obtain a preset BERT-BiLSTM-CRF model.
[0141] Optionally, the training unit can also be used to determine a question-and-answer dialogue mode, and construct a question-and-answer dialogue template based on the question-and-answer dialogue mode; based on the question-and-answer dialogue template, generate a question-and-answer sample set, each question-and-answer sample in the question-and-answer sample set includes a first sample placeholder label providing a first sample slot, a second sample placeholder querying a second sample slot, and a system sample placeholder corresponding to the second sample placeholder; use the question-and-answer sample set to train a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder to obtain a preset question-and-answer model.
[0142] Optionally, the training unit can also be used to obtain a chat conversation sample data set, where the chat conversation sample data set includes conversation sample data collected by the interface and a conversation sample set actually collected; and use the chat conversation sample data set to train a Seq2Seq model containing a recurrent neural network and an attention mechanism to obtain a preset Seq2Seq model.
[0143] Optionally, the processing unit 620 may be further configured to instruct the user to interact with the teaching assistant based on the unmet needs information fed back from the question-and-answer result.
[0144] Figure 7 An example of a physical structure diagram of an electronic device is shown below. Figure 7As shown, the electronic device 700 may include: a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other via the communication bus 740. The processor 710 may call the logic instructions in the memory 730 to execute the natural language question answering method, which includes:
[0145] Classify user questions and obtain target classification results;
[0146] Based on the target classification result, the user question is processed by knowledge question answering, question question answering, or casual chat dialogue processing to obtain a question answer result of the user question;
[0147] The question and answer results are displayed on the interactive interface.
[0148] In addition, the logic instructions in the above-mentioned memory 730 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention 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 a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0149] In another aspect, the present invention further provides a computer program product, comprising a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the natural language question answering method provided by each of the above methods, comprising:
[0150] Classify user questions and obtain target classification results;
[0151] Based on the target classification result, the user question is processed by knowledge question answering, question question answering, or casual chat dialogue processing to obtain a question answer result of the user question;
[0152] The question and answer results are displayed on the interactive interface.
[0153] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the natural language question answering method provided by the above methods, the method comprising:
[0154] Classify user questions and obtain target classification results;
[0155] Based on the target classification result, the user question is processed by knowledge question answering, question question answering, or casual chat dialogue processing to obtain a question answer result of the user question;
[0156] The question and answer results are displayed on the interactive interface.
[0157] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.
[0158] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A natural language question answering method, characterized in that: include: Classify user questions and obtain target classification results; Based on the target classification result, the user question is processed for knowledge question and answer, question and answer, or casual chat dialogue to obtain a question and answer result for the user question, including: when it is determined that the target classification result indicates that the user question belongs to the knowledge question and answer category, the knowledge question and answer process is performed; when it is determined that the target classification result indicates that the user question belongs to the casual chat dialogue category, the casual chat dialogue process is performed; when it is determined that the target classification result indicates that the user question belongs to the question and answer category, the question and answer process is performed; Displaying the question and answer results on an interactive interface; The step of performing question-answering processing on the user question based on the target classification result to obtain the question-answering result of the user question further includes: When it is determined that the target classification result indicates that the user question belongs to the question-answering category, a preset question-answering model is used to generate a user action label text for the user question; Based on the user action label text and pre-stored course topic data, obtaining a system action label text corresponding to the user action label text, wherein the system action label text is a response reply to the second slot in the user action label text; Based on the system action label text, generate a question-and-answer result in natural language form; Among them, the user action label includes a first placeholder label for providing a first slot and a second placeholder for inquiring about a second slot, and the preset question-answering model includes a model obtained by training a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder using a question-answering sample dataset.
2. The natural language question answering method according to claim 1, wherein: The user questions are classified to obtain target classification results, including: Use the preset BERT-sotfmax model to calculate the target classification probability corresponding to different classification labels of user questions; Based on the target classification probability, a target classification result is determined.
3. The natural language question answering method according to claim 1, wherein: The step of performing knowledge question answering on the user question based on the target classification result to obtain a question answering result for the user question further includes: When it is determined that the target classification result indicates that the user question belongs to the knowledge question answering category, a preset BERT-BiLSTM-CRF model is used to obtain a target entity output in the user question with a preset sequence annotation; Based on pre-stored subject knowledge graph data, determine the target candidate relationship with the highest semantic similarity to the target entity; Generate a target query statement based on the target candidate relationship and the target entity; The question and answer results corresponding to the target query statement are retrieved from the subject knowledge graph data.
4. The natural language question answering method according to claim 1, wherein: The step of performing casual conversation processing on the user question based on the target classification result to obtain a question-answer result of the user question further includes: When it is determined that the target classification result indicates that the user question belongs to the chat dialogue category, a preset Seq2Seq model is used to generate a question-and-answer result that matches the user question; Among them, the preset Seq2Seq model is used to predict the corresponding question and answer results after learning the user questions using the trained recurrent neural network and attention mechanism.
5. The natural language question answering method according to claim 2, wherein: The training process of the preset BERT-sotfmax model includes: Obtaining a classification sample data set and classification labels, wherein the classification sample data set includes knowledge question sample data, topic question sample data, and chat sentence sample data, and the classification labels include knowledge question and answer, topic question and answer, and chat dialogue; Selecting the classification labels corresponding to the classification sample data set to form a positive sample set, and randomly selecting the classification labels for the classification sample data set to form a negative sample set; The positive sample set and the negative sample set are used to train a BERT model containing a bidirectional Transformer encoder and a softmax encoder to obtain a preset BERT-sotfmax model.
6. The natural language question answering method according to claim 3, characterized in that: The training process of the preset BERT-BiLSTM-CRF model includes: Acquire knowledge question sample data, where the knowledge question sample data has been preprocessed and carries entity labels; The initial BERT-BiLSTM-CRF model is trained using the knowledge question sample data to obtain a preset BERT-BiLSTM-CRF model.
7. The natural language question answering method according to claim 1, wherein: The training process of the preset question answering model includes: Determine a question-answering dialogue mode, and construct a question-answering dialogue template based on the question-answering dialogue mode; Based on the question-and-answer dialogue template, a question-and-answer sample set is generated, wherein each question-and-answer sample in the question-and-answer sample set includes a first sample placeholder label providing a first sample slot, a second sample placeholder querying a second sample slot, and a system sample placeholder corresponding to the second sample placeholder; Using the question-answering sample set, a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder is trained to obtain a preset question-answering model.
8. The natural language question answering method according to claim 4, characterized in that: The training process of the preset Seq2Seq model includes: Acquire a chat conversation sample data set, where the chat conversation sample data set includes conversation sample data collected by the interface and a conversation sample set actually collected; The chat conversation sample dataset is used to train a Seq2Seq model containing a recurrent neural network and an attention mechanism to obtain a preset Seq2Seq model.
9. The natural language question answering method according to claim 1, wherein: After displaying the question-and-answer result on the interactive interface, the method further includes: In response to the information that the requirements are not met in the feedback of the question and answer results, the user is instructed to interact with the teaching assistant.
10. A natural language question answering system, characterized in that: include: A webpage interaction module is used to receive user questions on the interactive interface; The dialogue management module is used to classify the user questions, obtain target classification results, and perform knowledge question and answer processing, question question and answer processing, or casual chat dialogue processing on the user questions based on the target classification results to obtain the question and answer results of the user questions, including: when it is determined that the target classification result indicates that the user question belongs to the knowledge question and answer category, performing knowledge question and answer processing; when it is determined that the target classification result indicates that the user question belongs to the casual chat dialogue category, performing casual chat dialogue processing; when it is determined that the target classification result indicates that the user question belongs to the question and answer category, performing question question and answer processing; and further used to display the question and answer results on the interactive interface; Wherein, in performing question-and-answer processing on the user question based on the target classification result to obtain the question-and-answer result of the user question, the dialogue management module is also used to: when it is determined that the target classification result indicates that the user question belongs to the question-and-answer category, use a preset question-and-answer model to generate a user action label text for the user question; based on the user action label text and pre-stored course question data, obtain a system action label text corresponding to the user action label text, and the system action label text is a response reply to the second slot in the user action label text; based on the system action label text, generate a question-and-answer result in natural language form; wherein, the user action label includes a first placeholder label for providing a first slot and a second placeholder for asking a second slot, and the preset question-and-answer model includes a model obtained by training a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder using a question-and-answer sample data set.
11. A natural language question-answering device, characterized in that: include: Classification unit, used to classify user questions and obtain target classification results; a processing unit configured to perform knowledge question-answering processing, problem question-answering processing, or casual chat dialogue processing on the user question based on the target classification result to obtain a question-answering result of the user question, including: performing knowledge question-answering processing when it is determined that the target classification result indicates that the user question belongs to the knowledge question-answering category; performing casual chat dialogue processing when it is determined that the target classification result indicates that the user question belongs to the casual chat dialogue category; and performing problem question-answering processing when it is determined that the target classification result indicates that the user question belongs to the problem question-answering category. A display unit, configured to display the question-and-answer results on an interactive interface; Wherein, in performing question-and-answer processing on the user question based on the target classification result to obtain the question-and-answer result of the user question, the processing unit is further used to: when determining that the target classification result indicates that the user question belongs to the question-and-answer category, use a preset question-and-answer model to generate a user action label text for the user question; based on the user action label text and pre-stored course question data, obtain a system action label text corresponding to the user action label text, the system action label text is a response reply to the second slot in the user action label text; based on the system action label text, generate a question-and-answer result in a natural language form; wherein, the user action label includes a first placeholder label providing a first slot and a second placeholder asking for a second slot, and the preset question-and-answer model includes a model obtained by training a Seq2Seq model containing a BERT encoder and a soft-copy mechanism decoder using a question-and-answer sample data set.
12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the natural language question answering method according to any one of claims 1 to 9 is implemented.
13. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the natural language question answering method according to any one of claims 1 to 9 is implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the natural language question answering method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Knowledge graph driving type law intelligent consultation system
CN110765257A
Intelligent robot integrating chat, knowledge and task questions and answers
CN113515613A