CN118113831A - Question-answer data processing method and device, electronic equipment and storage medium - Google Patents

Question-answer data processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN118113831A
CN118113831A CN202410166076.5A CN202410166076A CN118113831A CN 118113831 A CN118113831 A CN 118113831A CN 202410166076 A CN202410166076 A CN 202410166076A CN 118113831 A CN118113831 A CN 118113831A
Authority
CN
China
Prior art keywords
intention
question
text
target
query
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410166076.5A
Other languages
Chinese (zh)
Inventor
齐天雨
贺宇
李明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xingtong Technology Co ltd
Original Assignee
Shenzhen Xingtong Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Xingtong Technology Co ltd filed Critical Shenzhen Xingtong Technology Co ltd
Priority to CN202410166076.5A priority Critical patent/CN118113831A/en
Publication of CN118113831A publication Critical patent/CN118113831A/en
Pending legal-status Critical Current

Links

Landscapes

  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a method, a device, an electronic device and a storage medium for processing question-answer data, wherein the method comprises the following steps: acquiring a question text of a query question; inputting the problem text into a pre-trained intention recognition model for intention recognition, and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter; invoking the target intent tool based on the target identification; inputting the target query parameters into the target intention tool to query, and obtaining a response text corresponding to the query problem; and feeding back the response text to the user. The scheme realizes that the question and answer are completed by combining the figure recognition model and the intention tool, and the answer corresponding to the question is obtained by inquiring by calling the corresponding intention tool, so that the accuracy of the answer is ensured, and the question with higher real-time requirement can be timely and accurately responded.

Description

