CN115658870A - Question-answer model-based reply method and device and electronic equipment - Google Patents

Question-answer model-based reply method and device and electronic equipment Download PDF

Info

Publication number
CN115658870A
CN115658870A CN202211368135.4A CN202211368135A CN115658870A CN 115658870 A CN115658870 A CN 115658870A CN 202211368135 A CN202211368135 A CN 202211368135A CN 115658870 A CN115658870 A CN 115658870A
Authority
CN
China
Prior art keywords
answer
replied
type
statement
description information
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
CN202211368135.4A
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.)
National University of Defense Technology
Original Assignee
National University of Defense Technology
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 National University of Defense Technology filed Critical National University of Defense Technology
Priority to CN202211368135.4A priority Critical patent/CN115658870A/en
Publication of CN115658870A publication Critical patent/CN115658870A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Machine Translation (AREA)

Abstract

The embodiment of the application discloses a reply method based on a question-answer model, which comprises the following steps: acquiring a sentence to be replied, which is input by a user; identifying a target object related to a statement to be replied; searching the description information of the target object from a preset description information base; identifying the type of the sentence to be replied; if the type of the statement to be replied is the answer type, acquiring and outputting reply information corresponding to the statement to be replied according to the target description information. The questions are classified and replied by identifying the types of the sentences to be replied, so that the replying precision is improved, the characteristics do not need to be extracted, the problem of difficulty in characteristic extraction is avoided, the target description information related to the contents to be replied is acquired, and then the replies are acquired according to the target description information, so that the model precision is improved, and the user can answer more satisfactorily and comprehensively.

Description

