Text matching method and device, equipment and storage medium

By using self-attention mechanism and multi-head attention mechanism for text matching in deep learning models, the problem of low accuracy of text matching in the existing technology is solved, the semantic and grammatical information extraction of questions is improved, and the question-answer system is improved. Match accuracy.

CN119202145APending Publication Date: 2024-12-27BEIJING JINGDONG ZHENSHI INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310760992.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-26
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, the accuracy of Chinese text matching is low, especially in complex sentence environments, and it is difficult to extract the semantic and grammatical information of the question sentence, resulting in the low accuracy of the question-answer system.

Method used

In the word embedding step of the deep learning model, the word embedding vectors of the word sequence to be matched and the word sequence of candidate matching results are obtained, feature extraction is performed through the multi-head attention mechanism, and the similarity feature vector is calculated to improve the matching accuracy. .

Benefits of technology

It improves the accuracy of text matching, enhances the correlation factors between question words, and improves the matching efficiency and accuracy of the question-and-answer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119202145A_ABST
    Figure CN119202145A_ABST
Patent Text Reader

Abstract

The invention provides a text matching method and device, equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps of obtaining a to-be-matched word sequence of a to-be-matched text; obtaining a candidate matching result word sequence of the to-be-matched text; based on a self-attention mechanism, respectively obtaining a word embedding vector of the to-be-matched word sequence and a word embedding vector of the candidate matching result word sequence; respectively carrying out feature extraction processing on the word embedding vector of the word sequence to be matched and the word embedding vector of the candidate matching result word sequence to obtain a feature sequence of the word sequence to be matched and a feature sequence of the candidate matching result word sequence; according to the feature sequence of the word sequence to be matched and the feature sequence of the word sequence of the candidate matching result, obtaining a similarity feature vector containing similarity comparison information between the text to be matched and the candidate matching result; and obtaining a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector. According to the method, the text matching accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a text matching method, device, electronic device and readable storage medium. Background Art

[0002] With the development of computer technology, more and more systems use artificial intelligence technology to answer questions raised by users. In the question-answering system in the related art, the keyword matching method is used to match the questions raised by users with the questions in the question-answering library, and the answers corresponding to the successfully matched questions are obtained to reply to customers. Due to the richness of Chinese meaning, the semantic similarity between sentences is directly measured based on keyword matching. In some cases, especially in complex sentence environments, the question matching accuracy is low, resulting in a low question-answering accuracy.

[0003] As mentioned above, how to improve the accuracy of text matching has become an urgent problem to be solved.

[0004] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention

[0005] The purpose of the present disclosure is to provide a text matching method, device, electronic device and readable storage medium, which can improve the accuracy of text matching at least to a certain extent.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] According to one aspect of the present disclosure, a text matching method is provided, comprising: obtaining a to-be-matched word sequence of a to-be-matched text; obtaining a candidate matching result word sequence of the to-be-matched text; obtaining a word embedding vector of the to-be-matched word sequence and a word embedding vector of the candidate matching result word sequence based on a self-attention mechanism; performing feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence, respectively, to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence; obtaining a similarity feature vector based on the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, wherein the similarity feature vector contains similarity comparison information between the to-be-matched text and the candidate matching result; and obtaining a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector.

[0008] According to an embodiment of the present disclosure, feature extraction processing is performed on the word embedding vectors of the word sequence to be matched and the word embedding vectors of the candidate matching result word sequence respectively to obtain a feature sequence of the word sequence to be matched and a feature sequence of the candidate matching result word sequence, including: performing feature extraction processing on the word embedding vectors of the word sequence to be matched based on a multi-head attention mechanism to obtain the feature sequence of the word sequence to be matched; performing feature extraction processing on the word embedding vectors of the candidate matching result word sequence based on a multi-head attention mechanism to obtain the feature sequence of the candidate matching result word sequence.

[0009] According to one embodiment of the present disclosure, the similarity feature vector includes a synthetic reasoning feature vector of a word sequence to be matched and a synthetic reasoning feature vector of a candidate matching result word sequence; obtaining the similarity feature vector based on the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence includes: performing difference calculation on the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence to obtain a difference feature sequence of the word sequence to be matched and a difference feature sequence of the candidate matching result word sequence; performing feature extraction processing on the difference feature sequence of the word sequence to be matched and the difference feature sequence of the candidate matching result word sequence, respectively, to obtain a synthetic reasoning feature vector of the word sequence to be matched and a synthetic reasoning feature vector of the candidate matching result word sequence.

[0010] According to an embodiment of the present disclosure, feature extraction processing is performed on the differential feature sequence of the word sequence to be matched and the differential feature sequence of the candidate matching result word sequence, respectively, to obtain a synthetic reasoning feature vector of the word sequence to be matched and a synthetic reasoning feature vector of the candidate matching result word sequence, including: performing feature extraction processing on the differential feature sequence of the word sequence to be matched based on a multi-head attention mechanism to obtain a synthetic reasoning feature vector of the word sequence to be matched; performing feature extraction processing on the differential feature sequence of the candidate matching result word sequence based on a multi-head attention mechanism to obtain a synthetic reasoning feature vector of the candidate matching result word sequence.

[0011] According to an embodiment of the present disclosure, a difference calculation is performed on the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence to obtain a difference feature sequence of the word sequence to be matched and a difference feature sequence of the candidate matching result word sequence, including: calculating the attention weight between the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence; obtaining a weighted sequence of the feature sequence of the word sequence to be matched and a weighted sequence of the feature sequence of the candidate matching result word sequence according to the attention weight; obtaining a difference feature sequence of the word sequence to be matched according to the feature sequence of the word sequence to be matched and its weighted sequence; obtaining a difference feature sequence of the candidate matching result word sequence according to the feature sequence of the candidate matching result word sequence and its weighted sequence.

[0012] According to one embodiment of the present disclosure, obtaining a candidate matching result word sequence of a text to be matched includes: obtaining candidate matching results of the text to be matched from a question and answer database; segmenting the candidate matching results of the text to be matched to obtain a candidate matching result word sequence of the text to be matched; the method also includes: updating the question and answer database according to the matching results between the text to be matched and the candidate matching results.

[0013] According to one embodiment of the present disclosure, obtaining a candidate matching result word sequence of a text to be matched includes: obtaining multiple questions in a question-answering database; respectively calculating a similarity score between the word sequence to be matched of the text to be matched and each question; selecting a preset number of questions with the highest similarity scores to the word sequence to be matched of the text to be matched from the multiple questions to obtain candidate matching results of the text to be matched; and performing word segmentation on each question in the candidate matching result of the text to be matched to obtain a candidate matching result word sequence of the text to be matched.