Question-answer data processing method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of artificial intelligence, and in particular relates to a method and a device for processing question-answer data, electronic equipment and a storage medium.
Background
Along with the improvement of computer computing power and the development of deep learning technology, the parameter quantity of the model is larger and larger, the capability is also gradually improved, a large model represented by ChatGPT brings natural language processing into a new era, and a ChatGPT model answers the questions of a user in a dialogue form and gives solutions and answers to the questions.
However, the question-answering scheme implemented by the large language model cannot mobilize the existing query tool, is limited by the huge parameter number of the large language model, and cannot be updated in real time, so that the large language model cannot accurately answer the problem with high real-time requirement.
Disclosure of Invention
In order to solve the above technical problems or at least partially solve the above technical problems, embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a storage medium for processing question-answer data.
According to an aspect of the present disclosure, there is provided a method for processing question-answer data, including:
acquiring a question text of a query question;
Inputting the problem text into a pre-trained intention recognition model for intention recognition, and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter;
Invoking the target intent tool based on the target identification;
inputting the target query parameters into the target intention tool to query, and obtaining a response text corresponding to the query problem;
And feeding back the response text to the user.
According to another aspect of the present disclosure, there is provided a processing apparatus for question-answer data, including:
The first acquisition module is used for acquiring a question text of a query question;
The second acquisition module is used for inputting the problem text into a pre-trained intention recognition model to perform intention recognition and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter;
a tool calling module for calling the target intention tool based on the target identification;
the query module is used for inputting the target query parameters into the target intention tool to query and obtaining a response text corresponding to the query problem;
And the feedback module is used for feeding the response text back to the user.
According to another aspect of the present disclosure, there is provided an electronic device including:
A processor; and
A memory in which a program is stored,
Wherein the program comprises instructions which, when executed by the processor, cause the processor to perform a method of processing question-answer data according to the preceding aspect.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the method of processing question-answer data according to the foregoing aspect.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the method for processing question-answer data according to the previous aspect.
According to one or more technical schemes provided by the embodiment of the disclosure, through acquiring a question text of a query question, inputting the question text into a pre-trained intention recognition model for intention recognition, and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter, calling the target intention tool based on the target identifier, inputting the target query parameter into the target intention tool for query, acquiring a response text corresponding to the query question, and feeding back the response text to a user. By adopting the scheme, the question and answer is completed by combining the figure recognition model and the intention tool, and the answer corresponding to the question is obtained by inquiring by calling the corresponding intention tool, so that the accuracy of the answer is ensured, and the timely and accurate response of the question with higher real-time requirement can be ensured.
Drawings
Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments, with reference to the following drawings, wherein:
FIG. 1 illustrates a flowchart of a method of processing question-answer data according to an exemplary embodiment of the present disclosure;
FIG. 2 illustrates a flowchart of a method of processing question-answer data according to another exemplary embodiment of the present disclosure;
FIG. 3 illustrates a schematic diagram of an intent recognition model training process in accordance with an exemplary embodiment of the present disclosure;
FIG. 4 illustrates a schematic diagram of an intent recognition model training process in accordance with another exemplary embodiment of the present disclosure;
FIG. 5 shows a schematic block diagram of a processing apparatus for question-answer data according to an exemplary embodiment of the present disclosure;
fig. 6 illustrates a block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below. It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Open field question-answering systems are an important task in Natural Language Processing (NLP) aimed at answering questions in natural language based on large-scale unstructured documents. From the initial Turing test to the latest generated large model, the model is interacted in a dialogue mode, so that an open-domain question-answering system is one of the core and main tasks of the natural language processing field.
The conventional question-answering system generally analyzes the questions of the user based on a knowledge graph and search, finds the most matched answer or document material with the questions through rules, splices the questions through the rules or models, gives the answers, and recognizes the intention of the user through a classification model for the question-answering system of the downstream task, so that the structure of the processing module for distributing the questions of the user to the professional field is more common. However, the design mode and architecture still have a plurality of problems and defects, because the meaning of natural language is more, the grammar structure is flexible and changeable, and the meaning is also influenced by the dialogue context, so that the answer obtained by only analyzing the problem of the user is often not the perfect answer, and the returned answer is not matched with the true intention of the user, and the accuracy is poor.
With the improvement of computer computing power and the development of deep learning technology, the parameter quantity of a model is larger and the capability is gradually improved, a large model represented by ChatGPT brings the natural language processing field into a new era, a ChatGPT model answers the problems of users in a dialogue form and gives self solutions and answers, the principle behind the solution is supported by huge pre-training corpus and computing power, and the model can be considered to learn almost all text data on the Internet and memorize internal links in the text data, so that the model can find similar problems and solutions corresponding to any problems. The success of ChatGPT large models in the dialog field has given new insight into the capabilities of artificial intelligence, and has also demonstrated that the limits of the question-answering capability and other various capabilities of the model have not yet been reached. However, the large language model is limited by the huge number of parameters, and cannot be updated in real time, so that the large language model cannot give accurate answers for the intention requirement of inquiring weather and the like with high real-time requirements.
Although the two methods described above are currently very powerful, the following drawbacks still exist:
1. The traditional knowledge-graph-based question-answering method can not link the contexts and is not applicable to multi-round dialogue scenes;
2. the traditional knowledge-graph-based question-answering method cannot answer the condition of the inquiry, and the extraction of the slot position cannot depend on historical answer information;
3. large model approaches do not mobilize existing query tools, such as weather query tools;
4. the accuracy of traditional question-answering methods and the language understanding capabilities of large models are not currently combined.
Aiming at the problems, the method for processing question and answer data is provided, the intention of a question text is identified by introducing a pre-trained intention identification model, and a corresponding intention tool is called based on the identification result of the model to acquire an answer corresponding to the problem, so that the natural language understanding capability of a large language model is combined with a query tool to realize man-machine interaction, and the answer corresponding to the problem is acquired by calling the corresponding intention tool to query, the accuracy of the answer is ensured, and the problem with higher real-time requirement can be ensured to acquire timely and accurate response. The scheme of the present disclosure mainly solves the following problems:
(1) Aiming at rule judgment of the traditional question-answering method, the scheme improves the defect of inflexibility of rules, and introduces a model with stronger natural language understanding capability to carry out intention recognition so as to improve accuracy of recognition results. Compared with the method based on the rule, the method based on the model for intention recognition can be more flexible, the strong learning ability of the model ensures that the standard questioning mode can be extracted accurately for the situation that the rule can be extracted, and the strong generalization ability of the model also provides strong guarantee for the extraction of the slot positions for the situation that the rule cannot be extracted;
(2) Aiming at the scene that the traditional question-answering method cannot process the inquiry and multi-round dialogue, the scheme extracts the slot information under the multi-round dialogue through the natural language understanding capability of the model so as to ensure the accuracy of intention recognition. For the context associated questions of the multi-round dialogue and the ability of analyzing answers, the text understanding ability of the final model is ensured through the strong ability of the base model and partial data in the fine tuning data, so that the model can integrate the historical dialogue information and the current questions to obtain complete question information;
(3) Aiming at the problem of calculation power consumption of a large model, the scheme introduces an intention recognition and classification model with lower calculation power consumption, and can be finely adjusted only by a small amount of data, thereby saving resources. For the problems of huge model parameters and high training cost like ChatGPT, the size of the base model adopted in the scheme is smaller than that of a main stream dialogue large model, meanwhile, the requirement on data quantity is not high in the scheme, and only training data with very small magnitude is needed for fine adjustment and use, so that the problem of huge calculation power consumption of the main stream large model is solved.
The following describes a method, an apparatus, an electronic device, and a storage medium for processing question-answer data provided by the present disclosure with reference to the accompanying drawings.
Fig. 1 illustrates a flowchart of a method of processing question-answer data according to an exemplary embodiment of the present disclosure, which may be performed by a question-answer data processing apparatus, wherein the apparatus may be implemented in software and/or hardware, and may be generally integrated in an electronic device, which may be a question-answer robot, a device integrated with a question-answer system, or the like.
As shown in fig. 1, the method for processing question-answer data may include the steps of:
step 101, obtaining a question text of a query question.
The query questions are questions input by a user, and the user can input the query questions in a text input mode, a voice input mode and the like. For example, the user may ask "what is the weather in beijing tomorrow? And the voice message input by the user is the inquiry problem.
In the embodiment of the disclosure, for a query question input by a user, the electronic device may determine a corresponding question text based on the query question. For example, if the user enters a query question in text form, the electronic device may take the received text information as question text; if the user inputs the query question in the form of voice, the electronic device may perform voice recognition on the received voice message, and use the voice recognition result as the question text.
Step 102, inputting the problem text into a pre-trained intention recognition model to perform intention recognition, and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter.
The intention recognition model is obtained through pre-training, a large language model can be trained by utilizing a pre-prepared training sample, a trained intention recognition model is obtained, a question text is input into the trained intention recognition model, the model can output an intention tool required to be called for answering a question expressed by the question text, and query parameters required by the intention tool for answer query can be obtained from the input question text, and can also be obtained through context understanding by combining the question text and the previous questions. The intention tool can be a weather query tool, an encyclopedia tool, a poetry query tool, an arithmetic calculation tool, a translation tool and other query tools. It can be understood that the intention tool which can be called by the electronic equipment can be selected and set according to the actual question-answer requirements, and further training data are obtained according to the intention tool which can be called by the electronic equipment to obtain an intention recognition model.
It should be noted that, the training process of the intent recognition model will be described in detail in the following embodiments, which are not described herein.
In the embodiment of the disclosure, for the obtained question text, the obtained question text may be input into a trained intent recognition model, the intent recognition model performs intent recognition on the question text, and a target intent text is output, where the target intent text includes a target identifier corresponding to a target intent tool and a target query parameter. The identification of the intention tool is used for uniquely representing the corresponding intention tool, the intention tool and the identification are in one-to-one correspondence, the identification can be the name of the intention tool, or a symbol or a number which can uniquely represent the intention tool, such as a preset number, and the like. The target query parameters are used for answer query by the target intention tool, and the target query parameters can be in the form of slot information extracted through slot extraction or a complete query statement. For example, for the entered question text "what is the weather in beijing tomorrow? "how can the question text be" Beijing tomorrow? The 'directly serves as the query parameter' and the extracted slot information 'Beijing', 'tomorrow' can also serve as the query parameter.
Thus, the electronic device can obtain the target intention text output by the intention recognition model.
Step 103, calling the target intention tool based on the target identification.
In the embodiment of the disclosure, after the electronic device acquires the target intention text, the electronic device may identify the target identifier carried in the text based on the target intention, and call the corresponding target intention tool. Because the identity of the intention tool and the intention tool are in one-to-one correspondence, the target intention tool can be uniquely determined according to the target identity and called.
And 104, inputting the target query parameters into the target intention tool to query, and obtaining a response text corresponding to the query problem.
In the embodiment of the disclosure, the electronic device may input the target query parameter carried in the target intention text into the currently invoked target intention tool, and the target intention tool performs answer query according to the target query parameter, and returns a response text to the electronic device, where the response text is the answer corresponding to the query question input by the user.
And step 105, feeding back the response text to the user.
In the embodiment of the disclosure, after the electronic device obtains the response text corresponding to the query problem from the target intention tool, the response text can be fed back to the user.
For example, if the user enters the query questions in text form, the electronic device may feedback the response text to the user in text form; if the user inputs the inquiry problem in a voice mode, the electronic equipment can convert the response text into a voice message, and then the response text is fed back to the user in a mode of playing the voice message, so that voice interaction between human and machine is realized.
According to the question and answer data processing method, through obtaining the question text of the query question, inputting the question text into a pre-trained intention recognition model to perform intention recognition, and obtaining the target intention text output by the intention recognition model, wherein the target intention text comprises a target mark corresponding to a target intention tool and a target query parameter, calling the target intention tool based on the target mark, inputting the target query parameter into the target intention tool to query, obtaining a response text corresponding to the query question, and feeding the response text back to a user. By adopting the scheme, the question and answer is completed by combining the figure recognition model and the intention tool, and the answer corresponding to the question is obtained by inquiring by calling the corresponding intention tool, so that the accuracy of the answer is ensured, and the timely and accurate response of the question with higher real-time requirement can be ensured.
In an alternative implementation of the present disclosure, as shown in fig. 2, based on the foregoing example, step 102 may include the following sub-steps:
step 201, obtaining an intention category corresponding to the question text.
In the embodiment of the disclosure, after the electronic device acquires the question text, the intention recognition may be performed on the question text to acquire the intention category corresponding to the question text. The intent class may be, for example, an arithmetic computation class, an encyclopedia query class, a translation class, and so on.
It should be noted that, the electronic device may identify the intention category corresponding to the question text by using a currently commonly used intention identification manner, and the disclosure is not limited to a specific identification manner. When determining the intention category, the determination may be performed based on the question text obtained at this time, or may be performed in combination with the question text obtained at this time and the previous question text, which is not limited in this disclosure.
Step 202, determining a slot position corresponding to the intention category and the total number of the slot positions based on the intention category.
The slots corresponding to different intention types can be preset, for example, corresponding slots can be set for weather inquiry intention, including a place slot and a time slot, and corresponding slots can be set for arithmetic calculation intention, including a calculation formula slot.
In the embodiment of the disclosure, after determining the intention category corresponding to the question text, the electronic device may acquire the slot positions corresponding to the intention category, and determine the total number of the corresponding slot positions. For example, for weather query intent, the determined slots include location and time, with a total number of slots of 2.
And 203, extracting slots from the question text based on the slots, and acquiring the number of slots extracted from the question text.
In the embodiment of the disclosure, the electronic device may perform slot extraction on the obtained question text based on the slot corresponding to the identified intention category, and obtain the number of slots extracted from the question text.
For example, assume that the question text obtained is "that is the body of the fluid? "what is the question text obtained last time is" what is the weather in beijing tomorrow? The intention type can be determined to be weather inquiry by combining the two-time problem text, the corresponding slots comprise places and time, the total number is 2, the acquired problem text is extracted based on the places and the time slots, the places and the time slots are extracted from the acquired problem text, the time information cannot be acquired, and the number of the slots extracted from the problem text is 1.
And 204, responding to the situation that the number of the slots is smaller than the total number, acquiring N historical question-answering texts before the question text, wherein N is a preset value and a positive integer.
The value of N may be set according to actual needs, for example, N may be set to 1, 2, etc.
In an embodiment of the present disclosure, the determined historical question-answer text includes a historical question text and a corresponding answer text. For example, a history question and answer text may be "where is the capital of country a? The first part of country a is B).
And 205, inputting the N historical question-answering texts and the question text into the intention recognition model together for intention recognition, wherein the intention recognition model recognizes a current entity from the question text, determines attention scores between the current entity and each of the N historical question-answering texts based on an attention mechanism, determines target historical information from the historical information based on the attention scores, and generates target intention text based on the target historical information and the question text.
The entity may be a word having a practical meaning such as weather, place, etc., and may be a noun or a verb. The history information refers to all words contained in the N history question-answering texts input at the time, including punctuation marks.
In the embodiment of the disclosure, after the number of slots extracted from the question text is obtained, the number of slots may be compared with the total number of slots corresponding to the intention category, if the number of slots is smaller than the total number, it is determined that the question text contains insufficient slots, and other slots need to be extracted by combining with the historical query question. If the number of the slots is not smaller than the total number, determining that all the slots are contained in the question text, and directly inputting the acquired question text into an intention recognition model to perform intention recognition.
The intention recognition model can comprise an attention mechanism, through training, the intention recognition model learns information of different entities, correlation among the entities and other knowledge, for example, the intention recognition model can learn that Beijing is a place and also learns weather is often correlated with the place, so after the intention recognition model is trained, after a question text and a historical question-answer text are input into the intention model, the intention recognition model can determine the correlation degree between the entities in the question text and the historical information based on the attention mechanism, the correlation degree is reflected through the attention score, the higher the attention score is, the higher the correlation degree between the two is indicated, and the contribution degree of the historical information to the current entity is larger. When the intention recognition model carries out intention recognition according to the input N historical question-answering texts and the question text, the current entity is recognized from the question text, attention scores between the current entity and each of the historical information in the N historical question-answering texts are determined based on an attention mechanism, target historical information is determined from the historical information based on each attention score, and then the target intention text is generated based on the target historical information and the question text. The target historical information is the historical information with the highest attention score, and the historical information is indicated to have the largest contribution to current intention recognition.
For example, assume that the historical question-answering text is "where is the capital of country a? The first of the a country is B ", the question text is" how do the weather here? And if yes, the intention recognition model recognizes that the current entity is weather from the question text, calculates attention scores between words in the historical question-answering text and the weather respectively through an attention mechanism, and selects a place B with the highest attention score as target historical information. The intention recognition model can determine weather of which the current intention is to inquire the place B according to the place B and the weather, and generate target intention text according to the place B and the weather, wherein the target intention text is, for example, "the requirement of inquiring the weather, and a weather inquiry tool is required to be called: what is the weather of place B? ".
For another example, the historical question-answering text is still the text described above, and the question text is "C state? And if yes, the intention recognition model recognizes that the current entity is 'C country' from the question text, calculates the attention scores between each word in the history question-answering text and 'C country' respectively through an attention mechanism, and selects 'capital' with the highest attention score as target history information. The intention recognition model can determine where the current intention is to inquire about the capital of the country C according to the country C and the capital, and generate target intention texts according to the country C and the capital, wherein the target intention texts are, for example, "the requirement of inquiring knowledge, and an encyclopedia inquiry tool needs to be called, and the query: where are the chief of country C? ".
According to the method for processing question and answer data, the intention category corresponding to the question text is obtained, the slot position corresponding to the intention category and the total number of the slot positions are determined based on the intention category, then the question text is subjected to slot position extraction based on the slot positions, the number of the slot positions extracted from the question text is obtained, N historical question and answer texts before the question text are obtained in response to the fact that the number of the slot positions is smaller than the total number, and then the N historical question and answer texts and the question text are input into the intention recognition model together to carry out intention recognition, so that when the slot position information contained in the question text is insufficient, the previous historical question and answer texts are input into the intention recognition model together to carry out intention recognition, the intention recognition model can accurately predict the query intention of the question in combination with context, and the accuracy of the intention recognition is improved.
In an alternative embodiment of the present disclosure, the electronic device may further input all the questions text in a round of dialogue into the intention recognition model to perform intention recognition, specifically, for each obtained question text, the electronic device may determine whether the question text is the first question text of the round of dialogue, if so, directly input the question text into the intention recognition model to perform intention recognition, and if not, obtain the start time of the round of dialogue.
For example, a time interval may be preset, and if the time difference between the acquisition times of two adjacent question texts is not smaller than the time interval, it is determined that the two question texts belong to two-round conversations. Therefore, for the question text acquired at this time, it can be judged whether the time difference between the acquisition time of the question text and the acquisition time of the last question text is smaller than the preset time interval, if not, it is judged that the question text acquired at this time is the first question text of the dialog of the present time, and the acquisition time corresponding to the question text can be used as the starting time of the dialog of the present time. If the time difference is not smaller than the preset time interval, judging that the acquired problem text is not the first problem text of the current dialogue, traversing each historical problem text upwards in sequence from the acquired problem text, acquiring the acquisition time corresponding to each historical problem text, comparing the acquisition time of two adjacent historical problem texts, and if the time difference between the acquisition time of the two adjacent historical problem texts acquired by the first comparison is not smaller than the preset time interval, judging that the two historical problem texts belong to two different dialogs, so that the acquisition time corresponding to the problem text with the later acquisition time in the two historical problem texts is used as the starting time of the current dialogue.
Then, the electronic device can acquire the acquisition time of each historical question-answer text and compare the acquisition time with the starting time of the current round of dialogue, and the historical question-answer text with the acquisition time later than the starting time is determined as the target historical question-answer text, and the target historical question-answer text and the acquired question text belong to the same round of dialogue. And the electronic equipment can input the target historical question-answering text and the acquired question text together into an intention recognition model for intention recognition, wherein the intention recognition model recognizes the current entity from the question text, determines the attention score between the current entity and each piece of historical information in the target historical question-answering text based on the attention mechanism, determines the target historical information from the historical information based on the attention score, and generates the target intention text based on the target historical information and the question text.
The intention recognition model can comprise an attention mechanism, through training, the intention recognition model learns information of different entities, correlation among the entities and other knowledge, for example, the intention recognition model can learn that Beijing is a place and also learns weather is often correlated with the place, so after the intention recognition model is trained, after a question text and a historical question-answer text are input into the intention model, the intention recognition model can determine the correlation degree between the entities in the question text and the historical information based on the attention mechanism, the correlation degree is reflected through the attention score, the higher the attention score is, the higher the correlation degree between the two is indicated, and the contribution degree of the historical information to the current entity is larger. When the intention recognition model carries out intention recognition according to the input target historical question-answering text and the question text, the current entity is recognized from the question text, attention scores between the current entity and each piece of historical information in the target historical question-answering text are determined based on an attention mechanism, the target historical information is determined from the historical information based on each attention score, and then the target intention text is generated based on the target historical information and the question text. The target historical information is the historical information with the highest attention score, and the historical information is indicated to have the largest contribution to current intention recognition.
In the embodiment of the disclosure, through determining the target historical question-answering text in the current round of dialogue, the target historical question-answering text and the acquired question text are input into the intention recognition model together to carry out intention recognition, so that the intention recognition is carried out by inputting the acquired question text and the previous historical question text in the current round of dialogue together to carry out intention recognition, the query intention of the current question is accurately predicted by utilizing the context understanding capability of the intention recognition model, and the accuracy of intention recognition is improved.
In an alternative embodiment of the present disclosure, as shown in fig. 3, the intent recognition model may be obtained by training the following steps:
Step 301, obtaining the intention requirement of the question-answering system.
The intention requirement of the question-answering system can be set by a designer according to actual requirements. The intent requirements may include, but are not limited to, arithmetic calculations, weather queries, poetry queries, and the like.
It can be understood that, for general question-answering systems and special question-answering systems, the key points of the general question-answering systems and the special question-answering systems are different, the design of a certain function is more focused mainly in consideration of the client group for which the system is oriented, for example, a life assistant type robot is biased to solve the problems of weather inquiry, encyclopedia inquiry and the like, and the question-answering system for students is focused on the subject problems of Chinese, mathematics and the like. Therefore, in the embodiment of the disclosure, the intention requirement of the question-answering system can be set according to the emphasis point of the question-answering system, so that training data can be constructed according to the intention requirement for model training.
It should be noted that, according to the designer's requirement of the question-answering system, the intention requirement of the personalized customization tool is selected, wherein the division of each intention must be clear and reasonable, and no overlapping situation can occur. For example, calculating intent, a calculator or other related tool needs to be invoked, so the data input by the intent should be in the form of an expression or a question should be in the form of a computational expression.
Step 302, acquiring historical query text from an intention tool corresponding to the intention requirement.
In the embodiment of the disclosure, after the intention requirement of the question-answering system is acquired, the historical query text can be acquired from the intention tool corresponding to the intention requirement.
For example, if the intent requirement is a weather query, and if the corresponding intent tool is a weather query tool, a historical weather query record may be obtained from the weather query tool as a historical query text.
Step 303, constructing a training sample corresponding to the intention requirement based on the historical query text, wherein the training sample comprises a sample question and a sample intention text, and the sample intention text comprises an inference description text, an intention tool identifier and query parameters contained in the sample question.
In the embodiment of the disclosure, for the obtained historical query text, a training sample corresponding to the intention requirement can be constructed based on the historical query text. Wherein the constructed training sample comprises sample questions and sample intention text, the sample intention text comprising inference description text, intention tool identification and query parameters contained in the sample questions.
For example, assuming that a historical query text is "formulate a warming learning plan for a junior three moderate difficulty practice knowledge point," the query text may be used as a sample question, and the sample intent text in a fixed format constructed may be "< throughput >: which is a requirement .<eot>\n<function>:learn_plan<eof>\n<parameters>:<plan_type>set<grade> for creating a learning plan junior three < learn _ difficult > moderate difficulty < source_type > practice knowledge point < eop > \n".
For another example, assuming that an obtained historical query text is "i am missing english of a bus," the query text may be used as a sample question, and the built sample intention text in a fixed format may be "< thick >: zh_to_en. < eot > \n < function >: zh_to_en < eof > \n < parameters >: query > I have missed English < eop > \n of the bus.
Wherein, in the sample intention text, key information is wrapped by special symbols, < thout > is used for indicating the start of the reasoning description text, < eot > \n is used for indicating the end of the reasoning description part; < function > and < eof > \n denote the beginning and end of the intent tool identification portion, with the intent tool representation in the middle; < parameters > and < eop > \n denote the beginning and end of the query parameters section, with the middle being the query parameters contained in the sample question.
In an optional embodiment of the disclosure, when a training sample corresponding to the intention requirement is constructed based on the historical query text, a question method of the question may be generalized by using tools such as similar question retrieval, and a generalization rule may be constructed according to the characteristics of the disagreement graph tool, so that the question may be generalized to obtain more questions, for example, the Chinese meaning of an english word may be asked by a Chinese meaning, what meaning, and other question methods.
In addition, in an alternative embodiment of the present disclosure, for the built training samples, the correctness of the training samples may be further checked, for example, the data in the character string format and the json parsed data may be mutually converted to verify the correctness of the training sample format and the resolvable correctness.
And step 304, training a large language model based on the training sample to obtain the intention recognition model.
The large language model can be any large language model which is open at present.
In the embodiment of the disclosure, after the training sample is obtained, the large language model can be trained based on the training sample, and the intention recognition model is obtained.
It can be understood that the effect of the generated language model is not only influenced by the capability of the model, but also has a great relation with decoding parameters, and the inventor of the scheme finds the decoding parameters with the best performance under the specific task of intention recognition and slot extraction through testing and exploration. Through tests, in the training task, the sample intention text with the fixed format provided by the present disclosure is greatly helpful to the learning of the model, and experiments also find that the format can ensure that the generated result format is stable, so that the generating capability of the slot and the intention is related to the natural language understanding capability of the model, and therefore, in the embodiment of the present disclosure, the decoding mode of beam-search is adopted, the repeated punishment weight parameter is set to be 1.1, and the decoding result effect is the best.
According to the method for processing the question-answering data, through acquiring the intention requirement of the question-answering system and acquiring the historical query text from the intention tool corresponding to the intention requirement, then constructing the training sample corresponding to the intention requirement based on the historical query text, wherein the training sample comprises sample questions and sample intention texts, and the sample intention texts comprise reasoning description texts, intention tool identifications and query parameters contained in the sample questions, further training a large language model based on the training sample to obtain an intention recognition model, therefore, the intention recognition model can be flexibly trained according to the design requirement of the question-answering system, and the flexibility of the method is improved.
In an alternative embodiment of the present disclosure, a step-by-step training strategy may be employed to make the learning path of the large language model simple to difficult, and gradually learn the patterns of the data in the training samples. Thus, as shown in FIG. 4, based on the embodiment shown in FIG. 3, step 304 may include the sub-steps of:
And step 401, performing single-round question-answering training on the large language model based on the training sample to obtain a single-round intention recognition model.
In the embodiment of the disclosure, the training sample constructed based on the historical query text may be single-round dialogue data, and the single-round dialogue data is used for performing single-round question-answer training on the large language model to obtain a single-round intention recognition model.
And step 402, testing the single-round intention recognition model by using test data to obtain the recognition accuracy of the single-round intention recognition model.
Wherein the intent satisfied by the test data is consistent with the intent satisfied by the training sample.
In the embodiment of the disclosure, for the obtained single-round intention recognition model, the single-round intention recognition model can be tested by utilizing test data, so that a test result output by the single-round intention recognition model is obtained, and further, the recognition accuracy of the single-round intention recognition model is obtained based on the test result.
For example, the recognition accuracy may be a ratio of the amount of test data in which the correct test data amount is intended to be recognized to the total amount of test data.
In the embodiment of the present disclosure, after the recognition accuracy of the single-round intent recognition model is obtained, the recognition accuracy may be compared with a preset value, if the recognition accuracy is greater than the preset value, step 403 is executed, and multiple rounds of question-answer training are performed on the basis of the single-round intent recognition model; and if the recognition accuracy is not greater than or equal to the preset value, acquiring a new sample again and training the single-round intention recognition model again until the recognition accuracy of the single-round intention recognition model is greater than the preset value. The main purpose of the single round of question-answer training stage is to verify the integrity and correctness of data, and for each type of intention and slot position, whether the data design and the slot position design are reasonable or not is judged by testing the single round of intention recognition model through test data.
And step 403, in response to the recognition accuracy rate being greater than a preset value, performing multiple rounds of question-answer training on the single-round intention recognition model by using the constructed multiple rounds of question-answer training samples to obtain the intention recognition model.
In the embodiment of the disclosure, when the recognition accuracy of the single-round intention recognition model is greater than a preset value, it can be determined that the effect of the single-round intention recognition model reaches the expected value, and at the moment, the multi-round question-answer training sample can be constructed to perform multi-round question-answer training on the single-round intention recognition model to obtain the intention recognition model.
In an alternative embodiment of the present disclosure, the multiple round of question-answer training samples include a plurality of question texts and sample intention texts determined based on context information of the plurality of question texts, the sample intention texts include inference description texts, intention tool identifications, and query parameters included in the sample questions, and the multiple round of question-answer training samples may be obtained in a manner including at least one of:
(1) And constructing multiple rounds of question-answering training samples based on training samples corresponding to the same intention requirement. For example, based on the single round of question-answer data, multiple rounds of rules may be built based on the intrinsic characteristics of each intention tool and multiple rounds of question-answer data within the same intention tool may be automatically generated, e.g., "what the apple means" as a first question, "what is that phonetic symbol? "as a challenge, the two questions constitute a plurality of question texts in a multi-round question-and-answer training sample, and the corresponding sample intention text can be expressed as" < thoughts >: which is a requirement for querying English words. < eot > \n < function >: english < eof > \n < parameters >: what the phonetic symbols of the < query > application are < eop > \n >.
(2) And constructing multiple rounds of question-answer training samples based on training samples corresponding to the different graph requirements. For example, a training sample corresponding to the weather query intent may be spliced with a training sample corresponding to the encyclopedia query intent to generate a multi-round question-answer training sample.
(3) And randomly splicing the acquired question and answer texts to obtain a plurality of rounds of question and answer training samples. The question and answer text can be randomly acquired, and multiple rounds of question and answer training samples can be obtained by randomly splicing the question and answer text, so that various rounds of data irrelevant to the context can be obtained.
In an alternative embodiment of the present disclosure, after performing multiple rounds of question-answer training on a single round of intention recognition model by using multiple rounds of question-answer training samples to obtain an intention recognition model, the intention recognition model may be tested by using multiple rounds of test data, and when the recognition effect of the intention recognition model is not ideal, a new multiple round of samples are constructed by adding confusable data, open question-answer data, and the like, and the intention recognition model is trained again based on the new multiple rounds of samples until the recognition effect of the intention recognition model reaches the expectation.
And step 404, determining target test data of which the intention is to identify errors from the test data based on the test result of the single-round intention identification model in response to the identification accuracy rate not being greater than the preset value.
In the embodiment of the disclosure, if the recognition accuracy of the single-round intention recognition model is not greater than a preset value, target test data of the intention recognition error may be determined from the test data based on the test result of the single-round intention recognition model.
For example, the recognition intention corresponding to each test data in the test result and the corresponding true intention can be compared, if the recognition intention and the true intention are inconsistent, the test data is judged to be in an intention recognition error, and the test data is determined to be one item of target test data.
Step 405, based on the target intention category corresponding to the target test data, acquiring a new sample corresponding to the target intention category.
In the embodiment of the disclosure, after the target test data is determined, a new sample corresponding to the target intention type may be obtained based on the target intention type corresponding to the target test data. The target intention category corresponding to the target test data is the correct intention corresponding to the target test data, and is not the recognition intention output by the single-round intention recognition model.
For example, a target training sample corresponding to the target intention category may be obtained from the original training sample, and the target training sample may be adjusted and perfected, for example, the format of the sample intention text may be adjusted, the question-about method of the sample problem may be adjusted, and a new sample may be obtained.
For example, a target training sample corresponding to the target intention category may be obtained from the original training sample, and boring, confusing data, open question-answer data, etc. may be added to obtain a new sample.
For example, the historical query text may be re-crawled from the intent tools corresponding to the target intent category to build new samples.
In the embodiment of the disclosure, by constructing a new sample according to the intention type of the target test data of which the intention is to identify errors in the test data, analysis and rule extraction of failure samples in the test data are realized, and the diversity and the number of the data are enhanced.
Step 406, training the single-round intention recognition model based on the new sample.
In the embodiment of the present disclosure, after obtaining a new sample, the single-round intent recognition model may be trained again based on the new sample, and after training, the test step of step 402 is performed on the new single-round intent recognition model, and the subsequent step is performed based on the test result of this time, until the recognition accuracy of the single-round intent recognition model reaches the expected effect.
According to the method for processing the question-answering data, the single-round intention recognition model is obtained through training, and when the recognition accuracy of the single-round intention recognition model is larger than the preset value, multiple rounds of question-answering training are conducted to obtain the intention recognition model, so that the learning path of the model is simplified to be difficult, and the learning effect of the model is improved. The intention recognition and the standardized problem slot extraction capacity of the model are detected by using the test data, and the recognition effect of the model can be ensured by adopting the accuracy as an evaluation standard.
By adopting the scheme disclosed by the invention, the large language model and the query tool can be combined together, so that the effects of both the large language model and the existing query tool are achieved. According to the scheme, the training samples can be obtained according to specific scene requirements to perform model training, for example, a weather searching function is not needed, and the relevant training data can not be obtained. The scheme introduces context intention related information compared with a rule extraction method, improves multi-round dialogue capability, and asks for example' where is the capital of China? "the answer to the model is Beijing, when the user is asking" that U.S. is? "if there is no semantic association of the context, then simply relying on rules to extract the question, the question that is being asked cannot be understood as" where is the capital of the united states? The scheme can be fully understood and extracted aiming at the closer intention and slot position of the context linkage, which is an advantage of the scheme compared with the traditional method. For the existing large model method generated by means of plain text, the scheme considers the information retrieval capability in a finer granularity, and ensures the follow-up answer accuracy of the model, for example, a user asks a question of what is the weather of Beijing today? The method for generating the text cannot give accurate answers at the moment, because weather conditions are changed every day, the large model is limited by huge parameters and cannot be updated in real time, and the method can guarantee the problem with high effectiveness requirements, can be used for processing the problem with high effectiveness, and optimizes the answer strategy generated by the plain text.
In summary, the scheme not only utilizes the context understanding capability of the large language model and the slot extraction capability of the multi-round dialogue, ensures the relevance of the context and the consistency of the semantics, but also can effectively mobilize the existing various query tools such as weather query, encyclopedia module and poetry query, and the like, thereby not only ensuring the accuracy of the rule-based method, but also making up the defects that the traditional method is inflexible and cannot understand the context, and simultaneously ensuring the language understanding capability of the large model to be fully exerted, and also slowing down the phenomenon of model illusion to the greatest extent.
The exemplary embodiment of the disclosure also provides a device for processing the question-answer data. Fig. 5 shows a schematic block diagram of a processing apparatus of question-answer data according to an exemplary embodiment of the present disclosure, and as shown in fig. 5, the processing apparatus 50 of question-answer data includes: a first acquisition module 510, a second acquisition module 520, a tool call module 530, a query module 540, and a feedback module 550.
The first obtaining module 510 is configured to obtain a question text of a query question;
A second obtaining module 520, configured to input the question text into a pre-trained intent recognition model for intent recognition, and obtain a target intent text output by the intent recognition model, where the target intent text includes a target identifier corresponding to a target intent tool and a target query parameter;
A tool invocation module 530 for invoking the target intent tool based on the target identification;
the query module 540 is configured to input the target query parameter into the target intention tool to query, and obtain a response text corresponding to the query problem;
and a feedback module 550, configured to feedback the response text to the user.
Optionally, the second acquisition module 520 is further configured to:
acquiring an intention category corresponding to the question text;
Determining a slot position corresponding to the intention category and the total number of the slot positions based on the intention category;
Performing slot extraction on the problem text based on the slots, and acquiring the number of slots extracted from the problem text;
Responding to the situation that the number of the slots is smaller than the total number, acquiring N historical question-answering texts before the question text, wherein N is a preset value and a positive integer;
And inputting the N historical question-answering texts and the question text into the intention recognition model together for intention recognition, wherein the intention recognition model recognizes a current entity from the question text, determines attention scores between the current entity and each of the N historical question-answering texts based on an attention mechanism, determines target historical information from the historical information based on the attention scores, and generates target intention text based on the target historical information and the question text.
Optionally, the second acquisition module 520 is further configured to:
Responding to the problem text as the first problem text of the non-self-round dialogue, and obtaining the starting time of the self-round dialogue;
Comparing the acquisition time of the historical question-answering text with the starting time, and determining a target historical question-answering text with the acquisition time later than the starting time;
And inputting the target historical question-answering text and the question text into the intention recognition model together for intention recognition, wherein the intention recognition model recognizes a current entity from the question text, determines attention scores between the current entity and each piece of historical information in the target historical question-answering text based on an attention mechanism, determines target historical information from the historical information based on the attention scores, and generates target intention text based on the target historical information and the question text.
Optionally, the processing device 40 of the question-answer data further includes: model training module for:
acquiring the intention requirement of a question-answering system;
acquiring historical query text from an intention tool corresponding to the intention requirement;
constructing a training sample corresponding to the intention requirement based on the historical query text, wherein the training sample comprises a sample question and a sample intention text, and the sample intention text comprises an inference description text, an intention tool identifier and query parameters contained in the sample question;
and training the large language model based on the training sample to obtain the intention recognition model.
Optionally, the model training module is further configured to:
carrying out single-round question-answering training on the large language model based on the training sample to obtain a single-round intention recognition model;
testing the single-round intention recognition model by using test data to obtain the recognition accuracy of the single-round intention recognition model;
And responding to the recognition accuracy rate being larger than a preset value, and performing multi-round question-answer training on the single-round intention recognition model by using the constructed multi-round question-answer training sample to obtain the intention recognition model.
Optionally, the model training module is further configured to:
Determining target test data of which the intention is to identify errors from the test data based on the test result of the single-round intention identification model in response to the identification accuracy rate not being greater than the preset value;
acquiring a new sample corresponding to a target intention category based on the target intention category corresponding to the target test data;
Training the single round intent recognition model based on the new sample.
Optionally, the acquiring manner of the multi-round question and answer training sample includes at least one of the following manners:
Constructing multiple rounds of question-answering training samples based on training samples corresponding to the same intention requirement;
constructing multiple rounds of question-answer training samples based on training samples corresponding to different graph requirements;
Randomly splicing the acquired question-answering texts to obtain a plurality of rounds of question-answering training samples;
Wherein the multi-round question and answer training sample comprises a plurality of question texts and sample intention texts determined based on context information of the plurality of question texts, the sample intention texts comprising inference description texts, intention tool identifications and query parameters contained in the sample questions.
The question-answer data processing device provided by the embodiment of the disclosure can execute any question-answer data processing method applicable to the electronic equipment, and has the corresponding functional modules and beneficial effects of the executing method. Details of the embodiments of the apparatus of the present disclosure that are not described in detail may refer to descriptions of any of the embodiments of the method of the present disclosure.
The exemplary embodiments of the present disclosure also provide an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor. The memory stores a computer program executable by the at least one processor for causing the electronic device to perform a method of processing question-answer data according to embodiments of the present disclosure when executed by the at least one processor.
The exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is for causing the computer to perform a method of processing question-answer data according to the embodiments of the present disclosure.
The exemplary embodiments of the present disclosure also provide a computer program product comprising a computer program, wherein the computer program, when being executed by a processor of a computer, is for causing the computer to perform a method of processing question-answer data according to embodiments of the present disclosure.
Referring to fig. 6, a block diagram of an electronic device 1100 that may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the electronic device 1100 includes a computing unit 1101 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the device 1100 can also be stored. The computing unit 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
A number of components in the electronic device 1100 are connected to the I/O interface 1105, including: an input unit 1106, an output unit 1107, a storage unit 1108, and a communication unit 1109. The input unit 1106 may be any type of device capable of inputting information to the electronic device 1100, and the input unit 1106 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device. The output unit 1107 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, video/audio output terminals, vibrators, and/or printers. Storage unit 1108 may include, but is not limited to, magnetic disks, optical disks. The communication unit 1109 allows the electronic device 1100 to exchange information/data with other devices through computer networks such as the internet and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as bluetooth (TM) devices, wiFi devices, wiMax devices, cellular communication devices, and/or the like.
The computing unit 1101 may be a variety of general purpose and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 1101 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1101 performs the respective methods and processes described above. For example, in some embodiments, the method of processing question-answer data may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 1108. In some embodiments, some or all of the computer programs may be loaded and/or installed onto electronic device 1100 via ROM 1102 and/or communication unit 1109. In some embodiments, the computing unit 1101 may be configured to perform the processing of the question-answer data by any other suitable means (e.g., by means of firmware).
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The terms "machine-readable medium" and "computer-readable medium" as used in this disclosure refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, programmable Logic Devices (PLDs)) for providing machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.

Claims (10)

1. A method for processing question-answer data, wherein the method comprises:
acquiring a question text of a query question;
Inputting the problem text into a pre-trained intention recognition model for intention recognition, and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter;
Invoking the target intent tool based on the target identification;
inputting the target query parameters into the target intention tool to query, and obtaining a response text corresponding to the query problem;
And feeding back the response text to the user.
2. The method of claim 1, wherein the entering the question text into a pre-trained intent recognition model for intent recognition comprises:
acquiring an intention category corresponding to the question text;
Determining a slot position corresponding to the intention category and the total number of the slot positions based on the intention category;
Performing slot extraction on the problem text based on the slots, and acquiring the number of slots extracted from the problem text;
Responding to the situation that the number of the slots is smaller than the total number, acquiring N historical question-answering texts before the question text, wherein N is a preset value and a positive integer;
And inputting the N historical question-answering texts and the question text into the intention recognition model together for intention recognition, wherein the intention recognition model recognizes a current entity from the question text, determines attention scores between the current entity and each of the N historical question-answering texts based on an attention mechanism, determines target historical information from the historical information based on the attention scores, and generates target intention text based on the target historical information and the question text.
3. The method of claim 1, wherein the entering the question text into a pre-trained intent recognition model for intent recognition comprises:
Responding to the problem text as the first problem text of the non-self-round dialogue, and obtaining the starting time of the self-round dialogue;
Comparing the acquisition time of the historical question-answering text with the starting time, and determining a target historical question-answering text with the acquisition time later than the starting time;
And inputting the target historical question-answering text and the question text into the intention recognition model together for intention recognition, wherein the intention recognition model recognizes a current entity from the question text, determines attention scores between the current entity and each piece of historical information in the target historical question-answering text based on an attention mechanism, determines target historical information from the historical information based on the attention scores, and generates target intention text based on the target historical information and the question text.
4. The method of claim 1, wherein the intent recognition model is obtained by training:
acquiring the intention requirement of a question-answering system;
acquiring historical query text from an intention tool corresponding to the intention requirement;
constructing a training sample corresponding to the intention requirement based on the historical query text, wherein the training sample comprises a sample question and a sample intention text, and the sample intention text comprises an inference description text, an intention tool identifier and query parameters contained in the sample question;
and training the large language model based on the training sample to obtain the intention recognition model.
5. The method of claim 4, wherein the training the large language model based on the training samples to obtain the intent recognition model comprises:
carrying out single-round question-answering training on the large language model based on the training sample to obtain a single-round intention recognition model;
testing the single-round intention recognition model by using test data to obtain the recognition accuracy of the single-round intention recognition model;
And responding to the recognition accuracy rate being larger than a preset value, and performing multi-round question-answer training on the single-round intention recognition model by using the constructed multi-round question-answer training sample to obtain the intention recognition model.
6. The method of claim 5, wherein the method further comprises:
Determining target test data of which the intention is to identify errors from the test data based on the test result of the single-round intention identification model in response to the identification accuracy rate not being greater than the preset value;
acquiring a new sample corresponding to a target intention category based on the target intention category corresponding to the target test data;
Training the single round intent recognition model based on the new sample.
7. The method of claim 5, wherein the multiple rounds of question-answering training samples are obtained in at least one of the following ways:
Constructing multiple rounds of question-answering training samples based on training samples corresponding to the same intention requirement;
constructing multiple rounds of question-answer training samples based on training samples corresponding to different graph requirements;
Randomly splicing the acquired question-answering texts to obtain a plurality of rounds of question-answering training samples;
Wherein the multi-round question and answer training sample comprises a plurality of question texts and sample intention texts determined based on context information of the plurality of question texts, the sample intention texts comprising inference description texts, intention tool identifications and query parameters contained in the sample questions.
8. A device for processing question-answer data, wherein the device comprises:
The first acquisition module is used for acquiring a question text of a query question;
The second acquisition module is used for inputting the problem text into a pre-trained intention recognition model to perform intention recognition and acquiring a target intention text output by the intention recognition model, wherein the target intention text comprises a target identifier corresponding to a target intention tool and a target query parameter;
a tool calling module for calling the target intention tool based on the target identification;
the query module is used for inputting the target query parameters into the target intention tool to query and obtaining a response text corresponding to the query problem;
And the feedback module is used for feeding the response text back to the user.
9. An electronic device, comprising:
A processor; and
A memory in which a program is stored,
Wherein the program comprises instructions which, when executed by the processor, cause the processor to perform the method of processing question-answer data according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method of processing question-answer data according to any one of claims 1-7.
CN202410166076.5A 2024-02-05 2024-02-05 Question-answer data processing method and device, electronic equipment and storage medium Pending CN118113831A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410166076.5A CN118113831A (en) 2024-02-05 2024-02-05 Question-answer data processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410166076.5A CN118113831A (en) 2024-02-05 2024-02-05 Question-answer data processing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN118113831A true CN118113831A (en) 2024-05-31

