A text similarity calculation system, method and storage medium based on multi-keyword pair matching
Through the multi-keyword pair matching text similarity calculation system, the WP-Attention mechanism and multi-granularity calculation are used to solve the redundancy and noise problems in the existing technology and improve the accuracy and robustness of text similarity calculation.
Patent Information
- Application Number
- CN202010970734.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-16
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2040-09-16
AI Technical Summary
Existing text similarity calculation methods ignore the characteristics of the text, and there are redundant information and noise, which affects the calculation accuracy.
Using a multi-keyword pair matching text similarity calculation system, through text preprocessing, pre-training, semantic encoding, keyword extraction, word-level and sentence-level similarity calculations, combined with the WP-Attention mechanism, weighted summation to improve calculations accuracy.
It effectively avoids the effects of redundancy and noise, improves the accuracy and robustness of text similarity calculation, and the model structure is simple and easy to expand.
Smart Images

Figure CN112232053B
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of text mining and computer technology, and in particular to a text similarity calculation system, method, and storage medium based on multi-keyword pair matching. Background Art
[0002] With the rapid development of the internet and artificial intelligence, the amount of information generated online is exploding. People are eager to extract content that closely matches their needs and interests from this vast amount of information. To meet this demand, a variety of applications have emerged, such as search engines, automatic question-answering systems, document classification and clustering, and text information retrieval. One of the key technologies in these applications is text similarity calculation, and the performance of these applications depends on the accuracy of sentence similarity calculations.
[0003] Text similarity in natural language processing tasks aims to study the degree of semantic match between two texts. The greater the similarity, the closer the match; the smaller the similarity, the less likely the match. The core and greatest difficulty in calculating text semantic similarity lies in semantic understanding. Only with a strong understanding of text can accurate calculations be achieved.
[0004] Text similarity is extremely important. For example, in certain fields (such as finance and medicine), automated question-answering systems need to search for relevant questions in an existing database based on the meaning of the question described by the user and return the optimal answer. This requires the use of similarity techniques in this paper to calculate the most matching question. In the field of intelligent information retrieval, search engines need to list all web pages that match the user's input keyword and use text similarity techniques to further process the search results, ranking them according to text similarity to improve the quality of information retrieval. Therefore, studying text similarity algorithms has important practical value.
[0005] The existing text similarity calculation methods mainly include: bag-of-words model-based methods, neural network-based methods, knowledge base-based methods and syntactic analysis-based methods. These methods all calculate the similarity of texts by capturing the semantic vectors of the texts.<P、Q> Perform shallow similarity calculations and ignore text pairs<P、Q> Its own characteristics: There is redundant information and noise, which greatly affects the text<P、Q> The accuracy of similarity calculation. Summary of the Invention
[0006] The purpose of this invention is to solve the problems of the existing text similarity calculation technology.<P、Q> To solve the redundancy and noise problems, we use multiple semantic levels and word and sentence granularity to analyze the text.<P、Q> The present invention performs similarity calculation and discloses a text similarity calculation system, method, and storage medium based on multi-keyword pair matching.
[0007] In order to achieve the above tasks, the present invention adopts the following technical solutions:
[0008] A text similarity calculation system based on multiple keyword pair matching includes at least the following sequentially connected components:
[0009] Text preprocessing module: preprocess the first text P and the second text Q respectively to obtain the preprocessed text pairs.<P,Q> ;
[0010] Pre-training module: Text pair<P,Q> Get the word vector for each word through pre-training;
[0011] Context module: semantically encode the word vector of each word obtained by pre-training to obtain the text pair<P,Q> Semantic vector of
[0012] Keyword pair extraction module: from text pairs<P,Q> Extract multiple keyword pairs with different semantic levels;
[0013] Word level similarity calculation module: calculates text pairs through word level tasks<P,Q> Word-level similarity;
[0014] Sentence level similarity calculation module: calculates text pairs through sentence level tasks<P,Q> Sentence-level similarity;
[0015] Similarity result output module:<P,Q> The similarity values obtained from word-level tasks and sentence-level tasks are weighted and summed to obtain the text similarity value.
[0016] The present invention also discloses a method for calculating text similarity based on multi-keyword pair matching, comprising the following steps:
[0017] Step S1: Preprocess the first text P and the second text Q separately, including word segmentation and stop word removal, to obtain the preprocessed text pairs.<P,Q> ;
[0018] Step S2: The pre-processed text<P,Q> Get word vectors through Word2vec pre-training;
[0019] Step S3: Match the text<P,Q> Perform word vector embedding representation, and then use BiLSTM to get text pairs<P、Q> Contextual representation of ;
[0020] Step S4: Use the proposed WP-Attention mechanism to extract<P,Q> Extract multiple keyword pairs with different semantic levels;
[0021] Step S5: Calculate text pairs through word-level tasks<P,Q> Word-level similarity, that is, the similarity of the semantic vector of each keyword pair is calculated, and the average result is used as the text pair.<P,Q> Similarity of word granularity;
[0022] Step S6: Calculate text pairs through sentence-level tasks<P,Q> Sentence-level similarity, that is, firstly<P,Q> Denoising is performed to retain only the extracted keywords to obtain the keyword sequence, which is then fed into BiLSTM aggregation to obtain the text pair<P,Q> The sentence semantic vector of text P and Q is calculated as the similarity of the semantic vector of text P and Q.<P,Q> Similarity at sentence granularity;
[0023] Step S7: perform weighted summation of the similarity values obtained in steps S5 and S6 to obtain a final similarity value, and output the result.
[0024] The present invention may also be applied to a storage medium made of any computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the overall text similarity calculation method based on multi-keyword pair matching of the present invention.
[0025] The present invention has the following beneficial technical effects compared with the prior art:
[0026] 1. This method extracts text pairs<P,Q> Keyword pairs, and only use these keyword pairs to represent sentences, avoiding text pairs<P,Q> The impact of redundancy and noise in the dataset on similarity judgment.
[0027] 2. This method calculates text pairs from multiple levels by extracting keyword pairs at different levels.<P,Q> The similarity of keywords is calculated from the word and sentence granularity through word-level tasks and sentence-level tasks.<P,Q> The similarity makes the result more accurate.
[0028] 3. The model structure of the present invention is simple, easy to expand, and robust, and can be easily promoted and used in practice. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a structural diagram of the text similarity calculation system based on multi-keyword pair matching of the present invention.
[0030] Figure 2 This is a specific flow chart of the text similarity calculation method based on multi-keyword pair matching of the present invention.
[0031] Figure 3 It is a structural diagram of the WP-Attention calculation of the present invention.
[0032] The specific contents of the present invention are further described in detail below with reference to the accompanying drawings and specific embodiments. DETAILED DESCRIPTION
[0033] join Figure 1 , a text similarity calculation system based on multi-keyword pair matching, comprising at least the following sequentially connected:
[0034] Preprocessing module: preprocess the acquired text P and text Q respectively to obtain the preprocessed text pairs.<P,Q> ;
[0035] Pre-training module: pre-processed text<P、Q> Get the word vector for each word through pre-training;
[0036] Context module: semantically encode the word vector of each word obtained by pre-training to obtain the text pair<P,Q> Semantic vector of
[0037] Keyword pair extraction module: from text pairs<P,Q> Extract multiple keyword pairs with different semantic levels;
[0038] Word level similarity calculation module: calculates text pairs through word level tasks<P,Q> Word-level similarity;
[0039] Sentence level similarity calculation module: calculates text pairs through sentence level tasks<P,Q> Sentence-level similarity;
[0040] Similarity result output module:<P,Q> The similarity values obtained from word-level tasks and sentence-level tasks are weighted and summed to obtain the text similarity value.
[0041] The preprocessing module completes word segmentation and removes stop words on the original data set to obtain text pairs.<P,Q> .
[0042] Furthermore, the pre-training module obtains the word vector of each word by pre-training, and uses the Word2vec algorithm to train the pre-processed text pairs.<P,Q> The word-vector matrix of .
[0043] The context representation module first analyzes the text pair<P,Q> The sequence is word-embedded, and then the word-embedded representation is passed through a BiLSTM to obtain the text pair<P,Q> Contextual representation of <h p , h q >.
[0044] Furthermore, the keyword pair extraction module proposes a word pair-based attention mechanism WP-Attention to calculate the text pair<P、Q> right<P,Q> For the attention scores of P and Q, select the group of words with the largest attention scores as the keyword pair <w p , w q >. Use different parameters to extract multiple groups of keyword pairs representing different semantic levels <w p k , w q k >, k = 1, 2, ..., K.
[0045] The word-level similarity calculation module calculates the similarity of the semantic vectors of each keyword pair through word-level task calculation, and then averages the results as the text pair similarity.<P,Q> Similarity at word granularity.
[0046] Furthermore, the sentence-level similarity calculation module first performs denoising, that is, only retains the extracted keywords to obtain the keyword sequence, and then feeds it into BiLSTM aggregation to obtain the text pair.<P,Q> The sentence semantic vector of text P and Q is calculated as the similarity of the semantic vector of text P and Q.<P,Q> Similarity at sentence granularity.
[0047] Furthermore, the similarity result output module outputs the text<P,Q> The similarity values obtained from word-level tasks and sentence-level tasks are weighted and summed to obtain the similarity value of the text.
[0048] See also Figure 2 The present invention also discloses a method for calculating text similarity based on multi-keyword pair matching, comprising the following steps:
[0049] Step S1: Preprocess the text P and Q separately, including word segmentation and stop word removal, to obtain the preprocessed text pairs.<P,Q> .
[0050] Step S2: The pre-processed text<P,Q> The word vector is obtained through Word2vec pre-training.
[0051] Step S3: Match the text<P、Q> Perform word vector embedding representation, and then use BiLSTM to get text pairs<P、Q> Contextual representation of ;
[0052] Step S4: Use the proposed WP-Attention mechanism to extract<P、Q> Extract multiple keyword pairs with multiple semantic levels;
[0053] Step S5: Calculate text pairs through word-level tasks<P,Q> Word-level similarity, that is, the similarity of the semantic vector of each keyword pair is calculated, and the average result is used as the text pair.<P,Q> Similarity of word granularity;
[0054] Step S6: Calculate text pairs through sentence-level tasks<P,Q> Sentence-level similarity, that is, firstly<P,Q> Denoising is performed to retain only the extracted keywords to obtain the keyword sequence, which is then fed into BiLSTM aggregation to obtain the text pair<P,Q> The sentence semantic vector of text P and Q is calculated as the similarity of the semantic vector of text P and Q.<P,Q> Similarity at sentence granularity.
[0055] Step S7: perform weighted summation of the similarity values obtained in steps S5 and S6 to obtain a final similarity value, and output the result.
[0056] The overall technical concept of the present invention is further explained below in conjunction with the various sub-steps of the text similarity calculation method based on multi-keyword pair matching of the present invention.
[0057] Step S1 uses Jieba word segmentation tool to complete the text segmentation<P、Q> The word segmentation is done and the stop words are removed from the text after word segmentation to obtain the text pair.<P,Q> .
[0058] Step S2 uses the text preprocessed in step S1 to<P,Q> As training corpus, the Word2vec algorithm is used for pre-training to obtain the word-vector matrix wv_matrix, and the mapping of each word to the word vector is obtained.
[0059] Step S3 further comprises two steps:
[0060] Step S3.1 uses Word2vec pre-trained word vectors, word vectors and exact matching tokens are spliced together as text pairs<P,Q> Embedded representation of <E p , E q >.
[0061] Step S3.2:<P、Q> The embedding representation is fed into BiLSTM to obtain the text pair <<P,Q> Contextual representation of <h p , h q >
[0062] h p =BiLSTM(E p ) (1)
[0063] h q =BiLSTM(E q ) (2)
[0064] Step S3.1 of the present invention further includes the following four steps:<P、Q> For each word w:
[0065] Step S3.1.1: Get the vector representation of the word based on the pre-trained word-vector matrix
[0066] E1=wv_matrix(w) (3)
[0067] Step S3.1.2 initializes each word in w into a word vector, and then feeds the word vector sequence into the LSTM network to obtain the word vector representation of w;
[0068] E2=char_LSTM(w) (4)
[0069] Step S3.1.3 marks the same words and synonyms in P and Q. If there are the same words or synonyms in P and Q, mark them as 1, otherwise mark them as 0.
[0070] E3=flag(w) (5)
[0071] Step S3.1.4 concatenates E1, E2, and E3 together as the embedding representations of P and Q.
[0072] E(w)=[E1,E2,E3] (6)
[0073] E=[E(w1),E(w2),...,E(w l )] (7)
[0074] Among them, w i Represents text pairs<P、Q> The i-th word, l represents the text pair<P、Q> The length of E represents the embedded representation of the text;
[0075] Furthermore, step S4 of the present invention comprises three steps:
[0076] Step S4.1 proposes to calculate the text pair<P、Q> WP-Attention is the attention score for each word in P and Q. See Figure 3 For a word Wp in P, if it has a large WP-Attention, it should have the following three characteristics: 1. It has rich features. 2. It is very important in P. 3. It has a great influence on Q. Specifically, these three features are: P's own features h p , P's attention score to P Q's attention score on P The attention score is determined by the weighted sum of these three parts and then calculated by the Softmax function<P,Q> For the attention weight of each word in P and Q, select the pair with the largest weight as the keyword pair.
[0077] Step S4.2 Calculation<P,Q> WP-Attention of each word in , get the attention weight α of each word p and α q .
[0078] Step S4.3 selects a group of words with the largest α as a group of keyword pairs.
[0079] w p =h p t , t=index(max(α p )) (8)
[0080] w q =h q t , t=index(max(α q )) (9)
[0081] in, <w p , w q > is the extracted keyword pair. Use different parameters to extract multiple groups of keyword pairs with different semantic levels. <w p k , w q k >, k = 1, 2, ..., K.
[0082] Step S4.1 of the present invention further includes the following two steps:
[0083] Step S4.1.1 calculates each<P,Q> WP-Attention for each word of P and Q:
[0084]
[0085]
[0086] Where W pp , W qp , W p , W qq , W pq , W q , W d is the trainable parameter matrix, tanh is the activation function, wa p and wa q Respectively<P,Q> WP-Attention for each word of P and Q.
[0087] Step S4.1.2 calculates each<P,Q> The attention weight for each word of P and Q is shown in formula (12-13):
[0088]
[0089]
[0090] where α p and α q express<P,Q> Attention weight for each word of P and Q.
[0091] Furthermore, step S5 of the present invention includes two steps:
[0092] Step S5.1: For each keyword <w p k , w q k >interact with the semantic vectors to obtain the interaction vector F w :
[0093]
[0094] Where k = 1, 2, ..., K represents the number of the keyword pair, Represents the interaction vector of the k-th keyword pair.
[0095] Step S5.2 uses a multi-layer perceptron (MLP) to analyze the interaction vector Fitting is performed to obtain the similarity of each keyword pair, and the average value is used as<P,Q> Word level similarity:
[0096]
[0097] Furthermore, step S6 of the present invention includes two steps:
[0098] Step S6.1: Text pairing<P,Q> Denoising is performed to obtain a keyword sequence, which is then fed into BiLSTM to use the output of the last time step as the semantic vector of the sentence. <V p , V q >.
[0099] Step S6.2 will <V p , V q >Interact and get text<P,Q> Sentence-level interaction vector F s .
[0100] F s =[V p k , V q k , Vp k +V q k , V p k -V q k ,|V p k -V q k |] (16)
[0101] Step S6.3 uses a multi-layer perceptron (MLP) to analyze the interaction vector F s Fitting to get text pairs<P,Q> Sentence level similarity.
[0102] similarity s<P,Q> =MLP(F s ) (17)
[0103] Step S7 sets similarity w<P,Q> and similarity s<P,Q> Weighted summation to obtain the final text pair<P,Q> similarity;
[0104] similarity <P,Q> =β*similarity s<P,Q> +(1-β)*similarity w<P,Q> (18)
[0105] Where β is the weight of the sentence-level task, and (1-β) is the weight of the word-level task, which are adjusted as hyperparameters.
[0106] To evaluate the results of text similarity calculations, we designed a set of experiments using a classic text similarity dataset, the BQ corpus, to measure the semantic similarity between two texts. Furthermore, when comparing our method with other methods, we used classification accuracy as the evaluation metric.
[0107] The BQ Corpus, a public dataset of Chinese banking question pairs, is used to determine the semantic similarity of sentence pairs. The BQ Corpus is constructed from a real customer service system within WeBank. In this dataset, if two questions express the same intent or share the same answer, they are semantically equivalent and are labeled 1. Otherwise, they have different intents and are labeled 0.
[0108] Therefore, the purpose of the experiment is to determine whether the question pairs are similar, predict the labels of the question pairs, compare them with the true labels, and calculate the accuracy of the successful prediction.
[0109] The BQ dataset contains 120,000 question pairs, divided into three parts: 100,000 pairs for training, 10,000 pairs for validation, and the rest for testing.
[0110] As shown in the table below, it is a comparison table of the accuracy calculation results on the BQ dataset.
[0111]
[0112] Among the baselines compared, Text-CNN is a typical convolutional neural network (CNN) model for sentence classification. BiLSTM is a bidirectional LSTM network suitable for capturing long-term dependencies in text. BiMPM is a bilateral multi-view matching model with good performance for natural language sentence matching. DIIN is a dense interactive inference network for natural language inference (NLI). DRCN is a densely connected deep RNN network that has been the most effective method for text similarity in the past two years.
[0113] The invention calculates the similarity at both the word level and sentence level, and performs similarity calculation on the semantic vectors of each keyword pair when calculating the word level similarity. Finally, the similarity values of the two tasks are weighted and summed to obtain the final result.
[0114] From the comparison results, it can be seen that compared with the above baseline, the accuracy of the present invention on the BQ dataset is the highest, 1.9 percentage points higher than the classic text similarity calculation method BiMPM and 0.6% higher than the DRCN method. The experiment shows that the text similarity calculation method of the present invention is very effective.
Claims
1. A text similarity calculation system based on multi-keyword pair matching, characterized in that: At least including the following: Text preprocessing module: preprocess the first text P and the second text Q respectively to obtain the preprocessed text pairs.<P,Q> ; Pre-training module: Text pair<P,Q> Get the word vector for each word through pre-training; Context module: semantically encode the pre-trained word vectors of each word to obtain text pairs<P,Q> The semantic vector of Keyword pair extraction module: from text pairs<P,Q> Extract multiple keyword pairs with different semantic levels; The specific process includes: Step S4.1 calculates the characteristic h of P itself respectively p , P's attention score to P Q's attention score to P Through the weighted sum of these three parts, the text pair is calculated through the Softmax function<P,Q> For each word in P and Q, the pair with the largest weight is selected as the keyword pair; Step S4.2 Calculate text pairs<P,Q> WP-Attention of each word in , and get the attention weight α of each word p and α q ; Step S4.3 selects a group of words with the largest α as a group of keyword pairs, as shown in formula (8-9): w p =h p t ,t=index(max(α p )) (8) w q =h q t ,t=index(max(α q )) (9) in, <w q , w q > is the extracted keyword pair; use different parameters to extract multiple groups of keyword pairs containing different semantic levels <w p k , w q k >, k = 1, 2, ..., K; The step S4.1 further comprises the following steps: Step S4.1.1 Calculate the text pair by equation (8,9)<P,Q> WP-Attention for each word of P and Q: Where W pp ,W qp ,W p ,W qq ,W pq ,W q ,W d is the trainable parameter matrix, tanh is the activation function, wa p and wa q Represents text pairs<P,Q> WP-Attention for each word of P and Q; Step S4.1.2 calculates the text pair through the Softmax function<P,Q> The attention weight for each word of P and Q is shown in formula (12-13): where α p and α q Represents text pairs<P,Q> Attention weight for each word of P and Q; Word-level similarity calculation module: Calculate text pairs through word-level tasks<P,Q> The word-level similarity is as follows: the semantic vectors of each keyword pair are similarly calculated through word-level task calculations, and the results are averaged as the text pair.<P,Q> Similarity of word granularity; Sentence-level similarity calculation module: Calculate text pairs through sentence-level tasks<P,Q> The similarity at the sentence level is as follows: first, denoising is performed, that is, only the extracted keywords are retained to obtain the keyword sequence, and then the keyword sequence is fed into the BiLSTM aggregation to obtain the text pair.<P,Q> The sentence semantic vector of text P and Q is calculated as the similarity of the text pair.<P,Q> Similarity at sentence granularity; Similarity result output module:<P,Q> The similarity values obtained from word-level tasks and sentence-level tasks are weighted and summed to obtain the text similarity value.
2. The text similarity calculation system based on multiple keyword pair matching as claimed in claim 1, characterized in that: The preprocessing module completes word segmentation and removes stop words on the original data set to obtain text pairs.<P,Q> .
3. The text similarity calculation system based on multiple keyword pair matching as claimed in claim 1, characterized in that: The word vector of each word obtained by the pre-training is:<P,Q> The word-vector matrix of .
4. The text similarity calculation system based on multiple keyword pair matching as claimed in claim 1, characterized in that: The context module first analyzes the text pair<P,Q> The sequence is represented by word embedding, and then the word embedding representation is passed through a BiLSTM to obtain the text pair<P,Q> Contextual representation of <W p ,h q >.
5. The text similarity calculation system based on multiple keyword pair matching as claimed in claim 1, characterized in that: The keyword pair extraction module proposes a word pair-based attention mechanism WP-Attention to calculate the text pair<P,Q> For the attention scores of P and Q, select the group of words with the largest attention scores as the keyword pair <w p , w q >, use different parameters to extract multiple groups of keyword pairs representing different semantic levels <w p k , w q k >, k = 1, 2,…, K.
6. A text similarity calculation method based on multi-keyword pair matching, characterized in that: The steps include: Step S1: Preprocess the first text P and the second text Q respectively, including word segmentation and stop word removal, to obtain the preprocessed text pairs.<P,Q> ; Step S2: The preprocessed text<P,Q> Get word vectors through Word2vec pre-training; Step S3: Match the text<P,Q> Perform word vector embedding representation, and then use BiLSTM to get text pairs<P,Q> Contextual representation of ; Step S4: Use the proposed WP-Attention mechanism to extract<P,Q> Extract multiple keyword pairs with different semantic levels; specifically include the following steps: Step S4.1 calculates the characteristics h of P itself respectively p , P's attention score to P Q's attention score to P Through the weighted sum of these three parts, the text pair is calculated through the Softmax function<P,Q> For each word in P and Q, the pair with the largest weight is selected as the keyword pair; Step S4.2 Calculate text pairs<P,Q> WP-Attention of each word in , and get the attention weight α of each word p and α q ; step S4.3 selects a group of words with the largest α as a group of keyword pairs, as shown in formula (8-9): w p =h p t ,t=index(max(α p )) (8) w q =h q t ,t=index(max(α q )) (9) in, <w p , w q > is the extracted keyword pair; use different parameters to extract multiple groups of keyword pairs containing different semantic levels <w p k , w q k >, k = 1, 2, ..., K; The step S4.1 further comprises the following steps: Step S4.1.1 Calculate the text pair by equation (8,9)<P,Q> WP-Attention for each word of P and Q: Where W pp ,W qp ,W p ,W qq ,W pq ,W q ,W d is the trainable parameter matrix, tanh is the activation function, wa p and wa q Represents text pairs<P,Q> WP-Attention for each word of P and Q; Step S4.1.2 calculates the text pair through the Softmax function<P,Q> The attention weight for each word of P and Q is shown in formula (12-13): where α p and α q Represents text pairs<P,Q> Attention weight for each word of P and Q; Step S5: Calculate text pairs through word-level tasks<P,Q> Word-level similarity, that is, the similarity of the semantic vectors of each keyword pair is calculated, and the average result is used as the text pair.<P,Q> Similarity of word granularity; Step S6: Calculate text pairs through sentence-level tasks<P,Q> Sentence-level similarity, that is, firstly<P,Q> De-noising is performed to retain only the extracted keywords to obtain the keyword sequence, which is then fed into the BiLSTM aggregation to obtain the text pair<P,Q> The sentence semantic vector of text P and Q is calculated as the similarity of the text pair.<P,Q> Similarity at sentence granularity; Step S7: perform weighted summation of the similarity values obtained in steps S5 and S6 to obtain a final similarity value, and output the result.
7. The text similarity calculation method based on multiple keyword pair matching as claimed in claim 6, characterized in that: Step S1 uses Jieba word segmentation tool to complete the text segmentation.<P、Q> The word segmentation is performed, and the stop words are removed from the text after the word segmentation to obtain the text pair<P,Q> .
8. The text similarity calculation method based on multiple keyword pair matching as claimed in claim 6, characterized in that: Step S2 uses the text preprocessed in step S1 to<P,Q> As training corpus, the Word2vec algorithm is used for pre-training to obtain the word-vector matrix wv_matrix, and the mapping of each word to the word vector is obtained.
9. The text similarity calculation method based on multiple keyword pair matching as claimed in claim 6, characterized in that: The step S3 further comprises the following steps: Step S3.1 uses Word2vec pre-trained word vectors, word vectors and exact matching tokens are concatenated together as text pairs<P,Q> The embedding representation of <E p , E q > Step S3.2:<P,Q> The embedding representation is fed into BiLSTM to obtain the text pair<P,Q> The embedded contextual representation of <h p ,h q >, as shown in formula (1-2); h p =BiLSTM(E p ) (1) h q =BiLSTM(E q ) (2) The step S3.1 further comprises the following steps:<P,Q> Each word in is denoted as w: Step S3.1.1 obtains the vector representation of the word based on the word-vector matrix obtained by pre-training, as shown in formula (3): E1=wv_matrix(w) (3) Step S3.1.2 initializes each word of w into a word vector, and then feeds the word vector sequence into the LSTM network to obtain the word vector representation of w, as shown in formula (4); E2=char_LSTM(w) (4) Step S3.1.3 marks the same words and synonyms in P and Q. If there are the same words or synonyms in P and Q, they are marked as 1, otherwise they are marked as 0, as shown in formula (5): E3=flag(w) (5) Step S3.1.4 concatenates E1, E2, and E3 together as the embedded representation of P and Q, as shown in equation (6-7): E(w)=[E1,E2,E3] (6) And=[E(w1),E(w2),…,E(w l )] (7) Among them, w i Represents text pairs<P、Q> The i-th word, l represents the text pair<P、Q> The length of E represents the embedding representation of the text.
10. The text similarity calculation method based on multiple keyword pair matching according to claim 6, characterized in that: The step S5 further comprises the following steps: Step S5.1: For each keyword <w p k , w q k >interact with the semantic vectors to obtain the interaction vector F w , as shown in formula (14): F wk =[w p k ,w q k ,w p k +w q k ,w p k -w q k ,|w p k -w q k |] (14) Where k = 1, 2, ..., K represents the number of the keyword pair, represents the interaction vector of the kth keyword pair; Step S5.2 uses a multi-layer perceptron to analyze the interaction vector Fitting is performed to obtain the similarity of each keyword pair, and the average value is taken as the text pair.<P,Q> Word level similarity, as shown in formula (15):
11. The text similarity calculation method based on multiple keyword pair matching according to claim 6, characterized in that: The step S6 further comprises the following steps: Step S6.1: Text pair<P,Q> Denoising is performed to obtain a keyword sequence, which is then fed into BiLSTM to use the output of the last time step as the semantic vector of the sentence. <V p ,V q > Step S6.2: The semantic vector of the sentence <V p ,V q >Interact and get text pairs<P,Q> Sentence-level interaction vector F s , as shown in formula (16): F s =[V p k ,V q k ,V p k +V q k ,V p k -V q k ,|V p k -V q k |] (16) Step S6.3 uses a multi-layer perceptron to analyze the interaction vector F s Fitting to get text pair<P,Q> Sentence level similarity, as shown in formula (17): similarity s<P,Q> =MLP(F s ) (17)。 12. The text similarity calculation method based on multiple keyword pair matching according to claim 6, characterized in that: The step S7 will be similarity w<P,Q> and similarity s<P,Q> Weighted summation to get the final text pair<P,Q> The similarity is shown in formula (18): similarity <P,Q> =β*similarity s>P,Q> +(1-β)*similarity w>P,Q> (18) Where β is the weight of the sentence-level task, and (1-β) is the weight of the word-level task, which are adjusted as hyperparameters.
13. A storage medium storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by one or more processors, the one or more processors execute the text similarity calculation method based on multi-keyword pair matching as described in any one of claims 6 to 12.
