CN113239169A - Artificial intelligence-based answer generation method, device, equipment and storage medium - Google Patents

Artificial intelligence-based answer generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN113239169A
CN113239169A CN202110609412.5A CN202110609412A CN113239169A CN 113239169 A CN113239169 A CN 113239169A CN 202110609412 A CN202110609412 A CN 202110609412A CN 113239169 A CN113239169 A CN 113239169A
Authority
CN
China
Prior art keywords
answer
similar
sentences
sentence
replied
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.)
Granted
Application number
CN202110609412.5A
Other languages
Chinese (zh)
Other versions
CN113239169B (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202110609412.5A priority Critical patent/CN113239169B/en
Publication of CN113239169A publication Critical patent/CN113239169A/en
Priority to PCT/CN2022/072187 priority patent/WO2022252636A1/en
Application granted granted Critical
Publication of CN113239169B publication Critical patent/CN113239169B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to the field of artificial intelligence, in particular to an answer generation method, device, equipment and storage medium based on artificial intelligence, which realize that a generation model generates more relevant and accurate answers under the condition that the information of sentences to be replied of a user is limited. The answer generation method based on artificial intelligence comprises the following steps: receiving a sentence to be replied, and inputting the sentence to be replied into a retrieval model; and acquiring similar sentences matched with the sentences to be replied and screened out from a preset dialogue corpus by the retrieval model, and acquiring answer sentences of the similar sentences in the dialogue corpus. Extracting difference keywords of the similar sentences and the sentences to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set; and extracting similar keywords of the answer sentences to obtain a similar keyword set. And inputting the difference keyword set and the similar keyword set into the trained generation model, and outputting an answer.

Description

Artificial intelligence-based answer generation method, device, equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence, and in particular, to an answer generation method, apparatus, device, and storage medium based on artificial intelligence.
Background
With the continuous development of social media and the continuous progress of artificial intelligence technology, intelligent conversation systems play an increasingly important role in the current society. The question-answering system based on the generative method uses a standard question-answering pair as training data, and uses a generative model (usually an Encoder-Decoder framework) in natural language processing to train to obtain an answer result. The generative model-based approach is capable of automatically generating answers that are highly relevant to the user's question, but because the user's question contains limited information, the results of the generative model may be prone to safe answers, such as "good", "kayian", etc., which are meaningless and time-consuming for users using a human-machine dialog system.
Disclosure of Invention
The application provides an answer generation method, device, equipment and storage medium based on artificial intelligence, which can realize that more relevant and accurate answers are given under the condition that question information of a user is limited.
In a first aspect, the present application provides an artificial intelligence-based answer generation method, including:
receiving a statement to be replied, and inputting the statement to be replied into a retrieval model;
acquiring similar sentences matched with the sentences to be replied and screened out from a preset dialogue corpus by the retrieval model, and acquiring answer sentences of the similar sentences in the dialogue corpus;
extracting the difference keywords of the similar sentence and the sentence to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set;
extracting similar keywords of the answer sentence to obtain a similar keyword set;
and inputting the difference keyword set and the similar keyword set into a trained generation model, and outputting an answer.
In a second aspect, the present application further provides an artificial intelligence-based answer generating apparatus, comprising:
the sentence receiving module is used for receiving the sentence to be replied and inputting the sentence to be replied into the retrieval model;
a similar sentence acquisition module, configured to acquire the search-type model, screen out a similar sentence matched with a sentence to be replied from a preset dialogue corpus, and acquire an answer sentence of the similar sentence in the dialogue corpus;
the difference keyword extraction module is used for extracting the difference keywords of the similar sentences and the sentences to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set;
the similar keyword extraction module is used for extracting similar keywords of the answer sentences to obtain a similar keyword set;
and the answer generating module is used for inputting the difference keyword set and the similar keyword set into a trained generative question-answer model and outputting an answer.
In a third aspect, the present application further provides a computer device comprising a memory and a processor; the memory is used for storing a computer program; the processor is configured to execute the computer program and to implement the answer generation method as described above when executing the computer program.
In a fourth aspect, the present application also provides a storage medium storing a computer program which, when executed by a processor, causes the processor to implement the answer generation method as described above.
According to the answer generation method, the answer generation device, the computer equipment and the storage medium, similar sentences are searched for sentences to be replied of the user through the search model, answer sentences of the similar sentences are obtained, difference keywords are further extracted from the similar sentences, the similar keywords are extracted from the answer sentences, the difference keywords and the similar keywords are used as input of the generation model, and input information is added for the generation model. Therefore, the problem that the generated model gives safe and meaningless answers due to the fact that the information contained in the question of the user is limited can be solved, and more relevant and accurate answers are given under the condition that the information of the question of the user is limited.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram of an answer generation method provided by an embodiment of the present application;
FIG. 2 is a network schematic diagram of an answer generation method provided by an embodiment of the present application;
FIG. 3 is a schematic block diagram of an answer generation apparatus provided by an embodiment of the present application;
fig. 4 is a block diagram schematically illustrating a structure of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
It is to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
With the continuous development of social media and the continuous progress of artificial intelligence technology, intelligent conversation systems play an increasingly important role in the current society. For example, a small artificial intelligence assistant introduced by hundredths and a dialogue system of microsoft corporation, small ice are all the business scenes of realizing man-machine dialogue, the former uses a retrieval method to recall the answer expected by a user, and the latter realizes automatic answer generation according to the question of the user through a deep learning model.
The question-answering system based on the retrieval method is mainly applied to intelligent question-answering systems (such as Taobao platform robot customer service) in specific fields, and the method generally maintains a dialogue corpus database which can be used for retrieval in advance, takes input questions of a user as question sentences, then finds the question sentences most similar to the question sentences of the user by utilizing sentence similarity calculation, and then outputs corresponding answers as responses. The question-answer pairs in the database pass strict screening, so that the answers returned to the user are fluent in language and clear in expression. However, due to the limitations of database size and sentence similarity matching methods, the final answer is often topic-independent and mishapable.
The question-answering system based on the generative method is mainly trained by using a standard question-answering pair as training data and using a generative model (usually an Encoder-Decoder framework) in natural language processing, can automatically generate answers highly related to user questions, but because the question sentences of the user contain limited information, the result of the generative question-answering model may tend to be safe answers such as 'good', 'kayao', and the like, which is meaningless and time-consuming for consumers using a man-machine dialogue system.
Based on the defects and shortcomings of the existing intelligent dialogue system, the answer generation method combining the search method and the generation method is provided, and the input information of the generation model is added based on the user statement through the search method, so that the generation method can generate more relevant answers based on the user statement. Firstly, the sentences of the user are searched based on a search method, and similar sentences matched with the sentences of the user and answers corresponding to the similar sentences are obtained. Then extracting difference keywords from all similar sentences and sentences of the user, extracting similar keywords from all answers, taking the obtained difference keywords and similar keywords as the input of the generating method, and outputting the final answer by the generating model. Thereby enabling more accurate and relevant answers to be generated in situations where the information provided by the user's sentence is limited.
The embodiment of the application provides an answer generation method, device and equipment based on artificial intelligence and a storage medium. The answer generation method can be applied to a server and also can be applied to a chip in a specific product, for example, a chip in an artificial intelligence device. The retrieval model is used for adding input information to the generation model based on the sentence to be replied, so that the answer given under the condition that the information given by the user is limited is more accurate and relevant. The server may be an independent server or a server cluster.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flow chart of an artificial intelligence-based answer generation method according to an embodiment of the present application. The answer generation method can be applied to a server to obtain more accurate answers which are more relevant to the sentences of the user.
As shown in fig. 1, the answer generation method specifically includes steps S101 to S105.
S101, receiving a statement to be replied, and inputting the statement to be replied into a retrieval model.
Wherein the sentences to be replied comprise question sentences or non-question sentences; the sentence to be replied may be in a speech form or a text form, and when the sentence to be replied is in the speech form, the sentence to be replied needs to be converted into the text form to be input into the retrieval model.
S102, obtaining similar sentences which are screened out from a preset dialogue corpus by the retrieval model and are matched with the sentences to be replied, and obtaining answer sentences of the similar sentences in the dialogue corpus.
Inputting the sentences to be replied and the sentences in the preset dialogue corpus into the retrieval model, and generating Jaccard similarity coefficients for representing the similarity between the sentences in the preset dialogue corpus and the sentences to be replied; acquiring similar sentences matched with the sentences to be replied, which are screened from the preset dialogue corpus by the retrieval model based on the Jaccard similarity coefficient; the similarity coefficient of the similar statement and the statement to be replied is larger than a first preset threshold and smaller than a second preset threshold.
In some embodiments, after the to-be-replied sentence and the sentence in the preset dialogue corpus are input into the search model, the search model generates a Jaccard Similarity coefficient (Jaccard Similarity coefficient) representing the text Similarity between the sentences in the preset dialogue corpus and the to-be-replied sentence, and then determines whether the sentence is a similar sentence of the to-be-replied sentence according to the Jaccard Similarity coefficient. The higher the Jaccard similarity coefficient value between sentences represents that the sentences have higher similarity and higher matching degree. The retrieval model screens out sentences in a preset dialogue corpus which have Jaccard similarity coefficient values larger than a first preset threshold value and smaller than a second preset threshold value, selects a preset number of sentences with the highest Jaccard similarity coefficient values from the screened results as final output similar sentences according to requirements, further obtains corresponding answer sentences of the similar sentences in a preset dialogue preset library, and corresponds the similar sentences output by the retrieval model and the corresponding answer sentences one by one to form similar question-answer pairs.
Illustratively, the retrieval model screens out sentences of which the Jaccard similarity coefficient with the to-be-replied sentences in a preset dialogue corpus is greater than 0.5 and less than 0.9, and selects 3 sentences with the highest Jaccard similarity coefficients from the sentences as similar sentences to be output.
It should be noted that the first preset threshold, the second preset threshold, and the preset number may be set according to practical applications, and this application is not specifically limited to this.
In other embodiments, the retrieval model may also be used to evaluate the text similarity between sentences based on cosine similarity, so as to match out similar sentences similar to the sentence to be replied. The cosine similarity is used for evaluating the similarity of two statement vectors by calculating an included angle between the two statement vectors.
It should be noted that the preset dialogue corpus is a database which is maintained in advance and contains dialogue sentences, and includes both question-answering sentences and answer sentences corresponding to the question-answering sentences. The dialog corpus can be used for receiving and recording dialog corpuses of general daily dialogues or dialog corpuses related to specific application scenes according to the requirements of the application scenes.
S103, extracting the difference keywords of the similar sentences and the sentences to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set.
The application provides a Semantic Alignment Keyword Extraction (SAKE) model for extracting keywords. The semantic alignment keyword extraction model is based on computing an Attention matrix characterizing deep semantics using Cross-Attention (Cross-Attention), and extracting keywords based on the Attention matrix.
Specifically, a statement to be replied is converted into a first vector, a similar statement is converted into a second vector, and an attention matrix is calculated according to the first vector and the second vector; obtaining a minimum value of the attention matrix to obtain a difference keyword of the similar sentence and the sentence to be replied; and taking a union set of the difference keywords to obtain a difference keyword set.
Firstly, text sentences need to be converted into vector form, and methods for vectorizing sentences are various.
In some embodiments, the text sentence is first one-hot encoded into a sparse matrix, and then the sparse matrix is changed into a dense matrix through linear transformation by randomly initializing an embedding layer, and the mutually independent one-hot vectors are changed into relationship vectors considering the intrinsic relation between words.
In other embodiments, statement vectors may also be generated based on a Neural Network Language Model (NNLM).
It should be noted that: all similar sentences need to be aligned to the sentences to be replied, so that the sentences to be replied are converted into first vectors, other similar sentences are converted into second vectors, and the attention matrix between each similar sentence and the sentences to be replied is calculated in sequence. Wherein the attention matrix is represented as:
Figure BDA0003095395610000061
wherein, vAConverting the sentence to be replied into a first vector vBFor the similar statement to a second vector, dkAre normalized coefficients.
By minimizing the attention matrix, words existing in the sentence to be replied but not existing in the similar sentence can be obtained as the difference keywords between the two. Wherein, the difference keyword formula is as follows:
Figure BDA0003095395610000062
wherein i denotes the row, j denotes the column, L is a predetermined hyper-parameter,
Figure BDA0003095395610000063
the expression finds the minimum L lines and corresponds to the extracted difference keywords.
And (4) taking a union set of the difference keywords of all similar sentences and the sentences to be replied to obtain a difference keyword set.
Illustratively, for example, the to-reply statement is: which wine and white spirit are better drunk? Assume that similar sentences obtained by the search model are: similar statement 1: is the spirit drunk better than the wine? Similar statement 2: is there a better wine than white spirit? The difference keywords of the similar sentence 1 and the sentence to be replied are: "more" "and" "which". The difference keywords of the similar sentence 2 and the sentence to be replied are: "wine", "and", "which". Taking a union set of the difference keywords to obtain a difference keyword set as follows: [ more "" and "" which "" wine "].
And S104, extracting similar keywords of the answer sentence to obtain a similar keyword set.
Specifically, a first answer sentence in the answer sentences is converted into a first answer vector, other answer sentences in the answer sentences are converted into a second answer vector, and the attention matrix is calculated according to the first answer vector and the second answer vector. The first answer sentence is the answer sentence corresponding to the similar sentence with the highest matching degree with the sentence to be replied.
It should be noted that: and taking the answer sentence corresponding to the similar sentence which is most matched with the sentence to be replied as a reference answer sentence, wherein other answer sentences need to be aligned to the reference answer sentence. Thus, the reference answer sentence is converted into a first answer vector, other answer sentences in the answer sentence are converted into a second answer vector, and the attention matrixes between the other answer sentences and the reference answer sentence are sequentially calculated. And carrying out maximum evaluation on the attention matrix to obtain similar keywords of the first answer sentence and other answer sentences in the answer sentences. Wherein the similar keyword formula is as follows:
wherein the similar keyword formula is as follows:
Figure BDA0003095395610000071
wherein i denotes the row, j denotes the column, L is a predetermined hyper-parameter,
Figure BDA0003095395610000072
and (4) calculating the L rows with the maximum row number, and corresponding to the extracted similar keywords.
And (4) taking similar keywords from all other answer sentences except the reference answer sentences and the reference answer sentences, and taking a union set of all similar keywords to obtain a similar keyword set.
Illustratively, for example, answer sentence 1 is "i am personally disliked to drink", and answer sentence 2 is "see personal taste, i prefer white spirit". Similar keywords of answer sentence 2 and answer sentence 1 are: "personal", "like" and "wine". Thus the set of similar keywords is: [ PERSONAL "LIFE" AND "WINE" ].
According to the keyword extraction model based on semantic alignment, attention matrixes are used for conducting normalized accumulation, deep semantic relevance and accumulated semantic characteristics are considered in keyword extraction, and therefore extracted keywords are more accurate.
And S105, inputting the difference keyword set and the similar keyword set into a trained generation model, and outputting an answer. The generative models include a trained first generative model and a trained second generative model.
Specifically, inputting the difference keyword set and the similar keyword set into a trained first generation model, and outputting an ordered keyword sequence by predicting the positions of words in the difference keyword set and the similar keyword set in a sentence; and inputting the ordered keyword sequence into the trained second generation model, and outputting an answer.
In the embodiments provided in the present application, the first generative model and the second generative model are both based on the pre-training language model bert (bidirectional Encoder replication from transforms), but are trained based on different model parameters and training strategies. The BERT model does not adopt the traditional one-way language model or a method of carrying out shallow splicing on two one-way language models for pre-training, but adopts a new Mask Language Model (MLM) to generate deep two-way language representation. The BERT model pre-trains bi-directional transforms using MLM to generate deep bi-directional linguistic representations. After pre-training, a high level of performance can be achieved in a wide variety of downstream tasks by adding only one additional output layer for fine-tuning (fine-tune), and no task-specific structural modifications to the BERT model are required.
In the embodiments provided in this application, the network structure of the first generative model is: the first BERT model is followed by the first fully-connected layer and Softmax. The training goal of the first generation model is to output a predicted ordered set of words based on a given unordered set of words. Specifically, the unordered keyword set is input into a first BERT model, the enhancement semantic vector of the word is output through a transformer encoder, and the first BERT model is followed by a first full-link layer and a Softmax layer to output the predicted ordered keyword set. It should be noted that, in the training process of the first generative model, the parameters of the first BERT model are not fine-tuned, but the trained first generative model is obtained by adjusting the parameters of the first fully-connected layer.
In the embodiments provided in the present application, the network structure of the second generative model is: the second BERT model is followed by a second fully-connected layer and Softmax. The training goal of the second generative model is to output a predicted complete sentence based on the ordered set of keywords. The second generation model is based on the understanding of the context information and the semantics, and in the output sentence, words not included in the keyword set can be obtained through prediction, and words included in a part of the keyword set can be ignored. It should be noted that, in the training process of the second generative model, parameters of the second BERT model and the second fully connected layer need to be fine-tuned to obtain the trained second generative model.
Firstly, an unordered keyword set obtained by taking a union set of a difference keyword set and a similar keyword set is input into a trained first generation model to generate an ordered keyword set, wherein the ordered keyword set is equivalent to combining discrete words into an incomplete sentence. Secondly, inputting the ordered keyword set into a trained second generation model, and outputting a complete sentence by the second generation model based on the ordered keyword set.
And outputting the predicted answer through a two-stage generation model, wherein the first generation model predicts the position information to obtain an ordered discrete word set, and the second stage predicts the finally generated answer sentence according to the ordered discrete word set, so that the generated result is smoother.
According to the answer generation method, similar sentences are searched for the sentences to be replied of the user based on the search model, answer sentences of the similar sentences are obtained, difference keywords are further extracted from the similar sentences, similar keywords are extracted from the answer sentences, the difference keywords and the similar keywords are used as input of the generation model, and input information is added for the generation model. Therefore, the problem that the generated model gives safe and meaningless answers due to the fact that the information contained in the question of the user is limited can be solved, and the result of more relevant and accurate answers is given under the condition that the information of the question of the user is limited.
Referring to fig. 3, an embodiment of the present application provides a schematic block diagram of a reply generation apparatus, which may be configured with a server.
As shown in fig. 3, the answer generating apparatus 400 includes: a sentence receiving module 401, a similar sentence obtaining module 402, a difference keyword extracting module 403, a similar keyword extracting module 404, and an answer generating module 405.
A statement receiving module 401, configured to receive a statement to be replied, and input the statement to be replied into a retrieval model;
a similar sentence obtaining module 402, configured to obtain a similar sentence, which is screened by the retrieval model from a preset dialog corpus and is matched with the sentence to be replied, and obtain an answer sentence of the similar sentence in the dialog corpus.
A difference keyword extraction module 403, configured to extract, based on a preset semantic alignment keyword extraction model, a difference keyword between the similar sentence and the sentence to be replied, so as to obtain a difference keyword set.
A similar keyword extracting module 404, configured to extract similar keywords of the answer sentence, so as to obtain a similar keyword set.
And an answer generating module 405, configured to input the difference keyword set and the similar keyword set into a trained generating model, and output an answer.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus and the modules described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The apparatus described above may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 4.
Referring to fig. 4, fig. 4 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device may be a server.
Referring to fig. 4, the computer device includes a processor, a memory, and a network interface connected through a system bus, wherein the memory may include a storage medium and an internal memory.
The storage medium may store an operating system and a computer program. The computer program includes program instructions that, when executed, cause a processor to perform any one of the answer generation methods.
The processor is used for providing calculation and control capability and supporting the operation of the whole computer equipment.
The internal memory provides an environment for the execution of a computer program on a storage medium, which when executed by a processor causes the processor to perform any of the answer generation methods.
The network interface is used for network communication, such as sending assigned tasks and the like. Those skilled in the art will appreciate that the architecture shown in fig. 4 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that the Processor may be a Central Processing Unit (CPU), and the Processor may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor is configured to execute a computer program stored in the memory to implement the steps of:
receiving a statement to be replied, and inputting the statement to be replied into a retrieval model;
acquiring similar sentences matched with the sentences to be replied and screened out from a preset dialogue corpus by the retrieval model, and acquiring answer sentences of the similar sentences in the dialogue corpus;
extracting difference keywords from the similar sentences and the sentences to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set;
extracting similar keywords from the answer sentences to obtain a similar keyword set;
and inputting the difference keyword set and the similar keyword set into a trained generation model, and outputting an answer.
In one embodiment, the processor, when implementing obtaining of similar sentences, which are screened from a preset dialogue corpus by the retrieval model and match the sentences to be replied, is configured to implement:
inputting the sentences to be replied and the sentences in the preset dialogue corpus into the retrieval model, and generating Jaccard similarity coefficients for representing the similarity between the sentences in the preset dialogue corpus and the sentences to be replied;
acquiring similar sentences matched with the sentences to be replied, which are screened from the preset dialogue corpus by the retrieval model based on the Jaccard similarity coefficient; the similarity coefficient of the similar statement and the statement to be replied is larger than a first preset threshold and smaller than a second preset threshold.
In one embodiment, the processor is configured to, when implementing a preset semantic alignment keyword extraction model, extract a difference keyword between the similar sentence and the sentence to be replied to obtain a difference keyword set, implement:
converting the statement to be replied into a first vector, converting the similar statement into a second vector, and calculating an attention matrix according to the first vector and the second vector;
obtaining a minimum value of the attention matrix to obtain a difference keyword of the similar statement and the statement to be replied;
and taking a union set of the difference keywords to obtain a difference keyword set.
In one embodiment, the processor, when configured to compute the attention matrix, is configured to:
Figure BDA0003095395610000111
wherein, vAConverting the sentence to be replied into a first vector vBFor the similar statement to a second vector, dkIs a normalized coefficient;
the difference keyword formula is as follows:
Figure BDA0003095395610000112
wherein i denotes the row, j denotes the column, L is a predetermined hyper-parameter,
Figure BDA0003095395610000113
the expression finds the minimum L lines and corresponds to the extracted difference keywords.
In one embodiment, the processor, when configured to extract similar keywords of the answer sentence to obtain a set of similar keywords, is configured to:
converting a first answer sentence of the answer sentences into a first answer vector, converting other answer sentences in the answer sentences into a second answer vector, and calculating an attention matrix according to the first answer vector and the second answer vector; the first answer sentence is an answer sentence corresponding to the similar sentence with the highest matching degree with the sentence to be replied;
obtaining a maximum value of the attention matrix to obtain similar keywords of the first answer sentence and other answer sentences in the answer sentences;
taking a union set of all similar keywords to obtain a similar keyword set;
wherein the similar keyword formula is as follows:
Figure BDA0003095395610000121
wherein i denotes the row, j denotes the column, L is a predetermined hyper-parameter,
Figure BDA0003095395610000122
and (4) calculating the L rows with the maximum row number, and corresponding to the extracted similar keywords.
In one embodiment, the trained generative models include a first trained generative model and a second trained generative model, and the processor, when configured to implement inputting the set of difference keywords and the set of similar keywords into the trained generative models and outputting answers, is configured to implement:
inputting the difference keyword set and the similar keyword set into the trained first generation model, and outputting an ordered keyword sequence by predicting the positions of words in the difference keyword set and the similar keyword set in sentences;
and inputting the ordered keyword sequence into the trained second generation model, and outputting an answer.
The trained generative model is obtained based on a pre-trained language model BERT.
In an embodiment of the present application, a storage medium is further provided, where the storage medium stores a computer program, where the computer program includes program instructions, and the processor executes the program instructions to implement any answer generation method provided in the embodiment of the present application.
The storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device.
While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An artificial intelligence-based answer generation method, comprising:
receiving a statement to be replied, and inputting the statement to be replied into a retrieval model;
acquiring similar sentences matched with the sentences to be replied and screened out from a preset dialogue corpus by the retrieval model, and acquiring answer sentences of the similar sentences in the dialogue corpus;
extracting the difference keywords of the similar sentence and the sentence to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set;
extracting similar keywords of the answer sentence to obtain a similar keyword set;
and inputting the difference keyword set and the similar keyword set into a trained generation model, and outputting an answer.
2. The answer generation method according to claim 1, wherein the obtaining of the search model and the similar sentences matched with the sentences to be replied, which are screened from a preset dialogue corpus, comprises:
inputting the sentences to be replied and the sentences in the preset dialogue corpus into the retrieval model, and generating Jaccard similarity coefficients for representing the similarity between the sentences in the preset dialogue corpus and the sentences to be replied;
acquiring similar sentences matched with the sentences to be replied, which are screened from the preset dialogue corpus by the retrieval model based on the Jaccard similarity coefficient;
the similarity coefficient of the similar statement and the statement to be replied is larger than a first preset threshold and smaller than a second preset threshold.
3. The answer generation method according to claim 1, wherein the extracting the difference keywords of the similar sentence and the sentence to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set comprises:
converting the statement to be replied into a first vector, converting the similar statement into a second vector, and calculating an attention matrix according to the first vector and the second vector;
obtaining a minimum value of the attention matrix to obtain a difference keyword of the similar statement and the statement to be replied;
and taking a union set of the difference keywords to obtain a difference keyword set.
4. The answer generation method according to claim 3, wherein the attention matrix is represented as:
Figure FDA0003095395600000021
wherein, vAA first vector, v, transformed for the statement to be repliedBA second vector transformed for the similar statement, dkIs a normalized coefficient;
the difference keyword formula is as follows:
Figure FDA0003095395600000022
wherein i denotes the row, j denotes the column, L is a predetermined hyper-parameter,
Figure FDA0003095395600000023
the expression finds the minimum L lines and corresponds to the extracted difference keywords.
5. The answer generation method of claim 4, wherein said extracting similar keywords of said answer sentence to obtain a set of similar keywords comprises:
converting a first answer sentence of the answer sentences into a first answer vector, converting other answer sentences in the answer sentences into a second answer vector, and calculating an attention matrix according to the first answer vector and the second answer vector; the first answer sentence is an answer sentence corresponding to the similar sentence with the highest matching degree with the sentence to be replied;
obtaining a maximum value of the attention matrix to obtain similar keywords of the first answer sentence and other answer sentences in the answer sentences;
taking a union set of all similar keywords to obtain a similar keyword set;
wherein the similar keyword formula is as follows:
Figure FDA0003095395600000024
wherein i denotes the row, j denotes the column, L is a predetermined hyper-parameter,
Figure FDA0003095395600000025
and (4) calculating the L rows with the maximum row number, and corresponding to the extracted similar keywords.
6. The answer generation method of claim 1, wherein the trained generative model comprises a trained first generative model and a trained second generative model;
inputting the difference keyword set and the similar keyword set into a trained generation model, and outputting an answer, wherein the method comprises the following steps:
inputting the difference keyword set and the similar keyword set into the trained first generation model, and outputting an ordered keyword sequence by predicting the positions of words in the difference keyword set and the similar keyword set in sentences;
and inputting the ordered keyword sequence into the trained second generation model, and outputting an answer.
7. The answer generation method according to claim 6, wherein the trained generative model is derived based on a pre-trained language model BERT.
8. An artificial intelligence based answer generation apparatus, the apparatus comprising:
the sentence receiving module is used for receiving a sentence to be replied and inputting the sentence to be replied into the retrieval model;
a similar sentence acquisition module, configured to acquire a similar sentence, which is screened by the retrieval model from a preset dialog corpus and is matched with the sentence to be replied, and acquire an answer sentence of the similar sentence in the dialog corpus;
the difference keyword extraction module is used for extracting the difference keywords of the similar sentences and the sentences to be replied based on a preset semantic alignment keyword extraction model to obtain a difference keyword set;
the similar keyword extraction module is used for extracting similar keywords of the answer sentences to obtain a similar keyword set;
and the answer generating module is used for inputting the difference keyword set and the similar keyword set into a trained generating model and outputting an answer.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory is used for storing a computer program;
the processor for executing the computer program and for implementing the answer generation method according to any one of claims 1-7 when executing the computer program.
10. A storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, causes the processor to carry out the answer generation method according to any one of claims 1-7.
CN202110609412.5A 2021-06-01 2021-06-01 Answer generation method, device, equipment and storage medium based on artificial intelligence Active CN113239169B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110609412.5A CN113239169B (en) 2021-06-01 2021-06-01 Answer generation method, device, equipment and storage medium based on artificial intelligence
PCT/CN2022/072187 WO2022252636A1 (en) 2021-06-01 2022-01-14 Artificial intelligence-based answer generation method and apparatus, device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110609412.5A CN113239169B (en) 2021-06-01 2021-06-01 Answer generation method, device, equipment and storage medium based on artificial intelligence

Publications (2)

Publication Number Publication Date
CN113239169A true CN113239169A (en) 2021-08-10
CN113239169B CN113239169B (en) 2023-12-05

Family

ID=77136270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110609412.5A Active CN113239169B (en) 2021-06-01 2021-06-01 Answer generation method, device, equipment and storage medium based on artificial intelligence

Country Status (2)

Country Link
CN (1) CN113239169B (en)
WO (1) WO2022252636A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113609275A (en) * 2021-08-24 2021-11-05 腾讯科技(深圳)有限公司 Information processing method, device, equipment and storage medium
CN113868398A (en) * 2021-10-14 2021-12-31 北京倍倾心智能科技中心(有限合伙) Dialogue data set, method for constructing security detection model, method for evaluating security of dialogue system, medium, and computing device
WO2022252636A1 (en) * 2021-06-01 2022-12-08 平安科技(深圳)有限公司 Artificial intelligence-based answer generation method and apparatus, device, and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116843149A (en) * 2023-07-11 2023-10-03 深圳市深水水务咨询有限公司 Reservoir flood control scheduling method based on generation type learning
CN116860950B (en) * 2023-09-04 2023-11-14 北京市电通电话技术开发有限公司 Method and system for updating corpus of term conversation robot
CN117474043B (en) * 2023-12-27 2024-04-02 湖南三湘银行股份有限公司 Intelligent question-answering system based on training model

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110257961A1 (en) * 2010-04-14 2011-10-20 Marc Tinkler System and method for generating questions and multiple choice answers to adaptively aid in word comprehension
JP2014021535A (en) * 2012-07-12 2014-02-03 Mitsubishi Electric Corp Related keyword string extraction device, related keyword string extraction method and device for searching interrelated sentence
CN107679225A (en) * 2017-10-20 2018-02-09 哈尔滨工业大学 A kind of reply generation method based on keyword
CN109033221A (en) * 2018-06-29 2018-12-18 上海银赛计算机科技有限公司 Answer generation method, device and server
CN110362651A (en) * 2019-06-11 2019-10-22 华南师范大学 Dialogue method, system, device and the storage medium that retrieval and generation combine
CN110457459A (en) * 2019-08-16 2019-11-15 深圳前海达闼云端智能科技有限公司 Dialog generation method, device, equipment and storage medium based on artificial intelligence
KR20200033009A (en) * 2018-09-19 2020-03-27 네이버 주식회사 Method of providing automatic answer
CN111128135A (en) * 2018-10-15 2020-05-08 珠海格力电器股份有限公司 Voice communication method and device
CN111177339A (en) * 2019-12-06 2020-05-19 百度在线网络技术(北京)有限公司 Dialog generation method and device, electronic equipment and storage medium
CN111460081A (en) * 2020-03-30 2020-07-28 招商局金融科技有限公司 Answer generation method based on deep learning, electronic device and readable storage medium
CN111782767A (en) * 2020-06-30 2020-10-16 北京三快在线科技有限公司 Question answering method, device, equipment and storage medium
CN112765306A (en) * 2020-12-30 2021-05-07 金蝶软件(中国)有限公司 Intelligent question answering method and device, computer equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7043593B2 (en) * 2018-04-23 2022-03-29 株式会社Nttドコモ Dialogue server
CN111368042A (en) * 2020-02-13 2020-07-03 平安科技(深圳)有限公司 Intelligent question and answer method and device, computer equipment and computer storage medium
CN112632252B (en) * 2020-12-25 2021-09-17 中电金信软件有限公司 Dialogue response method, dialogue response device, computer equipment and storage medium
CN113239169B (en) * 2021-06-01 2023-12-05 平安科技(深圳)有限公司 Answer generation method, device, equipment and storage medium based on artificial intelligence

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110257961A1 (en) * 2010-04-14 2011-10-20 Marc Tinkler System and method for generating questions and multiple choice answers to adaptively aid in word comprehension
JP2014021535A (en) * 2012-07-12 2014-02-03 Mitsubishi Electric Corp Related keyword string extraction device, related keyword string extraction method and device for searching interrelated sentence
CN107679225A (en) * 2017-10-20 2018-02-09 哈尔滨工业大学 A kind of reply generation method based on keyword
CN109033221A (en) * 2018-06-29 2018-12-18 上海银赛计算机科技有限公司 Answer generation method, device and server
KR20200033009A (en) * 2018-09-19 2020-03-27 네이버 주식회사 Method of providing automatic answer
CN111128135A (en) * 2018-10-15 2020-05-08 珠海格力电器股份有限公司 Voice communication method and device
CN110362651A (en) * 2019-06-11 2019-10-22 华南师范大学 Dialogue method, system, device and the storage medium that retrieval and generation combine
CN110457459A (en) * 2019-08-16 2019-11-15 深圳前海达闼云端智能科技有限公司 Dialog generation method, device, equipment and storage medium based on artificial intelligence
CN111177339A (en) * 2019-12-06 2020-05-19 百度在线网络技术(北京)有限公司 Dialog generation method and device, electronic equipment and storage medium
CN111460081A (en) * 2020-03-30 2020-07-28 招商局金融科技有限公司 Answer generation method based on deep learning, electronic device and readable storage medium
CN111782767A (en) * 2020-06-30 2020-10-16 北京三快在线科技有限公司 Question answering method, device, equipment and storage medium
CN112765306A (en) * 2020-12-30 2021-05-07 金蝶软件(中国)有限公司 Intelligent question answering method and device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
ZHILING ZHANG ET AL: "Diverse and Specific Clarification Question Generation with Keywords", 《ARXIV:2104.10317V1 [CS.CL]》, pages 1 - 11 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022252636A1 (en) * 2021-06-01 2022-12-08 平安科技(深圳)有限公司 Artificial intelligence-based answer generation method and apparatus, device, and storage medium
CN113609275A (en) * 2021-08-24 2021-11-05 腾讯科技(深圳)有限公司 Information processing method, device, equipment and storage medium
CN113609275B (en) * 2021-08-24 2024-03-26 腾讯科技(深圳)有限公司 Information processing method, device, equipment and storage medium
CN113868398A (en) * 2021-10-14 2021-12-31 北京倍倾心智能科技中心(有限合伙) Dialogue data set, method for constructing security detection model, method for evaluating security of dialogue system, medium, and computing device

Also Published As

Publication number Publication date
WO2022252636A1 (en) 2022-12-08
CN113239169B (en) 2023-12-05

Similar Documents

Publication Publication Date Title
CN113239169B (en) Answer generation method, device, equipment and storage medium based on artificial intelligence
CN113239700A (en) Text semantic matching device, system, method and storage medium for improving BERT
CN111241237B (en) Intelligent question-answer data processing method and device based on operation and maintenance service
CN111143576A (en) Event-oriented dynamic knowledge graph construction method and device
CN113591902A (en) Cross-modal understanding and generating method and device based on multi-modal pre-training model
CN113268609A (en) Dialog content recommendation method, device, equipment and medium based on knowledge graph
WO2023137911A1 (en) Intention classification method and apparatus based on small-sample corpus, and computer device
CN112417855A (en) Text intention recognition method and device and related equipment
CN112101042A (en) Text emotion recognition method and device, terminal device and storage medium
CN113705315A (en) Video processing method, device, equipment and storage medium
CN111145914B (en) Method and device for determining text entity of lung cancer clinical disease seed bank
CN116541493A (en) Interactive response method, device, equipment and storage medium based on intention recognition
CN112989843B (en) Intention recognition method, device, computing equipment and storage medium
CN112307738A (en) Method and device for processing text
CN112307048A (en) Semantic matching model training method, matching device, equipment and storage medium
CN116738956A (en) Prompt template generation method and device, computer equipment and storage medium
CN116186219A (en) Man-machine dialogue interaction method, system and storage medium
CN114003773A (en) Dialogue tracking method based on self-construction multi-scene
CN110347813B (en) Corpus processing method and device, storage medium and electronic equipment
CN114818644B (en) Text template generation method, device, equipment and storage medium
CN112131350B (en) Text label determining method, device, terminal and readable storage medium
CN117521674B (en) Method, device, computer equipment and storage medium for generating countermeasure information
WO2023134085A1 (en) Question answer prediction method and prediction apparatus, electronic device, and storage medium
CN114840697B (en) Visual question-answering method and system for cloud service robot
CN115203388A (en) Machine reading understanding method and device, computer 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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40055458

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant