Text matching method, device, equipment, and storage medium

By using feature enhancement of the word vectors of the sample statement, generating entity and attribute representation vectors and splicing them, and training the text matching model, the problem of insufficient utilization of entity features of existing models is solved, and the prediction accuracy and matching accuracy of user input statements are improved.

CN114077862BActive Publication Date: 2025-07-11ALIBABA GROUP HOLDING LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010851892.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-21
Publication Date
2025-07-11
Estimated Expiration
2040-08-21

AI Technical Summary

Technical Problem

During the training process, existing text matching models are difficult to effectively utilize entity and attribute features, resulting in insufficient prediction accuracy, especially in the absence of entity names in user input statements, matching accuracy decreases.

Method used

By using the word vectors of the sample statements to feature enhancement, the entity representation vector and attribute representation vector are generated from the entity information dimension and the attribute information dimension respectively, and splicing them into statement representation vectors. These vectors are used to train the text matching model to enhance the model's representation ability of entities and attribute features.

Benefits of technology

It improves the prediction accuracy of the text matching model, and can accurately match similar text in the preset knowledge base when the user input statement contains or does not include entity names, improving the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077862B_ABST
    Figure CN114077862B_ABST
Patent Text Reader

Abstract

One or more embodiments of this specification provide a text matching method, apparatus, device, and storage medium. The method may include: converting each word in the word sequence corresponding to the user input statement into a corresponding word vector; performing feature enhancement on each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement; concatenating the entity representation vector and the attribute representation vector to obtain a statement representation vector of the user input statement; inputting the representation vector of any statement in the preset knowledge base and the statement representation vector into a preset text matching model, and determining the statement in the preset knowledge base that matches the user input statement according to the output result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of this specification relate to the field of artificial intelligence technology, and in particular, to a text matching method, apparatus, device, and storage medium. Background Art

[0002] In related technologies, machine learning technology can use algorithms to learn from existing data and make judgments and decisions on real-world situations. Machine learning technology includes supervised learning, unsupervised learning, semi-supervised learning, reinforcement learning, and so on.

[0003] For the training process of supervised learning, the input sample data is called a "training set", and the sample data in the training set has a clear identifier or result (i.e., sample label). When using a supervised learning algorithm to establish a prediction model, the supervised learning algorithm establishes a learning process to compare the prediction result with the actual result of the "training set" and continuously adjusts the prediction model until the prediction result of the model reaches an expected accuracy rate.

[0004] Common application scenarios of supervised learning include classification problems, regression problems, etc., and common algorithms include logistic regression, neural networks, decision trees, support vector machines, Bayesian classifiers, and so on. Summary of the Invention

[0005] In view of this, one or more embodiments of this specification provide a text matching method, apparatus, device, and storage medium.

[0006] To achieve the above object, one or more embodiments of this specification provide the following technical solutions:

[0007] According to a first aspect of one or more embodiments of this specification, a text matching method is proposed, including:

[0008] Converting each word in the word sequence corresponding to the user input statement into a corresponding word vector;

[0009] Performing feature enhancement on each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement;

[0010] Concatenating the entity representation vector and the attribute representation vector to obtain a statement representation vector of the user input statement;

[0011] Inputting the representation vector of any statement in the preset knowledge base and the statement representation vector into a preset text matching model, and determining the statement in the preset knowledge base that matches the user input statement according to the output result.

[0012] According to a second aspect of one or more embodiments of the present specification, a method for training a text matching model is provided, including:

[0013] Obtain word vectors of each word in the word sequence corresponding to the sample statement;

[0014] Perform feature enhancement on each word vector to obtain an entity representation vector corresponding to the sample statement and an attribute representation vector corresponding to the sample statement;

[0015] Concatenate the entity representation vector and the attribute representation vector to obtain a statement representation vector of the sample statement;

[0016] Train a text matching model according to the statement representation vector and the corresponding sample label, where the sample label includes the similarity between the statement representation vector and the representation vectors of each statement in the preset knowledge base.

[0017] According to a third aspect of one or more embodiments of the present specification, a text matching device is provided, including:

[0018] A conversion unit that converts each word in the word sequence corresponding to the user input statement into a corresponding word vector;

[0019] A feature enhancement unit that performs feature enhancement on each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement;

[0020] A concatenation unit that concatenates the entity representation vector and the attribute representation vector to obtain a statement representation vector of the user input statement;

[0021] A matching unit that inputs the representation vector of any statement in the preset knowledge base and the statement representation vector into a preset text matching model, and determines the statement in the preset knowledge base that matches the user input statement according to the output result.

[0022] According to a fourth aspect of one or more embodiments of the present specification, a training device for a text matching model is provided, including:

[0023] An acquisition unit that acquires word vectors of each word in the word sequence corresponding to the sample statement;

[0024] A feature enhancement unit that performs feature enhancement on each word vector to obtain an entity representation vector corresponding to the sample statement and an attribute representation vector corresponding to the sample statement;

[0025] A concatenation unit that concatenates the entity representation vector and the attribute representation vector to obtain a statement representation vector of the sample statement;

[0026] A training unit trains a text matching model according to the statement representation vector and the corresponding sample labels, where the sample labels include the similarity between the statement representation vector and the representation vectors of each statement in a preset knowledge base.

[0027] According to a fifth aspect of one or more embodiments of this specification, an electronic device is provided, including:

[0028] A processor;

[0029] A memory for storing instructions executable by the processor;

[0030] Wherein, the processor realizes the method described in any one of the above embodiments by running the executable instructions.

[0031] According to a sixth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in any one of the above embodiments are realized.

[0032] As can be seen from the above embodiments, the technical solution provided in this specification improves the text representation method of the text matching model. In the process of training the text matching model, the features of each word in the sample statement are strengthened from the entity information dimension and the attribute information dimension respectively to obtain the statement representation vector of the sample statement, and this statement representation vector can reflect the entity features and attribute features of the sample statement. Then, using the statement representation vector of the sample statement and the corresponding sample labels to train the text matching model can improve the prediction accuracy of the trained text matching model.

[0033] Correspondingly, when using the trained text matching model for text matching, the user input statement is also feature-strengthened in the same way as above, and the obtained statement representation vector and the representation vectors of the statements in the preset knowledge base are used as the input of the text matching model, so that the similarity between the input vectors can be obtained through the output result of the text matching model, and then the statement in the preset knowledge base that matches the user input statement can be determined. Description of the Drawings

[0034] Figure 1 is a flowchart of a method for training a text matching model provided by an exemplary embodiment.

[0035] Figure 2 is a flowchart of a text matching method provided by an exemplary embodiment.

[0036] Figure 3 is a flowchart of another method for training a text matching model provided by an exemplary embodiment.

[0037] Figure 4It is a schematic diagram of feature enhancement provided by an exemplary embodiment.

[0038] Figure 5 It is a flowchart of another text matching method provided by an exemplary embodiment.

[0039] Figure 6 It is a schematic structural diagram of a device provided by an exemplary embodiment.

[0040] Figure 7 It is a block diagram of a training device for a text matching model provided by an exemplary embodiment.

[0041] Figure 8 It is a schematic structural diagram of another device provided by an exemplary embodiment.

[0042] Figure 9 It is a block diagram of a text matching device provided by an exemplary embodiment. Detailed implementation manners

[0043] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with one or more embodiments of this specification. On the contrary, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0044] It should be noted that: In other embodiments, the steps of the corresponding methods are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.

[0045] In the related art, supervised learning can be used to classify texts. Taking the customer service scenario as an example, when the FAQ (Frequently Asked Questions) online robot of the online customer service system communicates with a user, a text matching model can be used to determine the similarity between the user input statement and the text in the preset knowledge base, and then the statement in the preset knowledge base that matches the user input statement can be used to determine the reply content.

[0046] This specification aims to provide a training solution for a text matching model and a solution for text matching using the text matching model. By improving the text representation method of the text matching model, the prediction accuracy of the trained text matching model is improved.

[0047] Please refer to Figure 1 , Figure 1 which is a flowchart of a training method for a text matching model provided by an exemplary embodiment. As Figure 1 shown, this method is applied to any electronic device that can be used to train a machine learning model and may include the following steps:

[0048] Step 102, obtain the word vectors of each word in the word sequence corresponding to the sample sentence.

[0049] In this embodiment, taking the above customer service scenario as an example, a certain number of texts can be randomly selected from the online logs of the online customer service system (used to record the conversation content between users and the FAQ online robot), and then the texts are labeled by annotators. Thus, the texts and the labeled tags are used as a training set for subsequent training of the text matching model. Among them, the tags of the sample sentences can include the similarity (similarity degree) between the sample sentences and each sentence in the preset knowledge base.

[0050] As an exemplary embodiment, the sample sentences used to train the text matching model can be user input questions; correspondingly, the sentences in the preset knowledge base can include standard user questions. Among them, the standard user questions can be understood as one or more common expressions of a certain type of user questions. That is, taking the user questions configured in the preset knowledge base as a standard, calculate the similarity between the current user input question and each user question in the knowledge base, so as to determine the user question that matches the user input question (for example, the similarity exceeds the preset similarity threshold), and then use the knowledge point to which the user question belongs as the reply content of the user input question to explain the user's doubts. For example, the knowledge points can also be recorded in the knowledge base and establish a mapping relationship with the standard user questions. Of course, the sample sentences can also be other arbitrary forms of user input content, such as the chat content input by the user, the issued interaction instructions, etc., and this specification does not limit this.

[0051] After obtaining the sample sentence, the obtained sample sentence can be vectorized to facilitate subsequent extraction of the features of the sample sentence for feature enhancement. Specifically, the sample sentence can be tokenized first to obtain a word sequence corresponding to the sample sentence, and then an encoder can be used to encode the word sequence to obtain word vectors corresponding to each word in the word sequence. For example, if the sample sentence is the user input sentence "How to query the account points", then the user input sentence can be tokenized to obtain the word sequence "How, query, account points", and then each word in the word sequence can be encoded to obtain the corresponding word vectors. Among them, any encoder such as LSTM (Long Short-Term Memory), Transformer, CNN (Convolutional Neural Networks) can be used to encode the word sequence, and the output result of the encoder is the embedding (the embedded vector representation form of the word) of each word.

[0052] Step 104, perform feature enhancement on each word vector to obtain an entity representation vector corresponding to the sample sentence and an attribute representation vector corresponding to the sample sentence.

[0053] The entity set describes a set of entities with the same type and the same attributes, so it often has the concept of type. For example, an apple is an entity of the fruit type. And an attribute is the common property and characteristic that an entity has. For example, the origin, variety, color, etc. of an apple. In the process of training a text matching model, feature enhancement can be performed on each word in the sample sentence from the entity information dimension and the attribute information dimension respectively to obtain a sample sentence representation vector, so that the sample sentence representation vector can simultaneously reflect the entity features and attribute features of the sample sentence. Then, using the sample sentence representation vector and the corresponding sample label to train the text matching model can improve the prediction accuracy of the trained text matching model.

[0054] Specifically, when representing a sample sentence, by introducing the entity features and attribute features of the sample sentence, the discrimination ability between entities of a certain type can be enhanced, thereby improving the accuracy of finally matching and hitting the text in the preset knowledge base. Correspondingly, when performing text matching using the trained text matching model, the above-mentioned method of introducing entity features and attribute features is also adopted to strengthen the features of the user input sentence, and the obtained input text representation vector and the representation vector of the text in the preset knowledge base are used as the input of the text matching model. Then, the similarity between the input vectors can be obtained through the output result of the text matching model, and further, the text in the preset knowledge base that matches the user input sentence can be determined. Moreover, since the user input sentence is represented from both the entity information dimension and the attribute information dimension, even if the user input sentence has no entity (that is, the name of the entity does not appear in the text itself), the above-mentioned text matching operation can still be implemented. That is to say, the texts with entities and the texts without entities can be uniformly optimized, rather than being scattered into two text matching models for separate training and subsequent text matching.

[0055] For the process of feature enhancement, an entity information library and an attribute information library can be pre-configured. The entity information library contains at least one entity value, and the entity value is also represented in the form of a vector, that is, an entity information vector. In other words, there is a "one-to-one" relationship between the entity value and the entity information vector. The number of entity information vectors is the same as the number of entity values in the entity information library. Similarly, the attribute information library contains at least one attribute value, and the attribute value is also represented in the form of a vector, that is, an attribute information vector. Similarly, there is a "one-to-one" relationship between the attribute value and the attribute information vector. The number of attribute information vectors is the same as the number of attribute values in the attribute information library. It should be noted that this specification does not limit the number of entity information vectors and attribute information vectors. Taking festivals as an example, the entity values in the entity information library can include the Dragon Boat Festival, the Mid-Autumn Festival, the Tomb-Sweeping Festival, etc., and the attribute values in the attribute information library can include introduction, time, customs, etc.; these entity values and attribute values are all represented in the form of vectors.

[0056] The attention mechanism can obtain the dependencies and importance degrees between words in the text, so as to better represent the features of the text. Therefore, based on the configuration of the entity information library and the attribute information library, the entity attention weights (also called entity attention probabilities) between each word vector and the entity information vector can be determined through the attention mechanism, and the attribute attention weights (also called attribute attention probabilities) between each word vector and the attribute information vector can be determined through the attention mechanism. After determining the entity attention weights and the attribute attention weights, the entity representation vector can be obtained based on the entity attention weights, and the attribute representation vector can be obtained based on the attribute attention weights.

[0057] In one case, entity statement vectors can be used as entity representation vectors, and attribute statement vectors can be used as attribute representation vectors. In this case, the attention weights (including the above-mentioned entity attention weights and attribute attention weights) can be measured by similarity; for example, the entity attention weight is the similarity between the word vector and the entity information vector in the entity information library. Then, the similarity between each word vector and at least some of the entity information vectors can be calculated through the attention mechanism, and the obtained similarities are weighted and summed as the first entity attention weights of the corresponding word vectors to obtain the entity statement vector; similarly, the similarity between each word vector and at least some of the attribute information vectors can be calculated through the attention mechanism, and the obtained similarities are weighted and summed as the first attribute attention weights of the corresponding word vectors to obtain the attribute statement vector. Among them, for the number of entity information vectors and attribute information vectors selected, it can be flexibly set according to the actual situation. For example, all the implementation information vectors in the entity information library can be selected to calculate the similarity, or only a part of the implementation information vectors can be selected to calculate the similarity; of course, this specification does not limit this.

[0058] In another case, in order to further improve the accuracy of feature enhancement to better represent the features of the sample statement, the entity representation vector may further include an entity value vector in addition to the above-mentioned entity statement vector; similarly, the attribute representation vector may further include an attribute value vector in addition to the above-mentioned attribute statement vector. The calculation methods of the entity value vector and the attribute value vector will be described below.

[0059] Based on the obtained entity statement vector, the similarity between at least some of the entity information vectors and the entity statement vector can be further calculated through the attention mechanism, so that the obtained similarities are weighted and summed as the second entity attention weights of the corresponding entity information vectors to obtain the entity value vector. After obtaining the entity value vector, the entity statement vector and the entity value vector can be concatenated to obtain the entity representation vector. Similarly, based on the obtained attribute statement vector, the similarity between at least some of the attribute information vectors and the attribute statement vector can be further calculated through the attention mechanism, so that the obtained similarities are weighted and summed as the second attribute attention weights of the corresponding attribute information vectors to obtain the attribute value vector. After obtaining the attribute value vector, the attribute statement vector and the attribute value vector can be concatenated to obtain the attribute representation vector.

[0060] Similar to the foregoing, when calculating the entity value vector and the attribute value vector, for the number of entity information vectors and attribute information vectors selected, it can be flexibly set according to the actual situation. For example, all the implementation information vectors in the entity information library can be selected to calculate the similarity, or only a part of the implementation information vectors can be selected to calculate the similarity; of course, this specification does not limit this.

[0061] Step 106: Concatenate the entity representation vector and the attribute representation vector to obtain the sentence representation vector of the sample sentence.

[0062] Step 108: Train a text matching model based on the sentence representation vector and the corresponding sample label. The sample label includes the similarity between the sentence representation vector and the representation vectors of each sentence in the preset knowledge base.

[0063] After obtaining the sample sentence representation vector that can simultaneously reflect the entity features and attribute features of the sample sentence through the above feature enhancement process, the text matching model can be trained using this sample sentence representation vector and the corresponding sample label.

[0064] In one case, the similarity between the sample sentence representation vector and the representation vectors of each text in the preset knowledge base can be used as the sample label. In this case, the input of the text matching model is the sample sentence representation vector and the representation vector of a sentence (any sentence) in the preset knowledge base (which can also be obtained by the above feature enhancement method), and the output is the similarity between the input vectors (hereinafter referred to as the first type of similarity).

[0065] In another case, on the basis of the above sample label, the similarity between the above entity value vector and the entity sentence vector (hereinafter referred to as the second type of similarity), and / or the similarity between the above attribute value vector and the attribute sentence vector (hereinafter referred to as the third type of similarity) can also be used as the sample label. In other words, in addition to the training task for the above first type of similarity, there are further training tasks for the above second type of similarity and / or the above third type of similarity, and training is carried out in the form of multi-task training. By using the above second type and third type of similarities as sample labels to assist in training, it can effectively avoid large deviations in the above feature enhancement process (inability to correctly represent the features of the text), thereby improving the prediction accuracy of the trained text matching model.

[0066] For example, a similarity threshold k can be set. If the similarity exceeds the similarity threshold k, the value of the corresponding sample label is 1, otherwise it is 0. Of course, different similarity thresholds can also be set for each type of similarity respectively, and this specification does not limit this.

[0067] In this embodiment, any model for text matching can be selected as the text matching model in step 108 above, and this specification does not limit this. For example, based on the above-described method of using the attention mechanism for text representation, a text matching model incorporating the attention mechanism can be correspondingly adopted. For instance, algorithms such as ESIM (Enhanced LSTM for Natural Language Inference), DSSM (Deep Structured Semantic Models), and ABCNN (Attention-Based Convolutional Neural Network).

[0068] Regarding the above Figure 1 illustrated embodiment of training a text matching model, this specification also correspondingly provides a text matching solution based on the text matching model. Please refer to Figure 2 , Figure 2 which is a flowchart of a text matching method provided by an exemplary embodiment. As Figure 2 shown, this method is applied to any electronic device capable of text matching and may include the following steps:

[0069] Step 202, convert each word in the word sequence corresponding to the user input statement into a corresponding word vector.

[0070] As described above, the user input statement can be first tokenized to obtain the word sequence, and then an encoder is used to encode the word sequence to obtain the word vectors corresponding to each word in the word sequence.

[0071] Step 204, perform feature enhancement on each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement.

[0072] As described above, a preset entity information library and a preset attribute information library can be obtained. The preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector. Then, the entity representation vector is obtained based on the entity attention weights of each word vector and the entity information vector determined through the attention mechanism; and the attribute representation vector is obtained based on the attribute attention weights of each word vector and the attribute information vector determined through the attention mechanism.

[0073] As described above, the entity representation vector includes an entity statement vector, and the attribute representation vector includes an attribute statement vector. In this case, the similarity between each word vector and at least part of the entity information vector can be calculated through an attention mechanism, and each obtained similarity is used as the first entity attention weight of the corresponding word vector and weighted and summed to obtain the entity statement vector. Similarly, the similarity between each word vector and at least part of the attribute information vector can be calculated through an attention mechanism, and each obtained similarity is used as the first attribute attention weight of the corresponding word vector and weighted and summed to obtain the attribute statement vector.

[0074] As described above, the entity representation vector further includes an entity value vector, and the attribute representation vector further includes an attribute value vector. In this case, the similarity between at least part of the entity information vector and the entity statement vector can be calculated through an attention mechanism, and each obtained similarity is used as the second entity attention weight of the corresponding entity information vector and weighted and summed to obtain the entity value vector, and the entity statement vector and the entity value vector are concatenated to obtain the entity representation vector. Similarly, the similarity between at least part of the attribute information vector and the attribute statement vector can be calculated through an attention mechanism, and each obtained similarity is used as the second attribute attention weight of the corresponding attribute information vector and weighted and summed to obtain the attribute value vector, and the attribute statement vector and the attribute value vector are concatenated to obtain the attribute representation vector.

[0075] Step 206: Concatenate the entity representation vector and the attribute representation vector to obtain the statement representation vector of the user input statement.

[0076] Step 208: Input the representation vector of any statement in the preset knowledge base and the statement representation vector into a preset text matching model, and determine the statement in the preset knowledge base that matches the user input statement according to the output result.

[0077] As described above, the user input statement may be a user input question, and the text in the corresponding preset knowledge base may be a standard user question. Then, after determining the text in the preset knowledge base that matches the user input statement, the knowledge point to which the matched standard user question belongs can be further provided to the input party of the user input statement.

[0078] It should be noted that the training process of the text matching model can refer to the above Figure 1In the illustrated embodiment, the processing manner for the user input statement is similar to the processing manner for the sample statement described above, and will not be elaborated herein. Among them, for the different sample tags in the above two cases, the corresponding output results are also different. For example, the first type of similarity can be used as a measure for determining whether the two input vectors match. Of course, the second type of similarity and / or the third type of similarity can also be further used as measures.

[0079] For ease of understanding, the following takes the customer service scenario as an example to Figures 3 - 5 describe in detail the training process of the text matching model and the process of text matching using the text matching model.

[0080] Please refer to Figure 3 , Figure 3 which is a flowchart of another training method of the text matching model provided by an exemplary embodiment. As Figure 3 shown, the method may include the following steps:

[0081] Step 302, perform word segmentation on the user question to obtain a word sequence.

[0082] In this embodiment, a certain number of user questions can be randomly selected from the online logs of the online customer service system, and then the annotators annotate these user questions, so as to use the user questions and the annotated tags as a training set for subsequent training of the text matching model. Among them, the tags of the user questions may include the similarity (similarity degree) between the user questions and each standard user question in the preset knowledge base.

[0083] The standard user question can be understood as one or more common expressions of a certain type of user question. That is, taking the user questions configured in the preset knowledge base as the standard, calculating the similarity between the current user input question and each user question in the knowledge base, so as to determine the user question that matches the user input question (for example, the similarity exceeds the preset similarity threshold), and then using the knowledge point to which the user question belongs as the reply content of the user input question to explain the user's doubt. For example, the knowledge points can also be recorded in the knowledge base and establish a mapping relationship with the standard user questions.

[0084] Step 304, encode the word sequence to obtain word vectors corresponding to each word in the word sequence.

[0085] In this embodiment, the user question is used as a sample statement to train the text matching model. As Figure 4As shown, if the user's question is "What date is the Dragon Boat Festival?", the user's question can be segmented to obtain the word sequence "Dragon Boat Festival, is, what date", and then each word in the word sequence can be encoded to obtain the corresponding word vector. For example, the word vector of the word "Dragon Boat Festival" is vector 301, the word vector of the word "is" is vector 302, and the word vector of the word "what date" is vector 303.

[0086] Among them, any encoder such as LSTM (Long Short-Term Memory, long short-term memory artificial neural network), Transformer, CNN (Convolutional Neural Networks, convolutional neural network) can be used to encode the word sequence, and the output result of the encoder is the embedding of each word.

[0087] Step 306A, compress the word vector into an entity statement vector.

[0088] In this embodiment, an entity value dictionary (i.e., the entity information library in Figure 1 ) and an attribute value dictionary (i.e., the attribute information library in Figure 1 ) can be pre-configured. The entity value dictionary contains at least one entity value, and the entity value is also represented in the form of a vector. Similarly, the attribute value dictionary contains at least one attribute value, and the attribute value is also represented in the form of a vector. It should be noted that this specification does not limit the number of entity values and attribute values. Taking festivals as an example, the entity values in the entity dictionary can include the Dragon Boat Festival, the Mid-Autumn Festival, the Tomb-Sweeping Festival, etc., and the attribute values in the attribute value dictionary can include introduction, time, customs, etc.; these entity values and attribute values are all represented in the form of vectors.

[0089] The attention mechanism can capture the dependencies and importance among words in a text, thus better representing the features of the text. Therefore, the entity attention weights (also called entity attention probabilities) of each word with respect to the entity values in the entity value dictionary can be determined through the attention mechanism. For example, (at least some of) the entity values in the entity value dictionary can be first converted into an entity matching vector, and then the similarity between the embedding of each word and the entity matching vector is calculated to obtain a matching score. Then, all the matching scores are passed through softmax (normalization) and used as the weighting coefficients for adding the embeddings. Finally, the embeddings of all words are weighted and added together to obtain the entity sentence vector. For example, the cosine distances between the word vectors 301 - 313 and the entity matching vector are calculated to obtain the matching scores. Then, after passing all the matching scores through softmax, the weighting coefficients a - c for the word vectors 301 - 313 are obtained respectively. Then, the product of the word vector 301 and the weighting coefficient a is the vector 311, the product of the word vector 302 and the weighting coefficient b is the vector 312, and the product of the word vector 303 and the weighting coefficient c is the vector 313. Further, adding the vectors 311 - 313 together gives the entity sentence vector.

[0090] Step 306B: Compress the word vector into an attribute sentence vector.

[0091] The calculation method of the attribute sentence vector is similar to the calculation process of the entity sentence vector and will not be elaborated here.

[0092] Step 308A: Compress the candidate entity value vector into an entity value vector.

[0093] In this embodiment, the weighted vector representations (i.e., entity value vectors) of the entity values in the entity value dictionary and the weighted vector representations (i.e., attribute value vectors) of the attribute values in the attribute value dictionary can be further obtained through the attention mechanism respectively.

[0094] For example, a certain number of entity values can be selected from the entity value field as candidate entity values. The similarity between the vectors (embeddings) of the candidate entity values and the above-mentioned entity sentence vector is calculated to obtain a matching score. Then, all the matching scores are passed through softmax and used as the weighting coefficients for adding the vectors of the candidate entity values. Finally, the vectors of all the candidate entity values are weighted and added together to obtain the entity value vector.

[0095] For example, the cosine distances between the vectors 321 - 323 of the candidate entity values and the entity statement vector are calculated to obtain matching scores. Then, after passing all the matching scores through softmax, the weighted coefficients d - f of the vectors 321 - 323 are obtained respectively. Then, the product of the vector 321 and the weighted coefficient d is the vector 331, the product of the vector 322 and the weighted coefficient e is the vector 332, and the product of the vector 323 and the weighted coefficient f is the vector 333. Further, adding the vectors 331 - 333 gives the entity value vector.

[0096] Step 308B: Compress the candidate attribute value vector into an attribute value vector.

[0097] The calculation method of the attribute value vector is similar to the calculation process of the entity value vector and will not be elaborated here.

[0098] Step 310A: Concatenate to obtain an entity representation vector.

[0099] Concatenate the entity statement vector and the entity value vector to obtain an entity representation vector.

[0100] Step 310B: Concatenate to obtain an attribute representation vector.

[0101] Concatenate the attribute statement vector and the attribute value vector to obtain an attribute representation vector.

[0102] Step 312: Concatenate the entity representation vector and the attribute representation vector to obtain a user question representation vector.

[0103] In this embodiment, the user question representation vector includes an entity statement vector, an entity value vector, an attribute statement vector, and an attribute value vector. Among them, the concatenation order can be flexibly set according to the actual situation, as long as all user questions in the sample statement are concatenated in a unified order. This specification does not limit this.

[0104] Step 314: Determine the sample label.

[0105] Step 316: Perform multi - task training to obtain a text matching model.

[0106] In the process of training a text matching model, the inputs are the representation vectors of the user's question and the sentences (any sentence) in the preset knowledge base (which can also be obtained, for example, by the above-mentioned feature enhancement method), and the outputs (i.e., sample labels) include the similarity between the input vectors (the first type of similarity), the similarity between the entity value vector and the entity sentence vector (the second type of similarity), and the similarity between the attribute value vector and the attribute sentence vector (the third type of similarity). By using the above-mentioned first type of similarity, second type of similarity, and third type of similarity as sample labels for multi-task training, it is possible to effectively avoid large deviations in the above-mentioned feature enhancement process (inability to correctly represent the features of the text), thereby improving the prediction accuracy of the trained text matching model.

[0107] For example, the format of the training sample sentences is: query1 query2 label entityproperty; where query1 represents the representation vector of the user's question, query2 represents the representation vector of the standard user question in the knowledge base, label represents the first type of similarity, entity represents the second type of similarity, and property represents the third type of similarity. Among them, a similarity threshold k can be set. If the similarity exceeds the similarity threshold k, the value of the corresponding sample label is 1, otherwise it is 0. Of course, different similarity thresholds can also be set for each type of similarity respectively, and this specification does not limit this.

[0108] For the text matching algorithm adopted, a text matching model with an attention mechanism can be used. For example, algorithms such as ESIM, DSSM, and ABCNN, and this specification does not limit this.

[0109] Please refer to Figure 5 , Figure 5 which is a flowchart of another text matching method provided by an exemplary embodiment. As Figure 5 shown, the method may include the following steps:

[0110] Step 502, perform word segmentation on the user input question to obtain a word sequence.

[0111] Step 504, encode the word sequence to obtain word vectors corresponding to each word in the word sequence.

[0112] Step 506A, compress the word vectors into entity sentence vectors.

[0113] Step 506B, compress the word vectors into attribute sentence vectors.

[0114] Step 508A, compress the candidate entity value vectors into entity value vectors.

[0115] Step 508B, compress the candidate attribute value vector into an attribute value vector.

[0116] Step 510A, splice to obtain an entity representation vector.

[0117] Step 510B, splice to obtain an attribute representation vector.

[0118] Step 512, splice to obtain an input question representation vector.

[0119] For the specific implementation details of the above steps 502 - 512, reference can be made to the above steps 302 - 312, which will not be elaborated here.

[0120] Step 514, input the input question representation vector into the text matching model.

[0121] Step 516, determine the user standard question that matches in the knowledge base.

[0122] It should be noted that for the above situation where the sample label contains label, entity, and property, when using the text matching model for prediction, it can be determined whether the two input vectors match only according to the label in the output result of the text matching model. For example, when using the text matching model for text matching, the input format is query1 and query2, and the output is label. Then, when the value of label exceeds the preset similarity threshold, it can be determined that the two input vectors match each other, that is, the match is successful.

[0123] Of course, entity and / or property can also be further used as a measurement criterion for determining whether the two input vectors match each other. For example, only when the values of abel, entity, and property all exceed the corresponding similarity thresholds can it be determined that the two input vectors match each other.

[0124] Step 518, output knowledge points.

[0125] In this embodiment, the knowledge points can also be recorded in the knowledge base and establish a mapping relationship with the standard user questions. Taking the network operator providing customer service to users as an example, the mapping relationship between the standard user questions and the knowledge points is shown in Table 1:

[0126] User's question Knowledge point Can domestic remaining data be used to turn on the hotspot? Personal hotspot settings instructions MMS cannot be sent MMS usage instructions How to use the phone bill redeemed with points Points redemption introduction How to replace a SIM card in a different location Cross - region SIM card replacement introduction What is targeted data? Targeted data introduction …… ……

[0127] Table 1

[0128] Then, after determining the user standard question that matches the user input question in the knowledge base, the knowledge points to which the user standard question belongs can be used as the reply content for the user input question to explain the user's doubts, thereby improving the user experience.

[0129] It should be noted that the above scenarios of network operators are only exemplary examples, and the text matching scheme in this specification can also be applied to any other type of business platform that provides customer service to users. For example, business platforms such as e-commerce, government affairs, finance, education, culture and entertainment, health, and tourism can all provide customer service to users.

[0130] Corresponding to the above method embodiments, this specification also provides embodiments of a training device for a text matching model and a text matching device.

[0131] Figure 6 It is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to Figure 6 , at the hardware level, this device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610. Of course, it may also include other hardware required for other services. The processor 602 reads the corresponding computer program from the non-volatile memory 610 into the memory 608 and then runs it, forming a training device for the text matching model at the logical level. Of course, in addition to the software implementation method, one or more embodiments of this specification do not exclude other implementation methods, such as logical devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logical unit, and can also be hardware or a logical device.

[0132] Please refer to Figure 7 , in a software implementation manner, the training device for the text matching model may include:

[0133] An obtaining unit 71, which obtains the word vectors of each word in the word sequence corresponding to the sample statement;

[0134] A feature strengthening unit 72, which strengthens the features of each word vector to obtain an entity representation vector corresponding to the sample statement and an attribute representation vector corresponding to the sample statement;

[0135] A splicing unit 73, which splices the entity representation vector and the attribute representation vector to obtain a statement representation vector of the sample statement;

[0136] A training unit 74, which trains a text matching model according to the statement representation vector and the corresponding sample label, and the sample label includes the similarity between the statement representation vector and the representation vectors of each statement in the preset knowledge base.

[0137] Optionally, the obtaining unit 71 is specifically configured to:

[0138] Perform word segmentation processing on the sample statement to obtain the word sequence;

[0139] Encode the word sequence using an encoder to obtain word vectors corresponding to each word in the word sequence.

[0140] Optionally, the feature enhancement unit 72 is specifically configured to:

[0141] Obtain a preset entity information library and a preset attribute information library. The preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector;

[0142] Based on the entity attention weights between each word vector determined by the attention mechanism and the entity information vector, obtain the entity representation vector; and, based on the attribute attention weights between each word vector determined by the attention mechanism and the attribute information vector, obtain the attribute representation vector.

[0143] Optionally, the entity representation vector includes an entity statement vector, and the attribute representation vector includes an attribute statement vector;

[0144] The feature enhancement unit 72 is further configured to: calculate the similarity between each word vector and at least some of the entity information vectors through the attention mechanism, and perform weighted summation of the obtained similarities as the first entity attention weights of the corresponding word vectors to obtain the entity statement vector; and,

[0145] Calculate the similarity between each word vector and at least some of the attribute information vectors through the attention mechanism, and perform weighted summation of the obtained similarities as the first attribute attention weights of the corresponding word vectors to obtain the attribute statement vector.

[0146] Optionally, the entity representation vector further includes an entity value vector, and the attribute representation vector further includes an attribute value vector;

[0147] The feature enhancement unit 72 is further configured to: calculate the similarity between at least some of the entity information vectors and the entity statement vector through the attention mechanism, and perform weighted summation of the obtained similarities as the second entity attention weights of the corresponding entity information vectors to obtain the entity value vector, and splice the entity statement vector and the entity value vector to obtain the entity representation vector; and,

[0148] Calculate the similarity between at least some of the attribute information vectors and the attribute statement vector through the attention mechanism, and perform weighted summation of the obtained similarities as the second attribute attention weights of the corresponding attribute information vectors to obtain the attribute value vector, and splice the attribute statement vector and the attribute value vector to obtain the attribute representation vector.

[0149] Optionally, the sample tag further includes: the similarity between the entity value vector and the entity statement vector; and / or, the similarity between the attribute value vector and the attribute statement vector.

[0150] Optionally, the sample statement includes a user input question, and the statements in the preset knowledge base include standard user questions.

[0151] Figure 8 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to Figure 8 , at the hardware level, the device includes a processor 802, an internal bus 804, a network interface 806, a memory 808, and a non-volatile memory 810. Of course, there may also be other hardware required for other services. The processor 802 reads the corresponding computer program from the non-volatile memory 810 into the memory 808 and then runs it, forming a text matching device at the logical level. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logical devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logical unit, and can also be hardware or a logical device.

[0152] Please refer to Figure 9 , in a software implementation, the text matching device may include:

[0153] A conversion unit 91 that converts each word in the word sequence corresponding to the user input statement into a corresponding word vector;

[0154] A feature enhancement unit 92 that enhances the features of each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement;

[0155] A splicing unit 93 that splices the entity representation vector and the attribute representation vector to obtain a statement representation vector of the user input statement;

[0156] A matching unit 94 that inputs the representation vector of any statement in the preset knowledge base and the statement representation vector into a preset text matching model, and determines the statement in the preset knowledge base that matches the user input statement according to the output result.

[0157] Optionally, the conversion unit 91 is specifically configured to:

[0158] Perform word segmentation on the user input statement to obtain the word sequence;

[0159] Use an encoder to encode the word sequence to obtain the word vectors corresponding to each word in the word sequence.

[0160] Optionally, the feature enhancement unit 92 is specifically configured to:

[0161] Obtain a preset entity information library and a preset attribute information library, where the preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector;

[0162] Obtain the entity representation vector based on the entity attention weights of each word vector determined by the attention mechanism and the entity information vector; and obtain the attribute representation vector based on the attribute attention weights of each word vector determined by the attention mechanism and the attribute information vector.

[0163] Optionally, the entity representation vector includes an entity statement vector, and the attribute representation vector includes an attribute statement vector;

[0164] The feature enhancement unit 92 is further configured to: calculate the similarity between each word vector and at least part of the entity information vectors through the attention mechanism, and perform weighted summation of the obtained similarities as the first entity attention weights of the corresponding word vectors to obtain the entity statement vector; and,

[0165] calculate the similarity between each word vector and at least part of the attribute information vectors through the attention mechanism, and perform weighted summation of the obtained similarities as the first attribute attention weights of the corresponding word vectors to obtain the attribute statement vector.

[0166] Optionally, the entity representation vector further includes an entity value vector, and the attribute representation vector further includes an attribute value vector;

[0167] The feature enhancement unit 92 is further configured to: calculate the similarity between at least part of the entity information vectors and the entity statement vector through the attention mechanism, and perform weighted summation of the obtained similarities as the second entity attention weights of the corresponding entity information vectors to obtain the entity value vector, and splice the entity statement vector and the entity value vector to obtain the entity representation vector; and,

[0168] calculate the similarity between at least part of the attribute information vectors and the attribute statement vector through the attention mechanism, and perform weighted summation of the obtained similarities as the second attribute attention weights of the corresponding attribute information vectors to obtain the attribute value vector, and splice the attribute statement vector and the attribute value vector to obtain the attribute representation vector.

[0169] Optionally, the user input statement includes a user input question, and the statements in the preset knowledge base include standard user questions; the device further includes:

[0170] A providing unit 95 that provides the user with the knowledge points to which the matched standard user question belongs.

[0171] The systems, apparatuses, modules or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device, or a combination of any several of these devices.

[0172] In a typical configuration, a computer includes one or more processors (CPUs), an input / output interface, a network interface, and a memory.

[0173] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0174] Computer-readable media includes permanent and non-permanent, removable and non-removable media and can store information by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.

[0175] It should also be noted that the term "comprises", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the element.

[0176] The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown or sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0177] The terms used in one or more embodiments of this specification are for the purpose of describing particular embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0178] It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "upon" or "in response to determining".

[0179] The above is only the preferred embodiment of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included within the scope of protection of one or more embodiments of this specification.

Claims

1. A text matching method, characterized in that, Including: Converting each word in the word sequence corresponding to the user input statement into a corresponding word vector; Performing feature enhancement on each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement; wherein, the entity representation vector includes: an entity statement vector determined based on the entity attention weights of each word vector and a preset entity information vector, and an entity value vector determined based on the entity attention weights of the preset entity information vector and the entity statement vector; the attribute representation vector includes: an attribute statement vector determined based on the attribute attention weights of each word vector and a preset attribute information vector, and an attribute value vector determined based on the attribute attention weights of the preset attribute information vector and the attribute statement vector; Concatenating the entity representation vector and the attribute representation vector to obtain a statement representation vector of the user input statement; Inputting the representation vector of any statement in the preset knowledge base and the statement representation vector into a preset text matching model, and determining the statement in the preset knowledge base that matches the user input statement according to the output result.

2. The method according to claim 1, wherein The converting each word in the word sequence corresponding to the user input statement into a corresponding word vector includes: Performing word segmentation processing on the user input statement to obtain the word sequence; Using an encoder to encode the word sequence to obtain the word vectors corresponding to each word in the word sequence.

3. The method according to claim 1, characterized in that The performing feature enhancement on each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement includes: Obtaining a preset entity information library and a preset attribute information library, where the preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector; Obtaining the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined by the attention mechanism; and obtaining the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined by the attention mechanism.

4. The method according to claim 3, wherein The obtaining the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined by the attention mechanism includes: calculating the similarity between each word vector and at least part of the entity information vectors through the attention mechanism, and performing weighted summation on the obtained similarities as the first entity attention weights of the corresponding word vectors to obtain the entity statement vector; The obtaining the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined by the attention mechanism includes: calculating the similarity between each word vector and at least part of the attribute information vectors through the attention mechanism, and performing weighted summation on the obtained similarities as the first attribute attention weights of the corresponding word vectors to obtain the attribute statement vector.

5. The method according to claim 4, characterized in that Said obtaining the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined by the attention mechanism includes: calculating the similarity between at least part of the entity information vectors and the entity statement vector through the attention mechanism, taking the obtained similarities as the second entity attention weights of the corresponding entity information vectors, performing weighted summation to obtain the entity value vector, and concatenating the entity statement vector and the entity value vector to obtain the entity representation vector; Said obtaining the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined by the attention mechanism includes: calculating the similarity between at least part of the attribute information vectors and the attribute statement vector through the attention mechanism, taking the obtained similarities as the second attribute attention weights of the corresponding attribute information vectors, performing weighted summation to obtain the attribute value vector, and concatenating the attribute statement vector and the attribute value vector to obtain the attribute representation vector.

6. The method according to claim 1, characterized in that, The user input statement includes a user input question, and the statements in the preset knowledge base include standard user questions; the method further includes: Providing the user with the knowledge points to which the matched standard user questions belong.

7. A training method for a text matching model, characterized in that Including: Obtaining the word vectors of each word in the word sequence corresponding to the sample statement; Performing feature enhancement on each word vector to obtain an entity representation vector corresponding to the sample statement and an attribute representation vector corresponding to the sample statement; wherein, the entity representation vector includes: an entity statement vector determined based on the entity attention weights of each word vector and a preset entity information vector, and an entity value vector determined based on the entity attention weights of the preset entity information vector and the entity statement vector; the attribute representation vector includes: an attribute statement vector determined based on the attribute attention weights of each word vector and a preset attribute information vector, and an attribute value vector determined based on the attribute attention weights of the preset attribute information vector and the attribute statement vector; Concatenating the entity representation vector and the attribute representation vector to obtain the statement representation vector of the sample statement; Training a text matching model according to the statement representation vector and the corresponding sample label, where the sample label includes the similarity between the statement representation vector and the representation vectors of each statement in the preset knowledge base.

8. The method according to claim 7, wherein The obtaining the word vectors of each word in the word sequence corresponding to the sample statement includes: Performing word segmentation on the sample statement to obtain the word sequence; Using an encoder to encode the word sequence to obtain the word vectors corresponding to each word in the word sequence.

9. The method according to claim 7, wherein The performing feature enhancement on each word vector to obtain an entity representation vector corresponding to the sample statement and an attribute representation vector corresponding to the sample statement includes: Obtaining a preset entity information library and a preset attribute information library, where the preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector; Obtain the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined by the attention mechanism; and, obtain the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined by the attention mechanism.

10. The method according to claim 9, characterized in that, The entity representation vector includes an entity statement vector, and the attribute representation vector includes an attribute statement vector; The obtaining of the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined by the attention mechanism includes: calculating the similarity between each word vector and at least part of the entity information vectors through the attention mechanism, and taking the obtained similarities as the first entity attention weights of the corresponding word vectors and performing weighted summation to obtain the entity statement vector; The obtaining of the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined by the attention mechanism includes: calculating the similarity between each word vector and at least part of the attribute information vectors through the attention mechanism, and taking the obtained similarities as the first attribute attention weights of the corresponding word vectors and performing weighted summation to obtain the attribute statement vector.

11. The method according to claim 10, characterized in that, The entity representation vector further includes an entity value vector, and the attribute representation vector further includes an attribute value vector; The obtaining of the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined by the attention mechanism includes: calculating the similarity between at least part of the entity information vectors and the entity statement vector through the attention mechanism, taking the obtained similarities as the second entity attention weights of the corresponding entity information vectors and performing weighted summation to obtain the entity value vector, and concatenating the entity statement vector and the entity value vector to obtain the entity representation vector; The obtaining of the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined by the attention mechanism includes: calculating the similarity between at least part of the attribute information vectors and the attribute statement vector through the attention mechanism, taking the obtained similarities as the second attribute attention weights of the corresponding attribute information vectors and performing weighted summation to obtain the attribute value vector, and concatenating the attribute statement vector and the attribute value vector to obtain the attribute representation vector.

12. The method according to claim 11, wherein The sample label further includes: the similarity between the entity value vector and the entity statement vector; and / or, the similarity between the attribute value vector and the attribute statement vector.

13. The method according to claim 7, wherein The sample statement includes a user input question, and the statements in the preset knowledge base include standard user questions.

14. A text matching device, characterized in that, Including: A conversion unit that converts each word in the word sequence corresponding to the user input statement into a corresponding word vector; A feature enhancement unit that enhances the features of each word vector to obtain an entity representation vector corresponding to the user input statement and an attribute representation vector corresponding to the user input statement; wherein, the entity representation vector includes: an entity statement vector determined based on the entity attention weights of each word vector and a preset entity information vector, and an entity value vector determined based on the entity attention weights of the preset entity information vector and the entity statement vector; the attribute representation vector includes: an attribute statement vector determined based on the attribute attention weights of each word vector and a preset attribute information vector, and an attribute value vector determined based on the attribute attention weights of the preset attribute information vector and the attribute statement vector; A splicing unit that splices the entity representation vector and the attribute representation vector to obtain a statement representation vector of the user input statement; A matching unit that inputs the representation vector of any statement in a preset knowledge base and the statement representation vector into a preset text matching model, and determines the statement in the preset knowledge base that matches the user input statement according to the output result.

15. The device according to claim 14, characterized in that, The conversion unit is specifically used for: Performing word segmentation processing on the user input statement to obtain the word sequence; Using an encoder to encode the word sequence to obtain word vectors corresponding to each word in the word sequence.

16. The device according to claim 14, characterized in that, The feature enhancement unit is specifically used for: Obtaining a preset entity information library and a preset attribute information library, where the preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector; Obtaining the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined through the attention mechanism; and obtaining the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined through the attention mechanism.

17. The device according to claim 16, wherein The entity representation vector includes an entity statement vector, and the attribute representation vector includes an attribute statement vector; The feature enhancement unit is further used for: calculating the similarity between each word vector and at least part of the entity information vectors through the attention mechanism, and performing weighted summation on the obtained similarities as the first entity attention weights of the corresponding word vectors to obtain the entity statement vector; and Calculating the similarity between each word vector and at least part of the attribute information vectors through the attention mechanism, and performing weighted summation on the obtained similarities as the first attribute attention weights of the corresponding word vectors to obtain the attribute statement vector.

18. The device according to claim 17, characterized in that The entity representation vector further includes an entity value vector, and the attribute representation vector further includes an attribute value vector; The feature enhancement unit is further used for: calculating the similarity between at least part of the entity information vectors and the entity statement vector through the attention mechanism, and performing weighted summation on the obtained similarities as the second entity attention weights of the corresponding entity information vectors to obtain the entity value vector, and splicing the entity statement vector and the entity value vector to obtain the entity representation vector; And, Calculate the similarity between at least part of the attribute information vectors and the attribute statement vectors through the attention mechanism, sum up the obtained similarities as the second attribute attention weights of the corresponding attribute information vectors to obtain the attribute value vectors, and splice the attribute statement vectors and the attribute value vectors to obtain the attribute representation vectors.

19. The device according to claim 14, characterized in that, The user input statement includes a user input question, and the statements in the preset knowledge base include standard user questions; the apparatus further includes: A providing unit that provides the user with the knowledge points to which the matched standard user questions belong.

20. A training device for a text matching model, characterized in that, including: An obtaining unit that obtains the word vectors of each word in the word sequence corresponding to the sample statement; A feature enhancement unit that enhances the features of each word vector to obtain an entity representation vector corresponding to the sample statement and an attribute representation vector corresponding to the sample statement; wherein, the entity representation vector includes: an entity statement vector determined based on the entity attention weights of each word vector and a preset entity information vector, and an entity value vector determined based on the entity attention weights of the preset entity information vector and the entity statement vector; the attribute representation vector includes: an attribute statement vector determined based on the attribute attention weights of each word vector and a preset attribute information vector, and an attribute value vector determined based on the attribute attention weights of the preset attribute information vector and the attribute statement vector; A splicing unit that splices the entity representation vector and the attribute representation vector to obtain a statement representation vector of the sample statement; A training unit that trains a text matching model according to the statement representation vector and the corresponding sample label, and the sample label includes the similarity between the statement representation vector and the representation vectors of each statement in the preset knowledge base.

21. The device according to claim 20, characterized in that, The obtaining unit is specifically used for: Performing word segmentation processing on the sample statement to obtain the word sequence; Using an encoder to encode the word sequence to obtain the word vectors corresponding to each word in the word sequence.

22. The device according to claim 20, characterized in that, The feature enhancement unit is specifically used for: Obtaining a preset entity information library and a preset attribute information library, where the preset entity information library contains at least one entity information vector, and the preset attribute information library contains at least one attribute information vector; Obtaining the entity representation vector based on the entity attention weights of each word vector and the entity information vector determined through the attention mechanism; and obtaining the attribute representation vector based on the attribute attention weights of each word vector and the attribute information vector determined through the attention mechanism.

23. The device according to claim 22, wherein, The entity representation vector includes an entity statement vector, and the attribute representation vector includes an attribute statement vector; The feature enhancement unit is further used for: calculating the similarity between each word vector and at least part of the entity information vectors through the attention mechanism, summing up the obtained similarities as the first entity attention weights of the corresponding word vectors to obtain the entity statement vector; and Calculating the similarity between each word vector and at least part of the attribute information vectors through the attention mechanism, summing up the obtained similarities as the first attribute attention weights of the corresponding word vectors to obtain the attribute statement vector.

24. The device according to claim 23, characterized in that, The entity representation vector further includes an entity value vector, and the attribute representation vector further includes an attribute value vector; The feature enhancement unit is further configured to: calculate the similarity between at least part of the entity information vectors and the entity statement vector through an attention mechanism, use the obtained similarities as the second entity attention weights of the corresponding entity information vectors to perform weighted summation to obtain the entity value vector, and splice the entity statement vector and the entity value vector to obtain the entity representation vector; And, calculate the similarity between at least part of the attribute information vectors and the attribute statement vector through an attention mechanism, use the obtained similarities as the second attribute attention weights of the corresponding attribute information vectors to perform weighted summation to obtain the attribute value vector, and splice the attribute statement vector and the attribute value vector to obtain the attribute representation vector.

25. The device according to claim 24, characterized in that, The sample label further includes: the similarity between the entity value vector and the entity statement vector; and / or, the similarity between the attribute value vector and the attribute statement vector.

26. The device according to claim 20, characterized in that, The sample statement includes a user input question, and the statements in the preset knowledge base include standard user questions.

27. An electronic device, characterized in that, Including: A processor; A memory for storing processor-executable instructions; Wherein, the processor realizes the method according to any one of claims 1-13 by running the executable instructions.

28. A computer-readable storage medium, characterized in that, Stored thereon are computer instructions, and when the instructions are executed by the processor, the steps of the method according to any one of claims 1-13 are realized.

Citation Information

Patent Citations

  • Knowledge question and answer retrieval method and device based on tourism domain knowledge graph

    CN111353030A