[0014] According to one embodiment of the present disclosure, the similarity feature vector includes a synthetic reasoning feature vector of a word sequence to be matched and a synthetic reasoning feature vector of a candidate matching result word sequence; obtaining a matching result between a text to be matched and a candidate matching result based on the similarity feature vector, including: performing average pooling and maximum pooling processing on the synthetic reasoning feature vector of the word sequence to be matched to obtain an average pooling feature value and a maximum pooling feature value of the word sequence to be matched; performing average pooling and maximum pooling processing on the synthetic reasoning feature vector of the candidate matching result word sequence to obtain an average pooling feature value and a maximum pooling feature value of the candidate matching result word sequence; arranging the average pooling feature value and the maximum pooling feature value of the word sequence to be matched and the average pooling feature value and the maximum pooling feature value of the candidate matching result word sequence into a fully connected input vector; performing weighted and biased processing on the fully connected input vector to obtain a classifier input vector; classifying the classifier input vector through a soft maximum classifier to obtain a matching result between the text to be matched and the candidate matching result.

[0015] According to one embodiment of the present disclosure, obtaining a sequence of words to be matched of a text to be matched includes: performing word segmentation processing on the text to be matched to obtain a segmentation result of the text to be matched; comparing the segmentation result of the text to be matched with a preset stop word list, removing stop words in the segmentation result of the text to be matched, and obtaining the sequence of words to be matched.

[0016] According to another aspect of the present disclosure, a text matching device is provided, comprising: a first acquisition module, used to acquire a to-be-matched word sequence of a to-be-matched text; a second acquisition module, used to acquire a candidate matching result word sequence of the to-be-matched text; a word embedding module, used to respectively obtain a word embedding vector of the to-be-matched word sequence and a word embedding vector of the candidate matching result word sequence based on a self-attention mechanism; a feature extraction module, used to respectively perform feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence; a similarity calculation module, used to obtain a similarity feature vector according to the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, wherein the similarity feature vector contains similarity comparison information between the to-be-matched text and the candidate matching result; and a classification module, used to obtain a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector.

[0017] According to another aspect of the present disclosure, an electronic device is provided, comprising: a memory, a processor, and executable instructions stored in the memory and executable in the processor, wherein the processor implements any of the above methods when executing the executable instructions.

[0018] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, and when the executable instructions are executed by a processor, any of the above methods is implemented.

[0019] The text matching method provided by the embodiment of the present disclosure first obtains the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence respectively based on the self-attention mechanism, then performs feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence respectively, obtains the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, then obtains the similarity feature vector containing the similarity comparison information between the to-be-matched text and the candidate matching result based on the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, and then obtains the matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector. The self-attention mechanism is used to solve the technical problems in the related art that the word embedding vector is difficult to extract the semantics and grammatical information of the question sentence and cannot obtain the position information of each word in the input question sentence, and the accuracy of text matching can be improved to a certain extent.

[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail example embodiments thereof with reference to the attached drawings.

[0022] Figure 1 A schematic diagram showing a system structure in an embodiment of the present disclosure.

[0023] Figure 2 A flowchart of a text matching method in an embodiment of the present disclosure is shown.

[0024] Figure 3 Shows Figure 2 FIG. 5 is a schematic diagram of the processing process of step S202 in one embodiment.

[0025] Figure 4 Shows Figure 2 FIG. 4 is a schematic diagram of the processing process of step S204 in one embodiment.

[0026] Figure 5 Shows Figure 2 FIG. 5 is a schematic diagram of the processing process of step S208 in one embodiment.

[0027] Figure 6 Shows Figure 2 FIG. 5 is a schematic diagram of the processing process of step S210 in one embodiment.

[0028] Figure 7 Shows Figure 6 FIG. 5 is a schematic diagram of the processing process of step S602 in one embodiment.

[0029] Figure 8 Shows Figure 6 FIG. 5 is a schematic diagram of the processing process of step S604 in one embodiment.

[0030] Fig. 9 Shows Figure 2 FIG. 5 is a schematic diagram of the processing process of step S212 in one embodiment.

[0031] Fig.10 A flowchart of another text matching method in an embodiment of the present disclosure is shown.

[0032] Fig.11 is based on Figures 2 to 10 A schematic diagram of a neural network structure for text matching is shown.

[0033] Fig.12 is based on Figures 2 to 11 A schematic diagram of the processing flow of a question-answering system is shown.

[0034] Fig.13 is based on Fig.12 A schematic diagram of the question-answering system architecture is shown.

[0035] Fig.14A A schematic diagram of page display is exemplarily shown.

[0036] Fig. 14B Another page display schematic diagram is shown exemplarily.

[0037] Fig. 14C Another page display schematic diagram is shown as an example.

[0038] Fig.14D Another page display schematic diagram is exemplarily shown.

[0039] Fig.15 A block diagram of a text matching device in an embodiment of the present disclosure is shown.

[0040] Fig.16 A block diagram of another text matching device in an embodiment of the present disclosure is shown.

[0041] Fig.17 A schematic structural diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0042] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The accompanying drawings are only schematic illustrations of the disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.

[0043] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, devices, steps, etc. may be adopted. In other cases, well-known structures, methods, devices, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0044] In addition, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. The symbol " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0045] In this disclosure, unless otherwise clearly specified and limited, terms such as "connection" should be understood in a broad sense, for example, it can be an electrical connection or can communicate with each other; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in this disclosure can be understood according to specific circumstances.

[0046] The short text matching algorithms used in question-answering systems in related technologies mainly include two categories: traditional question-answering systems and question-answering systems based on deep learning models for text matching.

[0047] Traditional question-answering systems use keyword matching methods or shallow machine learning-based models to determine the literal similarity between questions raised by users and questions in the question-answering database. For example, algorithms such as BoW (Bag of words), VSM (Vector Space Model), TF-IDF (Term Frequency–Inverse Document Frequency), BM25 (Best Matching), Jaccord, and SimHash are used to match sentences. For this method, sufficient training samples are required when training the model, otherwise the model effect will be very poor. However, in practical applications, it is impossible to train in all occasions, so the actual effect of this method is not ideal. Moreover, due to the richness of Chinese meaning, directly measuring the semantic similarity between sentences based on keyword matching has the disadvantages of low question-answering accuracy, stiff answer sentences, and lack of automatic answer generation in some cases, especially in complex sentence environments.