Question-answer model-based reply method and device and electronic equipment
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a reply method and device based on a question-answering model and electronic equipment.
Background
The question-answering system is an intelligent information search system capable of answering questions posed by a user using accurate and concise natural language. The question-answering system generally searches for a question with the highest similarity to a question input by a user from a question-answering information base stored in advance according to the question input by the user, and outputs an answer corresponding to the question with the highest similarity. However, the question-answering system is limited by the question-answering library, and the questions that can be answered are limited.
The traditional machine learning method trains a question-answering system by extracting semantic features of question sentences as training samples, and the operation related to the traditional extraction of the semantic features comprises the following steps: rule matching, partitioning, or syntactic analysis. However, these operations of extracting features all have various problems: the rule matching relies on a pre-designed rule to identify semantic feature words in the initial question sentence, so that the rule matching is not easy to expand and lacks of universality; the segmentation method is to segment the initial question sentence by analyzing the word organization rules and semantic features of the initial question sentence, but the segmentation precision is not high, so that the obtained semantic feature words are inaccurate; syntactic analysis can be affected by the analysis result, resulting in poor precision of training samples.
In the existing semantic feature extraction method, part of methods are based on rules and have poor applicability, and the diversity of the obtained training samples is poor, and the precision of the obtained training samples is poor due to the lack of precision of the other part of methods, so that the performance of the question-answering system obtained by training is poor, and the output answers are not matched with the questions.
Disclosure of Invention
The embodiment of the application provides a reply method and device based on a question-answering model and electronic equipment, and can solve the problems that the existing question-answering system is poor in performance, and output answers are not matched with input questions.
In a first aspect, an embodiment of the present application provides a reply method based on a question-answer model, where the method includes:
acquiring a sentence to be replied, which is input by a user;
identifying a target object related to the to-be-replied statement;
searching the description information of the target object from a preset description information base to be used as target description information;
identifying the type of the statement to be replied, wherein the type of the statement to be replied is one of the following types: the answer-free type or the answer-provided type refers to a type in which a valid answer cannot be obtained, and the answer-provided type refers to a type in which a valid answer can be obtained;
if the type of the statement to be replied is the answer type, acquiring and outputting reply information corresponding to the statement to be replied according to the target description information.
In an alternative design, further comprising:
if the type of the sentence to be replied is a first answer type, extracting the descriptor of the target object from the sentence to be replied, calculating the probability that the answer of the sentence to be replied is a positive answer and the probability of a negative answer according to the descriptor of the target object and the target description information, and outputting the answer with higher probability;
if the type of the statement to be replied is a second answer type, searching reply information corresponding to the statement to be replied from the target description information, determining the starting position and the ending position of the reply information in the target description information, and outputting a text between the starting position and the ending position as an answer.
In an alternative design, further comprising:
if the type of the statement to be replied is the answer-free type, outputting preset reply information, wherein the preset reply information comprises error report information or default reply information.
In an alternative design, the identifying the type of the to-be-replied statement includes:
integrating the target description information into the sentence to be replied to obtain a text to be recognized;
adding a starting identifier and an ending identifier in the text to be recognized;
acquiring a segment vector, a position vector and a word vector corresponding to the text to be recognized according to the starting identifier and the ending identifier;
adding the segment vector, the position vector and the word vector corresponding to the text to be recognized to obtain an input vector;
and inputting the input vector into a pre-trained question-answer model so as to identify the type of the sentence to be replied.
In an alternative design, the calculating, according to the descriptor of the target object and the target description information, a probability that an answer of the sentence to be replied is a positive answer and a probability that an answer of the sentence to be replied is a negative answer includes:
recording an index vector of a descriptor of the target object in the statement to be replied to obtain a position output vector of the index vector in the statement to be replied;
coding is carried out according to the position output vector and the segment vector, the position vector and the word vector corresponding to the text to be recognized, and a semantic relation score is obtained;
and calculating the probability that the answer of the sentence to be replied is a positive answer and the probability of a negative answer according to the semantic relation score.
In an alternative design, the determining a start position and an end position of the reply message in the target description message includes:
processing a word vector corresponding to each character in the text to be recognized to obtain a hidden vector;
calculating the position of each character in the target description information as the initial position of answer according to the hidden vectorProbability P istart And probability P as answer termination position jend
Calculating P istart *P jend And taking a position i corresponding to the position combination with the maximum calculation result as a starting position and taking a position j as an ending position, wherein i and j respectively represent the position of each word in the target description information, M is the length of the target description information, i, j =1,2, \ 8230 \ 8230;, M is smaller than j.
In an alternative design, the pre-trained question-answer model is trained by:
obtaining a training data set, the training data set comprising: inquiring a judgment data set, reasoning a non-data set and extracting a prediction data set;
dividing the training data set into a training set, a verification set and a test set according to a preset proportion, wherein the training set is used for model fitting, the verification set is used for adjusting the fitting degree, and the test set is used for evaluating a trained question-answer model;
processing the data of the training data set according to a preset rule, and inputting the data into a model to be trained, wherein the model to be trained comprises: the method comprises the steps that a query judgment model to be trained, a reasoning non-model to be trained and an extraction prediction model to be trained are obtained;
and jointly training the model to be trained to obtain the pre-trained question-answer model.
In a second aspect, an embodiment of the present application provides a reply device based on a question-answering model, where the device includes:
the acquisition module is used for acquiring the sentence to be replied, which is input by a user;
the processing module is used for identifying a target object related to the statement to be replied; searching the description information of the target object from a preset description information base to be used as target description information;
the identification module is used for identifying the type of the statement to be replied, and the type of the statement to be replied is one of the following types: the answer-free type refers to a type that no effective answer can be obtained, or the answer-type refers to a type that an effective answer can be obtained;
and the reply module is used for acquiring and outputting reply information corresponding to the statement to be replied according to the target description information if the type of the statement to be replied is the answer type.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory and one or more processors; wherein the memory is configured to store computer program code comprising computer instructions; the computer instructions, when executed by the processor, cause the electronic device to perform some or all of the steps of the method of the first aspect or various possible implementations of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer storage medium, where instructions are stored, and when the instructions are executed on a computer, the instructions cause the computer to perform part or all of the steps of the method in the first aspect or various possible implementations of the first aspect.
The embodiment of the application provides a reply method based on a question-answering model, which comprises the following steps: acquiring a sentence to be replied, which is input by a user; identifying a target object related to the statement to be replied; searching the description information of the target object from a preset description information base to be used as target description information; identifying the type of the statement to be replied, wherein the type of the statement to be replied is one of the following types: the answer-free type or the answer-provided type refers to a type in which a valid answer cannot be obtained, and the answer-provided type refers to a type in which a valid answer can be obtained; if the type of the statement to be replied is the answer type, acquiring and outputting reply information corresponding to the statement to be replied according to the target description information. The questions are classified and replied by identifying the types of the sentences to be replied, so that the replying precision is improved, the characteristics do not need to be extracted, the problem of difficulty in characteristic extraction is avoided, the target description information related to the contents to be replied is acquired, and then the replies are acquired according to the target description information, so that the model precision is improved, and the user can answer more satisfactorily and comprehensively.
Drawings
In order to more clearly explain the technical solution of the present application, the drawings needed to be used in the embodiments are briefly described below, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a flowchart of a reply method based on a question-answer model according to an embodiment of the present application;
fig. 2 is a flowchart of a second question-answering model-based reply method according to an embodiment of the present application;
FIG. 3 is a flow chart of a pre-trained question-answer model training process provided in an embodiment of the present application;
FIG. 4 is a schematic diagram illustrating an exemplary composition of a replying device based on a question-answering model according to an embodiment of the present disclosure;
fig. 5 is an exemplary structural schematic diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions of the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The terminology used in the following embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in the specification of the present application and the appended claims, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that although the terms first, second, etc. may be used in the following embodiments to describe a class of objects, the objects should not be limited to these terms. These terms are only used to distinguish between particular objects of that class of objects. For example, the following embodiments may employ the terms first, second, etc. to describe a type, but the type should not be limited to these terms. These terms are only used to distinguish different types. The following embodiments may adopt the terms first, second, etc. to describe other class objects in the same way, and are not described herein again.
The embodiment of the application provides a question-answer model-based reply method, a question-answer model-based reply device and electronic equipment.
The answer method based on the question-answering model according to the embodiments of the present application is described below in several embodiments.
The method according to the embodiment of the present application is described below by taking a museum scene as an example, and it should be noted that the museum scene is only an exemplary description, and a question-answer model-based reply method according to the embodiment of the present application is not limited.
As shown in fig. 1, fig. 1 illustrates a reply method 100 (hereinafter referred to as method 100) based on a question-answering model, where the method 100 includes the following steps:
step S101, obtaining a sentence to be replied, which is input by a user.
The sentence to be replied input by the user may be a judgment type sentence, or an inquiry type sentence, for example, in a museum scene, the input of the user may be "where a toilet is, which an exhibit of the number 123 is, or" the exhibit of the number 123 and the exhibit of the number 456 are in the same era ", and the sentence to be replied input by the user may also be a sentence of other forms.
And step S102, identifying the target object related to the statement to be replied.
The target object involved in the sentence to be replied is "number 123" for example, the target object involved in the "number 123 exhibit" is "number 123 exhibit" in which dynasty the user inputs, "when the sentence to be replied is" toilet is ", the target object in the sentence to be replied is" toilet ", when the user inputs" number 123 exhibit and number 456 exhibit are the same dynasty, the target object in the sentence to be replied is "number 132 exhibit" and "number 456 exhibit". Of course, the target objects involved in the to-be-replied sentence include, but are not limited to, as described above, and in other scenarios, the target objects may be other individuals.
Step S103, searching the description information of the target object from a preset description information base as the target description information.
The preset description information base includes all description information in the current scene, and taking a museum scene as an example, the preset description information base may include: information of all exhibits of the museum, room information of the exhibition hall, background history information of the museum, and the like, wherein the information of the exhibits may include: exhibit number, age, time of listing, background story, etc. Of course, the description information library preset in the museum scene includes, but is not limited to, the description information library described above, and may also be other description information related to the museum.
After the target object is determined, the target object is searched in the preset description information base according to the target object, for example, the sentence to be replied, which is input by the user, is "which-the-heading exhibit is a cultural relic", where the target object is "the exhibit with the number 123", and then the description information related to "the exhibit with the number 123" is searched in the preset description information base.
Step S104, identifying the type of the statement to be replied, wherein the type of the statement to be replied is one of the following types: the answer-free type refers to a type in which a valid answer is not obtained, or the answer-provided type refers to a type in which a valid answer is obtained.
The to-be-replied statement input by the user may be any type of statement, and therefore, in the target description information, there may be a reply corresponding to the to-be-replied statement, and there may also be no reply corresponding to the to-be-replied statement, and correspondingly, the to-be-replied statement is divided into a no-answer type and an answer type according to whether there is corresponding reply information in the target description information.
Step S105, if the type of the statement to be replied is the answer type, acquiring and outputting reply information corresponding to the statement to be replied according to the target description information.
If the sentence to be replied is of answer type, then the reply information corresponding to the sentence to be replied is determined in the target description information, for example, the sentence to be replied input by the user is "the cultural relic in which the exhibition with number 123 is in which orientation", and the target description information should include all the information related to the "exhibition with number 123", including the information of the year of the exhibition, so that the heading of the "exhibition with number 123" is determined as "the Qing dynasty" and output.
The embodiment of the application provides a reply method based on a question-answer model, which is characterized in that the questions are classified and replied by identifying the types of the sentences to be replied, the reply precision is improved, the characteristics do not need to be extracted, the problem of difficulty in characteristic extraction is avoided, the reply is obtained by obtaining the target description information related to the contents to be replied and then the target description information, the model precision is improved, and the user can answer more satisfactorily and more comprehensively.
In some optional embodiments, further comprising:
if the type of the sentence to be replied is a first answer type, extracting the descriptor of the target object from the sentence to be replied, calculating the probability that the answer of the sentence to be replied is a positive answer and the probability of a negative answer according to the descriptor of the target object and the target description information, and outputting the answer with higher probability;
if the type of the statement to be replied is a second answer type, searching reply information corresponding to the statement to be replied from the target description information, determining the starting position and the ending position of the reply information in the target description information, and outputting a text between the starting position and the ending position as an answer.
In this embodiment, as shown in fig. 2, fig. 2 is a flowchart of a second replying method based on a question-and-answer model provided in the embodiment of the present application, and taking a museum scenario as an example, reply information corresponding to a sentence to be replied exists in target description information, so that the sentence to be replied is an answer type, and the answer type includes two types: a first answer type and a second answer type, if the to-be-replied sentence is determined to be the first answer type, for example: "the exhibit with the number 123 and the exhibit with the number 456 are the same dynasty", the reply to the question may only be a positive answer or a negative answer, and then the current sentence to be replied is determined to be the first answer type. The target objects "the exhibit of number 123" and "the exhibit of number 456" are obtained from the sentence to be replied, the generation of the two exhibits are respectively determined from the target description information correspondingly, and then it is determined whether the answer is a positive answer or a negative answer, for example, the reply information of this embodiment may be "yes" or "no", of course, the reply information may also be "yes" or "no", and the reply may be a reply expressing a positive meaning or a negative meaning, which is not limited in this application.
In this embodiment, if the sentence to be replied is "which heading of the exhibited item with the number 123 is", it is determined that the current sentence to be replied is of the second answer type, and then the reply information related to the sentence is searched for from the target description information, the searched keywords may be "the exhibited item with the number 123" and "heading", and finally the corresponding reply information "the exhibited item with the number 132 is the heading of the cultural item" is output.
In some optional embodiments, further comprising:
if the type of the statement to be replied is the answer-free type, outputting preset reply information, wherein the preset reply information comprises error report information or default reply information.
In this embodiment, if the information corresponding to the to-be-replied sentence cannot be found in the target description information, it is determined that the current to-be-replied sentence is of a no-answer type. For example, the sentence to be replied, which is input by the user, is "how to go to the hot pot shop", wherein the target object is the hot pot shop, and the description information related to the hot pot shop does not exist in the target description information, the model outputs preset replies such as "input error, re-input request", "no" or "no answer exists, search for other texts", and the like, and certainly, the preset replies may also be other replies, which is not limited by the present application.
In some optional embodiments, the identifying the type of the to-be-replied statement includes:
integrating the target description information into the sentence to be replied to obtain a text to be recognized;
adding a starting identifier and an ending identifier in the text to be recognized;
acquiring a segment vector, a position vector and a word vector corresponding to the text to be recognized according to the starting identifier and the ending identifier;
adding the segment vector, the position vector and the word vector corresponding to the text to be recognized to obtain an input vector;
and inputting the input vector into a pre-trained question-answer model so as to identify the type of the sentence to be replied.
In some embodiments, the pre-trained question-answering model of the present application can be implemented as a Roberta model, which is a chinese-oriented pre-trained model based on a Bert model improvement. The Bert model can be used for dividing words and adding labels to an input text to obtain a word vector and a sentence vector of the text, and then semantic representation of each word in the text is obtained based on the word vector and the sentence vector.
In this embodiment, after the sentence to be replied and the target description information are obtained, the Roberta model is input, and the Bert model performs word segmentation and punctuation in the sentence to be replied and the text in the target description information and cleans punctuation marks to obtain a single character. Further, the Roberta model adds labels [ CLS ] and [ SEP ] to the entire text, as well as labels token entries, segment entries, position entries, to characterize the word, segment, and position vectors of each word in the text by these labels.
Where the flag [ CLS ] is used to indicate the first character of the text. The tag [ SEP ] is used to indicate the end of a sentence, such as adding the tag [ SEP ] after the sentence to be replied, and adding the tag [ SEP ] after the object description information. The label token embeddings is used to identify each word. The tag segments are used to identify each sentence, for example, to add an identifier "0" to each character in the sentence to be replied, and to add an identifier "1" to each character in the target description information. The tag positions embeddings are used to identify the position of each word in the text of each sentence.
Further, the Roberta model obtains semantic representations of each word in the text based on the aforementioned respective labels. Optionally, the Roberta model may include 12 layers of bidirectional fransformer structures, the bidirectional fransformer structures may capture dependence at a longer distance, and obtain a semantic representation of each word in the text according to the word vector, the segment vector, and the position vector.
Furthermore, a problem judgment layer is added to the Roberta model, the final hidden state of the word vector marked with [ CLS ] is taken, the probability that the statement to be replied belongs to three types is predicted after the problem judgment layer is weighted, and the type with the maximum probability is the type corresponding to the statement to be replied.
In some embodiments, the calculating, according to the descriptor of the target object and the target description information, the probability that the answer of the to-be-replied sentence is a positive answer and the probability that the answer of the to-be-replied sentence is a negative answer includes:
recording an index vector of a descriptor of the target object in the statement to be replied to obtain a position output vector of the index vector in the statement to be replied;
coding is carried out according to the position output vector and the segment vector, the position vector and the word vector corresponding to the text to be recognized, and a semantic relation score is obtained;
and calculating the probability that the answer of the sentence to be replied is a positive answer and the probability of a negative answer according to the semantic relation score.
In some embodiments, the determining a starting position and an ending position of the reply message in the target description message includes:
processing a word vector corresponding to each character in the text to be recognized to obtain a hidden vector;
calculating the position of each word in the target description information according to the hidden vectorProbability P as the starting position of the answer istart And probability P as answer termination position jend
Calculating P istart *P jend And taking a position i corresponding to the position combination with the maximum calculation result as a starting position and taking a position j as an ending position, wherein i and j respectively represent the position of each word in the target description information, M is the length of the target description information, i, j =1,2, \ 8230 \ 8230;, M is smaller than j.
In some embodiments, the pre-trained question-answer model is obtained by training:
obtaining a training data set, the training data set comprising: inquiring a judgment data set, reasoning a non-data set and extracting a prediction data set;
dividing the training data set into a training set, a verification set and a test set according to a preset proportion, wherein the training set is used for model fitting, the verification set is used for adjusting the fitting degree, and the test set is used for evaluating a trained question-answer model;
processing the data of the training data set according to a preset rule, and inputting the data into a model to be trained, wherein the model to be trained comprises: the method comprises the steps that a query judgment model to be trained, a reasoning non-model to be trained and an extraction prediction model to be trained are obtained;
and jointly training the model to be trained to obtain the pre-trained question-answer model.
As shown in fig. 3, the query judgment dataset includes three types of tags, which respectively correspond to types of the to-be-replied statements: a no answer type, a first answer type and a second answer type; reasoning is that the label of the non-data set is the answer type of the sentence to be replied: positive and negative answers; and extracting the labels in the prediction data set as the text of the starting position and the text of the ending position of the reply information in the target description information. The set of the three types of data sets is divided into a training set, a validation set and a test set according to the proportion of 8. The training set is used for model fitting, the verification set is used for adjusting the fitting degree in model training, and the test set is used for evaluating the model after the model training is completed. Then, the models to be trained are trained respectively, and then the joint training is carried out, so that the trained query judgment model, the inference non-model and the extraction prediction model are combined to serve as the pre-trained question-answer model of the application. And finally, outputting the training model once per round, storing all models, evaluating the Roberta model on the test set by using indexes, selecting the model with the best effect, and determining the model to be the Roberta model used by the method.
In summary, according to the question-answer model-based reply method provided by the embodiment of the application, the questions are replied in a classified manner by identifying the types of the sentences to be replied, the reply precision is improved, the features do not need to be extracted, the problem of difficulty in feature extraction is avoided, the reply is obtained according to the target description information by obtaining the target description information related to the contents to be replied, the model precision is improved, and the user can answer more satisfactorily and more comprehensively.
Corresponding to the methods described in fig. 1 to fig. 3, the embodiment of the present application further provides a device for performing the above methods.
As shown in fig. 4, fig. 4 illustrates a replying apparatus based on a question-answering model, which includes:
an obtaining module 401, configured to obtain a to-be-replied statement input by a user;
a processing module 402, configured to identify a target object to which the to-be-replied statement relates; searching the description information of the target object from a preset description information base to be used as target description information;
an identifying module 403, configured to identify a type of the to-be-replied statement, where the type of the to-be-replied statement is one of: the answer-free type refers to a type that no effective answer can be obtained, or the answer-type refers to a type that an effective answer can be obtained;
and the reply module 404 is configured to, if the type of the to-be-replied statement is the answer type, obtain, according to the target description information, reply information corresponding to the to-be-replied statement and output the reply information.
It should be understood that the above division of each module/unit is only a division of a logic function, and in actual implementation, the functions of the above modules may be integrated into a hardware entity, for example, the functions of the processing module and the identification module may be integrated into a processor, the functions of the acquisition module and the reply module may be integrated into a transceiver, and programs and instructions for implementing the functions of the above modules may be maintained in a memory. For example, fig. 5 provides an electronic device 500, the electronic device 500 comprising may include a processor 511, a transceiver 512, and a memory 513. The transceiver 512 is used for transceiving data and signals in the method 100. The memory 513 may be used to store programs/codes and the like required by the processor 511 to perform the method 100.
In a specific implementation manner, corresponding to the electronic device 500, the embodiment of the present application further provides a computer storage medium, where the computer storage medium disposed in the electronic device 500 may store a program, and when the program is executed, some or all of the steps in the embodiments of the method 100 may be implemented. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a Random Access Memory (RAM), or the like.
As can be understood by those skilled in the art, for convenience and simplicity of description, for a specific working process of the system, the apparatus, and the unit described above, reference may be made to a corresponding process in the foregoing method embodiment, and details are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed method, apparatus and system may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be realized in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a control device of a cloud game, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
While alternative embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the present application.
The above-mentioned embodiments, objects, technical solutions and advantages of the present application are further described in detail, it should be understood that the above-mentioned embodiments are only examples of the present application, and are not intended to limit the scope of the present application, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the present application should be included in the scope of the present invention.

Claims (10)

1. A question-answering model-based reply method, characterized in that the method comprises:
acquiring a sentence to be replied, which is input by a user;
identifying a target object related to the statement to be replied;
searching the description information of the target object from a preset description information base to be used as target description information;
identifying the type of the statement to be replied, wherein the type of the statement to be replied is one of the following types: the answer-free type or the answer-provided type refers to a type in which a valid answer cannot be obtained, and the answer-provided type refers to a type in which a valid answer can be obtained;
if the type of the statement to be replied is the answer type, acquiring and outputting reply information corresponding to the statement to be replied according to the target description information.
2. The method of claim 1, further comprising:
if the type of the sentence to be replied is a first answer type, extracting the descriptor of the target object from the sentence to be replied, calculating the probability that the answer of the sentence to be replied is a positive answer and the probability of a negative answer according to the descriptor of the target object and the target description information, and outputting the answer with higher probability;
if the type of the statement to be replied is a second answer type, searching reply information corresponding to the statement to be replied from the target description information, determining the starting position and the ending position of the reply information in the target description information, and outputting a text between the starting position and the ending position as an answer.
3. The method of claim 1, further comprising:
if the type of the statement to be replied is the no answer type, outputting preset reply information, wherein the preset reply information comprises error report information or default reply information.
4. The method of claim 1, wherein the identifying the type of the statement to reply comprises:
integrating the target description information into the sentence to be replied to obtain a text to be recognized;
adding a starting identifier and an ending identifier in the text to be recognized;
acquiring a segment vector, a position vector and a word vector corresponding to the text to be recognized according to the starting identifier and the ending identifier;
adding the segment vector, the position vector and the word vector corresponding to the text to be recognized to obtain an input vector;
and inputting the input vector into a pre-trained question-answer model so as to identify the type of the sentence to be replied.
5. The method as claimed in claim 2 or 4, wherein said calculating the probability that the answer of said sentence to be replied is a positive answer and the probability that the answer is a negative answer according to the descriptor of said target object and said target description information comprises:
recording an index vector of a descriptor of the target object in the statement to be replied to obtain a position output vector of the index vector in the statement to be replied;
coding is carried out according to the position output vector and the segment vector, the position vector and the word vector corresponding to the text to be recognized, and a semantic relation score is obtained;
and calculating the probability that the answer of the sentence to be replied is a positive answer and the probability of a negative answer according to the semantic relation score.
6. The method of claim 2 or 4, wherein the determining the start position and the end position of the reply message in the target description message comprises:
processing a word vector corresponding to each character in the text to be recognized to obtain a hidden vector;
calculating the probability P of taking the position of each character in the target description information as the initial position of an answer according to the hidden vector istart And probability P as answer termination position jend
Calculating P istart *P jend And taking a position i corresponding to the position combination with the maximum calculation result as a starting position and taking a position j as an ending position, wherein i and j respectively represent the position of each word in the target description information, M is the length of the target description information, i, j =1,2, \ 8230 \ 8230;, M is smaller than j.
7. The method of claim 4, wherein the pre-trained question-answer model is trained by:
obtaining a training data set, the training data set comprising: inquiring a judgment data set, reasoning a non-data set and extracting a prediction data set;
dividing the training data set into a training set, a verification set and a test set according to a preset proportion, wherein the training set is used for model fitting, the verification set is used for adjusting the fitting degree, and the test set is used for evaluating a trained question-answer model;
processing the data of the training data set according to a preset rule, and inputting the data into a model to be trained, wherein the model to be trained comprises: the method comprises the steps that a query judgment model to be trained, a reasoning non-model to be trained and an extraction prediction model to be trained are obtained;
and jointly training the model to be trained to obtain the pre-trained question-answer model.
8. A question-answering model-based reply device, characterized in that the device comprises:
the acquisition module is used for acquiring the sentence to be replied input by the user;
the processing module is used for identifying a target object related to the statement to be replied; searching the description information of the target object from a preset description information base to be used as target description information;
the recognition module is used for recognizing the type of the statement to be replied, and the type of the statement to be replied is one of the following types: the answer-free type or the answer-provided type refers to a type in which a valid answer cannot be obtained, and the answer-provided type refers to a type in which a valid answer can be obtained;
and the reply module is used for acquiring and outputting reply information corresponding to the statement to be replied according to the target description information if the type of the statement to be replied is the answer type.
9. An electronic device, wherein the electronic device comprises memory and one or more processors; wherein the memory is to store computer program code comprising computer instructions; the computer instructions, when executed by the processor, cause the electronic device to perform the method of any of claims 1-7.
10. A computer-readable storage medium, comprising a computer program which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 7.
CN202211368135.4A 2022-11-03 2022-11-03 Question-answer model-based reply method and device and electronic equipment Pending CN115658870A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211368135.4A CN115658870A (en) 2022-11-03 2022-11-03 Question-answer model-based reply method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211368135.4A CN115658870A (en) 2022-11-03 2022-11-03 Question-answer model-based reply method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN115658870A true CN115658870A (en) 2023-01-31

Family

ID=84995019

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211368135.4A Pending CN115658870A (en) 2022-11-03 2022-11-03 Question-answer model-based reply method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN115658870A (en)

Similar Documents

Publication Publication Date Title
CN110196901B (en) Method and device for constructing dialog system, computer equipment and storage medium
CN110502621B (en) Question answering method, question answering device, computer equipment and storage medium
CN111914568B (en) Method, device and equipment for generating text sentence and readable storage medium
CN111949787A (en) Automatic question-answering method, device, equipment and storage medium based on knowledge graph
CN110727779A (en) Question-answering method and system based on multi-model fusion
CN110795543A (en) Unstructured data extraction method and device based on deep learning and storage medium
CN111738016A (en) Multi-intention recognition method and related equipment
CN111078837B (en) Intelligent question-answering information processing method, electronic equipment and computer readable storage medium
KR102271361B1 (en) Device for automatic question answering
CN110096572B (en) Sample generation method, device and computer readable medium
CN106649739B (en) Multi-round interactive information inheritance identification method and device and interactive system
US11461613B2 (en) Method and apparatus for multi-document question answering
CN112256845A (en) Intention recognition method, device, electronic equipment and computer readable storage medium
WO2019217150A1 (en) Search system for providing free-text problem-solution searching
CN113282711B (en) Internet of vehicles text matching method and device, electronic equipment and storage medium
CN113342958B (en) Question-answer matching method, text matching model training method and related equipment
CN116467417A (en) Method, device, equipment and storage medium for generating answers to questions
CN111708870A (en) Deep neural network-based question answering method and device and storage medium
CN109660621A (en) A kind of content delivery method and service equipment
CN113779202B (en) Named entity recognition method and device, computer equipment and storage medium
CN115658845A (en) Intelligent question-answering method and device suitable for open-source software supply chain
CN115357711A (en) Aspect level emotion analysis method and device, electronic equipment and storage medium
CN114595329A (en) Few-sample event extraction system and method for prototype network
CN115658870A (en) Question-answer model-based reply method and device and electronic equipment
CN114398482A (en) Dictionary construction method and device, electronic equipment and storage medium

Legal Events

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