CN108920654B - Question and answer text semantic matching method and device - Google Patents

Question and answer text semantic matching method and device Download PDF

Info

Publication number
CN108920654B
CN108920654B CN201810718708.9A CN201810718708A CN108920654B CN 108920654 B CN108920654 B CN 108920654B CN 201810718708 A CN201810718708 A CN 201810718708A CN 108920654 B CN108920654 B CN 108920654B
Authority
CN
China
Prior art keywords
candidate
question
answer
customer
matching
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.)
Active
Application number
CN201810718708.9A
Other languages
Chinese (zh)
Other versions
CN108920654A (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.)
Taikang Insurance Group Co Ltd
Taikang Online Property Insurance Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Taikang Online Property Insurance 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 Taikang Insurance Group Co Ltd, Taikang Online Property Insurance Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201810718708.9A priority Critical patent/CN108920654B/en
Publication of CN108920654A publication Critical patent/CN108920654A/en
Application granted granted Critical
Publication of CN108920654B publication Critical patent/CN108920654B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The application provides a question-answer text semantic matching method, which comprises the following steps: receiving a customer question; acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question; respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information; calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information; and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question. And the matching degree of the candidate information and the client problem is analyzed by combining multiple factors, so that the accuracy is improved.

Description

Question and answer text semantic matching method and device
Technical Field
The present application relates to the field of electronic devices, and in particular, to a method and an apparatus for matching question and answer text semantics.
Background
The intelligent question-answering system returns correct matching answers according to the matching degree of the candidate question answers by analyzing the real intentions of the customer questions. The intelligent question-answering system mainly comprises customer question understanding, information retrieval and answer generation.
According to the text semantic matching technology in the traditional question-answering system, a machine learning model mainly applied needs to be manually extracted, subjective errors exist, and the generalization capability of the machine learning model is insufficient. In practical engineering application, a worker needs to label a large amount of text data, the text data are labeled mainly according to work experience knowledge of a data label maker, and feature information of the text data is extracted, so that the text feature engineering quality is not high, but a large amount of work time is needed. Moreover, in the conventional question-answering system, the semantic matching information of the question-answering text is not comprehensive, the matching value of the client question and the candidate answer is only calculated, and the candidate answer with the highest matching is used as the answer to the client question. By adopting the method, only the matching value of the subsequent answer and the customer question is considered, the semantic matching factor is single, and the accuracy is low.
Disclosure of Invention
In view of this, the present application provides a method for semantic matching of question and answer text, which solves the problem of low accuracy of a question and answer system in the prior art due to a single semantic matching factor.
In order to achieve the above purpose, the present application provides the following technical solutions:
a question-answer text semantic matching method comprises the following steps:
receiving a customer question;
acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question;
respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
Preferably, the method for calculating a first matching factor between the customer question and the candidate answer and a second matching factor between the customer question and the candidate question according to the candidate information includes:
respectively obtaining a feature vector sequence of a customer question, a candidate question and a candidate answer, wherein the feature vector sequence has context local features;
obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix;
and obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix.
Preferably, the above method, wherein the obtaining of the feature vector sequences of the customer question, the candidate question and the candidate answer respectively includes:
according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
and capturing context local characteristics of the customer question word vector sequence, the candidate question word vector sequence and the candidate answer word vector sequence by using a preset bidirectional long-short time memory network Bi-LSTM to respectively obtain the characteristic vector sequences of the customer question, the candidate question and the candidate answer.
In the above method, preferably, the obtaining a first eigenvector similarity score matrix according to the eigenvector sequence of the customer question and the eigenvector sequence of the candidate answer includes:
and calculating the characteristic vector sequence of the customer question and the characteristic vector sequence of the candidate answer by using a preset text similarity calculation formula to obtain a first characteristic vector similarity score matrix.
The method preferably, the determining a first matching factor between the customer question and the candidate answer according to the first eigenvector similarity score matrix includes:
screening a preset number of feature information meeting preset important conditions from the first feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a first matching factor.
The above method, preferably, the calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information includes:
and carrying out weighted summation calculation on the first matching factor and the second matching factor of any candidate information to obtain a matching value of the candidate information.
Preferably, the method further includes, before receiving the customer question:
presetting a deep learning model and a calculation rule for calculating a matching value of candidate information according to a matching factor, wherein the deep learning model is used for calculating a first matching factor of a customer question and a candidate answer and a second matching factor of the customer question and the candidate question;
the preset process of the deep learning model is realized by training the deep learning model, and the process of training the deep learning model specifically comprises the following steps:
acquiring at least two training candidate information corresponding to a training client question, wherein each training candidate information comprises a training candidate question and a training candidate answer;
respectively acquiring a training client problem and a feature vector sequence of the at least two training candidate information based on the deep learning model;
obtaining a first training feature vector similarity score matrix according to the feature vector sequence of the training client question and the feature vector sequence of the training candidate answer based on the deep learning model;
obtaining a second training feature vector similarity score matrix based on the deep learning model, the feature vector sequence of the training client problem and the feature vector sequence of the training candidate problem;
screening feature information of which the preset number meets preset important conditions from the first training feature vector similarity score matrix and the second training feature vector similarity score matrix based on a preset screening algorithm of the deep learning model to form training text feature vectors;
performing semantic matching classification judgment on the training text feature vector based on the classifier of the deep learning model, training parameters of the deep learning model by using a gradient descent method on the obtained prediction result, and outputting a training result;
and when the training result meets a preset condition, recording parameters of the deep learning model, so that the deep learning model determines a reply answer to the customer question based on the parameters.
An apparatus for question-answer text semantic matching, comprising:
the receiving module is used for receiving the customer questions;
the acquisition module is used for acquiring at least two candidate information corresponding to the customer questions according to the customer questions, wherein any one of the candidate information comprises at least two factors;
the first calculation module is used for respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
a second calculation module for calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
and the selection module is used for selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the customer question.
A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method of semantic matching of question and answer text as defined in any one of the preceding claims.
An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method for question-and-answer text semantic matching as recited in any of the above.
Compared with the prior art, the method for matching the question and answer text semantics comprises the following steps: receiving a customer question; acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question; respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information; calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information; and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question. By adopting the method, the candidate information consisting of a plurality of factors is analyzed with the customer question to obtain a plurality of matching factors, the matching value of the candidate information corresponding to the matching factors and the customer question is calculated based on the matching factors, and then the candidate answer in the candidate information with the maximum matching value is selected as the answer corresponding to the customer question. In the scheme, the candidate information comprises a plurality of factors, and the matching degree of the candidate information and the customer problem is analyzed by combining the factors, so that the accuracy is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for semantic matching of a question and answer text according to an embodiment 1 of the present disclosure;
fig. 2 is a flowchart of a method for semantic matching of question and answer texts according to embodiment 2 of the present application;
fig. 3 is a flowchart of a method for semantic matching of question and answer texts according to an embodiment 3 of the present application;
fig. 4 is a flowchart of a method 4 for semantic matching of question and answer texts according to the present application;
FIG. 5 is a schematic diagram illustrating a process of processing a client question in a specific application scenario of the method for semantic matching of question and answer text provided by the present application;
fig. 6 is a schematic structural diagram of an embodiment of a device for semantic matching of question and answer texts according to the present application;
fig. 7 is a schematic structural diagram of an embodiment of an electronic device provided in 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 only a part of the embodiments of the present application, and not all of the embodiments. 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.
As shown in fig. 1, a flowchart of an embodiment 1 of a method for semantic matching of question and answer texts provided by the present application is applied to an electronic device, where the electronic device has a function of semantic matching of question and answer texts, and the method includes the following steps:
step S101: receiving a customer question;
the customer question is a question made by a customer, semantic matching needs to be carried out on the customer question, and an answer which is the most matched with the customer question is obtained from a plurality of candidate answers.
Step S102: acquiring at least two candidate messages corresponding to the customer questions according to the customer questions;
wherein each of the candidate information comprises a candidate answer and a candidate question.
A database is preset, and massive candidate questions and candidate answers are preset in the database to form candidate pairs.
Specifically, a plurality of candidate information corresponding to the customer question can be found by searching in the database based on the customer question, and each candidate information includes a candidate pair consisting of a candidate question and a candidate answer.
In specific implementation, rough search can be performed in a database based on the customer question, a plurality of candidate information related to the customer question can be searched, matching degrees of the candidate information and the customer question are calculated in subsequent steps, and a reply answer is determined.
Step S103: respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
in specific implementation, according to the obtained candidate answer and the candidate question, a preset algorithm may be adopted to calculate a first matching factor between the customer question and the candidate answer and a second matching factor between the customer question and the candidate question.
In a specific implementation, the matching factor may be a numerical value, the numerical value of a first matching factor of the customer question and the candidate answer characterizes the matching degree of the customer question and the candidate answer, and the numerical value of a second matching factor of the candidate question and the customer question characterizes the matching degree of the candidate question and the customer question, and the like.
It should be noted that, in the following embodiments, a detailed explanation will be made for the process of calculating the matching factor, and details are not described in this embodiment.
Step S104: calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
the matching factors respectively represent the matching degrees between a plurality of factors (candidate answers and candidate questions) and the customer questions, and when the matching degree between each candidate information and the customer questions is calculated, the matching factors corresponding to the factors are considered, so that the accuracy of calculating semantic matching between the candidate information and the customer questions is improved.
Step S105: and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
And calculating the matching values of the candidate information, wherein the larger the matching value of the candidate information is, the higher the matching degree of the candidate information and the client question is represented.
Therefore, from the matching values of the plurality of candidate information, the candidate answer in the candidate information with the largest matching value is selected as the reply answer of the client question.
It should be noted that, in the process of calculating the matching value of the candidate information, a plurality of factors in the candidate information corresponding to the customer question are considered, so that the calculation accuracy of the matching degree between the candidate information and the customer question is improved, and the accuracy of the finally determined answer is higher.
In summary, the method for semantic matching of question and answer texts provided by this embodiment includes: receiving a customer question; acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question; respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information; calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information; and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question. By adopting the method, the candidate information consisting of a plurality of factors is analyzed with the customer question to obtain a plurality of matching factors, the matching value of the candidate information corresponding to the matching factors and the customer question is calculated based on the matching factors, and then the candidate answer in the candidate information with the maximum matching value is selected as the answer corresponding to the customer question. In the scheme, the candidate information comprises a plurality of factors, and the matching degree of the candidate information and the customer problem is analyzed by combining the factors, so that the accuracy is improved.
As shown in fig. 2, a flowchart of an embodiment 2 of a method for semantic matching of a question and answer text provided by the present application includes the following steps:
step S201: receiving a customer question;
step S202: acquiring at least two candidate messages corresponding to the customer questions according to the customer questions;
steps S201 to S202 are the same as steps S101 to S102 in embodiment 1, and are not described in detail in this embodiment.
Step S203: respectively acquiring a feature vector sequence of a customer question, a candidate question and a candidate answer;
wherein the sequence of feature vectors has context local features.
The electronic equipment is preset with rules, processes the customer question, the candidate question and the candidate answer and obtains the characteristic vector sequence thereof
Specifically, the step S203 specifically includes:
step S2031: according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
the electronic equipment is preset with a professional dictionary and word segmentation rules.
Specifically, the professional dictionary correspondingly contains a large amount of words in the professional.
If the professional dictionary is an insurance professional dictionary, for example, the professional dictionary may contain unique words of the insurance specialty, such as "micro medical insurance" and the like.
It should be noted that, in an implementation, the professional dictionary may be updated according to actual situations, so that the words in the professional dictionary can cover the words related to the latest professional content.
And combining the professional dictionary according to a preset word segmentation rule, and performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase.
It should be noted that, the word segmentation is performed on the candidate question or the candidate answer, and the obtained number of the word segmentation may be the same or different, which is not limited in this embodiment.
Step S2032: respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
and respectively carrying out word vector sequence conversion on the client question phrase, the candidate question phrase and the candidate answer phrase to obtain a corresponding word vector sequence (the client question word vector sequence, the candidate question word vector sequence and the candidate answer word vector sequence).
In a specific implementation, the process of word vector sequence conversion can be performed by using an embedding layer of a keras (deep learning framework).
In specific implementation, in order to facilitate calculation of the word vector sequence, length threshold limitation is performed on the word vector sequence, when few words are used, 0 can be used for supplement, and when the number of words is greater than the limited threshold, words with threshold number are intercepted.
Step S2033: capturing context local features of a customer question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence by using a preset Bi-LSTM (Bidirectional long-short memory network), and respectively obtaining a customer question, a candidate question and a feature vector sequence of a candidate answer.
Wherein, the client question word vector sequence, the candidate question word vector sequence and the candidate answer word vector sequence are respectively input into Bi-LSTM (Bidirectional long short term memory) for processing.
In the specific implementation, in the process of inputting a word vector sequence into a deep neural network for processing to obtain a feature vector sequence, firstly, inputting the word vector sequence into a Bi-LSTM, processing the word vector sequence inside the Bi-LSTM to obtain a reverse word vector sequence, then respectively inputting the word vector sequence (positive sequence) and the reverse word vector sequence into two LSTMs (long short term memory networks), then respectively inputting the two LSTMs into the vector sequences, and splicing the two vector sequences to obtain the feature vector sequence.
Wherein, the formula of the LSTM network is as follows:
it=σ(Wxixt+Whiht-1+Wcict-1+bi)
ft=σ(Wxfxt+Whfht-1+Wcfct-1+bf)
ct=ftct-1+ittanh(Wxcxt+Whcht-1+bc)
ot=σ(Wxoxt+Whoht-1+Wcoct+bo)
ht=ottanh(ct)
where σ denotes a sigmoid activation function, tanh denotes a hyperbolic tangent activation function, and xtAnd (3) obtaining a word embedding vector in the t moment (the t-th word vector input), wherein i, f, o and c are input activation vectors of an input gate, a forgetting gate, an output gate and a cell unit respectively, and the vector length of the input activation vectors is consistent with that of the hidden layer vector h. The weight matrix and bias parameter descriptions have obvious meanings, e.g. WxiWeight matrix, W, representing inputs and input gateshiWeight matrix, W, representing hidden layers and input gatesciWeight matrix representing cell units and input gates, bi、bfThe offset parameters of the input gate and the forgetting gate are shown, and the corner marks of the offset parameters indicate the calculation parts.
Through the learning training of the LSTM, the input at the time t can learn the semantic information at the previous time and the later time. Because a bidirectional long-short time memory network Bi-LSTM is used, an input sequence is input into two long-short time memory network LSTM units from the forward direction and the reverse direction, and the output vector sequence is hfwAnd hbwAre superimposed and denoted by ht=[hfw,hbw]The feature vector sequence is a feature vector sequence which has context local features.
And finally, respectively obtaining corresponding feature vector sequences aiming at the customer question, the candidate answer and the candidate question.
In which S may be employedcq、SqAnd SaRespectively representing customer question and candidate answerAnd the feature vector sequence of the candidate question.
Step S204: obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix;
in this step, a first matching factor characterizing a matching value of the customer question and the candidate answer is calculated.
Specifically, the obtaining a first eigenvector similarity score matrix according to the eigenvector sequence of the customer question and the eigenvector sequence of the candidate answer includes: and calculating the characteristic vector sequence of the customer question and the characteristic vector sequence of the candidate answer by using a preset text similarity calculation formula to obtain a first characteristic vector similarity score matrix.
In a specific implementation, the text similarity calculation formula may adopt an inner product formula, a cosine formula, and the like.
In this embodiment, the inner product formula is taken as an example for explanation.
Let ScqiAnd SqjRespectively representing the characteristic vector sequence of the customer question and the characteristic vector sequence S of the candidate answercqAnd SqSequentially calculating the similarity of the ith and jth characteristic vectors, wherein the formula is as follows:
simcqiqj=scqi·sqj
wherein simqiajRepresenting a feature vector ScqiAnd SqjThe similarity of (c).
Specifically, the determining a first matching factor between the customer question and the candidate answer according to the first feature vector similarity score matrix includes:
step S2041: screening a preset number of feature information meeting preset important conditions from the first feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
wherein, k-MAX posing (k maximum values in the set) can be adopted for screening, and the characteristic information with the maximum k values is obtained by screening.
In specific implementation, k may be a smaller number, such as 10, but the value of k is not limited thereto, and other positive integers may also be used.
Wherein the text feature vector is a question-answer semantic match that can represent the candidate answer and the customer question.
Step S2042: and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a first matching factor.
The softmax classifier can be adopted for performing two-classification training learning of question-answer text semantic matching, the obtained candidate answer and the client question are matched or unmatched in prediction results, and the prediction probability value is output as a matching factor.
Step S205: obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix;
this step S205 is used to calculate a second matching factor for the candidate question and the customer question.
The calculation process and the process of calculating the first matching factor between the customer question and the candidate answer may refer to step S204.
In one embodiment, obtaining a second eigenvector similarity score matrix from the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem comprises: and calculating the characteristic vector sequence of the customer problem and the characteristic vector sequence of the candidate problem by using a preset text similarity calculation formula to obtain a second characteristic vector similarity score matrix.
In one embodiment, determining a second matching factor for the customer question and the candidate question based on the second eigenvector similarity score matrix comprises:
screening a preset number of feature information meeting preset important conditions from the second feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a second matching factor.
Step S206: calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
step S207: and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
Steps S206 to 207 are the same as steps S104 to 105 in embodiment 1, and are not described in detail in this embodiment.
In summary, in the method for semantic matching of question and answer texts provided by this embodiment, the calculating a first matching factor between the customer question and the candidate answer and a second matching factor between the customer question and the candidate question according to the candidate information includes: respectively obtaining a feature vector sequence of a customer question, a candidate question and a candidate answer, wherein the feature vector sequence has context local features; obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix; and obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix. By adopting the method, in the process of carrying out word vector sequence processing on the client questions, the candidate questions and the candidate answers and obtaining the final characteristic vector sequence, the context local characteristic information of the text can be obtained, and the key global characteristic information is selected, so that the understanding of deep semantics of the question and answer text is facilitated.
As shown in fig. 3, a flowchart of embodiment 3 of a method for semantic matching of question and answer text provided by the present application includes the following steps:
step S301: receiving a customer question;
step S302: acquiring at least two candidate messages corresponding to the customer questions according to the customer questions;
step S303: respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
steps S301 to 303 are the same as steps S101 to 103 in embodiment 1, and are not described in detail in this embodiment.
Step S304: carrying out weighted summation calculation on a first matching factor and a second matching factor of any candidate information to obtain a matching value of the candidate information;
when the matching value of the candidate information is calculated, the weight values of the first matching factor and the second matching factor are preset numerical values, and the determination of the weight values can be specifically realized in the process of training the deep learning model, and the following embodiments will explain the content of the part, and details are not described in this embodiment.
Specifically, the formula for calculating the matching value of the candidate information is as follows:
Figure BDA0001718145450000121
wherein p is1And p1Respectively representing a first matching factor and a second matching factor, alpha and beta being weights of the first matching factor and the second matching factor, respectively.
In the subsequent step, the matching values of the candidate information can be compared, and the candidate information with the largest value and the best matching with the customer problem is determined.
Step S305: and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
Step S305 is the same as step S105 in embodiment 1, and is not described in detail in this embodiment.
In summary, in the method for semantic matching of question and answer text provided by this embodiment, the calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information includes: and carrying out weighted summation calculation on the first matching factor and the second matching factor of any candidate information to obtain a matching value of the candidate information. By taking the weight of each matching factor into account, the accuracy of calculating semantic matching is improved.
As shown in fig. 4, a flowchart of an embodiment 4 of a method for semantic matching of a question and answer text provided by the present application includes the following steps:
step S401: presetting a deep learning model and calculating rules for calculating matching values of the candidate information according to the first matching factor and the second matching factor;
the deep learning model is used for calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question.
The preset process of the deep learning model is realized by training the deep learning model, so that the deep learning model is trained before the formal process of matching the question and answer text semantics of the client.
In a specific implementation, the candidate information includes a plurality of factors (candidate questions and candidate answers), and accordingly, the electronic device is provided with models corresponding to the factors, so that two deep learning models corresponding to the candidate questions and the candidate answers need to be trained respectively.
The rule for calculating the matching value of the candidate information according to the matching factor may adopt a weighted summation formula, wherein the weight of each matching factor may be manually set in advance.
The process of training the deep learning model specifically comprises:
step S01: acquiring at least two training candidate information corresponding to a training client question, wherein each training candidate information comprises a training candidate question and a training candidate answer;
in the training process, the training candidate information and the training client problem are paired one by one, and in specific implementation, the pairing process can be manually realized to ensure that the training candidate information paired with the training client problem is information corresponding to the training candidate information, so that interference is reduced.
Step S02: respectively acquiring a training client problem and a feature vector sequence of the at least two training candidate information based on the deep learning model;
in the deep learning model training process, a professional dictionary can be established first, so that professional word segmentation is performed on training client questions and training candidate information according to the professional dictionary and word segmentation rules.
In specific implementation, the professional dictionary may be established in advance according to a predetermined corpus.
Wherein, the corpus contains massive corpora.
In specific implementation, the corpus can be set according to different professional fields, and different corpuses can be set in different professional fields.
Step S03: obtaining a first training feature vector similarity score matrix according to the feature vector sequence of the training client question and the feature vector sequence of the training candidate answer based on the deep learning model;
step S04: obtaining a second training feature vector similarity score matrix based on the deep learning model, the feature vector sequence of the training client problem and the feature vector sequence of the training candidate problem;
step S05: screening feature information of which the preset number meets preset important conditions from the first training feature vector similarity score matrix and the second training feature vector similarity score matrix based on a preset screening algorithm of the deep learning model to form training text feature vectors;
step S06: performing semantic matching classification judgment on the training text feature vector based on the classifier of the deep learning model, training parameters of the deep learning model by using a gradient descent method on the obtained prediction result, and outputting a training result;
in the training process, training candidate information and training client questions are matched one by one, after word segmentation, word vector conversion is carried out, a feature vector sequence is obtained through Bi-LSTM processing, and two feature vector similarity score matrixes are obtained according to two groups of feature vector sequences (the training candidate questions and the training client questions, the training candidate answers and the training client questions).
The method comprises the steps of screening feature information of which the preset number meets preset important conditions from a first feature vector similarity score matrix and a second training feature vector similarity score matrix by adopting a preset screening algorithm, forming training text feature vectors, inputting the obtained text feature vectors into a deep learning model, specifically into a training layer (such as a full connection layer) of the model, so that a softmax classifier is used for performing two-class training learning on the text feature vectors, and training parameter values of obtained prediction results (matching and mismatching) by using a gradient descent method, wherein the parameter values are values taken by parameters of the deep learning model.
And in the process of training the parameters of the deep learning model, outputting a training result, and judging whether the training result meets a preset condition, wherein the preset condition is a condition for stopping training.
In the specific implementation, the training result is verified in the training process. Wherein the training result may be represented in a digital form.
Step S07: and when the training result meets a preset condition, recording parameters of the deep learning model, so that the deep learning model determines a reply answer to the customer question based on the parameters.
The preset condition is a condition for stopping training, and when the training result is optimal, the training can be stopped, and the model reaches an optimal state.
In particular, the training result being optimal means that the number of training results is no longer better.
Correspondingly, recording parameters when the deep learning model training result meets the preset conditions.
When the parameters of the deep learning model are the recorded parameters, text semantic matching can be performed on the received customer questions, and reply answers with high accuracy are obtained.
Step S402: receiving a customer question;
step S403: acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question;
step S404: respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
step S405: calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
step S406: and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
Steps S402 to 406 are the same as steps S101 to 105 in embodiment 1, and are not described in detail in this embodiment.
In summary, the method for semantic matching of question and answer texts provided by this embodiment further includes: the method comprises the steps of presetting a deep learning model and a calculation rule for calculating a matching value of candidate information according to a matching factor, wherein the deep learning model is used for calculating a first matching factor of a customer question and a candidate answer and a second matching factor of the customer question and the candidate question. By adopting the method, the deep learning model and the calculation rule for calculating the matching value of the candidate information according to the matching factor are set in advance, so that a basis is provided for the specific use of determining the answer reply for the client question from the candidate information.
Fig. 5 is a schematic diagram illustrating a process for handling a customer problem in a specific application scenario.
Searching a question and answer candidate set to obtain candidate questions and candidate answers; forming a group of candidate problems and client problems, and inputting a phrase into a deep learning model after completing word segmentation, wherein the model comprises an embedding layer, a Bi-LSTM, a text similarity calculation formula and a k-MAX posing, the candidate problems and the client problems are respectively processed by the embedding layer and the Bi-LSTM, respectively output eigenvector sequences are input into the text similarity calculation formula for eigenvector similarity calculation, calculation results are output to the k-MAX posing for processing, and a classifier is used for predicting results to obtain a matching factor p 1; correspondingly, the candidate answer and the customer question form a group, after word segmentation is completed, a phrase is input into another model, after the same treatment as the candidate question and the customer question, a matching factor p2 is obtained, and the matching factor p1 and the matching factor p2 are subjected to weighted summation to obtain the matching value of the candidate question, the candidate answer group and the customer question.
It should be noted that, when there is more than one candidate question and candidate answer found from the question-answer candidate set, the candidate question and candidate answer in the candidate answer combination with the largest matching value may be determined as the returned answer by comparing the finally obtained matching values.
Corresponding to the embodiment of the method for matching the question and answer text semantics provided by the application, the application also provides an embodiment of a device for applying the method for matching the question and answer text semantics.
Fig. 6 is a schematic structural diagram of an embodiment of an apparatus for semantic matching of a question and answer text provided by the present application, including the following structures: a receiving module 601, an obtaining module 602, a first calculating module 603, a second calculating module 604 and a selecting module 605;
the receiving module 601 is configured to receive a customer question;
the obtaining module 602 is configured to obtain at least two candidate information corresponding to the customer question according to the customer question, where any of the candidate information includes at least two factors;
the first calculating module 603 is configured to calculate, according to the candidate information, a first matching factor of the customer question and the candidate answer, and a second matching factor of the customer question and the candidate question, respectively;
in a specific implementation, the first calculation module 603 is provided with a deep learning model for calculating a first matching factor between the customer question and the candidate answer and a second matching factor between the customer question and the candidate question.
Specifically, the first computing module 603 is configured to obtain feature vector sequences of a customer question, a candidate question, and a candidate answer, respectively, where the feature vector sequences have context local features;
obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix;
and obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix.
Specifically, the first calculating module 603 obtains feature vector sequences of the customer question, the candidate question, and the candidate answer respectively, including:
according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
and capturing context local characteristics of the client question word vector sequence, the candidate question word vector sequence and the candidate answer word vector sequence by utilizing a preset bidirectional long-short time memory network to respectively obtain the client question, the candidate question and the candidate answer feature vector sequence.
Specifically, the obtaining, by the first calculating module 603, a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer includes:
and calculating the characteristic vector sequence of the customer question and the characteristic vector sequence of the candidate answer by using a preset text similarity calculation formula to obtain a first characteristic vector similarity score matrix.
Specifically, the determining, by the first calculating module 603, a first matching factor between the customer question and the candidate answer according to the first feature vector similarity score matrix includes:
screening a preset number of feature information meeting preset important conditions from the first feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a first matching factor.
Wherein, the second calculating module 604 is configured to calculate a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
specifically, the second calculating module is specifically configured to perform weighted summation calculation on the first matching factor and the second matching factor of any candidate information to obtain a matching value of the candidate information.
The selecting module 605 is configured to select a candidate answer in the candidate information with the largest matching value as a reply answer to the customer question.
In particular implementations, the first computing module can employ a deep learning model. The deep learning model comprises an embedding layer, a Bi-LSTM, a text similarity calculation formula, a k-MAX posing and the like.
In an embodiment of the present application, based on the foregoing solution, the receiving module 601 is configured to: a communication interface for receiving the client question from other structures connected to the device, or the receiving module 601 may be configured with a mouse, keyboard, touch device, etc. that can be used to input content.
For details that are not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the method for semantic matching of question and answer text described above for details that are not disclosed in the embodiments of the apparatus of the present application.
In a specific implementation, the apparatus for semantic matching of question and answer text includes a processor and a memory, where the receiving module 601, the obtaining module 602, the first calculating module 603, the second calculating module 604, the selecting module 605, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can set one or more than one, and the task scheduling is realized by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
In summary, in the device for semantic matching of question and answer texts provided by this embodiment, a plurality of matching factors are obtained by analyzing candidate information composed of a plurality of factors and a customer question, a matching value between the candidate information corresponding to the matching factor and the customer question is obtained by calculation based on the plurality of matching factors, and then a candidate answer in the candidate information with the largest matching value is selected as a correct answer corresponding to the customer question. In the scheme, the candidate information comprises a plurality of factors, and the matching degree of the candidate information and the customer problem is analyzed by combining the factors, so that the accuracy is improved.
The embodiment of the application provides a storage medium, wherein a program is stored on the storage medium, and the program realizes the question and answer text semantic matching method when being executed by a processor.
The embodiment of the application provides a processor, wherein the processor is used for running a program, and the question and answer text semantic matching method is executed when the program runs.
Fig. 7 is a schematic structural diagram of an embodiment of an electronic device provided in the present application, and includes the following structures: a processor 701 and a memory 702;
the electronic equipment comprises one or more processors;
a storage device to store one or more programs, the programs being executable on the processor.
Wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement a method of question and answer text semantic matching as in method embodiments 1-4.
In the present application, the electronic device may be a server, a Personal Computer (PC), a PAD (tablet), a mobile phone, or the like.
Specifically, the processor implements the following steps when executing the program:
receiving a customer question;
acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question;
respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
Preferably, calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question respectively according to the candidate information includes:
respectively obtaining a feature vector sequence of a customer question, a candidate question and a candidate answer, wherein the feature vector sequence has context local features;
obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix;
and obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix.
Preferably, the obtaining the feature vector sequences of the customer question, the candidate question and the candidate answer respectively comprises:
according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
and capturing context local characteristics of the client question word vector sequence, the candidate question word vector sequence and the candidate answer word vector sequence by utilizing a preset bidirectional long-short time memory network to respectively obtain the client question, the candidate question and the candidate answer feature vector sequence.
Preferably, the obtaining a first eigenvector similarity score matrix according to the eigenvector sequence of the customer question and the eigenvector sequence of the candidate answer includes:
and calculating the characteristic vector sequence of the customer question and the characteristic vector sequence of the candidate answer by using a preset text similarity calculation formula to obtain a first characteristic vector similarity score matrix.
Preferably, the determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix includes:
screening a preset number of feature information meeting preset important conditions from the first feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a first matching factor.
Preferably, the calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information includes:
and carrying out weighted summation calculation on the first matching factor and the second matching factor of any candidate information to obtain a matching value of the candidate information.
Preferably, before receiving the customer question, the method further includes:
presetting a deep learning model and a calculation rule for calculating a matching value of candidate information according to a matching factor, wherein the deep learning model is used for calculating a first matching factor of a customer question and a candidate answer and a second matching factor of the customer question and the candidate question;
the preset process of the deep learning model is realized by training the deep learning model, and the process of training the deep learning model specifically comprises the following steps:
acquiring at least two training candidate information corresponding to a training client question, wherein each training candidate information comprises a training candidate question and a training candidate answer;
respectively acquiring a training client problem and a feature vector sequence of the at least two training candidate information based on the deep learning model;
obtaining a first training feature vector similarity score matrix according to the feature vector sequence of the training client question and the feature vector sequence of the training candidate answer based on the deep learning model;
obtaining a second training feature vector similarity score matrix based on the deep learning model, the feature vector sequence of the training client problem and the feature vector sequence of the training candidate problem;
screening feature information of which the preset number meets preset important conditions from the first training feature vector similarity score matrix and the second training feature vector similarity score matrix based on a preset screening algorithm of the deep learning model to form training text feature vectors;
performing semantic matching classification judgment on the training text feature vector based on the classifier of the deep learning model, training parameters of the deep learning model by using a gradient descent method on the obtained prediction result, and outputting a training result;
and when the training result meets a preset condition, recording parameters of the deep learning model, so that the deep learning model determines a reply answer to the customer question based on the parameters.
The present application further provides a computer-readable medium having stored thereon a computer program adapted to perform, when executed on a data processing device, a procedure for initializing the following method steps:
receiving a customer question;
acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question;
respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information;
calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
Preferably, calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question respectively according to the candidate information includes:
respectively obtaining a feature vector sequence of a customer question, a candidate question and a candidate answer, wherein the feature vector sequence has context local features;
obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix;
and obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix.
Preferably, the obtaining the feature vector sequences of the customer question, the candidate question and the candidate answer respectively comprises:
according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
and capturing context local characteristics of the client question word vector sequence, the candidate question word vector sequence and the candidate answer word vector sequence by utilizing a preset bidirectional long-short time memory network to respectively obtain the client question, the candidate question and the candidate answer feature vector sequence.
Preferably, the obtaining a first eigenvector similarity score matrix according to the eigenvector sequence of the customer question and the eigenvector sequence of the candidate answer includes:
and calculating the characteristic vector sequence of the customer question and the characteristic vector sequence of the candidate answer by using a preset text similarity calculation formula to obtain a first characteristic vector similarity score matrix.
Preferably, the determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix includes:
screening a preset number of feature information meeting preset important conditions from the first feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a first matching factor.
Preferably, the calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information includes:
and carrying out weighted summation calculation on the first matching factor and the second matching factor of any candidate information to obtain a matching value of the candidate information.
Preferably, before receiving the customer question, the method further includes:
presetting a deep learning model and a calculation rule for calculating a matching value of candidate information according to a matching factor, wherein the deep learning model is used for calculating a first matching factor of a customer question and a candidate answer and a second matching factor of the customer question and the candidate question;
the preset process of the deep learning model is realized by training the deep learning model, and the process of training the deep learning model specifically comprises the following steps:
acquiring at least two training candidate information corresponding to a training client question, wherein each training candidate information comprises a training candidate question and a training candidate answer;
respectively acquiring a training client problem and a feature vector sequence of the at least two training candidate information based on the deep learning model;
obtaining a first training feature vector similarity score matrix according to the feature vector sequence of the training client question and the feature vector sequence of the training candidate answer based on the deep learning model;
obtaining a second training feature vector similarity score matrix based on the deep learning model, the feature vector sequence of the training client problem and the feature vector sequence of the training candidate problem;
screening feature information of which the preset number meets preset important conditions from the first training feature vector similarity score matrix and the second training feature vector similarity score matrix based on a preset screening algorithm of the deep learning model to form training text feature vectors;
performing semantic matching classification judgment on the training text feature vector based on the classifier of the deep learning model, training parameters of the deep learning model by using a gradient descent method on the obtained prediction result, and outputting a training result;
and when the training result meets a preset condition, recording parameters of the deep learning model, so that the deep learning model determines a reply answer to the customer question based on the parameters.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the device provided by the embodiment, the description is relatively simple because the device corresponds to the method provided by the embodiment, and the relevant points can be referred to the method part for description.
The previous description of the provided embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features provided herein.