[0048] The question-answering system based on deep learning model for text matching automatically extracts the relationship between words from a large number of samples, and matches sentences by combining the structural information in phrase matching and the hierarchical characteristics of text matching, and discovers the features that are difficult to discover with traditional models and are not obvious in a large amount of data. For example, the commonly used CNN (Convolutional Neural Network), RNN (Recurrent Neural Network), and Attention Mechanism algorithms are used to achieve this. This method obtains text features by extracting features from word vectors or word vectors, but it is difficult to fully express the semantics of sentences and cannot give answers based on the contextual semantic information provided by users, thus affecting the accuracy of the question-answering system.

[0049] Therefore, the present disclosure provides a text matching method, which adopts a self-attention mechanism in the word embedding step of a deep learning model to solve the technical problems in the related art that word embedding vectors are difficult to extract the semantic and grammatical information of questions and cannot obtain the position information of each word in the input question, thereby improving the accuracy of text matching to a certain extent.

[0050] Figure 1 An exemplary system architecture 10 to which the text matching method or text matching apparatus of the present disclosure can be applied is shown.

[0051] like Figure 1As shown, the system architecture 10 may include a terminal device 102, a network 104, a server 106, and a database 108. The terminal device 102 may be a variety of electronic devices having a display screen and supporting input and output, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc. The network 104 is used to provide a medium for a communication link between the terminal device 102 and the server 106. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The server 106 may be a server or server cluster that provides various services, etc. The database 108 may be a large database software placed on a server, or a small database software installed on a computer for storing data.

[0052] The user can use the terminal device 102 to interact with the server 106 and the database 108 through the network 104 to receive or send data, etc. For example, the user enters a question on the software of the terminal device 102, and sends it to the server 106 through the network 104. The server 106 performs text matching between the question and the question in the question and answer database 108, and after obtaining the matching question, sends the corresponding answer to the terminal device 102 through the network 104, and displays it to the customer on the software interaction interface.

[0053] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0054] Figure 2 FIG. 1 is a flowchart of a text matching method according to an exemplary embodiment. Figure 2 The method shown can be applied to the server side of the above system, for example, and can also be applied to the terminal device of the above system.

[0055] refer to Figure 2 , the method 20 provided in the embodiment of the present disclosure may include the following steps.

[0056] In step S202, a sequence of words to be matched of the text to be matched is obtained.

[0057] In some embodiments, the text to be matched may be a question text entered by a user in the interactive interface of the question-answering system software. For example, the question-answering system may be an intelligent question-answering system for answering questions of regional managers and express delivery personnel when using the logistics order distribution system. This disclosure is described using this as an example, but is not limited thereto.

[0058] In some embodiments, the text to be matched may be preprocessed by word segmentation to obtain a word sequence to be matched. For specific implementations, please refer to Figure 3 .

[0059] In step S204, a candidate matching result word sequence of the text to be matched is obtained.

[0060] In some embodiments, the word sequence to be matched can be matched with the question in the question-answer database to obtain the candidate matching results of the initial screening, and then the candidate matching results (question) are segmented to obtain the candidate matching result word sequence to be input into the deep learning text matching model. Figure 4 .

[0061] In step S206, the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence are obtained respectively based on the self-attention mechanism.

[0062] In some embodiments, word vectors can be generated based on the Transformer's Self-Attention algorithm. When using Self-Attention to calculate word vectors, the correlation between words in the question is mainly calculated to obtain the relationship between words, avoiding the problem of long-distance dependency. The input can be a sequence of words to be matched and a sequence of candidate matching results. When a group of word sequences is input into the Self-Attention mechanism, Self-Attention will first convert the group of input words into an embedded vector V, and then obtain the weight feature vectors Q and K through the embedded vector V, and then use the dot multiplication method to perform a score operation on the vectors Q, K, and V to calculate the score of each word in the word sequence relative to other words. The score calculation formula is shown in the following formula (1):

[0063] Score=Q·K (1)

[0064] In order to prevent the gradient from changing too frequently, the Score can be normalized, that is, the result of the Score calculation is divided by d k , where d k The embedding length is K; and the Softmax activation function is used to complete the activation operation; then the result of Softmax is multiplied by V to obtain the score matrix A of each weighted input vector V, and then the word embedding vector of the input word sequence is obtained by multiplying the input vector V by the score matrix A.

[0065] In step S208, feature extraction processing is performed on the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence respectively to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence.

[0066] In some embodiments, feature extraction processing can be performed on the word embedding vector based on the multi-head attention mechanism to obtain a feature sequence. Figure 5 .

[0067] In step S210, a similarity feature vector is obtained according to the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence. The similarity feature vector contains similarity comparison information between the to-be-matched text and the candidate matching result.

[0068] In some embodiments, the similarity feature vector may include a synthetic reasoning feature vector of the word sequence to be matched and a synthetic reasoning feature vector of the candidate matching result word sequence. The feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence may be subjected to difference calculation and then feature extraction processing may be performed to obtain the synthetic reasoning feature vector and the synthetic reasoning feature vector of the two word sequences. Figures 6 to 8 .

[0069] In step S212, a matching result between the to-be-matched text and the candidate matching result is obtained based on the similarity feature vector, which is not limited in the present disclosure.

[0070] In some embodiments, the similarity feature vectors may be pooled and then output through a fully connected layer and a softmax layer for classification. Fig. 9 .

[0071] According to the text matching method provided by the embodiment of the present disclosure, the word embedding vector of the word sequence to be matched and the word embedding vector of the candidate matching result word sequence are obtained respectively based on the self-attention mechanism, and then the word embedding vector of the word sequence to be matched and the word embedding vector of the candidate matching result word sequence are respectively subjected to feature extraction processing to obtain the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence, and then the similarity feature vector containing the similarity comparison information between the text to be matched and the candidate matching result is obtained based on the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence, and then the matching result between the text to be matched and the candidate matching result is obtained based on the similarity feature vector. The technical problem that the word embedding vector in the related art is difficult to extract the semantics and grammatical information of the question sentence and cannot obtain the position information of each word in the input question sentence is solved, the correlation factor between the words in the question sentence is increased, and the accuracy of text matching is improved.

[0072] Figure 3 Shows Figure 2 The processing diagram of step S202 in one embodiment is shown in FIG. Figure 3 As shown, in the embodiment of the present disclosure, the above step S202 may further include the following steps.

[0073] Step S302, performing word segmentation processing on the text to be matched to obtain a word segmentation result of the text to be matched.

[0074] In some embodiments, the question sentence may be split into individual words using Jieba Chinese word segmentation technology.

[0075] Step S304, comparing the word segmentation result of the text to be matched with a preset stop word list, removing the stop words in the word segmentation result of the text to be matched, and obtaining a word sequence to be matched.

