A method and device for recognizing a paraphrase sentence
By preprocessing the sentences to be recognized to obtain sentence vectors and difference vectors, and inputting them into the trained paraphrase sentence recognition model for classification prediction, the problem of low accuracy of paraphrase sentence recognition in the existing technology is solved, and improved Recognition accuracy.
Patent Information
- Application Number
- CN202010591942.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-24
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-06-24
AI Technical Summary
The recognition accuracy of paraphrased sentences in the existing technology is not high, which affects the user experience.
By obtaining the two sentences to be recognized, preprocessing is performed to determine the sentence vector and difference vector, and they are input into the recognition model trained using the labeled paraphrase training samples, and classification prediction is performed to determine whether it is a paraphrase.
It improves the accuracy of paraphrase sentence recognition and provides higher recognition accuracy than simply calculating the similarity of sentence vectors.
Smart Images

Figure CN111666755B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology (Fintech), and in particular to a method and device for recognizing paraphrased sentences. Background Art
[0002] With the development of computer technology, more and more technologies are being applied in the financial field. Traditional finance is gradually transforming into financial technology. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. In the customer service of the financial field, paraphrase recognition is an important issue in the intelligent voice customer service system. Correctly recognizing and understanding paraphrases can greatly improve the user experience.
[0003] In the intelligent voice customer service system, a paraphrase is generally defined as whether the user's current input is a semantically correct repetition of the previous sentence of the intelligent customer service. The existing technical solution generally determines whether it is a paraphrase by the vector similarity of two sentences. However, since the recognition accuracy only depends on the vector similarity, and the technical solution of vector similarity is simple and single, the recognition result of this method is not accurate, which affects the user experience.
[0004] In summary, there is an urgent need for a method for paraphrase sentence recognition to solve the problem of low paraphrase sentence recognition accuracy in the prior art. Summary of the invention
[0005] The present invention provides a method and device for recognizing a paraphrase sentence, which can solve the problem of low accuracy in recognizing a paraphrase sentence in the prior art.
[0006] In a first aspect, the present invention provides a method for recognizing a paraphrase sentence, comprising:
[0007] Get two sentences to be recognized;
[0008] When it is determined that the edit distance between the two sentences is not 0, preprocessing the two sentences to determine the sentence vectors of the two sentences and the difference vector of the two sentences;
[0009] Determining a vector to be identified according to the sentence vectors of the two sentences and the difference vectors of the two sentences;
[0010] The vector to be identified is input into a paraphrase recognition model to determine whether the two sentences are paraphrases. The paraphrase recognition model is obtained by training a preset recognition model using labeled paraphrase training samples.
[0011] In the above technical solution, after preprocessing the two sentences respectively, the sentence vectors of the two sentences and the difference vectors of the two sentences are obtained, and finally the vector to be recognized as the input of the paraphrase recognition model is obtained from the sentence vectors and the difference vectors of the two sentences. By treating the problem of identifying whether the two sentences are paraphrases as classification prediction, the recognition result obtained has high recognition accuracy compared to the method of simply calculating the vector similarity of the two sentences, which can improve the accuracy of paraphrase recognition.
[0012] Optionally, preprocessing the two sentences includes:
[0013] Perform character-level segmentation on the two sentences respectively to obtain characters corresponding to the two sentences;
[0014] The characters corresponding to the two sentences are placed in a preset format and then converted into a digital form of a preset length.
[0015] Optionally, determining the sentence vectors of the two sentences and the difference vector of the two sentences includes:
[0016] Inputting the two pre-processed sentences into different pre-training models respectively to obtain sentence vectors of the two sentences;
[0017] The absolute value of the difference between the sentence vectors of the two sentences is taken as the difference vector of the two sentences.
[0018] Optionally, determining the vector to be identified according to the sentence vectors of the two sentences and the difference vectors of the two sentences includes:
[0019] The sentence vectors of the two sentences and the difference vectors of the two sentences are weightedly summed to obtain the vector to be recognized; wherein the weight corresponding to each vector is obtained by training the initial weight of each vector during the training process of the paraphrase recognition model.
[0020] Optionally, the method of using the labeled paraphrase training samples to train a preset recognition model to obtain the paraphrase recognition model includes:
[0021] Get labeled paraphrase training samples;
[0022] After preprocessing each pair of sentences in the labeled paraphrase training samples, determine the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences;
[0023] Performing weighted summation on the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences with the initial weights corresponding to each vector to obtain an input vector for each pair of sentences;
[0024] The input vector is input into a preset recognition model for training until the preset recognition model converges to obtain the paraphrase sentence recognition model.
[0025] Optionally, the method further includes:
[0026] If it is determined that the edit distance between the two sentences is 0, then the two sentences are determined to be paraphrases.
[0027] Optionally, determining the edit distance between two sentences includes:
[0028] Remove meaningless words from the two sentences according to preset rules;
[0029] Determine the Levenshtein distance between two sentences after removing nonsense words.
[0030] In a second aspect, an embodiment of the present invention provides a device for recognizing a paraphrase sentence, comprising:
[0031] An acquisition unit, used for acquiring two sentences to be recognized;
[0032] The processing unit is used to determine the sentence vectors of the two sentences and the difference vector of the two sentences after pre-processing the two sentences when it is determined that the edit distance between the two sentences is not 0; determine the vector to be identified according to the sentence vectors of the two sentences and the difference vector of the two sentences; input the vector to be identified into a paraphrase recognition model to determine whether the two sentences are paraphrases, and the paraphrase recognition model is obtained by training a preset recognition model using labeled paraphrase training samples.
[0033] Optionally, the processing unit is specifically used for:
[0034] Perform character-level segmentation on the two sentences respectively to obtain characters corresponding to the two sentences;
[0035] The characters corresponding to the two sentences are placed in a preset format and then converted into a digital form of a preset length.
[0036] Optionally, the processing unit is specifically used for:
[0037] Inputting the two pre-processed sentences into different pre-training models respectively to obtain sentence vectors of the two sentences;
[0038] The absolute value of the difference between the sentence vectors of the two sentences is taken as the difference vector of the two sentences.
[0039] Optionally, the processing unit is specifically used for:
[0040] The sentence vectors of the two sentences and the difference vectors of the two sentences are weightedly summed to obtain the vector to be recognized; wherein the weight corresponding to each vector is obtained by training the initial weight of each vector during the training process of the paraphrase recognition model.
[0041] Optionally, the processing unit is specifically used for:
[0042] Get labeled paraphrase training samples;
[0043] After preprocessing each pair of sentences in the labeled paraphrase training samples, determine the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences;
[0044] Performing weighted summation on the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences with the initial weights corresponding to each vector to obtain an input vector for each pair of sentences;
[0045] The input vector is input into a preset recognition model for training until the preset recognition model converges to obtain the paraphrase sentence recognition model.
[0046] Optionally, the processing unit is further used for:
[0047] If it is determined that the edit distance between the two sentences is 0, then the two sentences are determined to be paraphrases.
[0048] Optionally, the processing unit is specifically used for:
[0049] Remove meaningless words from the two sentences according to preset rules;
[0050] Determine the Levenshtein distance between two sentences after removing nonsense words.
[0051] In a third aspect, the present invention provides a computing device, comprising:
[0052] Memory for storing computer programs;
[0053] The processor is used to call the computer program stored in the memory and execute the method described in the first aspect according to the obtained program.
[0054] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the method described in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0056] Figure 1 A schematic diagram of a system architecture provided for an embodiment of the present invention;
[0057] Figure 2 A schematic flow chart of a method for recognizing a paraphrase sentence provided by an embodiment of the present invention;
[0058] Figure 3 A schematic diagram of the structure of a device for recognizing paraphrased sentences provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0060] Figure 1 A system architecture is provided for an embodiment of the present invention. Figure 1 As shown, the system architecture may be a server 100 , including a processor 110 , a communication interface 120 , and a memory 130 .
[0061] The communication interface 120 is used to communicate with the customer service terminal device, send and receive information transmitted by the customer service terminal device, and realize communication.
[0062] The processor 110 is the control center of the server 100, and uses various interfaces and lines to connect various parts of the entire server 100, and executes various functions of the server 100 and processes data by running or executing software programs and / or modules stored in the memory 130, and calling data stored in the memory 130. Optionally, the processor 110 may include one or more processing units.
[0063] The memory 130 can be used to store software programs and modules. The processor 110 executes various functional applications and data processing by running the software programs and modules stored in the memory 130. The memory 130 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function, etc.; the data storage area can store data created according to business processing, etc. In addition, the memory 130 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0064] It should be noted that the above Figure 1 The structure shown is only an example and is not limited to this embodiment of the present invention.
[0065] Based on the above description, Figure 2 The process of a method for paraphrase recognition provided by an embodiment of the present invention is exemplarily shown, and the process can be executed by a device for paraphrase recognition.
[0066] like Figure 2 As shown, the specific steps of the process include:
[0067] Step 201: Obtain two sentences to be recognized.
[0068] In the embodiment of the present invention, the two sentences to be identified may be two sentences in the conversation data between the customer service and the user, for example, one sentence is input by the customer service and the other is input by the user, generally the customer service repeats the user's sentence, or the user repeats the customer service's sentence. For example, sentence A = "Manual operation repayment is OK" and sentence B = "Manual operation repayment is OK, right?"
[0069] Before obtaining the two sentences to be identified, it is necessary to train the paraphrase recognition model first, which can be specifically as follows: first obtain the annotated paraphrase training samples, in which positive samples and negative samples are provided. For example, for two sentences A and B, the annotation of the positive sample is that sentence B is a paraphrase of sentence A, and the annotation of the negative sample is that sentence B is not a paraphrase of sentence A. Then, after preprocessing each pair of sentences in the annotated paraphrase training samples, the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences are determined, and the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences are weighted and summed with the initial weights corresponding to each vector to obtain the input vector of each pair of sentences, and finally the input vector is input into the preset recognition model for training until the preset recognition model converges to obtain the paraphrase recognition model. Among them, in the process of training the paraphrase recognition model, the weights corresponding to the vectors are also trained.
[0070] Specifically, after obtaining the labeled paraphrase training samples, each pair of sentences in the paraphrase training samples is preprocessed, that is, each pair of sentences A and B in each pair of sentences is segmented at the character level, and then the [CLS] tag is placed at the beginning and the [SEP] tag is placed at the end of the sentence. For example, in the form of "[CLS]A[SEP]" and "[CLS]B[SEP]". And converted into a digital form of a preset length, that is, converted into an ID form. After processing, sentences A and B are both fixed-length, and sentences that are not long enough are padded with '0', and those that exceed the fixed length are truncated. The preset length can be set based on experience.
[0071] After obtaining the two preprocessed sentences, sentence A and sentence B are input into two pre-trained models Bert1 and Bert2 respectively to obtain the vector representations of sentence A and sentence B. A and e B , and then get the difference vector u=|e of the two sentence vectors A -e B |.
[0072] E A 、e B The final input vector l = ∑W(e A ,e B ,u), where W is the weight of the three vectors obtained by training. The input vector l is input into the preset recognition model for training. During the training process, the parameters of the upper model, W, and the parameters of Bert1 and Bert2 are continuously updated until the preset recognition converges, and then the paraphrase recognition model is obtained, which is the classification model. The preset recognition model can use DNN, LR, SVM, etc. according to the complexity of the problem.
[0073] Step 202: When it is determined that the edit distance between the two sentences is not 0, the two sentences are pre-processed to determine the sentence vectors of the two sentences and the difference vector of the two sentences.
[0074] After obtaining two sentences in step 201, it may be necessary to first remove the meaningless words in the two sentences. Here, the removal can be performed according to preset rules, which can be set based on experience. For example, the preset rule is to remove modal particles, that is, to remove "you mean", "you mean", "right", etc. For example, sentence A = "manual repayment is fine" and sentence B = "manual repayment is fine, right", you can get sentence A = "manual repayment is fine" and sentence B = "manual repayment is fine". Then determine the edit distance of the two sentences after removing the meaningless words. The edit distance can generally refer to the minimum number of editing operations required to convert one string into another. Allowable editing operations include replacing one character with another, inserting a character, and deleting a character. The fewer the number of editing operations, the closer the two are.
[0075] It should be noted that when the edit distance between two sentences is 0, it indicates that the two sentences are the same sentence, and it can be directly determined that the two sentences are paraphrases. Obviously, the edit distance between the above sentences A and B is 0, and the two sentences are paraphrases.
[0076] If the edit distance between the two sentences is not 0, it is necessary to distinguish them through the paraphrase recognition model. At this time, the two sentences need to be preprocessed to determine the sentence vectors of the two sentences and the difference vector of the two sentences.
[0077] The preprocessing process may be: firstly, the two sentences are segmented at the character level to obtain the characters corresponding to the two sentences, and then the characters corresponding to the two sentences are placed in a preset format and converted into a digital form of a preset length, thereby obtaining the two preprocessed sentences.
[0078] The two preprocessed sentences are input into different pre-trained models to obtain the sentence vectors of the two sentences. Finally, the absolute value of the difference between the sentence vectors of the two sentences is taken as the difference vector of the two sentences.
[0079] For example, if the sentence A = "You can unbind your bank card" and sentence B = "I can unbind it" are segmented at the character level, we can get sentence A = "You can unbind your bank card" and sentence B = "I can unbind it". Then put the [CLS] tag at the beginning and the [SEP] tag at the end of the sentence, that is, "[CLS] You can unbind your bank card [SEP]" and "[CLS] I can unbind it [SEP]". These two sentences are converted into an ID format of a preset length, where sentences with insufficient length are padded with '0' and sentences exceeding the fixed length are truncated.
[0080] Input the preprocessed sentence A into the pre-trained model Bert1, and input sentence B into the pre-trained model Bert2 to obtain the sentence vectors e for sentence A and sentence B respectively. A and e B , and then get the difference vector u=|e between the sentence vectors of the two sentences A -e B |.
[0081] Step 203: determining a vector to be identified based on the sentence vectors of the two sentences and the difference vectors of the two sentences.
[0082] Specifically, the sentence vectors of the two sentences and the difference vectors of the two sentences are weighted and summed to obtain the vector to be recognized. The weight corresponding to each vector is obtained by training the initial weight of each vector during the training process of the paraphrase recognition model.
[0083] For example, e A 、e B and u to obtain the vector to be identified M = ∑W (e A ,e B ,u), where W is the weight of the three vectors.
[0084] Step 204: input the vector to be recognized into a paraphrase recognition model to determine whether the two sentences are paraphrases.
[0085] The vector to be identified is input into the paraphrase recognition model to obtain whether the two sentences are paraphrases. Specifically, the vector to be identified is input into the paraphrase recognition model to obtain the predicted probability of whether the two sentences are paraphrases, and then determine whether the predicted probability of the two sentences being paraphrases is greater than the probability threshold. If so, the two sentences are determined to be paraphrases, otherwise the two sentences are determined not to be paraphrases. In other words, the feature vector is input into the paraphrase recognition model for prediction to obtain the predicted probability. Only when the predicted probability is greater than the probability threshold can the two sentences be determined to be paraphrases. Among them, the probability threshold can be set based on experience.
[0086] The embodiment of the present invention shows that by obtaining two sentences to be identified, when it is determined that the edit distance between the two sentences is not 0, the two sentences are pre-processed, and the sentence vectors of the two sentences and the difference vectors of the two sentences are determined. The vectors to be identified are determined according to the sentence vectors of the two sentences and the difference vectors of the two sentences. The vectors to be identified are input into the paraphrase recognition model to determine whether the two sentences are paraphrases. The paraphrase recognition model is obtained by training a preset recognition model using labeled paraphrase training samples. After pre-processing the two sentences respectively, the sentence vectors of the two sentences and the difference vectors of the two sentences are obtained. Finally, the vectors to be identified as input to the paraphrase recognition model are obtained from the sentence vectors and the difference vectors of the two sentences. By treating the problem of identifying whether the two sentences are paraphrases as classification prediction, the recognition result obtained is compared with the method of simply calculating the vector similarity of the two sentences. The recognition accuracy of the present application is high, and the recognition accuracy rate is improved.
[0087] Based on the same technical concept, Figure 3 The schematic diagram of the structure of a device for paraphrase sentence recognition provided by an embodiment of the present invention is exemplarily shown. The device can execute the process of paraphrase sentence recognition.
[0088] like Figure 3 As shown, the device specifically includes:
[0089] An acquisition unit 301 is used to acquire two sentences to be recognized;
[0090] The processing unit 302 is used to determine the sentence vectors of the two sentences and the difference vector of the two sentences after pre-processing the two sentences when it is determined that the edit distance between the two sentences is not 0; determine the vector to be identified according to the sentence vectors of the two sentences and the difference vector of the two sentences; input the vector to be identified into a paraphrase sentence recognition model to determine whether the two sentences are paraphrases, and the paraphrase sentence recognition model is obtained by training a preset recognition model using labeled paraphrase sentence training samples.
[0091] Optionally, the processing unit 302 is specifically configured to:
[0092] Perform character-level segmentation on the two sentences respectively to obtain characters corresponding to the two sentences;
[0093] The characters corresponding to the two sentences are placed in a preset format and then converted into a digital form of a preset length.
[0094] Optionally, the processing unit 302 is specifically configured to:
[0095] Inputting the two pre-processed sentences into different pre-training models respectively to obtain sentence vectors of the two sentences;
[0096] The absolute value of the difference between the sentence vectors of the two sentences is taken as the difference vector of the two sentences.
[0097] Optionally, the processing unit 302 is specifically configured to:
[0098] The sentence vectors of the two sentences and the difference vectors of the two sentences are weightedly summed to obtain the vector to be recognized; wherein the weight corresponding to each vector is obtained by training the initial weight of each vector during the training process of the paraphrase recognition model.
[0099] Optionally, the processing unit 302 is specifically configured to:
[0100] Get labeled paraphrase training samples;
[0101] After preprocessing each pair of sentences in the labeled paraphrase training samples, determine the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences;
[0102] Performing weighted summation on the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences with the initial weights corresponding to each vector to obtain an input vector for each pair of sentences;
[0103] The input vector is input into a preset recognition model for training until the preset recognition model converges to obtain the paraphrase sentence recognition model.
[0104] Optionally, the processing unit 302 is further configured to:
[0105] If it is determined that the edit distance between the two sentences is 0, then the two sentences are determined to be paraphrases.
[0106] Optionally, the processing unit 302 is specifically configured to:
[0107] Remove meaningless words from the two sentences according to preset rules;
[0108] Determine the Levenshtein distance between two sentences after removing nonsense words.
[0109] Based on the same technical concept, an embodiment of the present invention provides a computing device, including:
[0110] Memory for storing computer programs;
[0111] The processor is used to call the computer program stored in the memory and execute the above-mentioned method for paraphrase recognition according to the obtained program.
[0112] Based on the same technical concept, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the above-mentioned method for paraphrase recognition.
[0113] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0114] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0115] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0116] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0117] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0118] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of this application and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for recognizing a paraphrase sentence, characterized in that: include: Get two sentences to be recognized; When it is determined that the edit distance between the two sentences is not 0, preprocessing the two sentences, and inputting the preprocessed two sentences into different pre-training models respectively to obtain sentence vectors of the two sentences; Taking the absolute value of the difference between the sentence vectors of the two sentences as the difference vector of the two sentences; performing weighted summation on the sentence vectors of the two sentences and the difference vector of the two sentences to obtain the vector to be recognized; wherein the weight corresponding to each vector is obtained by training the initial weight of each vector in the training process of the paraphrase recognition model; The vector to be identified is input into the paraphrase recognition model to determine whether the two sentences are paraphrases, wherein the paraphrase recognition model is obtained by training a preset recognition model using labeled paraphrase training samples.
2. The method according to claim 1, characterized in that The preprocessing of the two sentences comprises: Perform character-level segmentation on the two sentences respectively to obtain characters corresponding to the two sentences; The characters corresponding to the two sentences are placed in a preset format and then converted into a digital form of a preset length.
3. The method according to claim 1 or 2, characterized in that The method of using the labeled paraphrase training samples to train a preset recognition model to obtain the paraphrase recognition model includes: Get labeled paraphrase training samples; After preprocessing each pair of sentences in the labeled paraphrase training samples, determine the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences; Performing weighted summation on the sentence vector of each sentence in each pair of sentences and the difference vector of each pair of sentences with the initial weights corresponding to each vector to obtain an input vector for each pair of sentences; The input vector is input into a preset recognition model for training until the preset recognition model converges to obtain the paraphrase sentence recognition model.
4. The method according to claim 1, characterized in that The method further comprises: If it is determined that the edit distance between the two sentences is 0, then the two sentences are determined to be paraphrases.
5. The method according to claim 1, characterized in that Determining the edit distance between two sentences includes: Remove meaningless words from the two sentences according to preset rules; Determine the Levenshtein distance between two sentences after removing nonsense words.
6. A device for recognizing a paraphrase sentence, characterized in that: include: An acquisition unit, used for acquiring two sentences to be recognized; A processing unit is used for, when it is determined that the edit distance between the two sentences is not 0, preprocessing the two sentences, and inputting the two preprocessed sentences into different pre-training models respectively to obtain sentence vectors of the two sentences; taking the absolute value of the difference between the sentence vectors of the two sentences as the difference vector of the two sentences; performing weighted summation on the sentence vectors of the two sentences and the difference vector of the two sentences to obtain the vector to be identified; wherein the weight corresponding to each vector is obtained by training the initial weight of each vector during the training process of the paraphrase recognition model; inputting the vector to be identified into the paraphrase recognition model to determine whether the two sentences are paraphrases, and the paraphrase recognition model is obtained by training a preset recognition model using labeled paraphrase training samples.
7. A computing device, characterized in that include: Memory for storing computer programs; A processor, configured to call a computer program stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer-executable program, and the computer-executable program is used to enable a computer to execute the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Text similarity calculation method and system
CN110750977A