Claims (8)

1. A question-answer text semantic matching method is characterized by comprising the following steps:
receiving a customer question;
acquiring at least two candidate messages corresponding to the customer questions according to the customer questions, wherein each candidate message comprises a candidate answer and a candidate question;
respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information; the calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question respectively according to the candidate information comprises:
according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
capturing context local characteristics of a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence by using a preset two-way long-and-short-time memory network to respectively obtain a client question, a candidate question and a candidate answer feature vector sequence, wherein the feature vector sequence has context local characteristics;
obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix; obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix;
calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
and selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the client question.
2. The method of claim 1, wherein obtaining a first eigenvector similarity score matrix from the eigenvector sequence for the customer question and the eigenvector sequence for the candidate answer comprises:
and calculating the characteristic vector sequence of the customer question and the characteristic vector sequence of the candidate answer by using a preset text similarity calculation formula to obtain a first characteristic vector similarity score matrix.
3. The method of claim 1, wherein determining a first matching factor for the customer question and the candidate answer based on the first eigenvector similarity score matrix comprises:
screening a preset number of feature information meeting preset important conditions from the first feature vector similarity score matrix by adopting a preset screening algorithm to form a text feature vector;
and performing semantic matching two-classification judgment on the text feature vector, and taking the semantic matching probability corresponding to the judgment result as a first matching factor.
4. The method of claim 1, wherein calculating the matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information comprises:
and carrying out weighted summation calculation on the first matching factor and the second matching factor of any candidate information to obtain a matching value of the candidate information.
5. The method of claim 1, wherein prior to receiving the customer issue, further comprising:
presetting a deep learning model and a calculation rule for calculating a matching value of candidate information according to a first matching factor and a second matching factor, wherein the deep learning model is used for calculating the first matching factor of a customer question and a candidate answer and the second matching factor of the customer question and the candidate question;
the preset process of the deep learning model is realized by training the deep learning model, and the process of training the deep learning model comprises the following steps:
acquiring at least two training candidate information corresponding to a training client question, wherein each training candidate information comprises a training candidate question and a training candidate answer;
respectively acquiring a training client problem and a feature vector sequence of the at least two training candidate information based on the deep learning model;
obtaining a first training feature vector similarity score matrix according to the feature vector sequence of the training client question and the feature vector sequence of the training candidate answer based on the deep learning model;
obtaining a second training feature vector similarity score matrix based on the deep learning model, the feature vector sequence of the training client problem and the feature vector sequence of the training candidate problem;
screening feature information of which the preset number meets preset important conditions from the first training feature vector similarity score matrix and the second training feature vector similarity score matrix based on a preset screening algorithm of the deep learning model to form training text feature vectors;
performing semantic matching classification judgment on the training text feature vector based on the classifier of the deep learning model, training parameters of the deep learning model by using a gradient descent method on the obtained prediction result, and outputting a training result;
and when the training result meets a preset condition, recording parameters of the deep learning model, so that the deep learning model determines a reply answer to the customer question based on the parameters.
6. An apparatus for semantic matching of question and answer text, comprising:
the receiving module is used for receiving the customer questions;
the acquisition module is used for acquiring at least two candidate information corresponding to the customer questions according to the customer questions, wherein any one of the candidate information comprises at least two factors;
the first calculation module is used for respectively calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question according to the candidate information; the calculating a first matching factor of the customer question and the candidate answer and a second matching factor of the customer question and the candidate question respectively according to the candidate information comprises:
according to a preset professional dictionary and word segmentation rules, performing word segmentation processing on the client question, the candidate question and the candidate answer respectively to obtain a client question phrase, a candidate question phrase and a candidate answer phrase;
respectively carrying out word vector conversion on the client question word group, the candidate question word group and the candidate answer word group to obtain a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence;
capturing context local characteristics of a client question word vector sequence, a candidate question word vector sequence and a candidate answer word vector sequence by using a preset two-way long-and-short-time memory network to respectively obtain a client question, a candidate question and a candidate answer feature vector sequence, wherein the feature vector sequence has context local characteristics;
obtaining a first feature vector similarity score matrix according to the feature vector sequence of the customer question and the feature vector sequence of the candidate answer, and determining a first matching factor of the customer question and the candidate answer according to the first feature vector similarity score matrix; obtaining a second eigenvector similarity score matrix according to the eigenvector sequence of the customer problem and the eigenvector sequence of the candidate problem, and determining a second matching factor of the customer problem and the candidate problem according to the second eigenvector similarity score matrix;
a second calculation module for calculating a matching value corresponding to each candidate information according to the first matching factor and the second matching factor of each candidate information;
and the selection module is used for selecting the candidate answer in the candidate information with the maximum matching value as the reply answer of the customer question.
7. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out a method of question-answer text semantic matching according to any one of claims 1 to 5.
8. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of question-and-answer text semantic matching according to any one of claims 1 to 5.
CN201810718708.9A 2018-06-29 2018-06-29 Question and answer text semantic matching method and device Active CN108920654B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810718708.9A CN108920654B (en) 2018-06-29 2018-06-29 Question and answer text semantic matching method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810718708.9A CN108920654B (en) 2018-06-29 2018-06-29 Question and answer text semantic matching method and device

Publications (2)

Publication Number Publication Date
CN108920654A CN108920654A (en) 2018-11-30
CN108920654B true CN108920654B (en) 2021-10-29

Family

ID=64423529

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810718708.9A Active CN108920654B (en) 2018-06-29 2018-06-29 Question and answer text semantic matching method and device

Country Status (1)

Country Link
CN (1) CN108920654B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109582970B (en) * 2018-12-12 2023-05-30 科大讯飞华南人工智能研究院(广州)有限公司 Semantic measurement method, semantic measurement device, semantic measurement equipment and readable storage medium
CN109800292A (en) * 2018-12-17 2019-05-24 北京百度网讯科技有限公司 The determination method, device and equipment of question and answer matching degree
CN109597881B (en) * 2018-12-17 2021-07-23 北京百度网讯科技有限公司 Matching degree determination method, device, equipment and medium
CN109726396A (en) * 2018-12-20 2019-05-07 泰康保险集团股份有限公司 Semantic matching method, device, medium and the electronic equipment of question and answer text
CN109918673B (en) * 2019-03-14 2021-08-03 湖北亿咖通科技有限公司 Semantic arbitration method and device, electronic equipment and computer-readable storage medium
CN110134775B (en) * 2019-05-10 2021-08-24 中国联合网络通信集团有限公司 Question and answer data generation method and device and storage medium
CN110347813B (en) * 2019-06-26 2021-09-17 北京大米科技有限公司 Corpus processing method and device, storage medium and electronic equipment
WO2020258506A1 (en) * 2019-06-27 2020-12-30 平安科技(深圳)有限公司 Text information matching degree detection method and apparatus, computer device and storage medium
CN110399473B (en) * 2019-06-28 2023-08-29 创新先进技术有限公司 Method and device for determining answers to user questions
CN110489730A (en) * 2019-08-14 2019-11-22 腾讯科技(深圳)有限公司 Text handling method, device, terminal and storage medium
CN111753062A (en) * 2019-11-06 2020-10-09 北京京东尚科信息技术有限公司 Method, device, equipment and medium for determining session response scheme
CN111026840B (en) * 2019-11-26 2023-10-13 腾讯科技(深圳)有限公司 Text processing method, device, server and storage medium
WO2021128044A1 (en) * 2019-12-25 2021-07-01 深圳市优必选科技股份有限公司 Multi-turn conversation method and apparatus based on context, and device and storage medium
CN111309878B (en) * 2020-01-19 2023-08-22 支付宝(杭州)信息技术有限公司 Search type question-answering method, model training method, server and storage medium
CN111259130B (en) * 2020-02-14 2023-04-07 支付宝(杭州)信息技术有限公司 Method and apparatus for providing reply sentence in dialog
CN112231456B (en) * 2020-10-15 2024-02-23 泰康保险集团股份有限公司 Question generation method, device, storage medium and electronic equipment
CN112434514B (en) * 2020-11-25 2022-06-21 重庆邮电大学 Multi-granularity multi-channel neural network based semantic matching method and device and computer equipment
CN112989001B (en) * 2021-03-31 2023-05-26 建信金融科技有限责任公司 Question and answer processing method and device, medium and electronic equipment
WO2022226879A1 (en) * 2021-04-29 2022-11-03 京东方科技集团股份有限公司 Question and answer processing method and apparatus, electronic device, and computer-readable storage medium
CN113157868B (en) * 2021-04-29 2022-11-11 青岛海信网络科技股份有限公司 Method and device for matching answers to questions based on structured database

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105989040A (en) * 2015-02-03 2016-10-05 阿里巴巴集团控股有限公司 Intelligent question-answer method, device and system

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102236677A (en) * 2010-04-28 2011-11-09 北京大学深圳研究生院 Question answering system-based information matching method and system
CN102903008B (en) * 2011-07-29 2016-05-18 国际商业机器公司 For the method and system of computer question and answer
CN102609500A (en) * 2012-02-01 2012-07-25 北京百度网讯科技有限公司 Question push method, question answering system using same and search engine
CN104133817A (en) * 2013-05-02 2014-11-05 深圳市世纪光速信息技术有限公司 Online community interaction method and device and online community platform
CN103544216B (en) * 2013-09-23 2017-06-06 Tcl集团股份有限公司 The information recommendation method and system of a kind of combination picture material and keyword
US20170212872A1 (en) * 2016-01-22 2017-07-27 International Business Machines Corporation Duplicate post handling with natural language processing
CN107315772B (en) * 2017-05-24 2019-08-16 北京邮电大学 The problem of based on deep learning matching process and device
CN107239574B (en) * 2017-06-29 2018-11-02 北京神州泰岳软件股份有限公司 A kind of intelligent Answer System knowledge-matched method and device of problem
CN107741976B (en) * 2017-10-16 2021-07-09 泰康保险集团股份有限公司 Intelligent response method, device, medium and electronic equipment
CN107818164A (en) * 2017-11-02 2018-03-20 东北师范大学 A kind of intelligent answer method and its system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105989040A (en) * 2015-02-03 2016-10-05 阿里巴巴集团控股有限公司 Intelligent question-answer method, device and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
社区问答搜索中排序方法的研究;伍浩铖;《中国优秀博硕士学位论文全文数据库(博士) 信息科技辑》;20170915;全文 *
问答系统的答案优化方法研究相;相洋;《中国博士学位论文全文数据库 信息科技辑》;20180115;全文 *

Also Published As

Publication number Publication date
CN108920654A (en) 2018-11-30

Similar Documents

Publication Publication Date Title
CN108920654B (en) Question and answer text semantic matching method and device
US11232141B2 (en) Method and device for processing an electronic document
US11610064B2 (en) Clarification of natural language requests using neural networks
US20170193086A1 (en) Methods, devices, and systems for constructing intelligent knowledge base
CN109978060B (en) Training method and device of natural language element extraction model
US20180150607A1 (en) Synthetic ground truth expansion
CN110674292B (en) Man-machine interaction method, device, equipment and medium
CN113157863B (en) Question-answer data processing method, device, computer equipment and storage medium
CN112287089B (en) Classification model training and automatic question-answering method and device for automatic question-answering system
US20200364216A1 (en) Method, apparatus and storage medium for updating model parameter
RU2730449C2 (en) Method of creating model for analysing dialogues based on artificial intelligence for processing user requests and system using such model
CN112527970A (en) Data dictionary standardization processing method, device, equipment and storage medium
CN109597982B (en) Abstract text recognition method and device
CN112749737A (en) Image classification method and device, electronic equipment and storage medium
CN108733694B (en) Retrieval recommendation method and device
CN112667803A (en) Text emotion classification method and device
CN116720214A (en) Model training method and device for privacy protection
CN111666770B (en) Semantic matching method and device
CN111783453B (en) Text emotion information processing method and device
CN114398482A (en) Dictionary construction method and device, electronic equipment and storage medium
CN112579774A (en) Model training method, model training device and terminal equipment
CN111400413A (en) Method and system for determining category of knowledge points in knowledge base
CN110955755A (en) Method and system for determining target standard information
CN116227598B (en) Event prediction method, device and medium based on dual-stage attention mechanism
CN117076670A (en) Text recognition method and device, processor and electronic equipment

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
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Floor 36, Zheshang Building, No. 718 Jianshe Avenue, Jiang'an District, Wuhan, Hubei 430019

Patentee after: TK.CN INSURANCE Co.,Ltd.

Patentee after: TAIKANG INSURANCE GROUP Co.,Ltd.

Address before: Taikang Life Building, 156 fuxingmennei street, Xicheng District, Beijing 100031

Patentee before: TAIKANG INSURANCE GROUP Co.,Ltd.

Patentee before: TK.CN INSURANCE Co.,Ltd.

CP03 Change of name, title or address