WO2020232877A1 - 一种问题答案选取方法、装置、计算机设备及存储介质 - Google Patents

一种问题答案选取方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2020232877A1
WO2020232877A1 PCT/CN2019/102923 CN2019102923W WO2020232877A1 WO 2020232877 A1 WO2020232877 A1 WO 2020232877A1 CN 2019102923 W CN2019102923 W CN 2019102923W WO 2020232877 A1 WO2020232877 A1 WO 2020232877A1
Authority
WO
WIPO (PCT)
Prior art keywords
vector
answer
question
target
potential
Prior art date
Application number
PCT/CN2019/102923
Other languages
English (en)
French (fr)
Inventor
王健宗
程宁
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020232877A1 publication Critical patent/WO2020232877A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Definitions

  • This application relates to the field of deep learning technology, and in particular to a method, device, computer equipment and storage medium for selecting answers to questions.
  • Intelligent question answering is a long-term research topic in the field of artificial intelligence.
  • a user asks a question
  • question is determined through technical means such as speech recognition and semantic recognition
  • multiple potential answers related to the question can often be searched from the preset answer database.
  • these Potential answers are provided to users as the final answer to the question, which is obviously difficult to meet the needs of users.
  • the embodiments of the present application provide a method, a device, a computer device, and a storage medium for selecting a question answer to solve the problem of how to find the best answer from multiple potential answers.
  • a method for selecting answers to questions including:
  • the potential answer corresponding to the selected one potential answer vector is determined as the final answer of the target question.
  • a question answer selection device including:
  • the target question obtaining module is used to obtain the target question of the answer to be matched
  • Potential answer obtaining module used to obtain each potential answer
  • the vectorization module is used to perform vectorization processing on the target question and each potential answer respectively to obtain the target question vector and each potential answer vector;
  • the model recognition module is used to input the target question vector and each potential answer vector as input to the pre-trained deep learning model for each potential answer vector to obtain a match corresponding to each potential answer vector Probability, the matching probability characterizing the probability that the potential answer corresponding to each potential answer vector matches the target question;
  • the answer vector selection module is used to select a potential answer vector with the largest matching probability from the various potential answer vectors
  • the final answer determination module is used to determine the selected potential answer corresponding to the one potential answer vector as the final answer of the target question.
  • a computer device including a memory, a processor, and computer-readable instructions stored in the memory and capable of running on the processor, and the processor implements the method for selecting answers to the above questions when the processor executes the computer-readable instructions A step of.
  • One or more readable storage media storing computer readable instructions, and the computer readable storage medium storing computer readable instructions to enable the one or more processors to execute the steps of the method for selecting answers to questions.
  • FIG. 1 is a schematic diagram of an application environment of a method for selecting a question answer in an embodiment of the present application
  • FIG. 2 is a flowchart of a method for selecting answers to questions in an embodiment of the present application
  • step 103 is a schematic flowchart of step 103 of the method for selecting an answer to a question in an embodiment of the present application in an application scenario;
  • FIG. 4 is a schematic flow diagram of pre-training a deep learning model in an application scenario in a method for selecting an answer to a question in an embodiment of the present application;
  • FIG. 5 is a schematic flowchart of step 304 of the method for selecting a question answer in an embodiment of the present application in an application scenario
  • FIG. 6 is a schematic flowchart of step 104 of the method for selecting a question answer in an embodiment of the present application in an application scenario
  • FIG. 7 is a schematic structural diagram of an application scenario of the question answer selection device in an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of another application scenario of the question answer selection device in an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a feature clustering module in an embodiment of the present application.
  • Fig. 10 is a schematic diagram of a computer device in an embodiment of the present application.
  • the method for selecting answers to questions provided in this application can be applied in the application environment as shown in Figure 1, where the client communicates with the server through the network.
  • the client can be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • the server can be implemented as an independent server or a server cluster composed of multiple servers.
  • a method for selecting answers to questions is provided.
  • the method is applied to the server in FIG. 1 as an example for description, including the following steps:
  • the server can obtain the target question of the answer to be matched according to actual use needs or application scenarios. For example, it may be that the user asks a question through the client, and the server determines the real question that the user wants to ask after analyzing and confirming the question.
  • the real question is the target question mentioned in this embodiment; or, it may be through a third party
  • the system is docked with the server.
  • the third-party system needs to find the best answer to the question, it provides the question and multiple potential answers corresponding to it to the server, so that the server can obtain the question as the target question of the answer to be matched.
  • the server After the server obtains the target question of the answer to be matched, it can also obtain each potential answer corresponding to the target question. These potential answers may come from the server itself. For example, the server can obtain real questions by analyzing user questions. Answers related to the real question are retrieved from the docked answer database as potential answers; or, these potential answers may be answers provided by the third-party system while providing the server with the question.
  • each potential answer should be an answer highly related to the target question.
  • the server After obtaining the target question and each potential answer, in order to facilitate subsequent deep learning model identification, the server needs to vectorize the target question and each potential answer to obtain the target question vector and each potential answer vector. Specifically, the server may record the target question and each potential answer in the form of a matrix. For each target question or the matrix corresponding to each potential answer, each word in the text can be mapped to one of the matrixes. Row vector.
  • step 103 may include:
  • each target text For each target text, convert each target word in each target text into a GloVe (Global Vectors for Word Representation) word vector to obtain an initial vector.
  • the target text is the target question or the target word. Describe potential answers;
  • the initial vector is a target vector corresponding to each target text, and the target vector is the target question vector or the potential answer vector;
  • the full name of GloVe is Global Vectors for Word Representation. It is an existing word representation tool based on global word frequency statistics (count-based&overall statistics). It can express a word as a real number. Vector.
  • the server uses GloVe to convert each target word in the target text into a word vector, thereby obtaining an initial question vector.
  • the target text mentioned here refers to the text of the target question or potential answer.
  • step 202 considering that the target text may contain proper nouns, such as name, location, etc., these proper nouns are difficult to be fully covered by GloVe. Therefore, the server can determine whether the target words are all covered by the GloVe word vector, and if all target words in the target text are covered, step 203 can be executed to directly determine that the initial vector is the target vector; Conversely, if each target word in the target text is not fully covered, the subsequent steps 204 and 205 need to be performed.
  • the server can determine that the initial vector is the target vector corresponding to each target text.
  • the target vector is the target question vector or the potential answer vector.
  • the server can convert the target words not covered by the GloVe word vector into a TransE word vector to obtain a supplementary vector.
  • TransE also known as the knowledge base method, is an existing algorithm model for effective learning of proper nouns, which can convert learned words into distributed vector representations.
  • the server can use TransE to perform vector conversion on the target words not covered by the GloVe word vector to obtain a supplementary vector.
  • step 205 it can be known that after obtaining the supplementary vector, the server can use the supplementary vector to add to the initial vector to fill in the lack of the initial vector, thereby obtaining the target vector corresponding to the target text.
  • the server uses GloVe to convert “dining” and "?” into word vectors, which are [1234] and [1235], respectively.
  • the server uses TransE to convert it into a word vector, and obtains [1236].
  • [1236] is added to [1234] and [1235] to get the target vector as [1236], [1234] and [1235], where the target vector can be expressed in the form of a one-dimensional vector, namely [1236], [1234] and [1235] are merged into [123612341235] as the target vector, which can also be expressed in the form of a two-dimensional vector, that is, [1236], [1234] and [1235] are respectively used as a row vector of a two-dimensional vector to obtain
  • the target vector is:
  • each potential answer vector For each potential answer vector, input the target question vector and each potential answer vector as input to a pre-trained deep learning model to obtain a matching probability corresponding to each potential answer vector, and The matching probability characterizes the probability that the potential answer corresponding to each potential answer vector matches the target question;
  • the target question vector and each potential answer vector can be input to the pre-trained
  • the deep learning model obtains the matching probability corresponding to each potential answer vector.
  • the matching probability characterizes the probability that the potential answer corresponding to each potential answer vector matches the target question. The greater the matching probability corresponding to a certain potential answer vector, the greater the potential answer corresponding to the potential answer vector The more matched the target question is, the more the potential answer corresponding to the potential answer vector can be considered to meet the user's needs in terms of user experience.
  • the deep learning model includes three parts: a hierarchical cyclic encoder, a feature clustering network, and a similarity calculation network.
  • the deep learning model can be pre-trained through the following steps:
  • each pair of question and answer samples includes a sample question and a standard answer corresponding to the sample question;
  • the hierarchical cyclic encoder is composed of two single-layer GRU neural networks.
  • each pair of question answer samples includes a sample question and a standard answer corresponding to the sample question.
  • the standard answer mentioned here refers to an answer that can answer the sample question after confirmation and review. In this embodiment, it can be considered that the standard answer is the most correct answer to the sample question.
  • the server can vectorize the sample questions and standard answers in each pair of question and answer samples for each pair of question and answer samples to obtain the sample question vector sum of each pair of question and answer samples.
  • the standard answer vector, the content of the vectorization processing will not be described here, and the details can be referred to step 103.
  • the layered cyclic encoder is composed of two single-layer GRU (Gated Recurrent Unit) neural networks.
  • the GRU neural network mentioned here is a variant of the cyclic neural network RNN. Compared with the RNN network, it is easy to forget the long-term data.
  • the GRU neural network has a more prominent performance in processing long texts and long vectors, which can be to a certain extent Solve the problem of being forgotten in long texts.
  • the server For the sample question vector of each pair of question and answer samples, the server first inputs the sample question vector into the first layer single-layer GRU neural network to update the vector state information to obtain the output vector of the first layer single-layer GRU neural network , Recorded as the first vector here.
  • the text paragraph of a sample question can be divided into c text blocks, each text block assumes a total of t words, the vector corresponding to each word is recorded as a vector block, the sample question vector corresponding to the sample question It consists of c*t vector blocks.
  • the server can input each vector block of the sample problem vector one by one into the first-layer single-layer GRU neural network, and obtain each first vector block after updating the state information for each vector block, denoted as c is the number of the text block, and t is the position of the word in the current text block. After getting c*t first vector block After that, the server then converts the first vector block corresponding to the last word in each text block Input one by one to the second single-layer GRU neural network to obtain each second vector block, which can be recorded as T represents the number at the Tth position in each vector block.
  • These second vector blocks constitute the problem feature vector corresponding to the sample problem vector.
  • the standard answer vector for each pair of question and answer samples is basically the same as the above processing process.
  • the server can input each vector block of the standard answer vector into the first layer of single-layer GRU neural network one by one, and obtain the corresponding vector block
  • Each third vector block after updating the status information is denoted as
  • the server then divides the first vector block corresponding to the last word in each text block Input one by one to the second single-layer GRU neural network to obtain each fourth vector block, which can be recorded as
  • These fourth vector blocks constitute the answer feature vector corresponding to the standard answer vector.
  • the first-layer single-layer GRU neural network and the second-layer single-layer GRU neural network in this embodiment may be a single-layer GRU neural network containing 200 hidden units.
  • the gradient cut value can be used to calculate the update compensation of the layered cyclic encoder during encoding by Adam optimizer, which is compared with commonly used
  • the gradient descent algorithm has better performance.
  • step 304 for the answer feature vector calculated in step 303, considering that the text length of the answer is generally longer than that of the question, it can be considered that the text of the answer has enough information for feature clustering calculation. Therefore, in this embodiment, step 304 needs to be performed for the answer feature vector, and step 304 is not required for the question feature vector calculated for step 303.
  • step 304 may include:
  • each feature vector block in each feature vector block calculates the similarity between each feature vector block and each preset feature category vector to obtain each similarity value, where each feature vector block refers to In each pair of question and answer samples, the corresponding partial vector of each word of the standard answer in the answer feature vector;
  • each feature vector block mentioned here is the aforementioned fourth vector block
  • This embodiment also presets each preset feature category vector, which can be specifically represented by a feature category matrix m.
  • m can be 64*4.
  • 64 represents a one-dimensional vector with 64 elements corresponding to each feature category, and 4 is a preset Set the number of feature categories.
  • each feature vector block can be dot-multiplied by each preset feature category vector, and the formula is expressed as Where k is the number of the feature category, the result obtained after dot multiplication is calculated by the softmax function to obtain the similarity value of each feature vector block and each preset feature category vector, the formula is expressed as
  • the feature vector block e u,A after the cluster update corresponding to each feature vector block can be expressed by the following formula:
  • K is the number of preset feature categories.
  • step 403 it can be understood that after the server calculates the feature vector block corresponding to each feature vector block and after clustering is updated, since each feature vector block is only a part of the vector corresponding to the standard answer, the server can change The cluster update feature vector blocks corresponding to the respective feature vector blocks are combined to obtain the answer feature vector after the cluster update for each pair of question and answer samples. It can also be considered that these feature vector blocks are organized as one The answer feature vector corresponding to the standard answer after clustering update.
  • the similarity calculation network can calculate the similarity between the two as the difference between the two.
  • the matching probability it can be seen that the higher the similarity, the more matching the two; on the contrary, the lower the similarity, the less matching the two.
  • the similarity calculation network can be expressed by the following formula:
  • P is the similarity value
  • M and b are the network parameters of the similarity calculation network
  • is the sigmoid function.
  • e u,A are the question feature vector output by the hierarchical cyclic encoder and the answer feature vector after the cluster update obtained in step 304 , respectively.
  • step 306 it is understandable that it can be considered that there is a 100% match between the sample question and the standard answer in each pair of questionnaire samples, and the theoretical matching probability between the two should be 100%, which is 1. Therefore, during the training process, the server can adjust the network parameters of the hierarchical cyclic encoder, the feature clustering network, and the similarity calculation network with the sample matching probability corresponding to each pair of question and answer samples as the adjustment target. , The error between the sample matching probability corresponding to each pair of question and answer samples and 1 is minimized, that is, the sample matching probability corresponding to each pair of question answer samples is as close to or equal to 1 as possible.
  • step 307 after completing the above steps 302-306 for each pair of question and answer samples, it can be determined that the error between the sample matching probability of each pair of question and answer samples and 1 satisfies the preset training termination condition. If it is satisfied, it is stated Each network parameter in the deep learning model has been adjusted in place, and it can be determined that the deep learning model has been trained; otherwise, if it is not satisfied, it means that each network parameter in the deep learning model has not been adjusted in place, and it still needs to continue training.
  • the training termination condition can be preset according to actual usage conditions.
  • the training termination condition can be set as follows: if the error between the sample matching probability of each pair of question and answer samples and 1 is less than the specified error value, It is considered that it meets the preset training termination condition. Or, it can also be set to: use the question and answer samples in the verification set to perform the above steps 302-306. If the error between the sample matching probability output by the deep learning model and 1 is within a certain range, it is considered to meet the preset Training termination conditions.
  • the collection of question and answer samples in the verification set is similar to the above step 301. Specifically, after step 301 is performed to collect multiple pairs of question and answer samples, a certain proportion of the collected question and answer samples are divided into the training set, and the remaining questions and answers The sample is divided into validation sets.
  • 80% of the collected question and answer samples can be randomly divided as the training set samples for the subsequent training of the deep learning model, and the other 20% can be divided into the subsequent verification of whether the deep learning model has been trained, that is, whether the preset training termination is satisfied A sample of the validation set of the condition.
  • a pair of question and answer samples can be extracted, and 9 wrong answers can be created for the sample questions of the question and answer sample, which is composed of 1 sample question and 10 Answers (1 standard answer and 9 wrong answers) form the test set.
  • 9 wrong answers can be created for the sample questions of the question and answer sample, which is composed of 1 sample question and 10 Answers (1 standard answer and 9 wrong answers) form the test set.
  • input the 1 sample question and 10 answers into the deep learning model to obtain the matching probabilities output by the deep learning model, and check whether the matching probability corresponding to the standard answer is the largest. If so, you can It is considered that the effect of the deep learning model after training is qualified; if not, the effect of the deep learning model after training is unqualified, and the network parameters of the deep learning model may need to be re-adjusted.
  • the deep learning model includes three parts: a hierarchical cyclic encoder, a feature clustering network, and a similarity calculation network.
  • Step 104 may include:
  • each potential answer vector For each potential answer vector, input the target question vector and each potential answer vector into a hierarchical cyclic encoder for encoding, to obtain a target question feature vector and a target answer feature vector;
  • step 501 the same as the above step 303, for each potential answer vector, the server inputs the target question vector and each potential answer vector to the hierarchical cyclic encoder for encoding, to obtain the target question feature vector and the target answer Feature vector.
  • the server inputs the target question vector and each potential answer vector to the hierarchical cyclic encoder for encoding, to obtain the target question feature vector and the target answer Feature vector.
  • the encoding process of the hierarchical cyclic encoder please refer to the content of the above step 303, which is not repeated here.
  • the server may also input the target answer feature vector corresponding to each potential answer vector into the feature clustering network for feature clustering calculation, and obtain the target answer after the cluster update
  • this step is the same as the above step 304, and the process of feature clustering calculation is referred to step 304, which will not be repeated here.
  • the network specifically clusters the features of answers with enough information, digs out the information with features from the vector data corresponding to the answer text, and then joins it in the subsequent steps to participate in the calculation of the matching probability, which can overcome and improve the current situation. There is a problem of poor neural network performance.
  • the server can calculate the similarity between the target question vector and the target answer feature vector after the cluster update corresponding to each potential answer vector through the similarity calculation network.
  • the similarity value between the target question and each potential answer is obtained as the matching probability corresponding to each potential answer vector. It can be seen that, assuming there are 100 potential answers and 1 target question, step 503 finally calculates that 100 matching probabilities correspond to 100 potential answers respectively, and each matching probability reflects the corresponding potential answer and the target question. The degree of match between.
  • the server obtains the matching probability corresponding to each potential answer vector.
  • the server may also sort the potential answer vectors according to the matching probability from large to small, and select the first-ranked potential answer vector.
  • the first-ranked potential answer vector selected here is the one with the largest matching probability. Potential answer vector.
  • the server may determine the potential answer corresponding to the selected potential answer vector as the final answer of the target question. It is understandable that the selected potential answer is more compatible with the target question than other potential answers, so the potential answer can be considered as the optimal answer.
  • the target question of the answer to be matched is obtained; and each potential answer is obtained; then, the target question and each potential answer are respectively vectorized to obtain the target question vector and each potential answer vector ;
  • the target question vector and each potential answer vector are input to the pre-trained deep learning model to obtain the matching probability corresponding to each potential answer vector, so
  • the matching probability characterizes the probability that the potential answer corresponding to each potential answer vector matches the target question; further, the potential answer vector with the largest matching probability is selected from each of the potential answer vectors; finally, the The selected potential answer corresponding to the one potential answer vector is determined as the final answer of the target question.
  • this application puts the target question and each potential answer into a deep learning model through vectorization, uses the deep learning model to calculate the matching probability of the target question and each potential answer, and then takes the potential answer with the largest matching probability as the target
  • the final answer to the question realizes the screening of the best answer and can meet the user's question and answer needs in the face of multiple potential answers.
  • a question answer selection device is provided, and the question answer selection device corresponds to the question answer selection method in the above-mentioned embodiment one by one.
  • the question answer selection device includes a target question acquisition module 601, a potential answer acquisition module 602, a vectorization module 603, a model recognition module 604, an answer vector selection module 605, and a final answer determination module 606.
  • the detailed description of each functional module is as follows:
  • the target question obtaining module 601 is used to obtain the target question of the answer to be matched;
  • the potential answer obtaining module 602 is used to obtain each potential answer
  • the vectorization module 603 is configured to perform vectorization processing on the target question and each potential answer respectively to obtain the target question vector and each potential answer vector;
  • the model recognition module 604 is configured to input the target question vector and each potential answer vector as input to a pre-trained deep learning model for each potential answer vector, and obtain the corresponding value for each potential answer vector Matching probability, the matching probability characterizing the probability that the potential answer corresponding to each potential answer vector matches the target question;
  • the answer vector selection module 605 is configured to select a potential answer vector with the largest matching probability from the various potential answer vectors;
  • the final answer determining module 606 is configured to determine the potential answer corresponding to the selected one of the potential answer vectors as the final answer of the target question.
  • the deep learning model includes three parts: a hierarchical cyclic encoder, a feature clustering network, and a similarity calculation network.
  • the deep learning model can be pre-trained through the following modules:
  • the question and answer sample collection module 607 is configured to collect multiple pairs of question and answer samples, and each pair of question and answer samples includes a sample question and a standard answer corresponding to the sample question;
  • the sample vectorization module 608 is configured to perform vectorization processing on the sample questions and standard answers in each pair of question and answer samples for each pair of question and answer samples to obtain the sample question vector and standard answer vector of each pair of question and answer samples;
  • the sample encoding module 609 is configured to input the sample question vector and the standard answer vector of each pair of question and answer samples into a hierarchical cyclic encoder for encoding to obtain a question feature vector and an answer feature vector.
  • the layered cyclic encoder consists of two Consists of a single-layer GRU neural network;
  • the feature clustering module 610 is configured to input the answer feature vector of each pair of question and answer samples into the feature clustering network to perform feature clustering calculation to obtain an updated answer feature vector;
  • the similarity value calculation module 611 is configured to calculate the similarity between the question feature vector of each pair of question answering samples and the answer feature vector after the cluster update through a similarity calculation network for each pair of question answering samples, to obtain State the similarity value between the sample question and the standard answer in each pair of Q&A samples as the sample matching probability;
  • the network parameter adjustment module 612 is configured to adjust the network parameters of the hierarchical cyclic encoder, the feature clustering network, and the similarity calculation network with the sample matching probability corresponding to each pair of question and answer samples as the adjustment target, Minimize the error between the sample matching probability corresponding to each pair of question and answer samples and 1;
  • the training completion determining module 613 is configured to determine that the deep learning model has been trained if the error between the sample matching probability of each pair of question and answer samples and 1 meets the preset training termination condition.
  • the feature clustering module 610 may include:
  • the similarity calculation unit 6101 is configured to calculate the similarity between each feature vector block and each preset feature category vector for each feature vector block in each feature vector block to obtain each similarity value.
  • Each feature vector block refers to the corresponding partial vector of each word of the standard answer in the answer feature vector in each pair of question and answer samples;
  • the weighted summation unit 6102 is configured to perform weighted summation operations on the respective similarity values and their corresponding preset feature category vectors, and connect the calculated vectors in parallel with each feature vector block to obtain the The feature vector block after cluster update corresponding to each feature vector block;
  • the feature vector combining unit 6103 is configured to combine the feature vector blocks after the cluster update corresponding to the respective feature vector blocks to obtain the answer feature vector after the cluster update of each pair of question answering samples.
  • model recognition module may include:
  • a vector coding unit for each potential answer vector, input the target question vector and each potential answer vector into a hierarchical cyclic encoder for encoding, to obtain a target question feature vector and a target answer feature vector;
  • the clustering calculation unit is configured to input the target answer feature vector corresponding to each potential answer vector into the feature clustering network to perform feature clustering calculation to obtain the target answer feature vector after cluster update;
  • the matching probability calculation unit is used to calculate the similarity between the target question vector and the target answer feature vector after cluster update corresponding to each potential answer vector through a similarity calculation network to obtain the target question and The similarity value of each potential answer is used as the matching probability corresponding to each potential answer vector.
  • the vectorization module may include:
  • the first conversion unit is used to convert each target word in each target text into a GloVe word vector for each target text, to obtain an initial vector, where the target text is the target problem or the potential answer;
  • the word judgment unit is used to judge whether each target word is covered by the GloVe word vector
  • the vector determination unit is configured to determine that the initial vector is the target vector corresponding to each target text if the judgment result of the word judgment unit is yes, and the target vector is the target problem vector or the potential Answer vector
  • the second conversion unit is configured to convert the target word not covered by the GloVe word vector into a TransE word vector if the judgment result of the word judgment unit is no to obtain a supplementary vector;
  • the vector adding unit is configured to add the supplementary vector to the initial vector to obtain a target vector corresponding to each target text.
  • the various modules in the device for selecting answers to the above questions can be implemented in whole or in part by software, hardware, and combinations thereof.
  • the foregoing modules may be embedded in the form of hardware or independent of the processor in the computer device, or may be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the foregoing modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 10.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a readable storage medium and an internal memory.
  • the readable storage medium stores an operating system, computer readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer readable instructions in the readable storage medium.
  • the database of the computer equipment is used to store the data involved in the method of selecting the answer to the question.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer-readable instructions are executed by the processor, a method for selecting answers to questions is realized.
  • the readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
  • a computer device including a memory, a processor, and computer-readable instructions stored on the memory and capable of running on the processor.
  • the processor executes the computer-readable instructions, the problem in the foregoing embodiment is realized.
  • the steps of the answer selection method for example, step 101 to step 106 shown in FIG. 2.
  • the functions of the modules/units of the device for selecting the answer to the question in the above embodiment are realized, for example, the functions of the modules 601 to 606 shown in FIG. 7. To avoid repetition, I won’t repeat them here.
  • a computer-readable storage medium In one embodiment, a computer-readable storage medium is provided.
  • the one or more computer-readable storage media store computer-readable instructions.
  • the steps of the method for selecting answers to the above questions are implemented, or the one or more readable storage media storing computer readable instructions, and the computer readable instructions are executed by one or more processors
  • the functions of each module/unit in the question answer selection device in the above-mentioned device embodiment are realized. To avoid repetition, I won’t repeat them here.
  • the readable storage medium provided in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
  • the computer-readable instructions can be stored in a computer-readable storage. In the medium, when the computer-readable instructions are executed, they may include the processes of the foregoing method embodiments.
  • any reference to memory, storage, database or other media used in the embodiments provided in this application may include and/or volatile memory.
  • the memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous chain Channel
  • memory bus Radbus direct RAM
  • RDRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • Biophysics (AREA)
  • Software Systems (AREA)
  • Biomedical Technology (AREA)
  • Databases & Information Systems (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请公开了一种问题答案选取方法、装置、计算机设备及存储介质,应用于深度学习技术领域,用于解决如何从多个潜在答案中寻找最佳答案的问题。本申请提供的方法包括:获取待匹配答案的目标问题;获取各个潜在答案;分别对目标问题和各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;针对每个潜在答案向量,将目标问题向量和每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到每个潜在答案向量对应的匹配概率,匹配概率表征了每个潜在答案向量对应的潜在答案与目标问题匹配的概率;从各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;将选取出的一个潜在答案向量对应的潜在答案确定为目标问题的最终答案。

Description

一种问题答案选取方法、装置、计算机设备及存储介质
本申请以2019年05月21日提交的申请号为201910421574.9,名称为“一种问题答案选取方法、装置、计算机设备及存储介质”的中国发明专利申请为基础,并要求其优先权。
技术领域
本申请涉及深度学习技术领域,尤其涉及一种问题答案选取方法、装置、计算机设备及存储介质。
背景技术
智能问答是人工智能领域中一个长期被研究的课题。在实际应用中,当用户提问后,经过语音识别、语义识别等技术手段确定用户的问题之后,往往可以从预设的答案数据库中搜索到与问题相关的多个潜在答案,然而,若将这些潜在答案均作为问题的最终答案提供给用户显然难以满足用户的需求。
因此,寻找一种从多个潜在答案中寻找最佳答案的方法成为本领域技术人员亟需解决的问题。
发明内容
本申请实施例提供一种问题答案选取方法、装置、计算机设备及存储介质,以解决如何从多个潜在答案中寻找最佳答案的问题。
一种问题答案选取方法,包括:
获取待匹配答案的目标问题;
获取各个潜在答案;
分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
一种问题答案选取装置,包括:
目标问题获取模块,用于获取待匹配答案的目标问题;
潜在答案获取模块,用于获取各个潜在答案;
向量化模块,用于分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
模型识别模块,用于针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
答案向量选取模块,用于从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
最终答案确定模块,用于将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述问题答案选取方法的步骤。
一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,使得所述一个或多个处理器执行上述问题答案选取方法的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出,本申请的其他特征和优点将从说明书、附图以及权利要求变得明显。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一实施例中问题答案选取方法的一应用环境示意图;
图2是本申请一实施例中问题答案选取方法的一流程图;
图3是本申请一实施例中问题答案选取方法步骤103在一个应用场景下的流程示意图;
图4是本申请一实施例中问题答案选取方法在一个应用场景下预先训练深度学习模型的流程示意图;
图5是本申请一实施例中问题答案选取方法步骤304在一个应用场景下的流程示意图;
图6是本申请一实施例中问题答案选取方法步骤104在一个应用场景下的流程示意图;
图7是本申请一实施例中问题答案选取装置一个应用场景下的结构示意图;
图8是本申请一实施例中问题答案选取装置另一个应用场景下的结构示意图;
图9是本申请一实施例中特征聚类模块的结构示意图;
图10是本申请一实施例中计算机设备的一示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请提供的问题答案选取方法,可应用在如图1的应用环境中,其中,客户端通过网络与服务器进行通信。其中,该客户端可以但不限于各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备。服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
在一实施例中,如图2所示,提供一种问题答案选取方法,以该方法应用在图1中的服务器为例进行说明,包括如下步骤:
101、获取待匹配答案的目标问题;
本实施例中,服务器可以根据实际使用的需要或者应用场景的需要获取到待匹配答案的目标问题。比如,可以是用户通过客户端提问,服务器经过对问题的分析和确认,确定出该用户想要询问的真实问题,该真实问题就是本实施例中所说的目标问题;或 者,可以通过第三方系统与服务器对接,该第三方系统需要为问题寻找最佳答案时,将该问题和与之对应的多个潜在答案提供给服务器,从而服务器可以获取到该问题作为待匹配答案的目标问题。
102、获取各个潜在答案;
服务器获取到待匹配答案的目标问题之后,可以一并获取到该目标问题对应的各个潜在答案,这些潜在答案可以是来自于服务器自身,比如上述服务器通过分析用户提问得出真实问题,服务器可以从对接的答案数据库中检索出与该真实问题相关的各个答案作为潜在答案;或者,这些潜在答案可以是第三方系统向服务器提供问题的同时一并提供的各个答案。
需要说明的是,本实施例中对服务器获取到目标问题和各个潜在答案的方式不作具体限定,但应当理解的是,所述各个潜在答案应当是与目标问题高度相关的答案。
103、分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
在得到所述目标问题和所述各个潜在答案之后,为了便于后续深度学习模型的识别,服务器需要分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量。具体地,服务器可以将所述目标问题和所述各个潜在答案以矩阵的形式记载,对于每个目标问题或每个潜在答案对应的矩阵,文本中的每个字词可以映射为矩阵中的一个行向量。
为便于理解,如图3所示,进一步地,步骤103可以包括:
201、针对每个目标文本,将所述每个目标文本中的各个目标字词分别转换为GloVe(Global Vectors for Word Representation)词向量,得到初始向量,所述目标文本为所述目标问题或所述潜在答案;
202、判断所述各个目标字词是否均被GloVe词向量覆盖,若是,则执行步骤203,若否,则执行步骤204;
203、确定所述初始向量为所述每个目标文本对应目标向量,所述目标向量为所述目标问题向量或所述潜在答案向量;
204、将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量;
205、将所述补充向量添加至所述初始向量,得到所述每个目标文本对应目标向量。
对于上述步骤201,GloVe的全称叫Global Vectors for Word Representation,它是现有一个基于全局词频统计(count-based&overall statistics)的词表征(word representation)工具,它可以把一个单词表达成一个由实数组成的向量。本实施例中,服务器使用GloVe将所述目标文本中的各个目标字词分别转换成词向量,从而得到初始问题向量。
其中,这里所说的目标文本是指目标问题或潜在答案的文本。
对于上述步骤202,考虑到目标文本中可能包含有专有名词,例如姓名、地点等,这些专有名词难以被GloVe全覆盖。因此,服务器可以判断所述各个目标字词是否均被GloVe词向量覆盖,如果该目标文本中的各个目标字词均已被覆盖,则可以执行步骤203,直接确定所述初始向量为目标向量;反之,如果该目标文本中的各个目标字词未被全覆盖,则需要执行后续步骤204和步骤205。
对于上述步骤203,由上述内容可知,若所述各个目标字词均被GloVe词向量覆盖,则服务器可以确定所述初始向量为所述每个目标文本对应目标向量。其中,目标向量为所述目标问题向量或所述潜在答案向量。
对于上述步骤204,若所述各个目标字词中任一个目标字词未被GloVe词向量覆盖,则可知该目标文本中存在无法被GloVe词向量覆盖的目标字词,为了补充这一部分的缺失,服务器可以将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量。
需要说明的,TransE,又称知识库方法,是一种现有的有效学习专有名词的算法模型,可以将学习到的字词转换为分布式向量表示。本实施例中,服务器可以采用TransE将未被GloVe词向量覆盖的目标字词进行向量转换,得到补充向量。
对于步骤205,可知,服务器在得到补充向量之后,可以使用该补充向量添加至该初始向量中,以填补初始向量的缺失,从而得到该目标文本对应的目标向量。举例说明,假设该目标文本为“小明吃饭吗”,该句子中包括“小明”、“吃饭”和“吗”三个目标字词。服务器使用GloVe将“吃饭”和“吗”转换为词向量,分别为[1234]和[1235],对于“小明”一词,服务器使用TransE将其转换为词向量,得到[1236],再将[1236]添加至[1234]和[1235]中,得到该目标向量为[1236]、[1234]和[1235],其中,该目标向量可以以一维向量的形式表达,即[1236]、[1234]和[1235]合并为[123612341235]作为该目标向量,也可以以二维向量的形式表达,即[1236]、[1234]和[1235]分别作为一个二维向量的行向量,得到目标向量为:
Figure PCTCN2019102923-appb-000001
104、针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
可以理解的是,服务器在得到所述目标问题向量和各个潜在答案向量之后,针对每个潜在答案向量,可以将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率。其中,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率,某个潜在答案向量对应的匹配概率越大,则该潜在答案向量对应的潜在答案与该目标问题越匹配,对于用户感受来说,可以认为该潜在答案向量对应的潜在答案越能满足用户的需求。
为便于理解,下面将对深度学习模型的训练过程进行详细描述。如图4所示,进一步地,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,所述深度学习模型可以通过以下步骤预先训练好:
301、收集多对问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案;
302、针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量;
303、将所述每对问答样本的样本问题向量和标准答案向量分别输入分层循环编码器进行编码,得到问题特征向量和答案特征向量,所述分层循环编码器由两个单层GRU神经网络组成;
304、将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量;
305、针对每对问答样本,通过相似度计算网络计算所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之间的相似度,得到所述每对问答样本中样本问题与标准答案的相似度值,作为样本匹配概率;
306、以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化;
307、若每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,则确定所述深度学习模型已训练好。
对于步骤301,为了更好地训练深度学习模型,可以预先收集大量的问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案。这里说的标准答案是指经过确认和审核,可以解答该样本问题的答案,在本实施例中,可以认为标准答案就是样本问题的最正确的答案。
对于步骤302,与上述步骤103同理,服务器可以针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量,此处不再对向量化处理的内容进行描述,具体可以参照步骤103。
对于步骤303,本实施例中,该所述分层循环编码器由两个单层GRU(Gated Recurrent Unit)神经网络组成。这里说的GRU神经网络是循环神经网络RNN的变种,相比RNN网络存在容易遗忘长期数据的问题,GRU神经网络在处理长文本、长向量的问题上有更加突出的表现,可以在一定程度上解决长文本中较远状态被遗忘的问题。
对于所述每对问答样本的样本问题向量,服务器首先将该样本问题向量输入到第一层单层GRU神经网络中进行对向量状态信息的更新,得到第一层单层GRU神经网络输出的向量,这里记为第一向量。在具体实现中,可以将一个样本问题的文本段落划分为c个文本块,每个文本块假设共t个单词,每个单词对应的向量记为一个向量块,该样本问题对应的样本问题向量由c*t个向量块组成。服务器可以将该样本问题向量的各个向量块逐个输入到第一层单层GRU神经网络,得到对各个向量块更新状态信息后的各个第一向量块,记为
Figure PCTCN2019102923-appb-000002
c为文本块的编号,t为单词在当前文本块中的位置。在得到c*t个第一向量块
Figure PCTCN2019102923-appb-000003
之后,服务器再将每个文本块中最后一个单词对应的第一向量块
Figure PCTCN2019102923-appb-000004
逐个输入到第二层单层GRU神经网络,得到各个第二向量块,可记为
Figure PCTCN2019102923-appb-000005
T表示每个向量块中处于第T个位置的编号。这些第二向量块组成该样本问题向量对应的问题特征向量。
同理,对于每对问答样本的标准答案向量与上述处理过程基本一致,具体地,服务器可以将该标准答案向量的各个向量块逐个输入到第一层单层GRU神经网络,得到对各个向量块更新状态信息后的各个第三向量块,记为
Figure PCTCN2019102923-appb-000006
服务器再将每个文本块中最后一个单词对应的第一向量块
Figure PCTCN2019102923-appb-000007
逐个输入到第二层单层GRU神经网络,得到各个第四向量块,可记为
Figure PCTCN2019102923-appb-000008
这些第四向量块组成该标准答案向量对应的答案特征向量。
具体地,本实施例中的第一层单层GRU神经网络和第二层单层GRU神经网络可以是含有200个隐藏单元的单层GRU神经网络。
优选地,为了优化该分层循环编码器的编码能力,合理设置其更新步长,可以采用梯度剪切值为1Adam优化器计算该分层循环编码器在编码时的更新补偿,相较于常用的梯度下降算法具有更好的性能。
对于步骤304,针对步骤303中计算出的答案特征向量,考虑到一般情况下答案的文本长度比问题的要长,可以认为答案的文本中具有足够多的信息进行特征的聚类计算。因此,本实施例中针对答案特征向量还需执行步骤304,而对步骤303计算得到问题特征向量则无需执行步骤304。
具体地,服务器在得到答案特征向量之后,可以将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量。为便于理解,如图5所示,更进一步地,步骤304可以包括:
401、针对各个特征向量块中的每个特征向量块,计算所述每个特征向量块与各个预 设特征类别向量之间的相似度,得到各个相似度值,所述各个特征向量块是指在所述每对问答样本中、标准答案的各个字词在所述答案特征向量中的对应部分向量;
402、将所述各个相似度值分别与各自对应的预设特征类别向量进行加权求和运算,并将运算得到的向量与所述每个特征向量块并联,得到所述每个特征向量块对应的、聚类更新后的特征向量块;
403、将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量。
对于上述步骤401,承接上述步骤303的内容,可知,这里所说的各个特征向量块即为上述的各个第四向量块
Figure PCTCN2019102923-appb-000009
本实施例还预先设置各个预设特征类别向量,具体可以使用特征类别矩阵m表示,比如m的大小可以为64*4,64表示每一特征类别对应64个元素的一维向量,4为预设的特征类别的数量。服务器计算所述每个特征向量块与各个预设特征类别向量之间的相似度时,可以将每个特征向量块分别与各个预设特征类别向量点乘,公式表示为
Figure PCTCN2019102923-appb-000010
其中k为特征类别的编号,点乘后得到的结果经过softmax函数计算即可得到每个特征向量块分别与各个预设特征类别向量的相似度值,公式表示为
Figure PCTCN2019102923-appb-000011
对于步骤402,具体地,所述每个特征向量块对应的、聚类更新后的特征向量块e u,A可以通过下述公式表示:
Figure PCTCN2019102923-appb-000012
其中,K为预设的特征类别的数量。
对于步骤403,可以理解的是,服务器在计算得到每个特征向量块对应的、聚类更新后的特征向量块之后,由于各个特征向量块仅为标准答案对应的向量的一部分,因此服务器可以将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量,也可以认为将这些各个特征向量块整理看作一个标准答案对应的、聚类更新后的答案特征向量。
对于步骤305,服务器在得到所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之后,即可通过相似度计算网络计算这两者的相似度作为两者之间的匹配概率,可知,相似度越高,表示两者越匹配;反之,相似度越低,表示两者越不匹配。具体地,所述相似度计算网络可以通过以下公式表示:
Figure PCTCN2019102923-appb-000013
其中,P为相似度值,M和b为该相似度计算网络的网络参数,σ是sigmoid函数。如上所述,
Figure PCTCN2019102923-appb-000014
和e u,A分别为分层循环编码器输出的问题特征向量和步骤304得到的聚类更新后的答案特征向量。
对于步骤306,可以理解的是,可以认为每对答问样本中的样本问题和标准答案之间是百分百匹配的,两者理论上的匹配概率应当为100%,也就是1。因此,在训练过程中,服务器可以以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化,也即,尽可能让所述每对问答样本对应的 样本匹配概率逼近或者等于1。
对于步骤307,在针对每对问答样本均执行完成上述步骤302-306之后,可以判断每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,若满足,则说明该深度学习模型中的各个网路参数已经调整到位,可以确定所述深度学习模型已训练好;反之,若不满足,则说明该深度学习模型中的各个网路参数尚未调整到位,仍需继续训练。其中,该训练终止条件可以根据实际使用情况预先设定,具体地,可以将该训练终止条件设定为:若每对问答样本对应的样本匹配概率与1之间的误差均小于指定误差值,则认为其满足该预设的训练终止条件。或者,也可以将其设为:使用验证集中的问答样本执行上述步骤302-306,若深度学习模型输出的样本匹配概率与1之间的误差在一定范围内,则认为其满足该预设的训练终止条件。其中,该验证集中的问答样本的收集与上述步骤301类似,具体地,可以执行上述步骤301收集得到多对问答样本后,将收集得到的问答样本中的一定比例划分为训练集,剩余的问答样本划分为验证集。比如,可以将收集得到的问答样本中随机划分80%作为后续训练深度学习模型的训练集的样本,将其它的20%划分为后续验证深度学习模型是否训练完成,也即是否满足预设训练终止条件的验证集的样本。
优选地,在实际应用中,为了测试已训练完成的深度学习模型的效果,可以提取一对问答样本,并为该问答样本的样本问题创造9个错误的答案,由这1个样本问题和10个答案(1个标准答案和9个错误答案)组成测试集。在深度学习模型训练完成之后,将这1个样本问题和10个答案输入到深度学习模型,得到深度学习模型输出的各个匹配概率,检验其中标准答案对应的匹配概率是否为最大,若是,则可以认为该深度学习模型训练后的效果合格;若否,则该深度学习模型训练后的效果不合格,可能需要重新调整深度学习模型的网络参数。
上面描述了该深度学习模型的训练过程,为便于理解,下面承接上述训练过程的内容,对步骤104使用该深度学习模型来得到目标问题向量与每个潜在答案向量之间匹配概率的过程进行详细描述。如图6所示,更进一步地,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,步骤104可以包括:
501、针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量;
502、将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量;
503、通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。
对于步骤501,与上述步骤303同理,服务器针对每个潜在答案向量,将该目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量。对于分层循环编码器的编码过程请参阅上述步骤303的内容,此处不再赘述。
对于步骤502,对于步骤501中得到目标答案特征向量,服务器还可以将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量,本步骤与上述步骤304同理,特征聚类计算的过程参阅步骤304,此处不再赘述。
可以理解的是,由于答案的文本通常比问题的文本要长,加上现有的神经网络的表现会随着文本长度增长而迅速下降,考虑到这点,该深度学习模型中的特征聚类网络特地针对具有足够多信息的答案进行特征的聚类,从答案文本对应的向量数据中深度挖掘出带有特征的信息,进而再加入到后续步骤中参与匹配概率的计算,可以克服和改善现 有神经网络表现较差的问题。
对于步骤503,与上述步骤305同理,服务器可以通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。可知,假设存在100个潜在答案,1个目标问题,则步骤503最后计算得到100个匹配概率分别与100个潜在答案一一对应,每个匹配概率反映了与之对应的潜在答案与该目标问题之间的匹配程度。
105、从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
由上述内容可知,服务器在得到所述每个潜在答案向量对应的匹配概率,为了筛选出各个潜在答案中的最优答案,先从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量。具体,服务器也可以按照匹配概率从大到小为所述各个潜在答案向量进行排序,选取出排序第一的潜在答案向量,这里选取出的排序第一的潜在答案向量也就是匹配概率最大的一个潜在答案向量。
106、将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
在选取出匹配概率最大的一个潜在答案向量之后,服务器可以将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。可以理解的是,选取出的该潜在答案相比其它潜在答案来说,与该目标问题更加匹配,因此可以认为该潜在答案为最优答案。
本申请实施例中,首先,获取待匹配答案的目标问题;并获取各个潜在答案;然后,分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;接着,针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;再之,从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;最后,将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。可见,本申请通过将目标问题和各个潜在答案向量化后投入到深度学习模型中,利用深度学习模型计算出目标问题与各个潜在答案的匹配概率,再从中取出匹配概率最大的潜在答案作为该目标问题的最终答案,实现了最佳答案的筛选,能够在面对多个潜在答案的情况下满足用户的问答需求。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
在一实施例中,提供一种问题答案选取装置,该问题答案选取装置与上述实施例中问题答案选取方法一一对应。如图7所示,该问题答案选取装置包括目标问题获取模块601、潜在答案获取模块602、向量化模块603、模型识别模块604、答案向量选取模块605和最终答案确定模块606。各功能模块详细说明如下:
目标问题获取模块601,用于获取待匹配答案的目标问题;
潜在答案获取模块602,用于获取各个潜在答案;
向量化模块603,用于分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
模型识别模块604,用于针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
答案向量选取模块605,用于从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
最终答案确定模块606,用于将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
如图8所示,进一步地,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,所述深度学习模型可以通过以下模块预先训练好:
问答样本收集模块607,用于收集多对问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案;
样本向量化模块608,用于针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量;
样本编码模块609,用于将所述每对问答样本的样本问题向量和标准答案向量分别输入分层循环编码器进行编码,得到问题特征向量和答案特征向量,所述分层循环编码器由两个单层GRU神经网络组成;
特征聚类模块610,用于将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量;
相似度值计算模块611,用于针对每对问答样本,通过相似度计算网络计算所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之间的相似度,得到所述每对问答样本中样本问题与标准答案的相似度值,作为样本匹配概率;
网络参数调整模块612,用于以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化;
训练完成确定模块613,用于若每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,则确定所述深度学习模型已训练好。
如图9所示,进一步地,所述特征聚类模块610可以包括:
相似度计算单元6101,用于针对各个特征向量块中的每个特征向量块,计算所述每个特征向量块与各个预设特征类别向量之间的相似度,得到各个相似度值,所述各个特征向量块是指在所述每对问答样本中、标准答案的各个字词在所述答案特征向量中的对应部分向量;
加权求和单元6102,用于将所述各个相似度值分别与各自对应的预设特征类别向量进行加权求和运算,并将运算得到的向量与所述每个特征向量块并联,得到所述每个特征向量块对应的、聚类更新后的特征向量块;
特征向量组合单元6103,用于将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量。
进一步地,所述模型识别模块可以包括:
向量编码单元,用于针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量;
聚类计算单元,用于将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量;
匹配概率计算单元,用于通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。
进一步地,所述向量化模块可以包括:
第一转换单元,用于针对每个目标文本,将所述每个目标文本中的各个目标字词分别转换为GloVe词向量,得到初始向量,所述目标文本为所述目标问题或所述潜在答案;
字词判断单元,用于判断所述各个目标字词是否均被GloVe词向量覆盖;
向量确定单元,用于若所述字词判断单元的判断结果为是,则确定所述初始向量为所述每个目标文本对应目标向量,所述目标向量为所述目标问题向量或所述潜在答案向量;
第二转换单元,用于若所述字词判断单元的判断结果为否,则将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量;
向量添加单元,用于将所述补充向量添加至所述初始向量,得到所述每个目标文本对应目标向量。
关于问题答案选取装置的具体限定可以参见上文中对于问题答案选取方法的限定,在此不再赘述。上述问题答案选取装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图10所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括可读存储介质、内存储器。该可读存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为可读存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储问题答案选取方法中涉及到的数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种问题答案选取方法。本实施例所提供的可读存储介质包括非易失性可读存储介质和易失性可读存储介质。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,处理器执行计算机可读指令时实现上述实施例中问题答案选取方法的步骤,例如图2所示的步骤101至步骤106。或者,处理器执行计算机可读指令时实现上述实施例中问题答案选取装置的各模块/单元的功能,例如图7所示模块601至模块606的功能。为避免重复,这里不再赘述。
在一个实施例中,提供了一种计算机可读存储介质,该一个或多个存储有计算机可读指令的可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行计算机可读指令时实现上述问题答案选取方法的步骤,或者,该一个或多个存储有计算机可读指令的可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行计算机可读指令时实现上述装置实施例中问题答案选取装置中各模块/单元的功能。为避免重复,这里不再赘述。本实施例所提供的可读存储介质包括非易失性可读存储介质和易失性可读存储介质。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括和/或易失性存储器。存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单 元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种问题答案选取方法,其特征在于,包括:
    获取待匹配答案的目标问题;
    获取各个潜在答案;
    分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
    针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
    从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
    将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
  2. 根据权利要求1所述的问题答案选取方法,其特征在于,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,所述深度学习模型通过以下步骤预先训练好:
    收集多对问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案;
    针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量;
    将所述每对问答样本的样本问题向量和标准答案向量分别输入分层循环编码器进行编码,得到问题特征向量和答案特征向量,所述分层循环编码器由两个单层GRU神经网络组成;
    将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量;
    针对每对问答样本,通过相似度计算网络计算所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之间的相似度,得到所述每对问答样本中样本问题与标准答案的相似度值,作为样本匹配概率;
    以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化;
    若每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,则确定所述深度学习模型已训练好。
  3. 根据权利要求2所述的问题答案选取方法,其特征在于,所述将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量包括:
    针对各个特征向量块中的每个特征向量块,计算所述每个特征向量块与各个预设特征类别向量之间的相似度,得到各个相似度值,所述各个特征向量块是指在所述每对问答样本中、标准答案的各个字词在所述答案特征向量中的对应部分向量;
    将所述各个相似度值分别与各自对应的预设特征类别向量进行加权求和运算,并将运算得到的向量与所述每个特征向量块并联,得到所述每个特征向量块对应的、聚类更新后的特征向量块;
    将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量。
  4. 根据权利要求2所述的问题答案选取方法,其特征在于,所述针对每个潜在答案 向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率包括:
    针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量;
    将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量;
    通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。
  5. 根据权利要求1至4中任一项所述的问题答案选取方法,其特征在于,所述分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量包括:
    针对每个目标文本,将所述每个目标文本中的各个目标字词分别转换为GloVe词向量,得到初始向量,所述目标文本为所述目标问题或所述潜在答案;
    判断所述各个目标字词是否均被GloVe词向量覆盖;
    若所述各个目标字词均被GloVe词向量覆盖,则确定所述初始向量为所述每个目标文本对应目标向量,所述目标向量为所述目标问题向量或所述潜在答案向量;
    若所述各个目标字词中任一个目标字词未被GloVe词向量覆盖,则将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量;
    将所述补充向量添加至所述初始向量,得到所述每个目标文本对应目标向量。
  6. 一种问题答案选取装置,其特征在于,包括:
    目标问题获取模块,用于获取待匹配答案的目标问题;
    潜在答案获取模块,用于获取各个潜在答案;
    向量化模块,用于分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
    模型识别模块,用于针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
    答案向量选取模块,用于从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
    最终答案确定模块,用于将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
  7. 根据权利要求6所述的问题答案选取装置,其特征在于,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,所述深度学习模型通过以下模块预先训练好:
    问答样本收集模块,用于收集多对问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案;
    样本向量化模块,用于针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量;
    样本编码模块,用于将所述每对问答样本的样本问题向量和标准答案向量分别输入分层循环编码器进行编码,得到问题特征向量和答案特征向量,所述分层循环编码器由两个单层GRU神经网络组成;
    特征聚类模块,用于将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量;
    相似度值计算模块,用于针对每对问答样本,通过相似度计算网络计算所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之间的相似度,得到所述每对问答样本中样本问题与标准答案的相似度值,作为样本匹配概率;
    网络参数调整模块,用于以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化;
    训练完成确定模块,用于若每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,则确定所述深度学习模型已训练好。
  8. 根据权利要求7所述的问题答案选取装置,其特征在于,所述特征聚类模块包括:
    相似度计算单元,用于针对各个特征向量块中的每个特征向量块,计算所述每个特征向量块与各个预设特征类别向量之间的相似度,得到各个相似度值,所述各个特征向量块是指在所述每对问答样本中、标准答案的各个字词在所述答案特征向量中的对应部分向量;
    加权求和单元,用于将所述各个相似度值分别与各自对应的预设特征类别向量进行加权求和运算,并将运算得到的向量与所述每个特征向量块并联,得到所述每个特征向量块对应的、聚类更新后的特征向量块;
    特征向量组合单元,用于将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量。
  9. 根据权利要求7所述的问题答案选取装置,其特征在于,所述模型识别模块包括:
    向量编码单元,用于针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量;
    聚类计算单元,用于将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量;
    匹配概率计算单元,用于通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。
  10. 根据权利要求6至9中任一项所述的问题答案选取装置,其特征在于,所述向量化模块包括:
    第一转换单元,用于针对每个目标文本,将所述每个目标文本中的各个目标字词分别转换为GloVe词向量,得到初始向量,所述目标文本为所述目标问题或所述潜在答案;
    字词判断单元,用于判断所述各个目标字词是否均被GloVe词向量覆盖;
    向量确定单元,用于若所述字词判断单元的判断结果为是,则确定所述初始向量为所述每个目标文本对应目标向量,所述目标向量为所述目标问题向量或所述潜在答案向量;
    第二转换单元,用于若所述字词判断单元的判断结果为否,则将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量;
    向量添加单元,用于将所述补充向量添加至所述初始向量,得到所述每个目标文本对应目标向量。
  11. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:
    获取待匹配答案的目标问题;
    获取各个潜在答案;
    分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
    针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入 至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
    从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
    将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
  12. 根据权利要求11所述的计算机设备,其特征在于,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,所述深度学习模型通过以下步骤预先训练好:
    收集多对问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案;
    针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量;
    将所述每对问答样本的样本问题向量和标准答案向量分别输入分层循环编码器进行编码,得到问题特征向量和答案特征向量,所述分层循环编码器由两个单层GRU神经网络组成;
    将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量;
    针对每对问答样本,通过相似度计算网络计算所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之间的相似度,得到所述每对问答样本中样本问题与标准答案的相似度值,作为样本匹配概率;
    以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化;
    若每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,则确定所述深度学习模型已训练好。
  13. 根据权利要求12所述的计算机设备,其特征在于,所述将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量包括:
    针对各个特征向量块中的每个特征向量块,计算所述每个特征向量块与各个预设特征类别向量之间的相似度,得到各个相似度值,所述各个特征向量块是指在所述每对问答样本中、标准答案的各个字词在所述答案特征向量中的对应部分向量;
    将所述各个相似度值分别与各自对应的预设特征类别向量进行加权求和运算,并将运算得到的向量与所述每个特征向量块并联,得到所述每个特征向量块对应的、聚类更新后的特征向量块;
    将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量。
  14. 根据权利要求12所述的计算机设备,其特征在于,所述针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率包括:
    针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量;
    将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量;
    通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。
  15. 根据权利要求11至14中任一项所述的计算机设备,其特征在于,所述分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量包括:
    针对每个目标文本,将所述每个目标文本中的各个目标字词分别转换为GloVe词向量,得到初始向量,所述目标文本为所述目标问题或所述潜在答案;
    判断所述各个目标字词是否均被GloVe词向量覆盖;
    若所述各个目标字词均被GloVe词向量覆盖,则确定所述初始向量为所述每个目标文本对应目标向量,所述目标向量为所述目标问题向量或所述潜在答案向量;
    若所述各个目标字词中任一个目标字词未被GloVe词向量覆盖,则将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量;
    将所述补充向量添加至所述初始向量,得到所述每个目标文本对应目标向量。
  16. 一个或多个存储有计算机可读指令的可读存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
    获取待匹配答案的目标问题;
    获取各个潜在答案;
    分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量;
    针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率,所述匹配概率表征了所述每个潜在答案向量对应的潜在答案与所述目标问题匹配的概率;
    从所述各个潜在答案向量中选取出匹配概率最大的一个潜在答案向量;
    将选取出的所述一个潜在答案向量对应的潜在答案确定为所述目标问题的最终答案。
  17. 根据权利要求16所述的可读存储介质,其特征在于,所述深度学习模型包括分层循环编码器、特征聚类网络和相似度计算网络三部分,所述深度学习模型通过以下步骤预先训练好:
    收集多对问答样本,每对所述问答样本包括一个样本问题和与所述样本问题对应的标准答案;
    针对每对问答样本,对所述每对问答样本中的样本问题和标准答案进行向量化处理,得到所述每对问答样本的样本问题向量和标准答案向量;
    将所述每对问答样本的样本问题向量和标准答案向量分别输入分层循环编码器进行编码,得到问题特征向量和答案特征向量,所述分层循环编码器由两个单层GRU神经网络组成;
    将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量;
    针对每对问答样本,通过相似度计算网络计算所述每对问答样本的问题特征向量与所述聚类更新后的答案特征向量之间的相似度,得到所述每对问答样本中样本问题与标准答案的相似度值,作为样本匹配概率;
    以所述每对问答样本对应的样本匹配概率为调整目标,调整所述分层循环编码器、所述特征聚类网络和所述相似度计算网络的网络参数,使得所述每对问答样本对应的样本匹配概率与1之间的误差最小化;
    若每对问答样本对应的样本匹配概率与1之间的误差满足预设的训练终止条件,则确定所述深度学习模型已训练好。
  18. 根据权利要求17所述的可读存储介质,其特征在于,所述将所述每对问答样本的答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的答案特征向量包括:
    针对各个特征向量块中的每个特征向量块,计算所述每个特征向量块与各个预设特征类别向量之间的相似度,得到各个相似度值,所述各个特征向量块是指在所述每对问答样本中、标准答案的各个字词在所述答案特征向量中的对应部分向量;
    将所述各个相似度值分别与各自对应的预设特征类别向量进行加权求和运算,并将运算得到的向量与所述每个特征向量块并联,得到所述每个特征向量块对应的、聚类更新后的特征向量块;
    将所述各个特征向量块各自对应的、聚类更新后的特征向量块组合得到所述每对问答样本的、聚类更新后的答案特征向量。
  19. 根据权利要求17所述的可读存储介质,其特征在于,所述针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量作为输入投入至预先训练好的深度学习模型,得到所述每个潜在答案向量对应的匹配概率包括:
    针对每个潜在答案向量,将所述目标问题向量和所述每个潜在答案向量分别输入分层循环编码器进行编码,得到目标问题特征向量和目标答案特征向量;
    将所述每个潜在答案向量对应的目标答案特征向量输入特征聚类网络进行特征聚类计算,得到聚类更新后的目标答案特征向量;
    通过相似度计算网络计算所述目标问题向量与所述每个潜在答案向量对应的、聚类更新后的目标答案特征向量之间的相似度,得到所述目标问题与所述每个潜在答案的相似度值,作为所述每个潜在答案向量对应的匹配概率。
  20. 根据权利要求16至19中任一项所述的可读存储介质,其特征在于,所述分别对所述目标问题和所述各个潜在答案进行向量化处理,得到目标问题向量和各个潜在答案向量包括:
    针对每个目标文本,将所述每个目标文本中的各个目标字词分别转换为GloVe词向量,得到初始向量,所述目标文本为所述目标问题或所述潜在答案;
    判断所述各个目标字词是否均被GloVe词向量覆盖;
    若所述各个目标字词均被GloVe词向量覆盖,则确定所述初始向量为所述每个目标文本对应目标向量,所述目标向量为所述目标问题向量或所述潜在答案向量;
    若所述各个目标字词中任一个目标字词未被GloVe词向量覆盖,则将未被GloVe词向量覆盖的目标字词转换为TransE词向量,得到补充向量;
    将所述补充向量添加至所述初始向量,得到所述每个目标文本对应目标向量。
PCT/CN2019/102923 2019-05-21 2019-08-28 一种问题答案选取方法、装置、计算机设备及存储介质 WO2020232877A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910421574.9 2019-05-21
CN201910421574.9A CN110287296A (zh) 2019-05-21 2019-05-21 一种问题答案选取方法、装置、计算机设备及存储介质

Publications (1)

Publication Number Publication Date
WO2020232877A1 true WO2020232877A1 (zh) 2020-11-26

Family

ID=68001959

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102923 WO2020232877A1 (zh) 2019-05-21 2019-08-28 一种问题答案选取方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN110287296A (zh)
WO (1) WO2020232877A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112836035A (zh) * 2021-03-04 2021-05-25 泰康保险集团股份有限公司 匹配数据的方法、装置、设备和计算机可读介质
CN113139043A (zh) * 2021-04-29 2021-07-20 北京百度网讯科技有限公司 问答样本生成方法、装置、电子设备和存储介质
CN113360617A (zh) * 2021-06-07 2021-09-07 北京百度网讯科技有限公司 异常识别方法、装置、设备和存储介质
CN113392253A (zh) * 2021-06-28 2021-09-14 北京百度网讯科技有限公司 视觉问答模型训练及视觉问答方法、装置、设备及介质
CN113468309A (zh) * 2021-06-30 2021-10-01 竹间智能科技(上海)有限公司 文本中的答案抽取方法以及电子设备
CN114840648A (zh) * 2022-03-21 2022-08-02 阿里巴巴(中国)有限公司 答案生成方法、装置及计算机程序产品
CN115952270A (zh) * 2023-03-03 2023-04-11 中国海洋大学 冰箱的智能问答方法、装置和存储介质

Families Citing this family (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110825852B (zh) * 2019-11-07 2022-06-14 四川长虹电器股份有限公司 面向长文本的语义匹配方法及系统
CN111026853B (zh) * 2019-12-02 2023-10-27 支付宝(杭州)信息技术有限公司 目标问题的确定方法、装置、服务器和客服机器人
CN111340218B (zh) * 2020-02-24 2022-04-15 支付宝(杭州)信息技术有限公司 一种训练问题识别模型的方法和系统
CN111339274B (zh) * 2020-02-25 2024-01-26 网易(杭州)网络有限公司 对话生成模型训练方法、对话生成方法及装置
CN111339275B (zh) * 2020-02-27 2023-05-12 深圳大学 答题信息的匹配方法、装置、服务器和存储介质
CN111767375A (zh) * 2020-05-13 2020-10-13 平安科技(深圳)有限公司 语义召回方法、装置、计算机设备及存储介质
CN111539853B (zh) * 2020-06-19 2020-11-06 支付宝(杭州)信息技术有限公司 标准案由确定方法、装置和设备
CN111782767A (zh) * 2020-06-30 2020-10-16 北京三快在线科技有限公司 问答方法、装置、设备及存储介质
CN111966796B (zh) * 2020-07-21 2022-06-14 福建升腾资讯有限公司 问答对提取方法、装置、设备及可读存储介质
CN112016425B (zh) * 2020-08-21 2021-04-27 上海松鼠课堂人工智能科技有限公司 一种基于深度学习的手写答案识别方法和系统
CN112131364B (zh) * 2020-09-22 2024-03-26 沈阳东软智能医疗科技研究院有限公司 问答方法、装置、电子设备和存储介质
CN112580343A (zh) * 2020-11-03 2021-03-30 北京字节跳动网络技术有限公司 模型生成方法、问答质量判断方法、装置、设备及介质
CN112487148A (zh) * 2020-12-07 2021-03-12 北京明略软件系统有限公司 问题解答方法、装置、电子设备和计算机可读存储介质
CN112712069B (zh) * 2021-03-25 2021-07-23 北京易真学思教育科技有限公司 一种判题方法、装置、电子设备及存储介质
CN113159187A (zh) * 2021-04-23 2021-07-23 北京金山数字娱乐科技有限公司 分类模型训练方法及装置、目标文本确定方法及装置
CN114547282B (zh) * 2022-02-25 2022-09-09 广州中医药大学(广州中医药研究院) 一种植物分类动态检索方法
CN114610853A (zh) * 2022-03-14 2022-06-10 平安科技(深圳)有限公司 一种智能问答的优化方法及装置、存储介质、终端
CN114817505A (zh) * 2022-05-10 2022-07-29 国网江苏省电力有限公司南通供电分公司 一种基于历史工单匹配系统的供电工单快速回复方法
CN116059646B (zh) * 2023-04-06 2023-07-11 深圳尚米网络技术有限公司 一种交互式专家指导系统

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345585A (zh) * 2018-01-11 2018-07-31 浙江大学 一种基于深度学习的自动问答方法
CN109271505A (zh) * 2018-11-12 2019-01-25 深圳智能思创科技有限公司 一种基于问题答案对的问答系统实现方法
US20190065600A1 (en) * 2017-08-31 2019-02-28 International Business Machines Corporation Exploiting Answer Key Modification History for Training a Question and Answering System
CN109740077A (zh) * 2018-12-29 2019-05-10 北京百度网讯科技有限公司 基于语义索引的答案搜索方法、装置及其相关设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10331684B2 (en) * 2016-06-03 2019-06-25 International Business Machines Corporation Generating answer variants based on tables of a corpus
CN106469192B (zh) * 2016-08-30 2021-07-30 北京奇艺世纪科技有限公司 一种文本相关性的确定方法及装置
CN107818164A (zh) * 2017-11-02 2018-03-20 东北师范大学 一种智能问答方法及其系统
CN108133038B (zh) * 2018-01-10 2022-03-22 重庆邮电大学 一种基于动态记忆网络的实体级别情感分类系统及方法
CN109446302B (zh) * 2018-09-25 2023-08-22 中国平安人寿保险股份有限公司 基于机器学习的问答数据处理方法、装置和计算机设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190065600A1 (en) * 2017-08-31 2019-02-28 International Business Machines Corporation Exploiting Answer Key Modification History for Training a Question and Answering System
CN108345585A (zh) * 2018-01-11 2018-07-31 浙江大学 一种基于深度学习的自动问答方法
CN109271505A (zh) * 2018-11-12 2019-01-25 深圳智能思创科技有限公司 一种基于问题答案对的问答系统实现方法
CN109740077A (zh) * 2018-12-29 2019-05-10 北京百度网讯科技有限公司 基于语义索引的答案搜索方法、装置及其相关设备

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112836035A (zh) * 2021-03-04 2021-05-25 泰康保险集团股份有限公司 匹配数据的方法、装置、设备和计算机可读介质
CN113139043A (zh) * 2021-04-29 2021-07-20 北京百度网讯科技有限公司 问答样本生成方法、装置、电子设备和存储介质
CN113139043B (zh) * 2021-04-29 2023-08-04 北京百度网讯科技有限公司 问答样本生成方法、装置、电子设备和存储介质
CN113360617A (zh) * 2021-06-07 2021-09-07 北京百度网讯科技有限公司 异常识别方法、装置、设备和存储介质
CN113360617B (zh) * 2021-06-07 2023-08-04 北京百度网讯科技有限公司 异常识别方法、装置、设备和存储介质
CN113392253A (zh) * 2021-06-28 2021-09-14 北京百度网讯科技有限公司 视觉问答模型训练及视觉问答方法、装置、设备及介质
CN113392253B (zh) * 2021-06-28 2023-09-29 北京百度网讯科技有限公司 视觉问答模型训练及视觉问答方法、装置、设备及介质
CN113468309A (zh) * 2021-06-30 2021-10-01 竹间智能科技(上海)有限公司 文本中的答案抽取方法以及电子设备
CN113468309B (zh) * 2021-06-30 2023-12-22 竹间智能科技(上海)有限公司 文本中的答案抽取方法以及电子设备
CN114840648A (zh) * 2022-03-21 2022-08-02 阿里巴巴(中国)有限公司 答案生成方法、装置及计算机程序产品
CN115952270A (zh) * 2023-03-03 2023-04-11 中国海洋大学 冰箱的智能问答方法、装置和存储介质

Also Published As

Publication number Publication date
CN110287296A (zh) 2019-09-27

Similar Documents

Publication Publication Date Title
WO2020232877A1 (zh) 一种问题答案选取方法、装置、计算机设备及存储介质
WO2020237869A1 (zh) 一种问题意图识别方法、装置、计算机设备及存储介质
WO2020177282A1 (zh) 一种机器对话方法、装置、计算机设备及存储介质
WO2020147428A1 (zh) 交互内容生成方法、装置、计算机设备及存储介质
WO2020119030A1 (zh) 用于答复问题的模型训练方法、装置、设备及存储介质
US10679012B1 (en) Techniques to add smart device information to machine learning for increased context
WO2020119031A1 (zh) 基于深度学习的问答反馈方法、装置、设备及存储介质
JP7376731B2 (ja) 画像認識モデル生成方法、装置、コンピュータ機器及び記憶媒体
WO2021151328A1 (zh) 症状数据处理方法、装置、计算机设备及存储介质
WO2021169842A1 (zh) 数据更新方法、装置、电子设备及计算机可读存储介质
WO2021203854A1 (zh) 用户分类方法、装置、计算机设备和存储介质
CN112287089B (zh) 用于自动问答系统的分类模型训练、自动问答方法及装置
WO2020151310A1 (zh) 文本生成方法、装置、计算机设备及介质
WO2021114620A1 (zh) 病历质控方法、装置、计算机设备和存储介质
CN111598213B (zh) 网络训练方法、数据识别方法、装置、设备和介质
CN111078847A (zh) 电力用户意图识别方法、装置、计算机设备和存储介质
US20190228297A1 (en) Artificial Intelligence Modelling Engine
CN112418059A (zh) 一种情绪识别的方法、装置、计算机设备及存储介质
CN110598210A (zh) 实体识别模型训练、实体识别方法、装置、设备及介质
CN112131261A (zh) 基于社区网络的社区查询方法、装置和计算机设备
CN110377618B (zh) 裁决结果分析方法、装置、计算机设备和存储介质
CN114861671A (zh) 模型训练方法、装置、计算机设备及存储介质
CN114420313A (zh) 目标对象匹配方法、装置、计算机设备和存储介质
CN114036267A (zh) 对话方法及系统
CN111368044A (zh) 智能问答方法、装置、计算机设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19929513

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19929513

Country of ref document: EP

Kind code of ref document: A1