[0076] According to the method provided in the embodiment of the present disclosure, by performing preprocessing such as word segmentation and stop word removal on the text to be matched, a sequence of words to be matched for matching with a question and answer database is obtained, thereby improving the matching efficiency.

[0077] Figure 4 Shows Figure 2 The processing process of step S204 in one embodiment is shown in FIG. Figure 4 As shown, in the embodiment of the present disclosure, the above step S204 may further include the following steps.

[0078] Step S402: Acquire multiple questions in the question and answer database.

[0079] In some embodiments, taking the above-mentioned intelligent question-and-answer system for answering questions about the logistics order distribution system as an example, the current order distribution system team needs to answer questions by taking turns on duty. Based on previous on-duty experience and records of relevant documents, the questions frequently asked by regional managers and couriers and the standard answers corresponding to the questions can be sorted out. For example, these questions can be divided into "pre-sorting logic related questions", "address library related questions", "keyword related questions", "GIS fence related questions", "four-level analysis related questions", "site fence and road area related questions" and "other related questions". The Q_A library is established using the MySQL database, and the question_a table is used to store the sorted standard question and answer information, and the index table is used to store the index table information established by the inverted index. The Q_A library can provide a basis for the generation of the inverted index structure and the construction of the candidate question set in the question index module. When returning the answer, the system can also find the answer corresponding to the standard question from the Q_A library.

[0080] Step S404, respectively calculating the similarity scores between the to-be-matched word sequence of the to-be-matched text and each question sentence.

[0081] In some embodiments, the BM25 algorithm may be used to make a preliminary similarity judgment between the user input question and the questions in the self-built Q_A library, and obtain the similarity score of each question in the Q_A library.

[0082] Step S406 , selecting a preset number of questions having the highest similarity scores with the to-be-matched word sequence of the to-be-matched text from the multiple questions, and obtaining candidate matching results of the to-be-matched text.

[0083] In some embodiments, the top-ranked questions and answers can be extracted from the Q_A library to provide a candidate question set for the subsequent question matching using the deep learning text matching model (steps S206 to 212). For example, the preset number can be 5, 10, or 15.

[0084] Step S408, segmenting each question sentence in the candidate matching result of the to-be-matched text to obtain a candidate matching result word sequence of the to-be-matched text.

[0085] In some embodiments, the question sentence may be split into individual words using Jieba Chinese word segmentation technology.

[0086] According to the method provided in the embodiment of the present disclosure, by using the BM25 algorithm, the questions to be matched are preliminarily screened with all the questions in the question and answer library, and then several questions with high rankings are selected as the candidate question set, and then matched through a deep learning text matching model, the matching efficiency and accuracy of the question and answer system can be improved.

[0087] Figure 5 Shows Figure 2 The processing process of step S208 in one embodiment is shown in FIG. Figure 5 As shown, in the embodiment of the present disclosure, the above step S208 may further include the following steps.

[0088] Step S502: Perform feature extraction processing on the word embedding vector of the to-be-matched word sequence based on the multi-head attention mechanism to obtain a feature sequence of the to-be-matched word sequence.

[0089] Step S504, performing feature extraction processing on the word embedding vector of the candidate matching result word sequence based on the multi-head attention mechanism to obtain a feature sequence of the candidate matching result word sequence.

[0090] In some embodiments, a multi-head attention mechanism of a single-layer Transformer encoding unit can be used to perform feature extraction processing on the word embedding vector to obtain feature sequences of the to-be-matched word sequence and the candidate matching result word sequence, respectively.

[0091] According to the method provided in the embodiment of the present disclosure, a single-layer Transformer encoding unit is used in the encoding layer of the deep learning text matching model, which can solve the technical problem of being unable to obtain the connection between word contexts and unable to retain the high-level semantic information of sentences caused by the use of Bi-LSTM units in related technologies.

[0092] Figure 6 Shows Figure 2 The processing diagram of step S210 in one embodiment is shown in FIG. Figure 6As shown, in the embodiment of the present disclosure, the above step S210 may further include the following steps.

[0093] Step S602, performing difference calculation on the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence to obtain the difference feature sequence of the to-be-matched word sequence and the difference feature sequence of the candidate matching result word sequence.

[0094] In some embodiments, the local inference modeling method in the enhanced sequential inference model (ESIM) can be used to obtain the differential feature sequence of the word sequence to be matched and the differential feature sequence of the candidate matching result word sequence. For specific implementation methods, please refer to Figure 7 .

[0095] Step S604 , performing feature extraction processing on the difference feature sequences of the to-be-matched word sequences and the difference feature sequences of the candidate matching result word sequences, respectively, to obtain synthetic reasoning feature vectors of the to-be-matched word sequences and the synthetic reasoning feature vectors of the candidate matching result word sequences.

[0096] In some embodiments, feature extraction processing can be performed on the difference feature sequence based on the multi-head attention mechanism to obtain a synthetic reasoning feature vector. Figure 8 .

[0097] Figure 7 Shows Figure 6 The processing process of step S602 in one embodiment is shown in FIG. Figure 7 As shown, in the embodiment of the present disclosure, the above step S602 may further include the following steps.

[0098] Step S702, calculating the attention weight between the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence.

[0099] Step S704: obtaining a weighted sequence of feature sequences of the to-be-matched word sequence and a weighted sequence of feature sequences of the candidate matching result word sequence according to the attention weights.

[0100] In some embodiments, the Local Inference Modeling method in ESIM can be used to calculate the difference between the feature sequence of the extracted word sequence to be matched and the feature sequence of the candidate matching result word sequence, analyze the connection between the two word sequences, and obtain a weighted sequence of the feature sequences.

[0101] Step S706, obtaining a differential feature sequence of the to-be-matched word sequence according to the feature sequence of the to-be-matched word sequence and its weighted sequence.

[0102] Step S708, obtaining a differential feature sequence of the candidate matching result word sequence according to the feature sequence of the candidate matching result word sequence and its weighted sequence.

[0103] In some embodiments, the Local Inference Modeling method in ESIM may be used to combine the feature sequence, its weighted sequence, and the difference and product between the feature sequence and its weighted sequence, and store them in a differential feature sequence.

[0104] Figure 8 Shows Figure 6 The processing process of step S604 in one embodiment is shown in FIG. Figure 8 As shown, in the embodiment of the present disclosure, the above step S604 may further include the following steps.

[0105] Step S802: performing feature extraction processing on the differential feature sequence of the to-be-matched word sequence based on the multi-head attention mechanism to obtain a synthetic reasoning feature vector of the to-be-matched word sequence.

