Automatic question-answering method, device, electronic device and storage medium
By obtaining the character-level and word-level weighted feature vectors and some semantic features of the answers in the manual, the spatial feature fusion algorithm is used to fuse, which solves the problem that feature relationships in the prior art are not utilized, and improves the answer text accuracy of the automatic question-and-answer model.
Patent Information
- Application Number
- CN202111599940.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2041-12-24
AI Technical Summary
The interleaving of information between different features is not considered in the prior art, which leads to slow training and inference speed of automatic question-and-answer models and insufficiently utilized feature relationships.
By obtaining the manual character-level weighted feature vector, manual word-level weighted feature vector, and part of the semantic features starting or ending answers, the spatial feature fusion algorithm is used to fuse them to extract the fusion features to improve the accuracy of the answer text.
By fusion features, filter out contradictory or useless information in the features, retain feature information related to the question, and improve the accuracy of the answer text.
Smart Images

Figure CN114461765B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deep learning machine reading comprehension, and in particular to an automatic question-answering method, device, electronic device and storage medium. Background Art
[0002] In daily life, customers usually need to consult with human customer service or customer service robots through online platforms, telephone or face-to-face communication for services such as consultation, manual recommendation, and complaint. However, due to the current development of professional technologies in natural language processing such as semantic analysis and multi-round dialogue, the number of questions that customer service robots can answer and the degree of satisfaction are still limited; while human customer service is usually busy, but has to deal with many repetitive questions or processes. In addition, due to the different fields that customer service personnel are familiar with, the high mobility of customer service personnel, and the lack of understanding of the background information of customers who come to consult, there is a certain gap in the service level of human customer service.
[0003] Most existing technologies use recurrent neural networks to build automatic question-answering models. However, due to the sequential nature of recurrent networks, their training and inference speeds are slow, and similar models simply superimpose features together, while ignoring the relationship between features and failing to consider the interweaving of information between different features. Summary of the invention
[0004] Therefore, the technical problem to be solved by the present invention is to overcome the defect of the prior art that the interleaving of information between different features is not considered, thereby providing an automatic question answering method, device, electronic device and storage medium.
[0005] According to a first aspect, the present invention discloses an automatic question-answering method, comprising: based on a manual text and a question text, obtaining a manual character-level weighted feature vector, a manual word-level weighted feature vector, a semantic feature of the beginning part of an answer, and a semantic feature of the ending part of an answer; based on a spatial feature fusion algorithm, obtaining a first fusion feature according to the manual character-level weighted feature vector, the manual word-level weighted feature vector, and the semantic feature of the beginning part of an answer; based on a spatial feature fusion algorithm, obtaining a second fusion feature according to the manual character-level weighted feature vector, the manual word-level weighted feature vector, and the semantic feature of the ending part of an answer; and obtaining an answer text according to the first fusion feature and the second fusion feature.
[0006] Optionally, the method of obtaining a weighted manual character-level feature vector, a weighted manual word-level feature vector, semantic features of the beginning part of the answer and semantic features of the ending part of the answer based on the manual text and the question text includes: obtaining the manual text and the question text, generating a manual word-level feature vector, a manual character-level feature vector and a correlation matrix; generating a manual word-level weighted feature vector and a manual character-level weighted feature vector according to the manual word-level feature vector, the manual character-level feature vector and the correlation matrix; extracting semantic features of the beginning part of the answer and semantic features of the ending part of the answer according to the correlation matrix, the manual word-level weighted feature vector and the manual character-level weighted feature vector.
[0007] Optionally, the method of obtaining the manual text and the question text, generating the manual word-level feature vector, the manual character-level feature vector and the correlation matrix includes: obtaining the manual text and the question text; generating the manual word feature vector and the manual character feature vector according to the manual text; generating the question word feature vector and the question character feature vector according to the question text; generating the correlation matrix according to the manual word feature vector, the manual character feature vector, the question word feature vector and the question character feature vector.
[0008] Optionally, generating a manual word-level weighted feature vector and a manual character-level weighted feature vector according to the manual word-level feature vector, the manual character-level feature vector and the correlation matrix includes: generating a manual word-level weighted feature vector according to the correlation matrix and the manual word-level feature vector; generating a manual character-level weighted feature vector according to the correlation matrix and the manual character-level feature vector.
[0009] Optionally, extracting the semantic features of the beginning part of the answer and the semantic features of the ending part of the answer according to the correlation matrix, the manual word-level weighted feature vector and the manual character-level weighted feature vector includes: extracting the manual word-level weighted feature elements of the beginning part and the manual word-level weighted feature elements of the ending part according to preset rules according to the manual word-level weighted feature vector; extracting the manual character-level weighted feature elements of the beginning part and the manual character-level weighted feature elements of the ending part according to preset rules according to the manual character-level weighted feature vector; extracting the semantic features of the beginning part of the answer in the manual text according to the manual word-level weighted feature elements and the manual character-level weighted feature elements of the beginning part; extracting the semantic features of the ending part of the answer in the manual text according to the manual word-level weighted feature elements and the manual character-level weighted feature elements of the ending part.
[0010] Optionally, obtaining the answer text according to the first fusion feature and the second fusion feature includes: obtaining the starting position code with the largest probability value and the ending position code with the largest probability value according to the first fusion feature and the second fusion feature; obtaining the answer text according to the starting position code and the ending position code.
[0011] Optionally, obtaining the starting position code with the largest probability value and the ending position code with the largest probability value based on the first fusion feature and the second fusion feature includes: linearly transforming the first fusion feature to obtain a third fusion feature of a preset size; confirming the first probability value based on the third fusion feature; confirming the starting position code with the largest probability value based on the first probability value; linearly transforming the second fusion feature to obtain a fourth fusion feature of a preset size; confirming the second probability value based on the fourth fusion feature; and confirming the ending position code with the largest probability value based on the second probability value.
[0012] According to a second aspect, the present invention discloses an automatic question-answering device, comprising: a feature acquisition module, used to acquire a manual character-level weighted feature vector, a manual word-level weighted feature vector, a semantic feature of the beginning part of an answer, and a semantic feature of the ending part of an answer based on a manual text and a question text; a first fusion calculation module, used to acquire a first fusion feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector, and the semantic feature of the beginning part of an answer; a second fusion calculation module, used to acquire a second fusion feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector, and the semantic feature of the ending part of an answer; and an answer text acquisition module, used to acquire an answer text based on the first fusion feature and the second fusion feature.
[0013] According to a third aspect, the present invention discloses an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the automatic question-answering method as described in the first aspect and any optional implementation manner of the first aspect.
[0014] According to a fourth aspect, the present invention discloses a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the automatic question-answering method as described in the first aspect and any optional implementation manner of the first aspect are implemented.
[0015] The technical solution of the present invention has the following advantages:
[0016] The automatic question answering method provided by the present invention can filter out contradictory or useless information in the features by fusing the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic features of the beginning or end of the answer, and extract fusion features by adopting a spatial feature fusion algorithm. When used, the feature information that is more relevant to the question in the context can be retained by adjusting the fusion algorithm parameters. The accuracy of the answer text is improved by the first fusion feature and the second fusion feature. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 is a flowchart of a specific example of the automatic question-answering method in an embodiment of the present invention;
[0019] Figure 2 is a structural block diagram of a specific example of an automatic question-answering device in an embodiment of the present invention;
[0020] Figure 3 is a structural block diagram of another specific example of the automatic question-answering device in an embodiment of the present invention;
[0021] Figure 4 FIG. 4 is a specific example diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. 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.
[0023] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0024] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0025] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0026] The present invention discloses an automatic question-answering method, such as Figure 1 As shown, the following steps are included:
[0027] Step S1, based on the manual text and the question text, obtain the character-level feature vector, the word-level feature vector, the semantic features of the beginning part of the answer and the semantic features of the end part of the answer.
[0028] Specifically, first obtain the manual text and question text, generate the manual word-level feature vector, manual character-level feature vector and correlation matrix; then generate the manual word-level weighted feature vector and manual character-level weighted feature vector based on the manual word-level feature vector, manual character-level feature vector and correlation matrix; finally, extract the semantic features of the beginning part of the answer and the semantic features of the end part of the answer based on the correlation matrix, the manual word-level weighted feature vector and the manual character-level weighted feature vector.
[0029] Among them, the question text is the natural language text when the user asks the question; the manual text can be a manual document such as a manual instruction manual, that is, a pool of candidate answers that can solve the user's problem.
[0030] Specifically, when generating a manual feature vector and a correlation matrix, the manual text and the question text can be obtained first; then, based on the manual text, a manual word feature vector and a manual character feature vector are generated; then, based on the question text, a question word feature vector and a question character feature vector are generated; finally, a correlation matrix is generated based on the manual word feature vector, the manual character feature vector, the question word feature vector and the question character feature vector.
[0031] Among them, the process of generating manual word feature vectors and manual character feature vectors can firstly perform vector mapping on the manual text to generate manual word vectors and manual character vectors; then extract the semantic features in the manual word vectors and manual character vectors, and convert the manual word vectors and manual character vectors into manual word feature vectors and manual character feature vectors.
[0032] Exemplarily, the process of generating manual word vectors and manual character vectors can use the convolutional neural network vector mapping method in the prior art to map the vocabulary and characters in the manual text into a high-dimensional vector space, namely, the manual word feature vector and the manual character feature vector, which is not limited in the present invention. Exemplarily, the process of generating manual feature vectors can also be implemented by using a method in the prior art where a trained encoder encodes the manual word feature vector and the manual character feature vector, which is not limited in the present invention.
[0033] Similarly, the process of generating question word feature vectors and question character feature vectors can firstly perform vector mapping on the question text to generate question word vectors and question character vectors; then extract the semantic features in the question word vectors and question character vectors, and convert the question word vectors and question character vectors into question word feature vectors and question character feature vectors.
[0034] Exemplarily, the process of generating the problem word feature vector and the problem character feature vector may also adopt the convolutional neural network vector mapping method in the prior art to map the vocabulary and characters in the problem text to a high-dimensional vector space, i.e., the problem word feature vector and the problem character feature vector, which is not limited in the present invention. Exemplarily, the process of generating the problem feature vector may also be implemented by using a method in the prior art where a trained encoder encodes the problem word feature vector and the problem character feature vector, which is not limited in the present invention.
[0035] Among them, the process of generating the correlation matrix can calculate the word-level similarity between the manual word feature vector elements and the problem word feature vector elements according to a preset similarity calculation formula; then calculate the character-level similarity between the manual character feature vector elements and the problem character feature vector elements according to a preset similarity calculation formula; finally, the rows and columns in the word-level similarity and character-level similarity are normalized respectively, and integrated to generate the correlation matrix.
[0036] Exemplarily, the similarity calculation formula can be expressed by the following formula:
[0037] f(q,c)=W0[q,c,q⊙c]
[0038] Where q represents a manual word feature vector element or a manual character feature vector element, c represents a question word feature vector element or a question character feature vector element, and W 0 Represents the similarity coefficient, which can be obtained through multi-sample training.
[0039] Furthermore, the correlation matrix can represent the correlation between the information in the manual and the question and the degree of correlation, that is, for a certain word in the question, a certain word in the manual text is closest to it, so it can be considered that the word in the manual text is crucial to answering the question.
[0040] Exemplarily, the process of generating the correlation matrix may also use a recurrent neural network including attention in the prior art to calculate the correlation between the information in the manual and the question and the degree of correlation, which is not limited in the present invention. Exemplarily, when calculating the similarity, the HowNet in the prior art that can represent the relationship between concepts and the relationship between the attributes of concepts may also be used, which is not limited in the present invention.
[0041] Specifically, when extracting character-level feature vectors and word-level feature vectors related to the question text in the manual text, we can first generate a manual word-level weighted feature vector based on the correlation matrix and the manual word-level feature vector; then generate a manual character-level weighted feature vector based on the correlation matrix and the manual character-level feature vector.
[0042] The process of generating the manual word-level weighted feature vector may be to multiply each element in the manual word-level feature vector with each row or column of the correlation matrix according to a preset rule to generate the manual word-level weighted feature vector.
[0043] Exemplarily, the process of generating a manual word-level weighted feature vector may also be implemented using a bidirectional attention flow (BiDAF) model in the prior art, which is not limited in the present invention.
[0044] The process of generating the manual character-level weighted feature vector may be to multiply each element in the manual character-level feature vector with each row or column of the correlation matrix according to a preset rule to generate the manual word-level weighted feature vector.
[0045] Exemplarily, the process of generating a manual word-level weighted feature vector may also be implemented using a bidirectional attention flow (BiDAF) model in the prior art, which is not limited in the present invention.
[0046] Specifically, when extracting the semantic features of the beginning part and the ending part of the answer, we can first extract the manual word-level weighted feature elements of the beginning part and the manual word-level weighted feature elements of the ending part according to the preset rules based on the manual word-level weighted feature vector; then, according to the manual character-level weighted feature vector, extract the manual character-level weighted feature elements of the beginning part and the manual character-level weighted feature elements of the ending part according to the preset rules; then, according to the manual word-level weighted feature elements of the beginning part and the manual character-level weighted feature elements of the beginning part, extract the semantic features of the beginning part of the answer in the manual text; finally, according to the manual word-level weighted feature elements of the ending part and the manual character-level weighted feature elements of the ending part, extract the semantic features of the ending part of the answer in the manual text.
[0047] Exemplarily, the process of extracting the word-level weighted feature elements of the beginning manual and the word-level weighted feature elements of the ending manual can be implemented using a trained neural network model in the prior art, and the present invention is not limited to this.
[0048] Similarly, the process of extracting word-level weighted feature elements of the beginning manual and word-level weighted feature elements of the ending question manual can be implemented using a trained neural network model in the prior art, and the present invention is not limited to this.
[0049] Exemplarily, in the process of extracting the semantic features of the beginning part of the answer in the manual text, the word-level weighted feature elements of the beginning part of the manual and the character-level weighted feature elements of the beginning part of the manual can be input into a long short-term memory network (LSTM) or a sequence model for extraction, which is not limited to the present invention.
[0050] Similarly, in the process of extracting the semantic features of the end part of the answer in the manual text, the word-level weighted feature elements of the end part of the manual and the character-level weighted feature elements of the end part of the manual can be input into a long short-term memory network (LSTM) or a sequence model for extraction, which is not limited to the present invention.
[0051] Step S2, obtaining a first fused feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic features of the beginning part of the answer.
[0052] Step S3, obtaining a second fused feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic features of the end part of the answer.
[0053] Specifically, after the manual character-level weighted feature vector and the manual word-level weighted feature vector are superimposed into one vector, feature fusion is performed with the semantic features of the beginning part of the answer to obtain the first fused feature. Similarly, after the manual character-level weighted feature vector and the manual word-level weighted feature vector are superimposed into one vector, feature fusion is performed with the semantic features of the ending part of the answer to obtain the second fused feature.
[0054] Furthermore, taking three-layer fusion computing as an example, Represents the feature vector from the nth layer to the lth layer at the position (i, j) in the feature map. The first fusion feature can be expressed by the following formula:
[0055]
[0056] in, Represents the vector at the (i, j)th position of the lth layer of the output feature, and Represents the spatial weights of different layers to layer l on the feature map. The spatial weights can be learned by the model. and can be simple scalars, which are shared across all channels. and and All are between [0,1] and can be expressed by the following formula:
[0057]
[0058] Further, and As a parameter, it is represented by the softmax function and Then, a 1×1 convolutional layer is used to transform x 1→l and x 2→l To calculate the weighted scalar graph and
[0059] For example, assuming that the manual character-level weighted feature vector is [0.5, 0.5], and the manual word-level weighted feature vector is [0.8, 0.8], the superimposed manual weighted feature vector is Assume that the semantic features of the beginning of the answer are Then the first fusion feature y 1 It can be obtained by:
[0060]
[0061] Among them, the first layer fusion features It can be expressed by the following formula:
[0062]
[0063] Among them, the second layer fusion feature It can be expressed by the following formula:
[0064]
[0065] After calculation, we can get The first fusion feature
[0066] Similarly, the second fusion feature is obtained by using the same calculation method as the first fusion feature.
[0067] Step S4, obtaining the answer text according to the first fusion feature and the second fusion feature.
[0068] Specifically, firstly, according to the first fusion feature and the second fusion feature, the starting position code with the largest probability value and the ending position code with the largest probability value are obtained; then, according to the starting position code and the ending position code, the answer text is obtained.
[0069] Among them, the position code represents the position code of the characters in the manual text. According to the start position and end position codes, the position of the answer text in the manual can be determined.
[0070] Specifically, when obtaining the starting position code with the largest probability value and the ending position code with the largest probability value, the first fusion feature can be firstly linearly transformed to obtain a third fusion feature of a preset size; then, based on the third fusion feature, the first probability value can be confirmed; based on the first probability value, the starting position code with the largest probability value can be confirmed; then, the second fusion feature can be linearly transformed to obtain a fourth fusion feature of a preset size; then, based on the fourth fusion feature, the second probability value can be confirmed; finally, based on the second probability value, the ending position code with the largest probability value can be confirmed.
[0071] In the process of obtaining the third fusion feature of a preset size, the first fusion feature can be converted into the third fusion feature by matrix multiplication. Exemplarily, the third fusion feature can be obtained by multiplying the first fusion feature with a weight matrix of a preset size.
[0072] Among them, the process of confirming the first probability value can be calculated using the softmax function to calculate the first probability value p 1 The process can be expressed by the following formula:
[0073] p 1 =softmax(W 1 [F 3 ])
[0074] Among them, F 3 represents the elements in the third fusion feature, W 1 Represents the first probability confirmation coefficient, which can be obtained through multi-sample training.
[0075] The process of confirming the start position code with the largest probability value can be performed by multiple calculations until the first probability values corresponding to all elements in the third fusion feature are obtained. Then, all first probability values are traversed, and the corresponding start position code is output according to the largest first probability value.
[0076] Similarly, in the process of obtaining the fourth fusion feature of the preset size, the second fusion feature can be converted into the fourth fusion feature using matrix multiplication. Exemplarily, the fourth fusion feature can be obtained by multiplying the second fusion feature with a weight matrix of the preset size.
[0077] Similarly, the process of confirming the second probability value can be calculated using the softmax function to calculate the second probability value p 2 The process can be expressed by the following formula:
[0078] p 2 =softmax(W 2 [F 4 ])
[0079] Among them, F 4 represents the elements in the fourth fusion feature, W 2 Represents the second probability confirmation coefficient, which can be obtained through multi-sample training.
[0080] Similarly, the process of confirming the end position code with the largest probability value can be performed through multiple calculations until the second probability values corresponding to all elements in the fourth fusion feature are obtained. Then, all second probability values are traversed, and the corresponding end position code is output according to the largest second probability value.
[0081] The automatic question-answering method provided by the present invention can filter out contradictory or useless information in the features by fusing the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic features of the beginning or end of the answer, and extract the fusion features by adopting the spatial feature fusion algorithm. When in use, the feature information that is more relevant to the question in the context can be retained by adjusting the fusion algorithm parameters. The accuracy of the answer text is improved by the first fusion feature and the second fusion feature.
[0082] The present invention also discloses an automatic question-answering device, such as Figure 2 As shown, including:
[0083] The feature acquisition module 101 is used to obtain character-level feature vectors, word-level feature vectors, semantic features of the beginning part of the answer and semantic features of the end part of the answer based on the manual text and the question text; for details, please refer to the relevant description of step S1 in the above method embodiment, which will not be repeated here.
[0084] Specifically, Figure 3 As shown, the feature acquisition module 101 includes: a manual text input layer 201, which executes the process of acquiring the manual text. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A question text input layer 202, which executes the process of acquiring the question text. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A manual text mapping layer 203, which executes the process of generating the manual word vector and the manual character vector. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A manual vector encoding layer 204, which executes the process of generating the manual word feature vector and the manual character feature vector. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A question text mapping layer 205, which executes the process of generating the question word vector and the question character vector. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A question vector encoding layer 206, which executes the process of generating the question word feature vector and the question character feature vector. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A correlation calculation layer 207, which executes the process of generating the correlation matrix. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. The first model encoding layer 208 executes the process of generating the manual word-level weighted feature vector and the manual character-level weighted feature vector. For details, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. The second model encoding layer 209 executes the process of extracting the semantic features of the beginning part of the answer. For details, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. The third model encoding layer 210 executes the process of extracting the semantic features of the ending part of the answer. For details, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here.
[0085] The first fusion calculation module 102 is used to obtain the first fusion feature based on the spatial feature fusion algorithm according to the character-level feature vector, the word-level feature vector and the semantic features of the beginning part of the answer; the specific content can be found in the relevant description of step S2 in the above method embodiment, which will not be repeated here.
[0086] Specifically, Figure 3 As shown, the first fusion calculation module 102 includes: a starting partial fusion calculation layer 211, which executes a process of obtaining a first fusion feature. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here.
[0087] The second fusion calculation module 103 is used as a module to obtain the second fusion feature based on the spatial feature fusion algorithm according to the character-level feature vector, the word-level feature vector and the semantic features of the end part of the answer; for the specific content, please refer to the relevant description of step S3 in the above method embodiment, which will not be repeated here.
[0088] Specifically, Figure 3 As shown, the second fusion calculation module 103 includes: ending the partial fusion calculation layer 215, executing the process of obtaining the second fusion feature, and the specific content is referred to the relevant description in the embodiment of the method of the present invention, which will not be repeated here.
[0089] The answer text acquisition module 104 is used to obtain the answer text according to the first fusion feature and the second fusion feature; for the specific content, please refer to the relevant description of step S4 in the above method embodiment, which will not be repeated here.
[0090] Specifically, Figure 3 As shown, the answer text acquisition module 104 includes: a starting part linear transformation layer 212, which executes the process of obtaining the third fusion feature of a preset size. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A starting part probability calculation layer 213, which executes the process of confirming the first probability value. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. A starting part coding output layer 214, which executes the process of confirming the start position coding with the largest probability value. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. An ending part linear transformation layer 216, which executes the process of obtaining the fourth fusion feature of a preset size. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. An ending part probability calculation layer 217, which executes the process of confirming the second probability value. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here. An ending part coding output layer 218, which executes the process of confirming the end position coding with the largest probability value. For specific contents, please refer to the relevant description in the embodiment of the method of the present invention, which will not be repeated here.
[0091] The automatic question-answering device provided by the present invention can filter out contradictory or useless information in the features by fusing the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic features of the beginning or end of the answer, and extract the fusion features by adopting the spatial feature fusion algorithm. When in use, the feature information that is more relevant to the question in the context can be retained by adjusting the fusion algorithm parameters. The accuracy of the answer text is improved by the first fusion feature and the second fusion feature.
[0092] The embodiment of the present invention further provides an electronic device, such as Figure 4As shown, the electronic device may include a processor 301 and a memory 302, wherein the processor 301 and the memory 302 may be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0093] The processor 301 may be a central processing unit (CPU). The processor 301 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0094] The memory 302 is a non-transitory computer-readable storage medium that can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the automatic question-answering method in the embodiment of the present invention. The processor 301 executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory 302, that is, the automatic question-answering method in the above method embodiment is implemented.
[0095] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 301, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the processor 301 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0096] One or more modules are stored in the memory 302, and when executed by the processor 301, the execution is as follows: Figure 1 The automatic question answering method in the illustrated embodiment.
[0097] Although the exemplary embodiments and their advantages have been described in detail, those skilled in the art may make various changes, substitutions and modifications to these embodiments without departing from the spirit of the present invention and the scope of protection defined by the appended claims, and such modifications and variations all fall within the scope defined by the appended claims. For other examples, those of ordinary skill in the art should readily understand that the order of the process steps may be changed while maintaining the scope of protection of the present invention.
[0098] In addition, the scope of application of the present invention is not limited to the processes, mechanisms, manufactures, material compositions, means, methods and steps of the specific embodiments described in the specification. From the disclosure of the present invention, it will be easily understood by those skilled in the art that the processes, mechanisms, manufactures, material compositions, means, methods or steps that currently exist or will be developed in the future, which perform substantially the same functions as the corresponding embodiments described in the present invention or obtain substantially the same results, can be applied according to the present invention. Therefore, the claims attached to the present invention are intended to include these processes, mechanisms, manufactures, material compositions, means, methods or steps within their scope of protection.
Claims
1. An automatic question-answering method, characterized in that: include: Based on the manual text and the question text, obtain the manual character-level weighted feature vector, the manual word-level weighted feature vector, the semantic features of the beginning part of the answer and the semantic features of the end part of the answer; Obtaining a first fusion feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic feature of the beginning of the answer; Obtaining a second fusion feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic feature of the end of the answer; Acquire an answer text according to the first fusion feature and the second fusion feature; The step of obtaining a weighted manual character-level feature vector, a weighted manual word-level feature vector, a semantic feature of the beginning of the answer, and a semantic feature of the end of the answer based on the manual text and the question text includes: Obtain the manual text and question text, generate the manual word-level feature vector, the manual character-level feature vector and the correlation matrix; Generate a manual word-level weighted feature vector and a manual character-level weighted feature vector according to the manual word-level feature vector, the manual character-level feature vector and the correlation matrix; Extracting the semantic features of the beginning part of the answer and the semantic features of the ending part of the answer according to the correlation matrix, the word-level weighted feature vector of the manual and the character-level weighted feature vector of the manual; The step of extracting the semantic features of the beginning part of the answer and the semantic features of the ending part of the answer according to the correlation matrix, the word-level weighted feature vector of the manual, and the character-level weighted feature vector of the manual includes: According to the manual word-level weighted feature vector, extracting the manual word-level weighted feature element of the beginning part and the manual word-level weighted feature element of the ending part according to a preset rule; According to the manual character-level weighted feature vector, extracting the manual character-level weighted feature elements of the beginning part and the manual character-level weighted feature elements of the ending part according to a preset rule; Extracting semantic features of the beginning of the answer in the manual text according to the word-level weighted feature elements of the beginning manual and the character-level weighted feature elements of the beginning manual; According to the word-level weighted feature elements of the end part manual and the character-level weighted feature elements of the end part manual, semantic features of the end part of the answer in the manual text are extracted.
2. The automatic question-answering method according to claim 1, characterized in that: The obtaining of the manual text and the question text, and generating the manual word-level feature vector, the manual character-level feature vector and the correlation matrix, includes: Get the manual text and question text; Generating a manual word feature vector and a manual character feature vector according to the manual text; Generate a question word feature vector and a question character feature vector according to the question text; A correlation matrix is generated based on the manual word feature vector, the manual character feature vector, the question word feature vector and the question character feature vector.
3. The automatic question-answering method according to claim 1, characterized in that: The step of generating a manual word-level weighted feature vector and a manual character-level weighted feature vector according to the manual word-level feature vector, the manual character-level feature vector and the correlation matrix comprises: Generating a manual word-level weighted feature vector according to the correlation matrix and the manual word-level feature vector; A manual character-level weighted feature vector is generated according to the correlation matrix and the manual character-level feature vector.
4. The automatic question-answering method according to claim 1, characterized in that: The acquiring the answer text according to the first fusion feature and the second fusion feature includes: According to the first fusion feature and the second fusion feature, obtaining a start position code with a maximum probability value and an end position code with a maximum probability value; The answer text is obtained according to the starting position code and the ending position code.
5. The automatic question-answering method according to claim 4, characterized in that: The obtaining of the start position code with the largest probability value and the end position code with the largest probability value according to the first fusion feature and the second fusion feature comprises: Performing a linear transformation on the first fused feature to obtain a third fused feature of a preset size; Determining a first probability value according to the third fusion feature; According to the first probability value, determine the starting position code with the largest probability value; Performing a linear transformation on the second fused feature to obtain a fourth fused feature of a preset size; Determining a second probability value according to the fourth fusion feature; According to the second probability value, the end position code with the largest probability value is confirmed.
6. An automatic question-answering device, characterized in that: include: A feature acquisition module, for acquiring a manual character-level weighted feature vector, a manual word-level weighted feature vector, a semantic feature of the beginning of an answer, and a semantic feature of the end of an answer based on the manual text and the question text; A first fusion calculation module is used to obtain a first fusion feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic feature of the beginning of the answer; A second fusion calculation module is used to obtain a second fusion feature based on a spatial feature fusion algorithm according to the manual character-level weighted feature vector, the manual word-level weighted feature vector and the semantic feature of the end part of the answer; An answer text acquisition module, used for acquiring an answer text according to the first fusion feature and the second fusion feature; The step of obtaining a weighted manual character-level feature vector, a weighted manual word-level feature vector, a semantic feature of the beginning of the answer, and a semantic feature of the end of the answer based on the manual text and the question text includes: Obtain the manual text and question text, generate the manual word-level feature vector, the manual character-level feature vector and the correlation matrix; Generate a manual word-level weighted feature vector and a manual character-level weighted feature vector according to the manual word-level feature vector, the manual character-level feature vector and the correlation matrix; Extracting the semantic features of the beginning part of the answer and the semantic features of the ending part of the answer according to the correlation matrix, the word-level weighted feature vector of the manual and the character-level weighted feature vector of the manual; The step of extracting the semantic features of the beginning part of the answer and the semantic features of the ending part of the answer according to the correlation matrix, the word-level weighted feature vector of the manual, and the character-level weighted feature vector of the manual includes: According to the manual word-level weighted feature vector, extracting the manual word-level weighted feature element of the beginning part and the manual word-level weighted feature element of the ending part according to a preset rule; According to the manual character-level weighted feature vector, extracting the manual character-level weighted feature elements of the beginning part and the manual character-level weighted feature elements of the ending part according to a preset rule; Extracting semantic features of the beginning of the answer in the manual text according to the word-level weighted feature elements of the beginning manual and the character-level weighted feature elements of the beginning manual; According to the word-level weighted feature elements of the end part manual and the character-level weighted feature elements of the end part manual, semantic features of the end part of the answer in the manual text are extracted.
7. An electronic device, characterized in that: include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the automatic question-answering method as described in any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the automatic question-answering method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Machine reading understanding method for traffic infrastructure detection text
CN113312912A
An auto-disambiguation BOT engine for dynamic corpus selection per query
WO2019229769A1