A method and device for recognizing a paraphrase sentence
By identifying the semantic roles of two sentences and judging their consistency, the problem of low recognition accuracy of retelling sentences in the prior art is solved, and a higher recognition accuracy and user experience are achieved.
Patent Information
- Application Number
- CN202010591982.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-24
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2040-06-24
AI Technical Summary
In the prior art, the accuracy of retelling sentence recognition is not high, which affects the user experience.
By obtaining the two sentences to be identified, it is determined that their editing distance is not 0, and the semantic role of each word is identified. If the semantic roles of the two sentences are the same and the words corresponding to the same semantic roles are the same or are synonyms, it is determined to be a retelling sentence.
Improve the accuracy of retelling sentence recognition and improve user experience.
Smart Images

Figure CN111738019B_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 sentence 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 solutions generally use a word vector model to obtain the initial vector representation of the two sentences, and then use a CNN or RNN model to obtain the final vector representation of the two sentences. Finally, the two vectors are used to determine whether the two sentences are similar by calculating the similarity. However, 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, determining the semantic role of each word in the two sentences;
[0009] If the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonymous, then the two sentences are determined to be paraphrases.
[0010] In the above technical solution, when it is determined that the edit distance between the two sentences is not 0, after the semantic roles of the two sentences are identified, the two sentences can be determined to be paraphrases by judging that the semantic roles in the two sentences are the same and the words of the same semantic roles are the same or synonyms. Since the semantic roles of the two sentences that are both paraphrases should be the same, and the words corresponding to the semantic roles should also be the same or synonyms, the consistency of the semantic roles of the sentences and their corresponding words for paraphrasing can be used to identify paraphrases, which can improve the accuracy of paraphrasing recognition.
[0011] Optionally, the method further includes:
[0012] If the semantic roles in the two sentences are not exactly the same and / or the words corresponding to the same semantic roles are different, then determine whether the agents or patients in the semantic roles of the two sentences are the same; if not, perform a first processing on the words corresponding to the agent or patient, and determine whether the two sentences are paraphrases based on the semantic roles of the two sentences after the first processing; otherwise, determine whether the two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences.
[0013] In the above technical solution, when it is determined that the semantic roles are different or the words corresponding to the same semantic roles are different, the accuracy of paraphrase recognition can be further improved by analyzing the agent or the object in the semantic role to perform paraphrase recognition.
[0014] Optionally, performing a first processing on the words of the agent or the patient, and determining whether the two sentences are paraphrases according to the semantic roles of the two sentences after the first processing, includes:
[0015] Reversing and / or inheriting the words corresponding to the agent or patient in the two sentences;
[0016] If the semantic roles of the two sentences after reversal and / or inheritance are the same and the words corresponding to the same semantic roles are the same or synonyms, the two sentences are determined to be paraphrases; otherwise, whether the two sentences are paraphrases is determined based on the semantic additional words in the semantic roles of the two sentences.
[0017] By reversing and / or inheriting the words corresponding to the agent or the patient, the semantic roles of the two sentences after the reversal and / or inheritance can be made consistent, and then it can be determined whether the two sentences are repetition sentences.
[0018] Optionally, determining whether the two sentences are paraphrases according to the semantic additional words in the semantic roles of the two sentences includes:
[0019] Determine whether the semantic additional word is an adverbial modifier and a negative word, and if so, when it is determined that the number of the negative words is an even number, determine the two sentences as repetition sentences, and when it is determined that the number of the negative words is an odd number, determine the two sentences as repetition sentences;
[0020] Otherwise, determine whether the semantic additional word is the preset important information. If the semantic additional word is the preset important information, determine the sentence that asks the user a question. If the semantic additional word is not the preset important information, vectorize the two sentences and determine whether the two sentences are repetition sentences based on the similarity of the vectors of the two sentences.
[0021] In the above technical solution, when it is impossible to determine whether it is a paraphrase sentence through the agent or the patient, the semantic additional words can be analyzed to determine whether the two sentences are paraphrases, which can further improve the accuracy of paraphrase recognition.
[0022] Optionally, determining whether the two sentences are paraphrases according to the similarity of the vectors of the two sentences includes:
[0023] If the similarity between the vectors of the two sentences is greater than a threshold, the two sentences are determined to be paraphrases; otherwise, the two sentences are determined not to be paraphrases.
[0024] Optionally, determining the semantic role of each word in the two sentences includes:
[0025] The two sentences are input into a semantic role recognition model to determine the semantic role of each word in the two sentences, wherein the semantic role recognition model is obtained by training a sequence labeling model using training samples labeled according to the semantic role labels.
[0026] Optionally, the step of training a sequence labeling model using training samples labeled according to semantic role labels to obtain the semantic role recognition model includes:
[0027] Get training samples annotated according to semantic role labels,
[0028] Preprocessing the sentences in the training sample;
[0029] Input the preprocessed sentences into the pretrained model to obtain the vector representation of each word in each sentence;
[0030] The vector representation is input into a sequence labeling model for training to obtain the semantic role recognition model.
[0031] In a second aspect, an embodiment of the present invention provides a device for recognizing a paraphrase sentence, comprising:
[0032] An acquisition unit, used for acquiring two sentences to be recognized;
[0033] The processing unit is used to determine the semantic role of each word in the two sentences when it is determined that the edit distance between the two sentences is not 0; if the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonyms, then determine that the two sentences are paraphrases.
[0034] Optionally, the processing unit is further used for:
[0035] If the semantic roles in the two sentences are not exactly the same and / or the words corresponding to the same semantic roles are different, then determine whether the agents or patients in the semantic roles of the two sentences are the same; if not, perform a first processing on the words corresponding to the agent or patient, and determine whether the two sentences are paraphrases based on the semantic roles of the two sentences after the first processing; otherwise, determine whether the two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences.
[0036] Optionally, the processing unit is specifically used for:
[0037] Reversing and / or inheriting the words corresponding to the agent or patient in the two sentences;
[0038] If the semantic roles of the two sentences after reversal and / or inheritance are the same and the words corresponding to the same semantic roles are the same or synonyms, the two sentences are determined to be paraphrases; otherwise, whether the two sentences are paraphrases is determined based on the semantic additional words in the semantic roles of the two sentences.
[0039] Optionally, the processing unit is specifically used for:
[0040] Determine whether the semantic additional word is an adverbial modifier and a negative word, and if so, when it is determined that the number of the negative words is an even number, determine the two sentences as repetition sentences, and when it is determined that the number of the negative words is an odd number, determine the two sentences as repetition sentences;
[0041] Otherwise, determine whether the semantic additional word is the preset important information. If the semantic additional word is the preset important information, determine the sentence that asks the user a question. If the semantic additional word is not the preset important information, vectorize the two sentences and determine whether the two sentences are repetition sentences based on the similarity of the vectors of the two sentences.
[0042] Optionally, the processing unit is specifically used for:
[0043] If the similarity between the vectors of the two sentences is greater than a threshold, the two sentences are determined to be paraphrases; otherwise, the two sentences are determined not to be paraphrases.
[0044] Optionally, the processing unit is specifically used for:
[0045] The two sentences are input into a semantic role recognition model to determine the semantic role of each word in the two sentences, wherein the semantic role recognition model is obtained by training a sequence labeling model using training samples labeled according to the semantic role labels.
[0046] Optionally, the processing unit is specifically used for:
[0047] Get training samples annotated according to semantic role labels,
[0048] Preprocessing the sentences in the training sample;
[0049] Input the preprocessed sentences into the pretrained model to obtain the vector representation of each word in each sentence;
[0050] The vector representation is input into a sequence labeling model for training to obtain the semantic role recognition model.
[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] Step 202: When it is determined that the edit distance between the two sentences is not 0, determine the semantic role of each word in the two sentences.
[0070] After obtaining two sentences in step 201, it is necessary to first remove meaningless words in the two sentences, such as modal particles, "you mean", "you mean", "right", etc. Then determine the edit distance of the two sentences, which generally refers to the minimum number of edit operations required to convert one string into another. Allowable edit operations include replacing one character with another, inserting a character, and deleting a character. The fewer the number of edit operations, the closer the two are.
[0071] 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 the two sentences can be directly determined to be paraphrases. If the edit distance between the two sentences is not 0, it is necessary to input the two sentences into the semantic role recognition model to determine the semantic role of each word in the two sentences.
[0072] Wherein, when the sequence labeling model is trained using the training samples labeled according to the semantic role labeling to obtain the semantic role recognition model, the following may be specifically included:
[0073] First, we obtain training samples annotated according to semantic role annotation, then preprocess the sentences in the training samples, and then input the preprocessed sentences into the pre-training model to obtain the vector representation of each word in each sentence. Finally, we input the vector representation into the sequence annotation model for training to obtain the semantic role recognition model.
[0074] In the embodiment of the present invention, the task of SRL (Semantic Role Labeling) is to focus on the predicate of the sentence, study the relationship between each component and the predicate in the sentence, and use semantic roles to describe the relationship between them, that is, to determine other arguments and the roles of other arguments for the (core) predicate in the sentence. SRL usually divides the components of a sentence into three categories, namely: predicate (REL), core argument (ArgN, N∈{0,1,2,3,4,5}) and semantic additional words (ArgM-***), where the predicate is generally a verb or an adjective, the core argument represents the argument directly related to the predicate, such as the agent (Arg0) and the patient (Arg1) of the predicate, etc., and the semantic additional words represent the argument not directly related to the predicate and can exist independently, such as time (ArgM-TMP), place (ArgM-LOC), purpose (ArgM-PRP), degree (ArgM-DGR), scope (ArgM-EXT), etc. For example, in the sentence “You can search for *** public account now”, SRL can determine that the predicate is “search”, the agent is “you”, the object is “*** public account”, and the time is “now”.
[0075] In the specific training process, we first need to collect and annotate data according to the SRL annotation standard to obtain training sample D1. Then, we train the semantic role recognition model based on the training sample D1. The model can adopt a sequence annotation model based on BERT (Bidirectional Encoder Representations from Transformer, pre-trained model) + LSTM (Long Short-Term Memory, long short-term memory network) + CRF (Conditional Random Field, conditional random field). The training process is as follows:
[0076] First, the data in training sample D1 is preprocessed. The two sentences are segmented at the character level and converted into ID form. The [CLS] tag is set at the beginning of the sentence and the [SEP] tag is set at the end of the sentence. At the same time, the corpus is converted into a fixed length. Sentences that are not long enough are padded with '0', and those that exceed the fixed length are truncated.
[0077] Secondly, the preprocessed sentences are input into the pre-trained model BERT to obtain the vector representation of each word in the sentence. The obtained vector representation is then input into the upper-layer LSTM+CRF model for training to obtain the semantic role recognition model.
[0078] After the above semantic role recognition model is trained, two sentences can be input into the semantic role recognition model to obtain the semantic role of each word in the two sentences.
[0079] Step 203: If the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonymous, then it is determined that the two sentences are paraphrases.
[0080] After obtaining the semantic role of each word in the two sentences, it can be determined whether the semantic roles in the two sentences are the same and whether the words corresponding to the same semantic roles are the same or synonyms. When it is determined that the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonyms, it can be determined that the two sentences are paraphrases. In other words, if the semantic roles of the two sentences are exactly the same and the words corresponding to the semantic roles are exactly the same or synonyms, then they are paraphrases, such as sentence A = "It is considered a breach of contract" and sentence B = "It is considered a breach of contract, right?" Sentence A has a core predicate REL = "It is considered a breach of contract" and an object Arg1 = "Breach of contract". Sentence B has a core predicate REL = "It is considered a breach of contract" and an object Arg1 = "Breach of contract" after deleting meaningless words. The semantic roles and corresponding words of the two sentences are exactly the same, so they are paraphrases.
[0081] If the semantic roles of the two sentences and the corresponding words are not completely consistent, that is, the semantic roles in the two sentences are not completely the same and / or the words corresponding to the same semantic roles are different, it can be determined whether the agents or patients in the semantic roles of the two sentences are the same. If not, the words corresponding to the agents or patients are first processed, and whether the two sentences are paraphrases is determined based on the semantic roles of the two sentences after the first processing. Otherwise, it can be determined whether the two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences.
[0082] Among them, a first processing is performed on the words corresponding to the agent or the patient, and whether the two sentences are paraphrases is determined according to the semantic roles of the two sentences after the first processing. Specifically, the words corresponding to the agent or the patient in the two sentences are firstly reversed and / or inherited, and then it is determined that the semantic roles of the two sentences after the reversal and / or inheritance are the same and the words corresponding to the same semantic roles are the same or synonyms. If so, the two sentences are determined to be paraphrases. Otherwise, whether the two sentences are paraphrases is determined according to the semantic additional words in the semantic roles of the two sentences.
[0083] Reverse or inherit the agent or patient. If the semantic roles after reversal and inheritance are completely consistent and the words corresponding to the semantic roles are completely consistent or synonymous, then it is a paraphrase sentence. Otherwise, the semantic additional words in the semantic roles of the two sentences can be used to determine whether the two sentences are paraphrases. For example, sentence A = "You just unbind the bank card" and sentence B = "I just unbind it, right?" The core predicate REL of sentence A = "unbind", the agent Arg0 = "you", and the patient Arg1 = "bank card". The core predicate REL of sentence B = "unbind", the agent Arg0 = "I", and the patient is missing. The agent of sentence B is converted to "you". After inheriting the patient from A, it can be seen that the roles of the two sentences and the words corresponding to the roles are consistent or synonymous, so it can be determined that the two are paraphrases.
[0084] When determining whether two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences, it may include determining whether the semantic additional words are adverbials and negative words. If so, when the number of negative words is determined to be an even number, the two sentences are determined to be paraphrases, and when the number of negative words is determined to be an odd number, the two sentences are determined to be paraphrases. Otherwise, it is determined whether the semantic additional words are preset important information. If the semantic additional words are preset important information, a sentence that asks a question to the user is determined. If the semantic additional words are not preset important information, the two sentences are vectorized and then determined whether the two sentences are paraphrases based on the similarity of the vectors of the two sentences. The preset important information can be set based on experience, for example, it can be important information such as time and place.
[0085] That is, if the missing component is an adverbial in the semantic additional word ArgM, and the adverbial is a negative word, the number of missing components is determined. If it is an even number, it is a paraphrase sentence, otherwise it is a non-paraphrase sentence. If the missing component is important information such as time (ArgM-TMP) or location (ArgM-LOC), a rhetorical question is performed, that is, a rhetorical question is sent to the user, and the user's reply to the rhetorical question is used to determine whether it is a paraphrase sentence.
[0086] In the above embodiment, the method of determining whether two sentences are paraphrases based on the similarity of the vectors of the two sentences is mainly to vectorize the two sentences through word vectors or pre-trained models (Bert, XLNet, etc.), and judge by calculating the similarity of the two vectors. If the similarity is greater than a threshold, it is a paraphrase, otherwise, it is not a paraphrase.
[0087] The embodiment of the present invention shows that two sentences to be identified are obtained, and when it is determined that the edit distance between the two sentences is not 0, the semantic role of each word in the two sentences is determined, and if the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonyms, the two sentences are determined to be paraphrases. When it is determined that the edit distance between the two sentences is not 0, after the semantic roles of the two sentences are identified, the two sentences can be determined to be paraphrases by judging that the semantic roles in the two sentences are the same and the words with the same semantic roles are the same or synonyms. Since the semantic roles of two sentences that are both paraphrases should be the same, and the words corresponding to the semantic roles should also be the same or synonyms, the accuracy of paraphrasing sentence recognition can be improved by using the consistency of the sentence semantic roles and their corresponding words to perform paraphrasing sentence recognition.
[0088] 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.
[0089] like Figure 3 As shown, the device specifically includes:
[0090] An acquisition unit 301 is used to acquire two sentences to be recognized;
[0091] The processing unit 302 is used to determine the semantic role of each word in the two sentences when it is determined that the edit distance between the two sentences is not 0; if the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonyms, then the two sentences are determined to be paraphrases.
[0092] Optionally, the processing unit 302 is further configured to:
[0093] If the semantic roles in the two sentences are not exactly the same and / or the words corresponding to the same semantic roles are different, then determine whether the agents or patients in the semantic roles of the two sentences are the same; if not, perform a first processing on the words corresponding to the agent or patient, and determine whether the two sentences are paraphrases based on the semantic roles of the two sentences after the first processing; otherwise, determine whether the two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences.
[0094] Optionally, the processing unit 302 is specifically configured to:
[0095] Reversing and / or inheriting the words corresponding to the agent or patient in the two sentences;
[0096] If the semantic roles of the two sentences after reversal and / or inheritance are the same and the words corresponding to the same semantic roles are the same or synonyms, the two sentences are determined to be paraphrases; otherwise, whether the two sentences are paraphrases is determined based on the semantic additional words in the semantic roles of the two sentences.
[0097] Optionally, the processing unit 302 is specifically configured to:
[0098] Determine whether the semantic additional word is an adverbial modifier and a negative word, and if so, when it is determined that the number of the negative words is an even number, determine the two sentences as repetition sentences, and when it is determined that the number of the negative words is an odd number, determine the two sentences as repetition sentences;
[0099] Otherwise, determine whether the semantic additional word is the preset important information. If the semantic additional word is the preset important information, determine the sentence that asks the user a question. If the semantic additional word is not the preset important information, vectorize the two sentences and determine whether the two sentences are repetition sentences based on the similarity of the vectors of the two sentences.
[0100] Optionally, the processing unit 302 is specifically configured to:
[0101] If the similarity between the vectors of the two sentences is greater than a threshold, the two sentences are determined to be paraphrases; otherwise, the two sentences are determined not to be paraphrases.
[0102] Optionally, the processing unit 302 is specifically configured to:
[0103] The two sentences are input into a semantic role recognition model to determine the semantic role of each word in the two sentences, wherein the semantic role recognition model is obtained by training a sequence labeling model using training samples labeled according to the semantic role labels.
[0104] Optionally, the processing unit 302 is specifically configured to:
[0105] Get training samples annotated according to semantic role labels,
[0106] Preprocessing the sentences in the training sample;
[0107] Input the preprocessed sentences into the pretrained model to obtain the vector representation of each word in each sentence;
[0108] The vector representation is input into a sequence labeling model for training to obtain the semantic role recognition model.
[0109] Based on the same technical concept, 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] In a fourth aspect, the present invention provides a computer-readable storage medium storing a computer-executable program for causing a computer to execute the above-mentioned method for recognizing a paraphrase sentence.
[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 A step that specifies a function 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, the two sentences are input into a semantic role recognition model to determine the semantic role of each word in the two sentences, wherein the semantic role recognition model is obtained by obtaining training samples annotated according to semantic role annotations, preprocessing the sentences in the training samples; inputting the preprocessed sentences into a pre-training model to obtain a vector representation of each word in each sentence; and inputting the vector representation into a sequence labeling model for training; If the semantic roles in the two sentences are the same and the words corresponding to the same semantic roles are the same or synonymous, then the two sentences are determined to be paraphrases; the method further includes: If the semantic roles in the two sentences are not completely the same and / or the words corresponding to the same semantic roles are different, then determine whether the agent or the patient in the semantic roles of the two sentences are the same; if not, perform a first processing on the words corresponding to the agent or the patient, and determine whether the two sentences are paraphrases according to the semantic roles of the two sentences after the first processing; otherwise, determine whether the two sentences are paraphrases according to the semantic additional words in the semantic roles of the two sentences; the first processing on the words of the agent or the patient, and determine whether the two sentences are paraphrases according to the semantic roles of the two sentences after the first processing, includes: Reversing and / or inheriting the words corresponding to the agent or patient in the two sentences; If the semantic roles of the two sentences after reversal and / or inheritance are the same and the words corresponding to the same semantic roles are the same or synonymous, the two sentences are determined to be paraphrases; otherwise, whether the two sentences are paraphrases is determined based on the semantic additional words in the semantic roles of the two sentences; the step of determining whether the two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences includes: Determine whether the semantic additional word is an adverbial modifier and a negative word, and if so, when it is determined that the number of the negative words is an even number, determine the two sentences as repetition sentences, and when it is determined that the number of the negative words is an odd number, determine the two sentences as repetition sentences; Otherwise, determine whether the semantic additional word is the preset important information. If the semantic additional word is the preset important information, determine the sentence that asks the user a question. If the semantic additional word is not the preset important information, vectorize the two sentences and determine whether the two sentences are repetition sentences based on the similarity of the vectors of the two sentences.
2. The method according to claim 1, characterized in that The determining whether the two sentences are paraphrases according to the similarity of the vectors of the two sentences comprises: If the similarity between the vectors of the two sentences is greater than a threshold, the two sentences are determined to be paraphrases; otherwise, the two sentences are determined not to be paraphrases.
3. 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, inputting the two sentences into a semantic role recognition model to determine the semantic role of each word in the two sentences, wherein the semantic role recognition model is obtained by obtaining training samples annotated according to semantic role annotations, preprocessing the sentences in the training samples; inputting the preprocessed sentences into a pre-training model to obtain a vector representation of each word in each sentence; inputting the vector representation into a sequence labeling model for training; if the semantic roles in the two sentences are the same and the words corresponding to the same semantic role are the same or synonymous, then determining that the two sentences are paraphrases; the processing unit is also used for: If the semantic roles in the two sentences are not completely the same and / or the words corresponding to the same semantic roles are different, then determine whether the agents or patients in the semantic roles of the two sentences are the same; if not, perform a first processing on the words corresponding to the agents or patients, and determine whether the two sentences are paraphrases based on the semantic roles of the two sentences after the first processing; otherwise, determine whether the two sentences are paraphrases based on the semantic additional words in the semantic roles of the two sentences; the processing unit is specifically used to: Reversing and / or inheriting the words corresponding to the agent or patient in the two sentences; If the semantic roles of the two sentences after reversal and / or inheritance are the same and the words corresponding to the same semantic roles are the same or synonymous, the two sentences are determined to be paraphrases; otherwise, whether the two sentences are paraphrases is determined according to the semantic additional words in the semantic roles of the two sentences; the processing unit is specifically used to: Determine whether the semantic additional word is an adverbial modifier and a negative word, and if so, when it is determined that the number of the negative words is an even number, determine the two sentences as repetition sentences, and when it is determined that the number of the negative words is an odd number, determine the two sentences as repetition sentences; Otherwise, determine whether the semantic additional word is the preset important information. If the semantic additional word is the preset important information, determine the sentence that asks the user a question. If the semantic additional word is not the preset important information, vectorize the two sentences and determine whether the two sentences are repetition sentences based on the similarity of the vectors of the two sentences.
4. The device according to claim 3, characterized in that The processing unit is specifically used for: If the similarity between the vectors of the two sentences is greater than a threshold, the two sentences are determined to be paraphrases; otherwise, the two sentences are determined not to be paraphrases.
5. A computing device, characterized in that: include: Memory for storing computer programs; A processor is used to call the computer program stored in the memory and execute the method according to claim 1 or 2 according to the obtained program.
6. 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 claim 1 or 2.