[0106] Step S804, based on the multi-head attention mechanism, feature extraction processing is performed on the differential feature sequence of the candidate matching result word sequence to obtain a synthetic reasoning feature vector of the candidate matching result word sequence.

[0107] In some embodiments, a multi-head attention mechanism of a single-layer Transformer encoding unit can be used to perform feature extraction processing on the differential feature sequence to obtain synthetic reasoning feature vectors of the to-be-matched word sequence and the candidate matching result word sequence, respectively.

[0108] According to the method provided in the embodiment of the present disclosure, a single-layer Transformer encoding unit is used in the synthetic reasoning layer of the deep learning text matching model, which can solve the technical problem of being unable to obtain the connection between word contexts and unable to retain high-level semantic information of sentences caused by the use of Bi-LSTM units in related technologies.

[0109] Fig. 9 Shows Figure 2 The processing process of step S212 in one embodiment is shown in FIG. Fig. 9 As shown, in the embodiment of the present disclosure, the above step S212 may further include the following steps.

[0110] Step S902 , average pooling and maximum pooling processing are performed on the synthetic reasoning feature vector of the to-be-matched word sequence to obtain the average pooling feature value and the maximum pooling feature value of the to-be-matched word sequence.

[0111] Step S904, average pooling and maximum pooling processing are performed on the synthetic reasoning feature vector of the candidate matching result word sequence to obtain the average pooling feature value and the maximum pooling feature value of the candidate matching result word sequence.

[0112] Step S906: Arrange the average pooling feature value and the maximum pooling feature value of the to-be-matched word sequence and the average pooling feature value and the maximum pooling feature value of the candidate matching result word sequence into a fully connected input vector.

[0113] Step S908: Perform weighting and bias processing on the fully connected input vector to obtain a classifier input vector.

[0114] Step S910: classify the classifier input vector through a softmax classifier to obtain a matching result between the text to be matched and the candidate matching result.

[0115] In some embodiments, the classifier may output a probability value corresponding to the degree of matching. If the matching probability of the question with the highest matching probability is greater than a preset threshold, the match is considered successful, and the answer corresponding to the question may be retrieved from the Q_A library and then output to the page through the front-end page. If the matching probability of the question with the highest matching probability is less than a preset threshold, the system will output a matching failure prompt to the page.

[0116] Fig.10 FIG. 1 is a flowchart of another text matching method according to an exemplary embodiment. Fig.10 The method shown can be applied to the server side of the above system, for example, and can also be applied to the terminal device of the above system. Fig.10 and Figure 2 The main difference is that Fig.10 Added a step to update the question-answer database used to screen candidate matching results.

[0117] refer to Fig.10 , the method 100 provided in the embodiment of the present disclosure may include the following steps.

[0118] In step S1002, a sequence of words to be matched of a text to be matched is obtained.

[0119] In some embodiments, the specific implementation of step S1002 may refer to step S202.

[0120] In step S1004, candidate matching results of the text to be matched are obtained from the question and answer database.

[0121] In step S1006, the candidate matching results of the to-be-matched text are segmented to obtain a candidate matching result word sequence of the to-be-matched text.

[0122] In some embodiments, the specific implementation of step S1004 and step S1006 can refer to Figure 4 .

[0123] In step S1008, the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence are obtained respectively based on the self-attention mechanism.

[0124] In some embodiments, the specific implementation of step S1008 may refer to step S206.

[0125] In step S1010, feature extraction processing is performed on the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence respectively to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence.

[0126] In some embodiments, the specific implementation of step S1010 may refer to step S208.

[0127] In step S1012, a similarity feature vector is obtained according to the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence. The similarity feature vector contains similarity comparison information between the to-be-matched text and the candidate matching result.

[0128] In some embodiments, the specific implementation of step S1012 may refer to step S210.

[0129] In step S1014, a matching result between the to-be-matched text and the candidate matching result is obtained based on the similarity feature vector.

[0130] In some embodiments, the specific implementation of step S1014 may refer to step S212.

[0131] In step S1016, the question-answer database is updated according to the matching result between the text to be matched and the candidate matching result.

[0132] In some embodiments, the question and answer database can be supplemented in a timely manner. For example, for a question entered by a user, if Figure 4 The candidate matching result obtained by the method has a low score (such as lower than the preset threshold), and then Figures 5 to 9 The deep learning text matching model calculates the result with high similarity and then returns the answer to the user. If the question is queried multiple times (such as the number of times exceeds the preset threshold), the question can be updated to the system's question and answer database.

[0133] For example, for the use of Figure 4 The candidate matching results obtained by the method have lower scores. Figures 5 to 9The similarity calculated by the deep learning text matching model is also low, but the questions with a high number of queries can also be added to the system's question and answer database for storage and annotation to realize database updates.

[0134] Although the question-answer database in the related art is oriented to a common question set, the question-answer pairs contained therein are relatively fixed. When a user inputs a newly added or modified question about new fence information, it is difficult for the system to find a standard question sentence with a similar meaning to the user input. According to the method provided in the embodiment of the present disclosure, the question-answer database can be supplemented in a timely manner to improve the availability of the system.

[0135] Fig.11 is based on Figures 2 to 10 A schematic diagram of a neural network structure for text matching is shown in FIG. Fig.11 As shown, using the neural network to perform text matching may include the following steps S11002 to S11008.

[0136] In step S11002, the input word sequence is encoded. First, the word embedding module 1104 is used to embed the input word sequence 1102 to obtain a word vector. The specific implementation method can refer to step S206. Then the word vector is passed through the multi-head attention layer 1106 and the residual processing and normalization layer 1108. Based on the multi-head attention mechanism, the word embedding vector is subjected to feature extraction processing to obtain a feature sequence. The specific implementation method can refer to Figure 5 .

[0137] In step S11004, the local reasoning model of ESIM is used to perform similarity calculation on premise 1110 (feature sequence of the word sequence to be matched) and hypothesis 1112 (feature sequence of the candidate matching result word sequence), analyze the connection between the two word sequences, and obtain the difference feature sequence. Figure 7 .

[0138] In step S11006, the difference feature sequence is passed through a multi-head attention layer 1114 and a residual processing and normalization layer 1116, and a multi-head attention mechanism of a single-layer Transformer encoding unit is used to perform synthetic reasoning on the difference feature sequence to obtain synthetic reasoning feature vectors of the to-be-matched word sequence and the candidate matching result word sequence, respectively.

[0139] In step S11008, classification prediction is performed based on the synthetic inference feature vector, and after passing through the pooling layer 1118, it is input into the softmax classifier through the fully connected layer (not shown in the figure), and the matching results of the word sequence to be matched and the candidate matching result word sequence are output, for example, the three categories of "very good match", "general match" and "mismatch" and their corresponding probabilities. For specific implementation, please refer to Fig. 9 .

[0140] In some embodiments, a loss function in the form of a cross entropy function may be used to train Fig.11 The deep learning model shown.

[0141] Fig.12 is based on Figures 2 to 11 A schematic diagram of the question-answering system processing flow is shown in FIG. Fig.12 As shown, the processing flow may include the following steps S1202 to S1220.

[0142] Step S1202, the process starts.

[0143] Step S1204: The user inputs a question in the system software interactive interface, and the system performs pre-processing such as word segmentation.

[0144] Step S1206: Use the BM25 algorithm to make a preliminary similarity judgment between the user input question and the questions in the self-built question-answering database. For specific implementation methods, please refer to Figure 4 If the preliminary match is successful (for example, the scores of the top 10 questions with the highest similarity are greater than a preset threshold), the process goes to step S1208, otherwise, the process goes to step S1218.

[0145] Step S1208, obtaining a set of candidate questions initially screened by the BM25 algorithm.

[0146] Step S1210, the user input question is matched with each candidate question in the candidate question set through a deep learning model. The specific implementation method can refer to steps S206 to S212. If the model is successful (for example, there is a question with a matching probability higher than a preset threshold), go to step S1212, otherwise go to step S1218.

[0147] Step S1212, obtaining matching result questions.

[0148] Step S1214: extracting the answer corresponding to the matching result question from the question and answer database.

[0149] Step S1216, display the answer on the system software interactive interface.

[0150] Step S1218, the system software interactive interface prompts that no answer can be found.

[0151] Step S1220, the process ends.

[0152] Fig.13 is based on Fig.12 A schematic diagram of the question-answering system architecture is shown in FIG. Fig.13As shown, the user input module 1302 can be used to execute step S1204; the preprocessing module 1304 can be used to perform preprocessing such as word segmentation on the question input by the user; the first matching module 1306 can be used to interact with the database module 1305 to execute step S1206; the second matching module 1306 can be used to execute step S1210; the answer extraction module 1310 can be used to execute step S1214; and the page display module 1312 can be used to execute steps S1216 and S1218.

[0153] Due to the rapid growth in the scale of online ordering users, there has been a significant increase in the demand for managers to maintain road areas and stations, and for express delivery personnel to inquire and complain about orders, addresses, fences and road areas. However, there is currently no intelligent question-and-answer system to help the logistics order distribution system team answer online questions from regional managers and express delivery personnel. The order distribution system team needs to take turns on duty to answer questions for both, resulting in a waste of manpower costs.

[0154] By adopting the question-and-answer system (hereinafter referred to as "this system") using the text matching method provided by the embodiment of the present disclosure, express delivery personnel can not only obtain answers to existing questions in the question-and-answer database, but also can give relatively accurate answers when questions similar to those in the question-and-answer database or questions with inconsistent terms but the same semantics as those in the question-and-answer database are input. FIG. 14A to FIG. 14D Several page display schematic diagrams are shown as examples.

[0155] Fig.14A A schematic diagram of page display is shown as an example. Fig.14A As shown, the courier delivery personnel input the question sentence "Why was the fence of the xx road area adjusted? After the adjustment, I clicked Save, but the adjusted part was not saved and it was still the same as before the modification?" After the question sentence matching was performed by this system, the answer obtained was "The basic data of this station was a bit abnormal and has been restored." It can be seen that when the courier delivery personnel input a long question sentence, the method provided by the embodiment of the present disclosure can more accurately analyze the semantic information of the question sentence and give an answer at the same time.

[0156] When the question input by the user is different from the question in the question and answer database but has the same semantics, the method provided by the embodiment of the present disclosure can be used to match the appropriate question. Fig. 14B Another page display schematic diagram is shown as an example. The input question is "Why does the keyword not take effect immediately after release?" After the system performs question matching, the answer obtained is "It takes two hours after release to take effect." Fig. 14C Another schematic diagram of page display is shown as an example. The input question is "Does the keyword take effect immediately after release?" After the system performs question matching, the answer obtained is "It will take effect two hours after release." Fig.14DAnother page display diagram is shown as an example. The input question is "Can the keyword take effect immediately after release?" After matching the question using this system, the answer is "It will take effect two hours after release." FIG. 14B to FIG. 14D The questions all express the meaning of "how long does it take for the keyword to take effect after it is released". Although there are no relevant keywords such as "time", the method provided by the present invention can also accurately capture its meaning and extract the corresponding answer.

[0157] Fig.15 FIG. 1 is a block diagram of a text matching device according to an exemplary embodiment. Fig.15 The device shown can be applied to the server side of the above system, for example, and can also be applied to the terminal device of the above system.

[0158] refer to Fig.15 The device 150 provided in the embodiment of the present disclosure may include a first acquisition module 1502, a second acquisition module 1504, a word embedding module 1506, a feature extraction module 1508, a similarity calculation module 1510 and a classification module 1512.

[0159] The first acquisition module 1502 may be used to acquire a to-be-matched word sequence of a to-be-matched text.

[0160] The second acquisition module 1504 may be used to acquire a candidate matching result word sequence of the to-be-matched text.

[0161] The word embedding module 1506 can be used to obtain the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence based on the self-attention mechanism.

[0162] The feature extraction module 1508 may be used to perform feature extraction processing on the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence, respectively, to obtain feature sequences of the to-be-matched word sequence and feature sequences of the candidate matching result word sequence.

[0163] The similarity calculation module 1510 may be used to obtain a similarity feature vector according to a feature sequence of a to-be-matched word sequence and a feature sequence of a candidate matching result word sequence. The similarity feature vector includes similarity comparison information between the to-be-matched text and the candidate matching result.

[0164] The classification module 1512 may be used to obtain a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector.

[0165] Fig.16 FIG. 1 is a block diagram of another text matching device according to an exemplary embodiment. Fig.16 The device shown can be applied to the server side of the above system, for example, and can also be applied to the terminal device of the above system.

[0166] refer to Fig.16 The device 160 provided in the embodiment of the present disclosure may include a first acquisition module 1602, a second acquisition module 1604, a word embedding module 1606, a feature extraction module 1608, a similarity calculation module 1610, a classification module 1612 and a question and answer library update module 1614.

[0167] The first acquisition module 1602 may be used to acquire a to-be-matched word sequence of a to-be-matched text.

[0168] The first acquisition module 1602 can also be used to perform word segmentation processing on the text to be matched to obtain the word segmentation result of the text to be matched; compare the word segmentation result of the text to be matched with a preset stop word list, remove the stop words in the word segmentation result of the text to be matched, and obtain a word sequence to be matched.

[0169] The second acquisition module 1604 may be used to acquire a candidate matching result word sequence of the to-be-matched text.

[0170] The second acquisition module 1604 can also be used to obtain candidate matching results of the text to be matched from the question and answer database; perform word segmentation on the candidate matching results of the text to be matched to obtain a candidate matching result word sequence of the text to be matched.

[0171] The second acquisition module 1604 can also be used to obtain multiple questions in the question-answering database; calculate the similarity score between the to-be-matched word sequence of the to-be-matched text and each question; select a preset number of questions with the highest similarity scores with the to-be-matched word sequence of the to-be-matched text from the multiple questions to obtain candidate matching results of the to-be-matched text; segment each question in the candidate matching results of the to-be-matched text to obtain a candidate matching result word sequence of the to-be-matched text.

[0172] The word embedding module 1606 can be used to obtain the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence based on the self-attention mechanism.

[0173] The feature extraction module 1608 may be used to perform feature extraction processing on the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence, respectively, to obtain feature sequences of the to-be-matched word sequence and feature sequences of the candidate matching result word sequence.

[0174] The feature extraction module 1608 can also be used to perform feature extraction processing on the word embedding vector of the to-be-matched word sequence based on the multi-head attention mechanism to obtain the feature sequence of the to-be-matched word sequence; perform feature extraction processing on the word embedding vector of the candidate matching result word sequence based on the multi-head attention mechanism to obtain the feature sequence of the candidate matching result word sequence.

[0175] The similarity calculation module 1610 may be used to obtain a similarity feature vector according to a feature sequence of a to-be-matched word sequence and a feature sequence of a candidate matching result word sequence. The similarity feature vector includes similarity comparison information between the to-be-matched text and the candidate matching result.

[0176] The similarity feature vector may include a synthetic reasoning feature vector of a to-be-matched word sequence and a synthetic reasoning feature vector of a candidate matching result word sequence.

[0177] The similarity calculation module 1610 can also be used to perform difference calculation on the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence to obtain the difference feature sequence of the word sequence to be matched and the difference feature sequence of the candidate matching result word sequence; perform feature extraction processing on the difference feature sequence of the word sequence to be matched and the difference feature sequence of the candidate matching result word sequence respectively to obtain the synthetic reasoning feature vector of the word sequence to be matched and the synthetic reasoning feature vector of the candidate matching result word sequence.

[0178] The similarity calculation module 1610 can also be used to perform feature extraction processing on the differential feature sequence of the to-be-matched word sequence based on the multi-head attention mechanism to obtain a synthetic reasoning feature vector of the to-be-matched word sequence; perform feature extraction processing on the differential feature sequence of the candidate matching result word sequence based on the multi-head attention mechanism to obtain a synthetic reasoning feature vector of the candidate matching result word sequence.

[0179] The similarity calculation module 1610 can also be used to calculate the attention weight between the feature sequence of the word sequence to be matched and the feature sequence of the candidate matching result word sequence; obtain the weighted sequence of the feature sequence of the word sequence to be matched and the weighted sequence of the feature sequence of the candidate matching result word sequence according to the attention weight; obtain the differential feature sequence of the word sequence to be matched according to the feature sequence of the word sequence to be matched and its weighted sequence; obtain the differential feature sequence of the candidate matching result word sequence according to the feature sequence of the candidate matching result word sequence and its weighted sequence.

[0180] The classification module 1612 may be used to obtain a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector.

[0181] The question and answer database updating module 1614 may be used to update the question and answer database according to the matching result between the to-be-matched text and the candidate matching result.

[0182] The question and answer library update module 1614 can also be used to perform average pooling and maximum pooling processing on the synthetic reasoning feature vector of the word sequence to be matched, so as to obtain the average pooling feature value and the maximum pooling feature value of the word sequence to be matched; perform average pooling and maximum pooling processing on the synthetic reasoning feature vector of the candidate matching result word sequence, so as to obtain the average pooling feature value and the maximum pooling feature value of the candidate matching result word sequence; arrange the average pooling feature value and the maximum pooling feature value of the word sequence to be matched, and the average pooling feature value and the maximum pooling feature value of the candidate matching result word sequence into a fully connected input vector; perform weighted and bias processing on the fully connected input vector to obtain a classifier input vector; classify the classifier input vector through a soft maximum classifier to obtain a matching result between the text to be matched and the candidate matching result.

[0183] The specific implementation of each module in the device provided by the embodiment of the present disclosure can refer to the content of the above method, which will not be repeated here.

[0184] Fig.17 The following is a schematic diagram showing the structure of an electronic device in an embodiment of the present disclosure. It should be noted that: Fig.17 The device shown is only an example of a computer system, which should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0185] like Fig.17 As shown, the device 1700 includes a central processing unit (CPU) 1701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1702 or a program loaded from a storage portion 1708 into a random access memory (RAM) 1703. In the RAM 1703, various programs and data required for the operation of the device 1700 are also stored. The CPU 1701, the ROM 1702, and the RAM 1703 are connected to each other via a bus 1704. An input / output (I / O) interface 1705 is also connected to the bus 1704.

[0186] The following components are connected to the I / O interface 1705: an input section 1706 including a keyboard, a mouse, etc.; an output section 1707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1708 including a hard disk, etc.; and a communication section 1709 including a network interface card such as a LAN card, a modem, etc. The communication section 1709 performs communication processing via a network such as the Internet. A drive 1710 is also connected to the I / O interface 1705 as needed. A removable medium 1711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1710 as needed, so that a computer program read therefrom is installed into the storage section 1708 as needed.

[0187] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1709, and / or installed from a removable medium 1711. When the computer program is executed by a central processing unit (CPU) 1701, the above-mentioned functions defined in the system of the present disclosure are executed.

[0188] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0189] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0190] The modules involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The modules described may also be arranged in a processor, for example, they may be described as: a processor including an acquisition module, a word embedding module, a feature extraction module, a similarity calculation module and a classification module. The names of these modules do not constitute a limitation on the modules themselves in certain cases, for example, the acquisition module may also be described as a "module for obtaining text matching model input".

[0191] As another aspect, the present disclosure further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0192] Obtain a to-be-matched word sequence of the to-be-matched text; obtain a candidate matching result word sequence of the to-be-matched text; obtain a word embedding vector of the to-be-matched word sequence and a word embedding vector of the candidate matching result word sequence based on a self-attention mechanism; perform feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence, respectively, to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence; obtain a similarity feature vector based on the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, the similarity feature vector containing similarity comparison information between the to-be-matched text and the candidate matching result; obtain a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector.

[0193] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.

Claims

1. A text matching method, characterized in that: include: Obtain a sequence of words to be matched in the text to be matched; Obtain candidate matching result word sequence of the text to be matched; Based on the self-attention mechanism, the word embedding vectors of the word sequence to be matched and the word embedding vectors of the candidate matching result word sequence are obtained respectively; Performing feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence respectively to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence; Obtaining a similarity feature vector according to the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, wherein the similarity feature vector includes similarity comparison information between the to-be-matched text and the candidate matching result; A matching result between the to-be-matched text and the candidate matching result is obtained based on the similarity feature vector.

2. The method according to claim 1, characterized in that Performing feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence respectively to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence, including: Performing feature extraction processing on the word embedding vector of the to-be-matched word sequence based on a multi-head attention mechanism to obtain a feature sequence of the to-be-matched word sequence; Based on the multi-head attention mechanism, feature extraction processing is performed on the word embedding vector of the candidate matching result word sequence to obtain the feature sequence of the candidate matching result word sequence.

3. The method according to claim 1, characterized in that The similarity feature vector includes a synthetic reasoning feature vector of a to-be-matched word sequence and a synthetic reasoning feature vector of a candidate matching result word sequence; Obtaining a similarity feature vector according to the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence includes: Calculating the difference between the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence to obtain the difference feature sequence of the to-be-matched word sequence and the difference feature sequence of the candidate matching result word sequence; Feature extraction processing is performed on the difference feature sequence of the to-be-matched word sequence and the difference feature sequence of the candidate matching result word sequence respectively to obtain a synthetic reasoning feature vector of the to-be-matched word sequence and a synthetic reasoning feature vector of the candidate matching result word sequence.

4. The method according to claim 3, characterized in that Performing feature extraction processing on the difference feature sequence of the to-be-matched word sequence and the difference feature sequence of the candidate matching result word sequence respectively to obtain a synthetic reasoning feature vector of the to-be-matched word sequence and a synthetic reasoning feature vector of the candidate matching result word sequence, including: Performing feature extraction processing on the differential feature sequence of the to-be-matched word sequence based on a multi-head attention mechanism to obtain a synthetic reasoning feature vector of the to-be-matched word sequence; Based on the multi-head attention mechanism, feature extraction processing is performed on the differential feature sequence of the candidate matching result word sequence to obtain a synthetic reasoning feature vector of the candidate matching result word sequence.

5. The method according to claim 3, characterized in that: Calculating the difference between the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence to obtain the difference feature sequence of the to-be-matched word sequence and the difference feature sequence of the candidate matching result word sequence, including: Calculating the attention weight between the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence; Obtaining a weighted sequence of feature sequences of a to-be-matched word sequence and a weighted sequence of feature sequences of a candidate matching result word sequence according to the attention weights; Obtaining a differential feature sequence of the word sequence to be matched according to the feature sequence of the word sequence to be matched and its weighted sequence; The differential feature sequence of the candidate matching result word sequence is obtained according to the feature sequence of the candidate matching result word sequence and its weight sequence.

6. The method according to claim 1, characterized in that Get the candidate matching result word sequence of the text to be matched, including: Obtain candidate matching results of the text to be matched from the question-answering database; Segmenting the candidate matching results of the to-be-matched text to obtain a candidate matching result word sequence of the to-be-matched text; The method further comprises: The question-answer database is updated according to the matching result between the text to be matched and the candidate matching result.

7. The method according to claim 1, characterized in that Get the candidate matching result word sequence of the text to be matched, including: Obtain multiple questions in the question-answering database; Calculating the similarity scores between the to-be-matched word sequence of the to-be-matched text and each question sentence respectively; Selecting a preset number of questions with the highest similarity scores to the to-be-matched word sequence of the to-be-matched text from the multiple questions, and obtaining candidate matching results for the to-be-matched text; Each question sentence in the candidate matching result of the to-be-matched text is segmented to obtain a candidate matching result word sequence of the to-be-matched text.

8. The method according to claim 1, characterized in that The similarity feature vector includes a synthetic reasoning feature vector of a to-be-matched word sequence and a synthetic reasoning feature vector of a candidate matching result word sequence; Obtaining a matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector includes: Performing average pooling and maximum pooling processing on the synthetic reasoning feature vector of the to-be-matched word sequence to obtain an average pooling feature value and a maximum pooling feature value of the to-be-matched word sequence; Performing average pooling and maximum pooling processing on the synthetic reasoning feature vector of the candidate matching result word sequence to obtain an average pooling feature value and a maximum pooling feature value of the candidate matching result word sequence; Arranging the average pooled feature value and the maximum pooled feature value of the to-be-matched word sequence and the average pooled feature value and the maximum pooled feature value of the candidate matching result word sequence into a fully connected input vector; Performing weighting and biasing processing on the fully connected input vector to obtain a classifier input vector; The classifier input vector is classified by a soft maximum classifier to obtain a matching result between the text to be matched and a candidate matching result.

9. The method according to claim 1, characterized in that Get the word sequence to be matched in the text to be matched, including: Perform word segmentation on the text to be matched to obtain the word segmentation result of the text to be matched; The word segmentation result of the text to be matched is compared with a preset stop word list, and the stop words in the word segmentation result of the text to be matched are removed to obtain the word sequence to be matched.

10. A text matching device, characterized in that: include: A first acquisition module is used to acquire a sequence of words to be matched of a text to be matched; The second acquisition module is used to obtain a candidate matching result word sequence of the text to be matched; A word embedding module is used to obtain the word embedding vectors of the to-be-matched word sequence and the word embedding vectors of the candidate matching result word sequence based on the self-attention mechanism; A feature extraction module is used to perform feature extraction processing on the word embedding vector of the to-be-matched word sequence and the word embedding vector of the candidate matching result word sequence, respectively, to obtain a feature sequence of the to-be-matched word sequence and a feature sequence of the candidate matching result word sequence; A similarity calculation module, used for obtaining a similarity feature vector according to the feature sequence of the to-be-matched word sequence and the feature sequence of the candidate matching result word sequence, wherein the similarity feature vector contains similarity comparison information between the to-be-matched text and the candidate matching result; The classification module is used to obtain the matching result between the to-be-matched text and the candidate matching result based on the similarity feature vector.

11. An electronic device, comprising: A memory, a processor, and executable instructions stored in the memory and executable in the processor, wherein the processor implements the method according to any one of claims 1 to 9 when executing the executable instructions.

12. A computer-readable storage medium having computer-executable instructions stored thereon, characterized in that: When the executable instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.