Sentence processing method, electronic device and storage medium combining RPA and AI

By combining RPA and AI, natural language processing technology is used to segment and encode the sentences to be recognized, and generate sentence vectors with high similarity, which solves the problem of insufficient semantic relevance of sentences in the existing technology and improves the accuracy of responses in human-computer interaction scenarios. Rate.

CN112257430BActive Publication Date: 2024-09-13BEIJING LAIYE NETWORK TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011175983.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-03-27
Filing Date
2020-10-28
Publication Date
2024-09-13
Estimated Expiration
2040-10-28

AI Technical Summary

Technical Problem

In the existing technology, the way question statements are processed in human-computer interaction scenarios results in weak semantic relevance of the processed statements, which in turn affects the accuracy of the response results.

Method used

By combining RPA and AI, natural language processing is used to segment and encode the sentences to be recognized, generate long and short sentence vectors, determine the target sentence vector based on similarity, and output abbreviated sentences to improve semantic proximity.

Benefits of technology

It improves the response accuracy in human-computer interaction scenarios, reduces the dependence on manual rules and dictionaries, and enhances the semantic proximity between sentence abbreviations and original sentences.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112257430B_ABST
    Figure CN112257430B_ABST
Patent Text Reader

Abstract

The present invention provides a sentence processing method, electronic device and storage medium combining RPA and AI. In this solution, the RPA system performs word segmentation processing on the sentence to be recognized based on natural language processing NLP to obtain a word segmentation result, and then encodes all the words in the word segmentation result to obtain a long sentence vector, thereby determining a target sentence vector based on the similarity between the long sentence vector and the short sentence vector, wherein the short sentence vector is obtained by encoding some words in the word segmentation result; and then, based on the target sentence vector, generates and outputs an abbreviation sentence of the sentence to be recognized. The technical solution provided by the embodiment of the present invention enables the RPA system to perform abbreviation processing on the sentence to be recognized, which is conducive to improving the accuracy of responses in human-computer interaction scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a statement processing method combining RPA and AI, an electronic device, and a computer-readable storage medium. Background Art

[0002] Robotic Process Automation (RPA) uses specific "robot software" to simulate human operations on computers and automatically execute process tasks according to rules.

[0003] Artificial Intelligence (AI) is a technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence.

[0004] Natural Language Processing (NLP) is a science that studies computer systems that can effectively implement natural language communication, especially the software systems therein. It is an important direction in the fields of computer science and artificial intelligence.

[0005] With the continuous development of computer technology, human-computer dialogue and intelligent question-answering technology have been widely developed. Smart terminals such as mobile phones and computers can receive questions input by users, process them, and output answers to the questions, thus realizing intelligent interaction between humans and computers.

[0006] In the prior art, generally, the question sentence input by the user is abbreviated by using rules, dictionaries, etc., and then a human-computer interaction model is output to obtain a response sentence.

[0007] However, the existing method of processing question sentences results in weak semantic correlation between the processed sentences, which may cause the processed sentences to be inconsistent with idiomatic expressions, and may also lead to low accuracy of semantic recognition, which in turn has an adverse impact on the accuracy of the response results. Summary of the invention

[0008] In response to the above problems, the present invention provides a sentence processing method combining RPA and AI, an electronic device, and a computer-readable storage medium, which are used to abbreviate sentences to be recognized, thereby improving the response accuracy in human-computer interaction scenarios.

[0009] In a first aspect, an embodiment of the present invention provides a statement processing method, comprising:

[0010] The RPA system performs word segmentation on the recognition sentence based on natural language processing (NLP) to obtain the word segmentation result;

[0011] The RPA system encodes all words in the word segmentation result to obtain a long sentence vector;

[0012] The RPA system determines a target sentence vector based on the similarity between the long sentence vector and the short sentence vector; wherein the short sentence vector is obtained by encoding some words in the word segmentation result;

[0013] The RPA system generates and outputs an abbreviated sentence of the sentence to be recognized based on the target sentence vector.

[0014] In a second aspect, an embodiment of the present invention provides an electronic device, including:

[0015] The word segmentation module is used to perform word segmentation processing on the recognition sentence based on natural language processing (NLP) to obtain the word segmentation result;

[0016] An encoding module, used for encoding all words in the word segmentation result to obtain a long sentence vector;

[0017] A determination module, configured to determine a target sentence vector based on the similarity between the long sentence vector and the short sentence vector; wherein the short sentence vector is obtained by encoding some words in the word segmentation result;

[0018] The output module is used to generate and output an abbreviated sentence of the sentence to be recognized based on the target sentence vector.

[0019] In a third aspect, an embodiment of the present invention provides an electronic device, including: at least one processor and a memory;

[0020] The memory stores computer-executable instructions;

[0021] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to the first aspect.

[0022] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the method described in the first aspect is implemented.

[0023] An embodiment of the present invention provides a sentence processing method combining RPA and AI, an electronic device, and a computer-readable storage medium. In this solution, the RPA system obtains multiple words in the sentence to be recognized by segmenting the sentence to be recognized, thereby generating and outputting an abbreviated sentence of the sentence to be recognized based on the similarity between the short sentence vector obtained after encoding some words and the long sentence vector obtained after encoding all words. In this way, there is no need to maintain manual rules and dictionaries. Instead, from the perspective of phrases, the semantic relevance of each phrase is considered to obtain the abbreviated sentence of the sentence to be recognized, thereby improving the semantic proximity between the abbreviated sentence and the sentence to be recognized. Then, when the sentence to be recognized is a sentence to be answered, this is also conducive to improving the answer accuracy in the human-computer interaction scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0025] Figure 1 A schematic diagram of a human-computer interaction scenario provided by an embodiment of the present invention;

[0026] Figure 2 A flowchart of a statement processing method combining RPA and AI provided in an embodiment of the present invention;

[0027] Figure 3 A flowchart of another statement processing method combining RPA and AI provided in an embodiment of the present invention;

[0028] Figure 4 Functional block diagram of an electronic device provided by an embodiment of the present invention

[0029] Figure 5 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of 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.

[0031] The sentence processing method provided in the embodiment of the present invention is applied to an electronic device. Specifically, the electronic device may be a terminal.

[0032] The terminal involved in the embodiment of the present invention may be a wireless terminal or a wired terminal. The wireless terminal may be a device that provides voice and / or other service data connectivity to a user, a handheld device with a wireless connection function, or other processing devices connected to a wireless modem. The wireless terminal may communicate with one or more core network devices via a radio access network (Radio Access Network, referred to as RAN). The wireless terminal may be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in or vehicle-mounted mobile device, which exchanges language and / or data with the radio access network. For another example, the wireless terminal may also be a personal communication service (PCS) phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA) and other devices. The wireless terminal may also be referred to as a system, a subscriber unit, a subscriber station, a mobile station, a mobile station, a remote station, a remote terminal, an access terminal, a user terminal, a user agent, a user device or user equipment, without limitation herein. Optionally, the terminal device may also be a smart watch, a tablet computer or other device.

[0033] The technical solution provided by the embodiment of the present invention can be adapted to human-computer interaction scenarios.

[0034] For example, please refer to Figure 1 , Figure 1 A schematic diagram of a human-computer answering scenario is shown. In an online consultation human-computer interaction scenario, the user can input the question to be asked through voice or text, such as Figure 1 As shown in A, the terminal can receive a question input by the user, which is specifically "Hello, Dr. Cui, what should I do if my baby has diarrhea?" In this scenario, the question needs to be answered, such as Figure 1 As shown in B, the terminal can output the response data of the question, and the response data can specifically be "Hello, if your child has diarrhea, it is recommended that you take oral antidiarrheal medicine for infants and young children under the guidance of a doctor and drink more hot water.".

[0035] It should be understood that the aforementioned human-computer interaction scenario of online consultation is one scenario applicable to the embodiment of the present invention. In addition, the embodiment of the present disclosure is also applicable to other human-computer interaction scenarios. For example, it can also be applied to human-computer interaction scenarios of product inquiries, human-computer interaction scenarios of after-sales services, etc. The embodiment of the present invention has no special restrictions on the interactive content in the human-computer interaction scenario.

[0036] Furthermore, the embodiment of the present invention has no special restrictions on the interaction mode of the human-computer interaction scenario. This solution can be applied to pure text human-computer interaction scenarios and can also be applied to voice interaction scenarios.

[0037] In the aforementioned human-computer interaction scenario, after receiving the question input by the user, the long sentence is generally abbreviated through rules, dictionaries, etc., and the abbreviated words are used as input of the human-computer response model to achieve human-computer response.

[0038] As mentioned above, existing long sentence abbreviation methods ignore the semantic relevance before and after the abbreviation, which may cause the processed sentence to be inconsistent with the idiomatic expression, and may also lead to a low accuracy rate of semantic recognition, which in turn has an adverse impact on the accuracy of the response results.

[0039] The technical solution provided by the present invention is intended to solve the above technical problems.

[0040] The following specific embodiments are used to describe in detail the technical solutions of the present invention and how the technical solutions of the present application solve the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0041] Embodiment 1

[0042] The embodiment of the present invention provides a statement processing method combining RPA and AI. Figure 2 , the method comprises the following steps:

[0043] S202, the RPA system performs word segmentation processing on the sentence to be recognized based on natural language processing (NLP) to obtain a word segmentation result.

[0044] In the embodiments of the present disclosure, the execution subject is an RPA (Robotic Process Automation) system, and the RPA system can be pre-installed on a workstation, server, computer, user terminal and other devices.

[0045] The sentence to be recognized may be a user question received in a human-computer interaction scenario. For example, Figure 1 In the online answering scenario shown, the user question "Hello, Dr. Cui, what should I do if my baby has diarrhea?" received by the terminal may be a sentence to be recognized in an embodiment of the present invention.

[0046] It should be noted that the embodiment of the present invention has no restrictions on the form of the sentence to be recognized, and the sentence to be recognized may be a text or a voice. In other words, the user may realize human-computer interaction through either voice or text.

[0047] Among them, in the voice interaction scenario, after the RPA system receives the interactive voice from the user, it can convert the interactive voice into text to obtain the sentence to be recognized in text format.

[0048] When executing this step, the RPA system can implement word segmentation processing based on natural language processing (NLP) by using any word segmentation method. For example, a third-party word segmentation tool can be used to implement it. At this time, the RPA system only needs to input the sentence to be recognized into the third-party word segmentation tool and obtain the output of the third-party word segmentation tool to obtain the word segmentation result.

[0049] The word segmentation result includes multiple words. Figure 1 Taking the scenario shown as an example, the sentence to be recognized is "Hello, Doctor Cui, what should I do if my baby has diarrhea?", and the word segmentation result can be obtained as follows: "Hello, Doctor Cui, what should I do if my baby has diarrhea?" Among them, "|" is used to distinguish different words, and the space between two "|" is a word.

[0050] S204: The RPA system encodes all words in the word segmentation result to obtain a long sentence vector.

[0051] This step is used to encode the phrase consisting of all words.

[0052] It should be noted that, in the embodiment of the present invention, the phrase includes multiple words. In the embodiment of the present disclosure, the order of the multiple words in the phrase is the same as the order of the multiple words in the sentence to be recognized.

[0053] by Figure 1Taking the scenario shown as an example, the phrase consisting of all words is "Hello, Doctor Cui, my baby has diarrhea, what should I do?" In this step, the phrase only needs to be encoded according to the preset encoding method to obtain the long sentence vector. The encoding method includes but is not limited to the smooth inverse frequency (SIF) algorithm, Word2Vec (Word To Vector) algorithm, etc., which are not limited here.

[0054] S206, the RPA system determines the target sentence vector based on the similarity between the long sentence vector and each short sentence vector; wherein the short sentence vector is obtained by encoding some words in the word segmentation result.

[0055] In the embodiment of the present invention, the similarity between sentence vectors can be characterized by at least one of parameters such as cosine similarity, edit distance, and Jaccard index.

[0056] It should be noted that, in the embodiment of the present invention, the target sentence vector may be a short sentence vector, or may be obtained by performing secondary processing on the short sentence vector, which will be described in detail later.

[0057] Now we briefly explain the short sentence vector.

[0058] The short sentence vector is obtained by encoding some words in the word segmentation result. In other words, the short sentence vector is obtained by encoding the phrase composed of some words in the word segmentation result. It should be understood that a phrase can contain multiple words, and any two phrases are different.

[0059] Among them, the phrase composed of some words can be obtained by deleting some words from all the words.

[0060] Also, in this step, any phrase in each phrase composed of partial words may also include multiple words, and the order of the multiple words in the phrase is the same as the order of the multiple words in the sentence to be recognized.

[0061] For example, Figure 1 Taking the shown scenario as an example, the phrases that can be obtained from the sentence to be recognized may include but are not limited to the following: "Hello, doctor, my baby has diarrhea, what should I do?", "My baby has diarrhea, what should I do?", "Baby has diarrhea, what should I do?", "Diarrhea, what should I do?", "Hello, Doctor Cui, my baby has diarrhea", "My baby has diarrhea", "Baby has diarrhea", etc., without exhaustive list.

[0062] Therefore, in the embodiment of the present invention, one word can be reduced in sequence from the beginning to the end of the words in the sentence to be recognized to obtain multiple phrases; and / or one word can be reduced in sequence from the end to the beginning of the words in the sentence to be recognized to obtain multiple phrases. In this way, each phrase actually retains the semantic relevance between the words.

[0063] S208: The RPA system generates and outputs an abbreviation of the sentence to be recognized based on the target sentence vector.

[0064] In other words, based on the phrase corresponding to the target sentence vector, the abbreviated sentence of the sentence to be recognized can be obtained. For example, if the phrase corresponding to the target sentence vector is: "baby|diarrhea", the abbreviated sentence generated and output is: "baby diarrhea".

[0065] In summary, according to the sentence processing method combining RPA and AI in an embodiment of the present invention, the RPA system obtains multiple words in the sentence to be recognized by segmenting the sentence to be recognized, and thus generates and outputs an abbreviated sentence of the sentence to be recognized based on the similarity between the short sentence vector obtained after encoding some words and the long sentence vector obtained after encoding all words. In this way, there is no need for manual rules and dictionary maintenance, but from the perspective of phrases, the semantic relevance of each phrase is considered to obtain the abbreviated sentence of the sentence to be recognized, which improves the semantic proximity between the abbreviated sentence and the sentence to be recognized, and improves the response accuracy in human-computer interaction scenarios.

[0066] Now Figure 2 Based on the illustrated embodiment, the specific implementation of the embodiment of the present invention is described.

[0067] The above steps have explained the method of each phrase. On this basis, when obtaining long sentence vectors and short sentence vectors, the smoothed inverse frequency (SIF) algorithm can be used to encode each phrase separately to obtain multiple sentence vectors.

[0068] Specifically, the SIF algorithm is used to encode all the words (or phrases consisting of all the words) in the word segmentation result to obtain the long sentence vector. The SIF algorithm is used to encode the phrase consisting of some words to obtain the short sentence vector corresponding to the phrase.

[0069] Among them, using the SIF algorithm to encode a phrase to obtain a sentence vector means using the weights obtained by the SIF algorithm to perform weighted averaging on each word in the phrase to obtain the sentence vector of the phrase. In the SIF algorithm, it is believed that the lower the frequency of the word in the sentence, the greater its importance, so its weight coefficient is greater.

[0070] Optionally, the SIF algorithm can be obtained in advance through pre-training. The training word vectors used for pre-training can be derived from training texts, and the fields of the training texts and the sentences to be processed can be the same, which is conducive to improving the accuracy of the SIF algorithm. Specifically, the Word2Vec algorithm can be used to process the training texts to obtain the training word vectors.

[0071] In this way, we only need to perform encoding processing according to the above method to obtain the long sentence vector and the short sentence vector.

[0072] The method of determining the target sentence vector is now explained.

[0073] In an exemplary embodiment, the RPA system can determine, from the short sentence vectors of multiple short sentences composed of some words among the multiple words included in the word segmentation results, a short sentence vector whose similarity with the long sentence vector is greater than a preset threshold and whose difference with the preset threshold is the smallest, as the target sentence vector.

[0074] Specifically, the RPA system can delete the M words in the word segmentation result one by one based on a first order, and determine the similarity between the short sentence vector of the remaining words that constitute the short sentence and the long sentence vector, until the short sentence vector and the long sentence vector meet a preset condition; then, based on a second order opposite to the first order, delete the words in the short sentence one by one until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference with the preset threshold is the smallest.

[0075] It should be noted that, in the embodiment of the present invention, the order of reducing words when determining the candidate sentence vector (ie, the first order in the foregoing text) is different from the order of reducing words when determining the target sentence vector (ie, the second order in the foregoing text).

[0076] It should be understood that, in the specific implementation of this scheme, if the first order is from front to back, the second order is from back to front; conversely, if the first order is from back to front, the second order is from front to back.

[0077] For easier understanding, please refer to Figure 3 An embodiment shown in FIG. Figure 3 In the illustrated embodiment, the first order is from front to back, and the second order is from back to front. Figure 3 As shown, S206 may include the following steps:

[0078] S2062, the RPA system obtains a short sentence vector consisting of the last N words in the M words in the word segmentation result, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the last K-1 words and the long sentence vector is less than a preset first threshold, and obtains a candidate short sentence vector consisting of the last K words in the M words; wherein the value of N is M-1, M-2, ... 1, and the value of Q is 1 to P.

[0079] by Figure 1 The following scenario is used as an example for explanation.

[0080] The word segmentation result corresponding to the sentence to be recognized is "Hello, Doctor Cui, what should I do if my baby has diarrhea?".

[0081] Then, the RPA system reduces one word in the order from front to back, and the phrase 1 can be obtained as: "Doctor|Hello|,|My|Baby|Has Diarrhea|What Should I Do|?", and the phrase 1 is encoded to obtain the short sentence vector 1. Then, the cosine similarity between the short sentence vector 1 and the long sentence vector is calculated to be 0.9877. At this time, it is assumed that the first threshold is 0.8. Therefore, the cosine similarity corresponding to the short sentence vector 1 (the cosine similarity between the short sentence vector 1 and the long sentence vector) is greater than the first threshold, and the words are continued to be reduced in the order from front to back.

[0082] Based on phrase 1, the RPA system continues to reduce words in order from front to back, and obtains phrase 2, which is: "Hello|,|My|Baby|Diarrhea|What to do|?", and encodes phrase 2 to obtain short sentence vector 2. Then, the cosine similarity between short sentence vector 2 and long sentence vector is calculated to be 0.8942. At this time, the cosine similarity between short sentence vector 2 and long sentence vector is greater than the first threshold, and the words are continued to be reduced in order from front to back.

[0083] Based on phrase 2, the RPA system continues to reduce words in order from front to back, and obtains phrase 3, which is: "My family|baby|diarrhea|what to do|?", and encodes phrase 3 to obtain short sentence vector 3. Then, the cosine similarity between short sentence vector 3 and long sentence vector is calculated to be 0.8544. At this time, the cosine similarity between short sentence vector 3 and long sentence vector is greater than the first threshold, and the words are continued to be reduced in order from front to back.

[0084] Based on phrase 3, the RPA system continues to reduce words in order from front to back, and obtains phrase 4, which is: "Baby|diarrhea|what to do|?", and encodes phrase 4 to obtain short sentence vector 4. Then, the cosine similarity between short sentence vector 4 and the long sentence vector is calculated to be 0.8069. At this time, the cosine similarity between short sentence vector 4 and the long sentence vector is greater than the first threshold, and the words are continued to be reduced in order from front to back.

[0085] Based on phrase 4, the RPA system continues to reduce words in order from front to back, and obtains phrase 5, which is: "Diarrhea|What to do|?", and encodes phrase 5 to obtain short sentence vector 5. Then, the cosine similarity between short sentence vector 5 and the long sentence vector is calculated to be 0.7453. At this time, the cosine similarity between short sentence vector 5 and the long sentence vector is less than the first threshold.

[0086] Then, it can be determined that the cosine similarity between the short sentence vector 4 and the long sentence vector is just greater than the first threshold, and thus the short sentence vector 4 is determined as the candidate sentence vector.

[0087] S2064, the RPA system obtains the short sentence vector consisting of the first P words in the K words in the candidate short sentence vector, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the first Q-1 words and the long sentence vector is less than the preset second threshold, and the target short sentence vector is composed of the first Q words in the K words; wherein the value of P is K-1, K-2, ... 1, and the value of K is 1 to N.

[0088] The second threshold value may be the same as or different from the first threshold value, and can be customized as needed in actual scenarios. Figure 1 In the scenario shown, the second threshold may also be 0.8.

[0089] In this step, the RPA system actually starts from the other side of the candidate sentence vector to determine whether there are words with less influence on the semantics, thereby examining the semantic relevance of the words on the other side.

[0090] Still based on S2082 Figure 1 The example of the scenario shown continues.

[0091] The candidate sentence vector determined in S2082 is short sentence vector 4, that is, "Baby|diarrhea|what to do|?". On this basis, the RPA system reduces words in order from back to front, and obtains phrase 6, which is: "Baby|diarrhea", and encodes phrase 6 to obtain short sentence vector 6. Then, the cosine similarity between short sentence vector 6 and long sentence vector is calculated to be 0.8202. At this time, assuming that the second threshold is also 0.8, the cosine similarity between short sentence vector 6 and long sentence vector is greater than the second threshold, and then continue to reduce words in order from back to front.

[0092] Based on phrase 6, the RPA system continues to reduce words in order from back to front, and obtains phrase 7, which is: "Baby", and encodes phrase 7 to obtain short sentence vector 7. Then, the cosine similarity between short sentence vector 7 and long sentence vector is calculated to be 0.7511. At this time, the cosine similarity between short sentence vector 7 and long sentence vector is less than the second threshold.

[0093] Then, it can be determined that the cosine similarity between the short sentence vector 6 and the long sentence vector is just greater than the second threshold, and thus the short sentence vector 6 is determined as the target sentence vector.

[0094] Therefore, based on Figure 3 According to the method shown, the RPA system can generate and output "baby has diarrhea" as an abbreviation of the sentence to be recognized "Hello, Dr. Cui, what should I do if my baby has diarrhea?"

[0095] In addition, the embodiment of the present invention also provides another embodiment of S206. Figure 3 In the embodiment shown, the first order is from back to front, and the second order is from front to back. Specifically, in this embodiment, S206 may include the following steps:

[0096] S2066, the RPA system obtains, for the M words in the word segmentation result, a short sentence vector consisting of the first N words in the M words, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the first K-1 words and the long sentence vector is less than a preset third threshold, thereby obtaining a candidate short sentence vector consisting of the first K words in the M words; wherein the value of N is M-1, M-2, ... 1, and the value of K is 1 to N;

[0097] S2068, the RPA system obtains the short sentence vector consisting of the last P words in the K words in the candidate short sentence vector, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the last Q-1 words and the long sentence vector is less than the preset fourth threshold, and the target short sentence vector is composed of the last Q words in the K words; wherein the value of P is K-1, K-2, ... 1, and the value of Q is 1 to P.

[0098] In this embodiment, the third threshold value and the fourth threshold value may be the same or different, and the embodiment of the present invention has no particular limitation on this. In addition, the third threshold value and the first threshold value may be the same or different, and the second threshold value and the fourth threshold value may be the same or different, which will not be described in detail.

[0099] It should be noted that the specific implementation process and principle of steps S2066-S2068 may refer to the relevant contents of steps S2062-S2064 in the above embodiment, which will not be repeated here.

[0100] In addition to the foregoing embodiments, the embodiments of the present invention also provide another method for determining a target sentence vector.

[0101] In a possible embodiment, the RPA system can obtain multiple short sentence vectors based on the word segmentation results; wherein any two short sentence vectors correspond to different phrases; then, the similarity between the long sentence vector and each short sentence vector is calculated, and thus, based on the similarity, a target sentence vector is determined among the multiple short sentence vectors; wherein the target sentence vector is greater than a preset fifth threshold and the difference with the fifth threshold is the smallest.

[0102] In the embodiment of the present disclosure, the fifth threshold may be preset as needed, for example, the fifth threshold may be 0.8.

[0103] In one implementation of this embodiment, the RPA system can obtain various phrases of the sentence to be recognized in the aforementioned phrase manner, and then obtain various possible short sentence vectors, and then, based on the cosine similarity corresponding to each short sentence vector, determine the target sentence vector that meets the aforementioned conditions in the short sentence vector.

[0104] It should be understood that the target sentence vector can be obtained by comparing the cosine similarity corresponding to each short sentence vector with the fifth threshold.

[0105] Still Figure 1Take the scenario shown as an example. At this time, the phrase corresponding to the long sentence vector is "Hello, Doctor Cui, what should I do if my baby has diarrhea?"; and assuming that the phrase corresponding to the short sentence vector 1 is "Hello, Doctor, what should I do if my baby has diarrhea?", the phrase corresponding to the short sentence vector 2 is "What should I do if my baby has diarrhea?", and the phrase corresponding to the short sentence vector 3 is "What should I do if I have diarrhea?". Among them, the cosine similarity corresponding to the short sentence vector 1 (the cosine similarity between the short sentence vector 1 and the long sentence vector) is 0.9877, the cosine similarity corresponding to the short sentence vector 2 is 0.8069, and the cosine similarity corresponding to the short sentence vector 3 is 0.7453, and the fifth threshold at this time is assumed to be 0.8. Then, by comparison, it can be seen that the cosine similarity corresponding to the short sentence vector 2 is greater than the fifth threshold and is closest to the fifth threshold, so the short sentence vector 2 can be determined as the target sentence vector.

[0106] In summary, in the above-mentioned scheme provided by the embodiment of the present invention, the RPA system determines, from the short sentence vectors of multiple short sentences composed of some words in the multiple words included in the word segmentation results, a short sentence vector whose similarity with the long sentence vector is greater than a preset threshold and whose difference with the preset threshold is the smallest, as the target sentence vector, starting from the perspective of phrases and considering the semantic relevance of each phrase to obtain the abbreviated sentence of the sentence to be recognized, thereby improving the semantic proximity between the abbreviated sentence and the sentence to be recognized, and improving the response accuracy in the human-computer interaction scenario.

[0107] On the basis of the above-mentioned embodiment, after the abbreviation of the sentence to be recognized is obtained, more accurate human-computer interaction can be achieved based on the abbreviation.

[0108] For example, in Figure 1 In the human-computer interaction scenario of the online medical consultation shown, the user question received (sentence to be recognized) is "Hello, Dr. Cui, what should I do if my baby has diarrhea?". Through this solution, it is determined that the abbreviated sentence of the user's question is "baby has diarrhea". Therefore, the response sentence of the question can be obtained based on "baby has diarrhea".

[0109] Specifically, "baby has diarrhea" (or after extracting features from it, input the features) can be input into the human-machine response model, and the output of the human-machine response model can be obtained, and the output data can be used as the response statement to the user's question, and the response statement can be output, such as Figure 1 As shown in B.

[0110] Alternatively, you can also use the preset knowledge graph and use "baby diarrhea" as the index for question-answer search, search in the knowledge graph, and output the search results as response statements, such as Figure 1 As shown in B.

[0111] In addition to participating in human-computer interaction, the intent of the sentence to be recognized can also be recognized based on the abbreviation of the sentence to be recognized. I will not go into details about this, and the design can be customized in actual scenarios.

[0112] It is to be understood that some or all of the steps or operations in the above embodiments are merely examples, and the present application embodiments may also perform other operations or variations of various operations. In addition, the various steps may be performed in different orders presented in the above embodiments, and it is possible that not all of the operations in the above embodiments need to be performed.

[0113] When used in this application, although the terms "first", "second", etc. may be used in this application to describe various thresholds, etc., these thresholds should not be limited by these terms. These terms are only used to distinguish one threshold from another. For example, without changing the meaning of the description, a first threshold can be called a second threshold, and similarly, a second threshold can be called a first threshold, as long as all occurrences of "first threshold" are renamed consistently and all occurrences of "second threshold" are renamed consistently. The first threshold and the second threshold are both thresholds, but they may not be the same threshold.

[0114] The words used in this application are only used to describe the embodiments and are not used to limit the claims. As used in the description of the embodiments and claims, unless the context clearly indicates, the singular forms "a", "an" and "the" are intended to include the plural forms as well. Similarly, the term "and / or" as used in this application refers to any and all possible combinations of one or more associated listings. In addition, when used in this application, the term "comprise" and its variants "comprises" and / or including (comprising) refer to the existence of stated features, wholes, steps, operations, elements, and / or components, but do not exclude the existence or addition of one or more other features, wholes, steps, operations, elements, components and / or these groups.

[0115] Embodiment 2

[0116] Based on the statement processing method provided in the first embodiment above, the embodiment of the present invention further provides an apparatus embodiment for implementing each step and method in the above method embodiment.

[0117] An embodiment of the present invention provides an electronic device, please refer to Figure 4 , the electronic device 400 comprises:

[0118] A word segmentation module 42, used for performing word segmentation processing on the sentence to be recognized based on natural language processing (NLP) to obtain a word segmentation result;

[0119] The encoding module 44 is used to encode all the words in the word segmentation result to obtain a long sentence vector;

[0120] A determination module 46 is used to determine a target sentence vector based on the similarity between the long sentence vector and the short sentence vector; wherein the short sentence vector is obtained by encoding some words in the word segmentation result;

[0121] The output module 48 is used to generate and output an abbreviated sentence of the sentence to be recognized based on the target sentence vector.

[0122] In a specific embodiment, the determination module 46 is specifically configured to:

[0123] Among the short sentence vectors of multiple short sentences composed of some words among the multiple words included in the word segmentation result, a short sentence vector whose similarity with the long sentence vector is greater than a preset threshold and whose difference with the preset threshold is the smallest is determined as the target sentence vector.

[0124] In another specific embodiment, the determination module 46 is specifically configured to:

[0125] For the M words in the word segmentation result, words are deleted one by one based on the first order, and the similarity between the short sentence vector of the remaining words constituting the short sentence and the long sentence vector is determined until the short sentence vector and the long sentence vector meet a preset condition;

[0126] Based on a second order opposite to the first order, words in the short sentence are deleted one by one until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference between the short sentence vector and the long sentence vector is the smallest.

[0127] In another specific embodiment, the determination module 46 is specifically configured to:

[0128] For the M words in the word segmentation result, obtain a short sentence vector composed of the last N words in the M words, and calculate the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector composed of the last K-1 words and the long sentence vector is less than a preset first threshold, and obtain a candidate short sentence vector composed of the last K words in the M words; wherein the value of N is M-1, M-2, ... 1, and the value of Q is 1 to P;

[0129] For the K words in the candidate short sentence vector, obtain the short sentence vector composed of the first P words in the K words, and calculate the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector composed of the first Q-1 words and the long sentence vector is less than the preset second threshold, and the target short sentence vector is composed of the first Q words in the K words; wherein the value of P is K-1, K-2, ... 1, and the value of K is 1 to N.

[0130] In another specific embodiment, the determination module 46 is specifically configured to:

[0131] For the M words in the word segmentation result, a short sentence vector consisting of the first N words in the M words is obtained, and the similarity between the short sentence vector and the long sentence vector is calculated, until the similarity between the short sentence vector consisting of the first K-1 words and the long sentence vector is less than a preset third threshold, and a candidate short sentence vector consisting of the first K words in the M words is obtained; wherein the value of N is M-1, M-2, ... 1, and the value of K is 1 to N;

[0132] For the K words in the candidate short sentence vector, obtain the short sentence vector composed of the last P words in the K words, and calculate the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector composed of the last Q-1 words and the long sentence vector is less than the preset fourth threshold, and the target short sentence vector is composed of the last Q words in the K words; wherein the value of P is K-1, K-2, ... 1, and the value of Q is 1 to P.

[0133] In another specific embodiment, the determination module 46 is specifically configured to:

[0134] Based on the word segmentation results, multiple short sentence vectors are obtained; wherein any two short sentence vectors correspond to different phrases;

[0135] Calculate the similarity between the long sentence vector and each short sentence vector;

[0136] According to the similarity, a target sentence vector is determined from the multiple short sentence vectors; wherein the target sentence vector is greater than a preset fifth threshold and has a minimum difference with the fifth threshold.

[0137] In another specific embodiment, the short sentence vector is obtained by encoding a phrase consisting of multiple words, wherein the order of the words in the phrase is the same as the order of the words in the sentence to be recognized.

[0138] In another specific embodiment, the similarity between the long sentence vector and the short sentence vector is cosine similarity.

[0139] In another specific embodiment, the encoding module 44 is specifically configured to:

[0140] The smoothed inverse frequency (SIF) algorithm is used to encode all the words in the word segmentation results to obtain the long sentence vector.

[0141] Figure 4 The electronic device 400 of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effects can be further referred to the relevant description in the method embodiment. As mentioned above, the electronic device 400 can be a terminal.

[0142] It should be understood that the above Figure 4 The division of the modules of the electronic device 400 shown is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software calling through processing elements, and some modules can be implemented in the form of hardware. For example, the determination module 46 can be a separately established processing element, or it can be integrated in the electronic device 400, such as a chip of the electronic device. In addition, it can also be stored in the memory of the electronic device 400 in the form of a program, and called and executed by a processing element of the electronic device 400. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0143] For example, the above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more microprocessors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module above is implemented in the form of a processing element scheduler, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0144] Furthermore, an embodiment of the present invention provides an electronic device, please refer to Figure 5 , the electronic device 400 comprises:

[0145] Memory 410;

[0146] Processor 420; and

[0147] Computer programs;

[0148] The computer program is stored in the memory 410 and is configured to be executed by the processor 420 to implement the method of the above embodiment.

[0149] The number of processors 420 in the electronic device 400 may be one or more, and the processor 420 may also be referred to as a processing unit, which may implement certain control functions. The processor 420 may be a general-purpose processor or a dedicated processor, etc. In an optional design, the processor 420 may also store instructions, which may be executed by the processor 420, so that the electronic device 400 executes the method described in the above method embodiment.

[0150] In yet another possible design, the electronic device 400 may include a circuit, and the circuit may implement the functions of sending, receiving, or communicating in the aforementioned method embodiments.

[0151] Optionally, the number of memories 410 in the electronic device 400 may be one or more, and the memory 410 may store instructions or intermediate data, and the instructions may be executed on the processor 420, so that the electronic device 400 performs the method described in the above method embodiment. Optionally, other relevant data may also be stored in the memory 410. Optionally, instructions and / or data may also be stored in the processor 420. The processor 420 and the memory 410 may be provided separately or integrated together.

[0152] In addition, if Figure 5 As shown, a transceiver 430 is also provided in the electronic device 400, wherein the transceiver 430 can be called a transceiver unit, a transceiver, a transceiver circuit, or a transceiver, etc., and is used for data transmission or communication with a test device or other terminal device, which will not be repeated here.

[0153] like Figure 5 As shown, the memory 410, the processor 420 and the transceiver 430 are connected and communicated via a bus.

[0154] If the electronic device 400 is used to implement the corresponding Figure 2 When the method is used, for example, the transceiver 430 may receive a sentence to be recognized from the user. The processor 420 is used to complete the corresponding determination or control operation, and optionally, the corresponding instructions may be stored in the memory 410. The specific processing method of each component can refer to the relevant description of the above embodiment.

[0155] In addition, an embodiment of the present invention provides a readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the method of the first embodiment.

[0156] Since each module in this embodiment can execute the method shown in the first embodiment, for the parts not described in detail in this embodiment, reference may be made to the relevant description of the first embodiment.

[0157] The above description is only a preferred embodiment of the present invention and an explanation of the technical principles used. Those skilled in the art should understand that the disclosure scope involved in the present invention is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present invention (but not limited to) by each other.

[0158] In addition, although each operation is described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present invention. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0159] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A statement processing method combining RPA and AI, characterized in that: include: The RPA system performs word segmentation on the recognition sentence based on natural language processing (NLP) to obtain the word segmentation result; The RPA system encodes all words in the word segmentation result to obtain a long sentence vector; The RPA system deletes the M words in the word segmentation result one by one based on the first order, and determines the similarity between the short sentence vector of the short sentence composed of the remaining words and the long sentence vector, until the short sentence vector and the long sentence vector meet a preset condition; The RPA system deletes the words in the short sentence one by one based on a second order opposite to the first order until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference with the preset threshold is the smallest, and uses the short sentence vector as the target sentence vector; wherein the short sentence vector is obtained by encoding some words in the word segmentation result; The RPA system generates and outputs an abbreviated sentence of the sentence to be recognized based on the target sentence vector; The RPA system deletes the M words in the word segmentation result one by one based on the first order, and determines the similarity between the short sentence vector of the short sentence composed of the remaining words and the long sentence vector, until the short sentence vector and the long sentence vector meet the preset conditions, including: The RPA system obtains, for the M words in the word segmentation result, a short sentence vector consisting of the last N words in the M words, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the last K-1 words and the long sentence vector is less than a preset first threshold, thereby obtaining a candidate short sentence vector consisting of the last K words in the M words; wherein the value of N is M-1, M-2, ... 1, and the value of Q is 1 to P; The RPA system deletes the words in the short sentence one by one based on a second order opposite to the first order until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference between the short sentence vector and the long sentence vector is the smallest, including: The RPA system obtains, for the K words in the candidate short sentence vector, a short sentence vector consisting of the first P words among the K words, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the first Q-1 words and the long sentence vector is less than a preset second threshold, and a target short sentence vector consisting of the first Q words among the K words; wherein the value of P is K-1, K-2, ... 1, and the value of K is 1 to N.

2. The method according to claim 1, characterized in that The RPA system deletes the M words in the word segmentation result one by one based on the first order, and determines the similarity between the short sentence vector of the short sentence composed of the remaining words and the long sentence vector until the short sentence vector and the long sentence vector meet a preset condition, and further includes: The RPA system obtains, for the M words in the word segmentation result, a short sentence vector consisting of the first N words in the M words, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the first K-1 words and the long sentence vector is less than a preset third threshold, thereby obtaining a candidate short sentence vector consisting of the first K words in the M words; wherein the value of N is M-1, M-2, ... 1, and the value of K is 1 to N; The RPA system deletes words in the short sentence one by one based on a second order opposite to the first order until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference between the short sentence vector and the long sentence vector is the smallest, further comprising: The RPA system obtains, for the K words in the candidate short sentence vector, a short sentence vector consisting of the last P words of the K words, and calculates the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector consisting of the last Q-1 words and the long sentence vector is less than a preset fourth threshold, and a target short sentence vector consisting of the last Q words of the K words is obtained; wherein the value of P is K-1, K-2, ... 1, and the value of Q is 1 to P.

3. The method according to any one of claims 1 to 2, characterized in that: The short sentence vector is obtained by encoding a phrase consisting of multiple words, wherein the order of the words in the phrase is the same as the order of the words in the sentence to be recognized.

4. An electronic device, characterized in that: include: The word segmentation module is used to perform word segmentation processing on the recognition sentence based on natural language processing (NLP) to obtain the word segmentation result; An encoding module, used for encoding all words in the word segmentation result to obtain a long sentence vector; A determination module, configured to delete words one by one based on a first order for the M words in the word segmentation result, determine the similarity between the short sentence vector of the short sentence composed of the remaining words and the long sentence vector, until the short sentence vector and the long sentence vector meet a preset condition; based on a second order opposite to the first order, delete the words in the short sentence one by one, until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference with the preset threshold is the smallest, and use the short sentence vector as the target sentence vector; wherein the short sentence vector is obtained by encoding some words in the word segmentation result; An output module, used to generate and output an abbreviated sentence of the sentence to be recognized based on the target sentence vector; Among them, the deleting words one by one based on the first order for the M words in the word segmentation result, and determining the similarity between the short sentence vector of the remaining words constituting the short sentence and the long sentence vector, until the short sentence vector and the long sentence vector meet the preset condition, includes: For the M words in the word segmentation result, a short sentence vector consisting of the last N words in the M words is obtained, and the similarity between the short sentence vector and the long sentence vector is calculated, until the similarity between the short sentence vector consisting of the last K-1 words and the long sentence vector is less than a preset first threshold, and a candidate short sentence vector consisting of the last K words in the M words is obtained; wherein the value of N is M-1, M-2, ... 1, and the value of Q is 1 to P; Based on a second order opposite to the first order, words in the short sentence are deleted one by one until it is determined that the similarity between the short sentence vector and the long sentence vector is greater than a preset threshold and the difference between the short sentence vector and the long sentence vector is the smallest, including: For the K words in the candidate short sentence vector, obtain the short sentence vector composed of the first P words in the K words, and calculate the similarity between the short sentence vector and the long sentence vector, until the similarity between the short sentence vector composed of the first Q-1 words and the long sentence vector is less than a preset second threshold, and the target short sentence vector is composed of the first Q words in the K words; wherein the value of P is K-1, K-2, ... 1, and the value of K is 1 to N.

5. An electronic device, characterized in that: include: at least one processor and memory; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the processor executes the computer-executable instructions, the method according to any one of claims 1 to 3 is implemented.