Family

ID=91213027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410166076.5A Pending CN118113831A (en) 2024-02-05 2024-02-05 Question-answer data processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN118113831A (en)

Similar Documents

Publication Publication Date Title
KR20210038449A (en) Question and answer processing, language model training method, device, equipment and storage medium
CN112417102B (en) Voice query method, device, server and readable storage medium
CN111708869B (en) Processing method and device for man-machine conversation
WO2022237253A1 (en) Test case generation method, apparatus and device
CN112527998A (en) Reply recommendation method, reply recommendation device and intelligent device
US20220358292A1 (en) Method and apparatus for recognizing entity, electronic device and storage medium
CN107301164B (en) Semantic analysis method and device for mathematical formula
CN116737908A (en) Knowledge question-answering method, device, equipment and storage medium
CN112685550B (en) Intelligent question-answering method, intelligent question-answering device, intelligent question-answering server and computer readable storage medium
EP4060517A1 (en) System and method for designing artificial intelligence (ai) based hierarchical multi-conversation system
US11907863B2 (en) Natural language enrichment using action explanations
CN111930912A (en) Dialogue management method, system, device and storage medium
CN112905772A (en) Semantic correlation analysis method and device and related products
CN116821290A (en) Multitasking dialogue-oriented large language model training method and interaction method
CN106708950B (en) Data processing method and device for intelligent robot self-learning system
CN111553138A (en) Auxiliary writing method and device for standardizing content structure document
CN117194730B (en) Intention recognition and question answering method and device, electronic equipment and storage medium
CN111046674B (en) Semantic understanding method and device, electronic equipment and storage medium
CN112818096A (en) Dialog generating method and device
CN116842143A (en) Dialog simulation method and device based on artificial intelligence, electronic equipment and medium
CN118113831A (en) Question-answer data processing method and device, electronic equipment and storage medium
CN115114453A (en) Intelligent customer service implementation method and device based on knowledge graph
CN112052320A (en) Information processing method and device and computer readable storage medium
CN113343668B (en) Method and device for solving selected questions, electronic equipment and readable storage medium
CN111460106A (en) Information interaction method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination