Answer location acquisition method, device, equipment and medium based on big data

By using bidirectional recurrent neural networks and multi-layer convolutional layers in the question and answer model, combined with additive and self-attention mechanisms, the problem of large parameters and long training time of the existing question and answer model is solved, and the efficiency of the lightweight question and answer model is achieved. train.

CN111241244BActive Publication Date: 2024-10-11PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010037661.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-01-14
Publication Date
2024-10-11
Estimated Expiration
2040-01-14

AI Technical Summary

Technical Problem

The existing question and answer model has a large number of parameters and takes a long time to train the algorithm, making it impossible to build a lightweight question and answer model.

Method used

Using a method based on big data, the bidirectional recurrent neural network Bi-LSTM is used to extract and compress the features of the question information, combined with multi-layer convolutional layers to extract features of the text information, and through the additive attention mechanism and self-attention mechanism, Reduce the number of model parameters and implement parallel computing to shorten training time.

Benefits of technology

A lightweight question and answer model with shorter training time and smaller parameters is implemented, which improves the training efficiency of the question and answer model and solves the problem of large parameters and long training time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111241244B_ABST
    Figure CN111241244B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for obtaining the position of an answer based on big data, including: performing vectorization to obtain the word vector corresponding to the text information to be processed and the word vector corresponding to the question information; performing feature extraction and dimension compression on the word vector corresponding to the question information through a Bi-LSTM network to obtain question coding information; adding a position vector and the question coding information to each word vector in the text information to obtain text coding information; performing feature extraction on the text coding information through a preset multi-layer convolution layer to obtain text feature information corresponding to the text coding information; performing sequence labeling on the text feature information through a Bi-LSTM network to obtain the first probability and the second probability of each word in the text information; obtaining the word corresponding to the maximum value of the first probability as the answer start position and the word corresponding to the maximum value of the second probability as the answer end position. The present invention solves the problems of large number of parameters and long algorithm training time of the existing question-answering model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information technology, and in particular to a method, device, equipment and medium for obtaining answer locations based on big data. Background Art

[0002] Existing question-answering models are mainly implemented through recurrent neural networks or more complex deep learning language models. However, the algorithm accuracy of recurrent neural networks is limited, and the model cannot be calculated in parallel, which requires a long training time. Although deep learning language models allow parallel computing and have been able to achieve higher accuracy, since language models can handle a variety of natural language processing tasks, the model structure is complex and the number of parameters is relatively large, it also requires a long training time. It can be seen that whether it is a question-answering model based on a recurrent neural network or a deep learning language model, it has the disadvantage of a long algorithm training time and cannot build a lightweight question-answering model.

[0003] Therefore, finding a method to solve the problem of large number of parameters and long algorithm training in existing question-answering models has become a technical problem that technical personnel in this field urgently need to solve. Summary of the invention

[0004] The embodiments of the present invention provide a method, device, equipment and medium for obtaining answer positions based on big data to solve the problems of large number of parameters and long algorithm training time in existing question-answering models.

[0005] A method for obtaining an answer position based on big data, comprising:

[0006] Obtaining text information and question information to be processed, and performing vectorization on each word in the text information and question information respectively to obtain a word vector corresponding to the text information and a word vector corresponding to the question information;

[0007] The word vector corresponding to the question information is subjected to feature extraction through a bidirectional recurrent neural network Bi-LSTM, and the extracted multidimensional feature matrix is ​​compressed to a preset dimension to obtain question encoding information;

[0008] Adding the position vector and the question encoding information to each word vector in the text information to obtain text encoding information corresponding to the text information;

[0009] Performing feature extraction on the text encoding information through a preset multi-layer convolutional layer to obtain text feature information corresponding to the text information;

[0010] The text feature information is sequence-labeled by a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information;

[0011] Get the word corresponding to the first maximum probability as the starting position of the answer and the word corresponding to the second maximum probability as the ending position of the answer.

[0012] Furthermore, the bidirectional recurrent neural network Bi-LSTM is used to extract features from the word vector corresponding to the question information, and the extracted multidimensional feature matrix is ​​compressed to a preset dimension to obtain the question encoding information including:

[0013] The word vector corresponding to the question information is subjected to feature extraction through a bidirectional recurrent neural network Bi-LSTM to obtain an m*n dimensional feature matrix;

[0014] Through the additive attention mechanism, the m*n dimensional feature matrix is ​​compressed to a 1*n dimensional feature matrix;

[0015] Through a preset fully connected layer, the 1*n dimensional feature moment is converted into a 1*k dimensional feature matrix, and the 1*k dimensional feature matrix is ​​used as the question encoding information.

[0016] Furthermore, the adding of the position vector and the question encoding information to each word vector in the text information to obtain the text encoding information corresponding to the text information includes:

[0017] For each word vector in the text information, a position vector corresponding to the word vector is generated by using a preset sine function and a cosine function;

[0018] After the position vector and question encoding information are added to the word vector in sequence, the text encoding information corresponding to the word vector is obtained.

[0019] Furthermore, the feature extraction of the text encoding information by the preset multi-layer convolutional layer to obtain text feature information corresponding to the text information includes:

[0020] Performing feature extraction on the text encoding information through a preset first convolutional layer to obtain first text feature information corresponding to the text encoding information;

[0021] Perform feature extraction on the first text feature information respectively through three parallel second convolutional layers to obtain three sets of second text feature information;

[0022] Performing a matrix multiplication operation on any two sets of second text feature information, and normalizing the operation results through a softmax function to obtain weight information;

[0023] Adjust another set of second text feature information according to the weight information to obtain third text feature information;

[0024] The third text feature information and the first text feature information are summed up, and the result is used as the text feature information corresponding to the text information.

[0025] Furthermore, after obtaining the text feature information corresponding to the text information, the method further includes:

[0026] The text feature information is passed into a preset fully connected layer to obtain a binary classification result of whether there is answer information corresponding to the question information in the text information to be processed.

[0027] A device for obtaining an answer position based on big data, comprising:

[0028] A vectorization module, used to obtain the text information and question information to be processed, and perform vectorization on each word in the text information and question information respectively to obtain a word vector corresponding to the text information and a word vector corresponding to the question information;

[0029] The first feature extraction module is used to extract features from the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM, and compress the extracted multi-dimensional feature matrix to a preset dimension to obtain question encoding information;

[0030] An information adding module, used for adding a position vector and the question encoding information to each word vector in the text information to obtain text encoding information corresponding to the text information;

[0031] A second feature extraction module is used to extract features of the text encoding information through a preset multi-layer convolution layer to obtain text feature information corresponding to the text information;

[0032] A probability acquisition module is used to perform sequence annotation on the text feature information through a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information;

[0033] The answer acquisition module is used to acquire the word corresponding to the first maximum probability as the starting position of the answer and the word corresponding to the second maximum probability as the ending position of the answer.

[0034] Furthermore, the information adding module includes:

[0035] A position vector generating unit, used for generating a position vector corresponding to each word vector in the text information by using a preset sine function and a cosine function;

[0036] An adding unit is used to add the position vector and the question encoding information to the word vector in sequence to obtain the text encoding information corresponding to the word vector.

[0037] Furthermore, the second feature extraction module includes:

[0038] A first extraction unit, configured to perform feature extraction on the text encoding information through a preset first convolutional layer to obtain first text feature information corresponding to the text encoding information;

[0039] A second extraction unit is used to extract features of the first text feature information respectively through three parallel second convolutional layers to obtain three groups of second text feature information;

[0040] A weight acquisition unit, used to perform a matrix multiplication operation on any two sets of second text feature information, and perform normalization processing on the operation results through a softmax function to obtain weight information;

[0041] an adjusting unit, configured to adjust another set of second text feature information according to the weight information to obtain third text feature information;

[0042] The text feature acquisition unit is used to perform a summation process on the third text feature information and the first text feature information, and the obtained result is used as the text feature information corresponding to the text information.

[0043] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for obtaining the answer location based on big data is implemented.

[0044] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for obtaining the answer location based on big data is implemented.

[0045] The embodiment of the present invention performs vectorization on each word in the text information and the question information to obtain the word vector corresponding to the text information and the word vector corresponding to the question information; then uses a bidirectional recurrent neural network Bi-LSTM to extract features from the word vector corresponding to the question information, and compresses the extracted multidimensional feature matrix to a preset dimension to obtain question encoding information; adds a position vector and the question encoding information to each word vector in the text information to obtain text encoding information corresponding to the text information; then uses a preset multi-layer convolutional layer to extract features from the text encoding information to obtain text feature information corresponding to the text information; finally, uses a bidirectional recurrent neural network to sequence-label the text feature information to obtain a first probability and a second probability for each word in the text information; obtains the word corresponding to the maximum value of the first probability as the starting position of the answer and the word corresponding to the maximum value of the second probability as the ending position of the answer. The embodiment of the present invention implements a question-answering model based on a convolutional neural network and a partial recurrent neural network. Compared with the question-answering model implemented only based on the convolutional neural network, it has the lightweight characteristics of short training time and relatively small number of parameters. It can be trained with a relatively small number of parameters in a short training time, thereby improving the efficiency of question-answering model training and solving the problems of large number of parameters and long algorithm training time in the existing question-answering model. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.

[0047] Figure 1 is a flow chart of a method for obtaining an answer location based on big data in one embodiment of the present invention;

[0048] Figure 2 is a flow chart of step S102 in a method for obtaining an answer location based on big data in another embodiment of the present invention;

[0049] Figure 3 is a flow chart of step S103 in a method for obtaining an answer location based on big data in another embodiment of the present invention;

[0050] Figure 4 is a flow chart of step S104 in a method for obtaining an answer location based on big data in another embodiment of the present invention;

[0051] Figure 5 is a flow chart of a method for obtaining an answer location based on big data in another embodiment of the present invention;

[0052] Figure 6 It is a principle block diagram of a device for obtaining an answer position based on big data in one embodiment of the present invention;

[0053] Figure 7 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] The following is a detailed description of the answer location acquisition method based on big data provided by the present embodiment. The big data described in the embodiment of the present invention refers to building a question-answering model based on a long short-term memory network (Long Short-Term Memory, referred to as LSTM) and a convolutional neural network (Convolutional Neural Networks, referred to as CNN). Among them, LSTM is a time-recurrent neural network, which is suitable for processing and predicting important events with relatively long intervals and delays in time series. The question-answering model is equivalent to a reading comprehension model, the input of the model is text information and question information, and the output of the model is the answer location information found in the text information based on the question information. Here, the question information refers to words, sentences or paragraphs containing the content of the question, such as what day is today, who likes to eat apples. The text information refers to a sentence or paragraph containing the answer to the question. Optionally, the answer location acquisition method based on big data provided in the embodiment of the present invention is applied to a server. The server can be implemented with an independent server or a server cluster consisting of multiple servers. In one embodiment, such as Figure 1 As shown, a method for obtaining an answer location based on big data is provided, comprising the following steps:

[0056] In step S101, the text information and question information to be processed are obtained, and vectorization is performed on each word in the text information and question information respectively to obtain the word vector corresponding to the text information and the word vector corresponding to the question information.

[0057] Here, the embodiment of the present invention performs vectorization processing on the text information and the question information respectively, and uses a vector to represent each word in the text information and the question information. Optionally, for the text information, a corpus is formed with the text information, and the Word2Vec algorithm is used to train according to the corpus to obtain the word vector corresponding to each word in the text information, and the word vector corresponding to each word in the text information is combined to obtain the word vector corresponding to the text information. For the question information, a corpus is formed with the question information, and the Word2Vec algorithm is used to train according to the corpus to obtain the word vector corresponding to each word in the question information, and the word vector corresponding to each word in the question information is combined to obtain the word vector corresponding to the question information.

[0058] In step S102, feature extraction is performed on the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM, and the extracted multi-dimensional feature matrix is ​​compressed to a preset dimension to obtain question encoding information.

[0059] Here, the question encoding information is a feature matrix of the question information. In the embodiment of the present invention, a bidirectional recurrent neural network Bi-LSTM obtained by combining forward LSTM and backward LSTM is used to extract features from the word vector corresponding to the question information to obtain a multi-dimensional feature matrix.

[0060] The multidimensional feature matrix obtained above is the preliminary extracted question encoding. Since the dimension of the question encoding is related to the length of the question information, the longer the question information is, the longer the dimension of the question encoding is, and vice versa. In order to make the final question encoding information not limited by the length of the question information, the embodiment of the present invention further compresses the extracted multidimensional feature matrix to a preset dimension to unify the dimension of the question encoding. Optionally, Figure 2 FIG. 2 shows a specific implementation process of step S102 provided in an embodiment of the present invention. Figure 2 As shown, in step S102, the word vector corresponding to the question information is subjected to feature extraction by the bidirectional recurrent neural network Bi-LSTM, and the extracted multidimensional feature matrix is ​​compressed to a preset dimension, and the question encoding information is obtained, including:

[0061] In step S201, feature extraction is performed on the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM to obtain an m*n dimensional feature matrix.

[0062] Here, after the bidirectional recurrent neural network Bi-LSTM extracts features from the word vectors corresponding to the question information, it outputs an m*n dimensional feature matrix. Where m and n are both positive integers, m represents the number of word vectors corresponding to the question information, and n represents the feature dimension. It can be seen that this is a multidimensional feature matrix, and its dimension is related to the length of the question information (that is, the number of word vectors and feature dimensions), and is not uniform.

[0063] In step S202, the m*n dimensional feature matrix is ​​compressed to a 1*n dimensional feature matrix through an additive attention mechanism.

[0064] In order to solve the problem of non-uniform dimensions of the multi-dimensional feature matrix corresponding to the problem information, an embodiment of the present invention compresses the m*n dimensional feature matrix to a 1*n dimensional feature matrix through an additive attention mechanism. Specifically, by establishing a layer of feedforward fully connected layer, the algorithm formula of the fully connected layer can be expressed as wx+b; wherein x represents the input, in this embodiment, the input is the m*n dimensional feature matrix, and w and b represent the learned parameters. The m*n dimensional feature matrix is ​​passed through the feedforward fully connected layer, and then normalized through the softmax function to obtain a 1*m dimensional attention weight. The 1*m dimensional attention weight is added to the m*n dimensional feature matrix to compress the original m dimension to 1 dimension, thereby obtaining a 1*n dimensional feature matrix.

[0065] In step S203, the 1*n-dimensional feature moment is converted into a 1*k-dimensional feature matrix through a preset fully connected layer, and the 1*k-dimensional feature matrix is ​​used as question encoding information.

[0066] The 1*n dimensional feature matrix obtained by the additive attention mechanism of step S202 is still related to the number of features, and is not of uniform dimension. In this regard, the embodiment of the present invention further constructs a fully connected layer and customizes the output dimension k to convert the 1*n dimensional feature moment into a 1*k dimensional feature matrix to obtain the question encoding information of uniform dimension. Wherein k is a positive integer.

[0067] The embodiment of the present invention converts question encoding information of different dimensions output by a bidirectional recurrent neural network into question encoding information of unified dimensions through an additive attention mechanism and a fully connected layer, which facilitates the subsequent construction of text encoding information and simultaneously simplifies the number of parameters of the question-answering model, which is beneficial to shortening the training time of the question-answering model and realizing a lightweight question-answering model.

[0068] In step S103, the position vector and the question encoding information are added to each word vector in the text information to obtain text encoding information corresponding to the text information.

[0069] After obtaining the question encoding information, the embodiment of the present invention constructs text encoding information based on the question encoding information, and represents the question information through the question encoding information, so as to facilitate searching for a corresponding answer in the text information.

[0070] Here, the position vector represents the position of the word corresponding to the word vector in the text information. Since the subsequent steps will extract features from the text encoding information through a convolutional neural network, and the feature extraction of the text encoding information through a convolutional neural network will ignore the word order information, the embodiment of the present invention adds the position vector to the text encoding information to supplement this information, so that the question-answering model can use the order of the word vector sequence. Optionally, Figure 3 FIG. 4 shows a specific implementation process of step S103 provided in an embodiment of the present invention. Figure 3 As shown, the step S103 adds the position vector and the question encoding information to each word vector in the text information to obtain the text encoding information corresponding to the text information, including:

[0071] In step S301, for each word vector in the text information, a position vector corresponding to the word vector is generated by using a preset sine function and a cosine function.

[0072] The embodiment of the present invention selects sine functions and cosine functions of different frequencies to generate position vectors corresponding to word vectors in text information. The sine function and cosine function are:

[0073] PE(pos,2i)=sin(pos / 10000 2i / d )

[0074] PE(pos,2i+1)=cos(pos / 10000 2i / d )

[0075] In the above formula, PE represents the position vector corresponding to the word vector, pos represents the position number of the word vector in the text information, i represents the position vector of the i-th dimension, and i is a natural number; d represents the total dimension of the generated position vector, PE(pos,2i) represents the position vector of the 2i-th dimension corresponding to the pos-th word vector, and PE(pos,2i+1) represents the position vector of the 2i+1-th dimension corresponding to the pos-th word vector.

[0076] Optionally, in one embodiment of the present invention, the total dimension d is 100, that is, the dimension of the position vector is 100. Then, for the 10th word vector in the text information, the position vector of its first dimension is PE(pos,2i+1)=PE(10,1)=cos(10 / 10000 0 / 100 ), by setting 2i+1=1, we get i=0, and substitute it into cos(pos / 100002i / d )

[0077] The position vector of the second dimension is PE(pos,2i)=PE(10,2)=sin(10 / 10000 2 / 100 ), by setting 2i=2, we get i=1, and substitute it into sin(pos / 10000 2i / d )

[0078] The position vector of the third dimension is PE(pos,2i+1)=PE(10,3)=cos(10 / 10000 2 / 100 ), by setting 2i+1=3, we can obtain, i=1 and substitute it into cos(pos / 10000 2i / d ) income.

[0079] The same goes for position vectors in other dimensions.

[0080] In step S302, the position vector and the question encoding information are sequentially added to the word vector to obtain text encoding information corresponding to the word vector.

[0081] After obtaining the position vector corresponding to each word vector in the text information, the position vector is added to the word vector, and then the question encoding information is added to the position vector, and the obtained vector is used as the text encoding information corresponding to the word vector. The text encoding information represents the order information of the word vector in the text information through the position vector, which further supplements the word order information in the features extracted by the convolutional neural network; the question information is represented by the question encoding information, making it easier to find the corresponding answer in the text information. The text encoding information corresponding to all the word vectors in the text information is combined to obtain the text encoding information corresponding to the text information.

[0082] Optionally, in order to improve the training efficiency of the question-answering model and shorten the training time, step 102 and step S103 may be executed synchronously as two parallel structures of the question-answering model.

[0083] In step S104, feature extraction is performed on the text encoding information through a preset multi-layer convolutional layer to obtain text feature information corresponding to the text information.

[0084] After completing the encoding of the text information, the question-answering model provided by the embodiment of the present invention extracts features of the text encoding information through multiple convolutional layers. On the basis of the original convolutional layer, a self-attention mechanism is added. The self-attention mechanism is a three-layer parallel convolutional layer structure additionally constructed on the basis of the convolutional layer, in which the outputs of two parallel convolutional layers generate weight information for adjusting the output of another parallel convolutional layer. The output of another parallel convolutional layer after weight adjustment is then summed with the output of the original convolutional layer, and the result is used as the text feature information corresponding to the text encoding information. Since there may be interactive correlations between texts, the self-attention mechanism can assign higher attention weights to key words in the text information to improve the classification effect.

[0085] Optionally, Figure 4 FIG. 4 shows a specific implementation process of step S104 provided in an embodiment of the present invention. Figure 4 As shown, the feature extraction of the text encoding information by the preset multi-layer convolutional layer in step S104 to obtain text feature information corresponding to the text information includes:

[0086] In step S401, feature extraction is performed on the text encoding information through a preset first convolutional layer to obtain first text feature information corresponding to the text encoding information.

[0087] Here, the first convolution layer has only one layer. In the embodiment of the present invention, the text encoding information is passed to the first convolution layer for feature extraction, and feature information output by the first convolution layer is obtained as first text feature information corresponding to the text encoding information. The first text feature information is feature information after the text encoding information is further purified.

[0088] In step S402, feature extraction is performed on the first text feature information through three parallel second convolutional layers to obtain three groups of second text feature information.

[0089] Then, the first text feature information is respectively passed into three parallel second convolutional layers for feature extraction. Feature information output by each second convolutional layer is obtained as second text feature information. Here, the second text feature information is feature information further purified from the first text feature information. The three parallel second convolutional layers can be the same, and the three sets of second text feature information obtained are also the same.

[0090] In step S403, matrix multiplication operation is performed on any two sets of second text feature information, and the operation results are normalized by a softmax function to obtain weight information.

[0091] Here, it is assumed that the obtained second text feature information is an M*N dimensional feature matrix, and two groups are randomly selected from the three groups of second text feature information, and one group of second text feature information is transposed to obtain an N*M dimensional feature matrix, and a matrix multiplication operation is performed on the selected second text feature information and the transposed second text feature information to obtain an M*M dimensional feature matrix. Then, the M*M dimensional feature matrix is ​​normalized by a softmax function to obtain M*M dimensional weight information. Wherein, M and N are positive integers; the matrix multiplication operation is a prior art and will not be described in detail here.

[0092] In step S404, another set of second text feature information is adjusted according to the weight information to obtain third text feature information.

[0093] Here, the embodiment of the present invention performs a matrix multiplication operation on the M*M dimensional weight information and another set of second text feature information (M*N dimensional feature matrix) to adjust the another set of second text feature information to obtain an M*N dimensional feature matrix as the third text feature information. The third text feature information is feature information after the second text feature information is further purified.

[0094] In step S405, the third text feature information and the first text feature information are summed up, and the result is used as the text feature information corresponding to the text information.

[0095] In the embodiment of the present invention, the addition operation refers to summing the corresponding positions of two matrices of the same dimension and outputting matrices of the same dimension. Continuing with the previous example, the third text feature information and the first text feature information are both M*N dimensional feature matrices. In the embodiment of the present invention, the corresponding positions are summed, and the resulting M*N dimensional feature matrix is ​​used as the text feature information corresponding to the text encoding information.

[0096] The above steps S401 to S405 perform parallel calculations to extract features through convolutional neural networks, which effectively improves the training speed of the question-answering model and reduces the training time of the question-answering model compared to the form of sequential calculation of the input sequence by the recurrent neural network.

[0097] In step S105, the text feature information is sequence labeled by a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information.

[0098] The obtained text feature information is directly passed into the bidirectional recurrent neural network Bi-LSTM. In an embodiment of the present invention, the bidirectional recurrent neural network Bi-LSTM performs sequence labeling based on the input text feature information, and then outputs a set of target sequences. In the target sequence, two probabilities of each word in the text information are included, namely, the first probability of being the beginning of the answer and the second probability of being the end of the answer.

[0099] In step S106, the word corresponding to the first maximum probability value is obtained as the answer start position and the word corresponding to the second maximum probability value is obtained as the answer end position.

[0100] After obtaining the target sequence, the first maximum probability value and the second maximum probability value are selected, and the word corresponding to the first maximum probability value is used as the answer start position, and the word corresponding to the second maximum probability value is used as the answer end position. The content between the answer start position and the answer end position is combined as the answer to the question information in the text information, which effectively improves the accuracy of answer annotation.

[0101] To summarize, the question-answering model implemented based on a convolutional neural network and a partial recurrent neural network in the embodiment of the present invention has an improved attention mechanism that effectively improves the accuracy performance and training convergence efficiency of the question-answering model compared to the question-answering model implemented only based on a convolutional neural network. It has the lightweight characteristics of short training time and relatively small number of parameters, and can be trained with a relatively small number of parameters in a short training time, thereby improving the efficiency of question-answering model training and solving the problems of large number of parameters and long algorithm training time in existing question-answering models. Moreover, sequence encoding through the LSTM structure has better output labeling effect than labeling of the fully connected layer.

[0102] Optionally, as a preferred example of the present invention, a binary classification result of whether the answer can be found in the text information can also be obtained according to the text feature information corresponding to the text encoding information output in step S104. Figure 5 Another implementation process of the method for obtaining the answer position based on big data provided by the embodiment of the present invention includes steps S501 to S504, wherein steps S501 to S504 are Figure 1 Steps S501 to S504 described in the embodiment are the same, please refer to the description of the above embodiment for details, and will not be repeated here. The method also includes:

[0103] In step S505, the text feature information is passed to a preset fully connected layer to obtain a binary classification result of whether there is answer information corresponding to the question information in the text information to be processed.

[0104] Here, the text feature information output after passing through multiple convolutional layers is an M*N matrix, where M represents the number of word vectors in the text information. The embodiment of the present invention first compresses the text feature information into an N-dimensional vector through additive attention, and then connects the N-dimensional vector to a preset fully connected layer. The output of the fully connected layer includes two dimensions, indicating that the answer can be found and indicating that the answer cannot be found. The fully connected layer can be used to classify whether there is answer information corresponding to the question information in the text information to be processed, that is, whether there is answer information corresponding to the question information in the text information or there is no answer information corresponding to the question information in the text information, and obtain a binary classification result.

[0105] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.

[0106] In one embodiment, a device for obtaining an answer position based on big data is provided, and the device for obtaining an answer position based on big data corresponds to the method for obtaining an answer position based on big data in the above embodiment. Figure 6 As shown, the answer position acquisition device based on big data includes a vectorization module 61, a first feature extraction module 62, an information addition module 63, a second feature extraction module 64, a probability acquisition module 65, and an answer acquisition module 66. The detailed description of each functional module is as follows:

[0107] A vectorization module 61 is used to obtain text information and question information to be processed, and perform vectorization on each word in the text information and question information to obtain a word vector corresponding to the text information and a word vector corresponding to the question information;

[0108] A first feature extraction module 62 is used to extract features from the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM, and compress the extracted multi-dimensional feature matrix to a preset dimension to obtain question encoding information;

[0109] An information adding module 63, used for adding a position vector and the question encoding information to each word vector in the text information to obtain text encoding information corresponding to the text information;

[0110] A second feature extraction module 64 is used to extract features from the text encoding information through a preset multi-layer convolution layer to obtain text feature information corresponding to the text information;

[0111] The probability acquisition module 65 is used to perform sequence labeling on the text feature information through a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information;

[0112] The answer acquisition module 66 is used to acquire the word corresponding to the first maximum probability as the starting position of the answer and the word corresponding to the second maximum probability as the ending position of the answer.

[0113] Optionally, the first feature extraction module 62 includes:

[0114] A feature extraction unit is used to extract features from the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM to obtain an m*n dimensional feature matrix;

[0115] A compression unit, used for compressing the m*n dimensional feature matrix into a 1*n dimensional feature matrix through an additive attention mechanism;

[0116] The conversion unit is used to convert the 1*n dimensional feature moment into a 1*k dimensional feature matrix through a preset fully connected layer, and use the 1*k dimensional feature matrix as question encoding information.

[0117] Optionally, the information adding module 63 includes:

[0118] A position vector generating unit, used for generating a position vector corresponding to each word vector in the text information by using a preset sine function and a cosine function;

[0119] An adding unit is used to add the position vector and the question encoding information to the word vector in sequence to obtain the text encoding information corresponding to the word vector.

[0120] Optionally, the second feature extraction module 64 includes:

[0121] A first extraction unit, configured to perform feature extraction on the text encoding information through a preset first convolutional layer to obtain first text feature information corresponding to the text encoding information;

[0122] A second extraction unit is used to extract features of the first text feature information through three parallel second convolutional layers to obtain three sets of second text feature information;

[0123] A weight acquisition unit, used to perform a matrix multiplication operation on any two sets of second text feature information, and perform normalization processing on the operation results through a softmax function to obtain weight information;

[0124] an adjusting unit, configured to adjust another set of second text feature information according to the weight information to obtain third text feature information;

[0125] The text feature acquisition unit is used to perform a summation process on the third text feature information and the first text feature information, and the obtained result is used as the text feature information corresponding to the text information.

[0126] Optionally, the device further comprises:

[0127] The classification module is used to pass the text feature information into a preset fully connected layer to obtain a binary classification result of whether there is answer information corresponding to the question information in the text information to be processed.

[0128] For the specific definition of the answer location acquisition device based on big data, please refer to the definition of the answer location acquisition method based on big data above, which will not be repeated here. Each module in the above-mentioned answer location acquisition device based on big data can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can 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 above modules.

[0129] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device 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 computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for obtaining an answer location based on big data is implemented.

[0130] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0131] Obtaining text information and question information to be processed, and performing vectorization on each word in the text information and question information respectively to obtain a word vector corresponding to the text information and a word vector corresponding to the question information;

[0132] The word vector corresponding to the question information is subjected to feature extraction through a bidirectional recurrent neural network Bi-LSTM, and the extracted multidimensional feature matrix is ​​compressed to a preset dimension to obtain question encoding information;

[0133] Adding the position vector and the question encoding information to each word vector in the text information to obtain text encoding information corresponding to the text information;

[0134] Performing feature extraction on the text encoding information through a preset multi-layer convolutional layer to obtain text feature information corresponding to the text information;

[0135] The text feature information is sequence-labeled by a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information;

[0136] Get the word corresponding to the first maximum probability as the starting position of the answer and the word corresponding to the second maximum probability as the ending position of the answer.

[0137] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, 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 link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0138] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0139] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for obtaining answer location based on big data, It is characterized in that include: Obtaining text information and question information to be processed, and performing vectorization on each word in the text information and question information respectively to obtain a word vector corresponding to the text information and a word vector corresponding to the question information; The word vector corresponding to the question information is subjected to feature extraction through a bidirectional recurrent neural network Bi-LSTM, and the extracted multidimensional feature matrix is ​​compressed to a preset dimension to obtain question encoding information, including: extracting features from the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM to obtain an m*n dimensional feature matrix; compressing the m*n dimensional feature matrix to a 1*n dimensional feature matrix through an additive attention mechanism; converting the 1*n dimensional feature matrix into a 1*k dimensional feature matrix through a preset fully connected layer, and using the 1*k dimensional feature matrix as question encoding information; Adding the position vector and the question encoding information to each word vector in the text information to obtain the text encoding information corresponding to the text information, including: for each word vector in the text information, generating the position vector corresponding to the word vector by using a preset sine function and a cosine function; adding the position vector and the question encoding information to the word vector in sequence to obtain the text encoding information corresponding to the word vector; Performing feature extraction on the text encoding information through a preset multi-layer convolution layer to obtain text feature information corresponding to the text information; The text feature information is sequence-labeled by a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information; Get the word corresponding to the first maximum probability as the starting position of the answer and the word corresponding to the second maximum probability as the ending position of the answer.

2. The method for obtaining the answer position based on big data as claimed in claim 1, It is characterized in that The feature extraction of the text encoding information by the preset multi-layer convolutional layer to obtain text feature information corresponding to the text information includes: Performing feature extraction on the text encoding information through a preset first convolutional layer to obtain first text feature information corresponding to the text encoding information; Perform feature extraction on the first text feature information respectively through three parallel second convolutional layers to obtain three sets of second text feature information; Performing a matrix multiplication operation on any two sets of second text feature information, and normalizing the operation results through a softmax function to obtain weight information; Adjust another set of second text feature information according to the weight information to obtain third text feature information; The third text feature information and the first text feature information are summed up, and the result is used as the text feature information corresponding to the text information.

3. The method for obtaining the answer position based on big data as claimed in claim 1, It is characterized in that After obtaining the text feature information corresponding to the text information, the method further includes: The text feature information is passed into a preset fully connected layer to obtain a binary classification result of whether there is answer information corresponding to the question information in the text information to be processed.

4. A device for obtaining answer positions based on big data, It is characterized in that include: A vectorization module, used to obtain the text information and question information to be processed, and perform vectorization on each word in the text information and question information respectively to obtain a word vector corresponding to the text information and a word vector corresponding to the question information; The first feature extraction module is used to extract features from the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM, and compress the extracted multi-dimensional feature matrix to a preset dimension to obtain question encoding information; An information adding module, used for adding a position vector and the question encoding information to each word vector in the text information to obtain text encoding information corresponding to the text information; A second feature extraction module is used to extract features from the text encoding information through a preset multi-layer convolution layer to obtain text feature information corresponding to the text information; A probability acquisition module is used to perform sequence annotation on the text feature information through a bidirectional recurrent neural network Bi-LSTM to obtain a first probability and a second probability of each word in the text information; An answer acquisition module, used to acquire the word corresponding to the first maximum probability as the starting position of the answer and the word corresponding to the second maximum probability as the ending position of the answer; The first feature extraction module includes: a feature extraction unit, used to extract features from the word vector corresponding to the question information through a bidirectional recurrent neural network Bi-LSTM to obtain an m*n dimensional feature matrix; a compression unit, used to compress the m*n dimensional feature matrix to a 1*n dimensional feature matrix through an additive attention mechanism; a conversion unit, used to convert the 1*n dimensional feature matrix into a 1*k dimensional feature matrix through a preset fully connected layer, and use the 1*k dimensional feature matrix as the question encoding information; The information adding module includes: a position vector generating unit, which is used to generate a position vector corresponding to each word vector in the text information through preset sine function and cosine function; an adding unit, which is used to add the position vector and question coding information to the word vector in sequence to obtain the text coding information corresponding to the word vector.

5. The device for obtaining the answer position based on big data as claimed in claim 4, It is characterized in that The second feature extraction module comprises: A first extraction unit, configured to perform feature extraction on the text encoding information through a preset first convolutional layer to obtain first text feature information corresponding to the text encoding information; A second extraction unit is used to extract features of the first text feature information through three parallel second convolutional layers to obtain three sets of second text feature information; A weight acquisition unit, used to perform a matrix multiplication operation on any two sets of second text feature information, and perform normalization processing on the operation results through a softmax function to obtain weight information; an adjusting unit, configured to adjust another set of second text feature information according to the weight information to obtain third text feature information; The text feature acquisition unit is used to perform a summation process on the third text feature information and the first text feature information, and the obtained result is used as the text feature information corresponding to the text information.

6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method for obtaining the answer position based on big data as described in any one of claims 1 to 3 is implemented.

7. A computer-readable storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the method for obtaining the answer position based on big data as claimed in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Machine reading comprehension answer obtaining method based on multi-round attention mechanism

    CN110083682A

  • Answer determination method and device

    CN110309282A