Method, device, equipment and storage medium for semantic completion in multi-round dialogue
By performing grammatical detection and semantic completion of the statements entered by users in multiple rounds of conversations, the problem of low recognition and feedback accuracy of intelligent dialogue robots in the case of semantic incompleteness is solved, and the accuracy of semantic analysis and response information search is improved.
Patent Information
- Application Number
- CN202010088078.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-12
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-02-12
AI Technical Summary
In multiple rounds of conversations, the intelligent dialogue robot cannot accurately identify the user's intentions due to incomplete semantics of the statements entered by the user, resulting in low feedback accuracy.
By using the preset corpus sentence breaking function and the preset analysis function, multiple rounds of dialogues entered by the user are syntax detected, and sentences with incomplete semantics are supplemented according to the semantics of the context of the multi-round dialogue, including filling in the missing parts of the semantics and replacing fingers Unknown words.
The accuracy of semantic analysis results is improved and the accuracy of searching for response information based on semantic analysis results is enhanced.
Smart Images

Figure CN111325034B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to a method, device, equipment and storage medium for semantic completion in multi-round dialogues. Background Art
[0002] Human-computer interaction (HCI) is a discipline that studies the interactive relationship between systems and users. Systems can be various machines or computerized systems and software. Usually, users communicate with the system through a visible human-computer interaction interface and perform operations to achieve information exchange between users and the system to complete a certain task. Human-computer interaction is an important part of the field of artificial intelligence, especially in customer service or consultation acquisition, where users can obtain the information they need through human-computer interaction.
[0003] In terms of customer service, we currently communicate with users through intelligent conversational robots, and use the feedback data from intelligent conversational robots to meet users' needs for information.
[0004] However, since the semantics of the user's requests obtained by the intelligent dialogue robot are unclear, such as the user's input requirements lack a subject or object, the intelligent dialogue robot cannot accurately identify the user's intention and cannot accurately feedback the response information based on the user's intention, resulting in low accuracy of the intelligent dialogue robot's feedback. Summary of the invention
[0005] The present invention provides a method, device, equipment and storage medium for completing semantics in a multi-round dialogue, which is used to solve the problem of incomplete sentence semantics in a multi-round dialogue, improves the accuracy of semantic analysis results, and also improves the accuracy of searching for corresponding response information based on the semantic analysis results.
[0006] A method for semantic completion in a multi-round dialogue is provided for the first aspect of an embodiment of the present invention, comprising: using a preset corpus segmentation function and a preset analysis function to perform grammar detection on a first sentence input by a user, and obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first sentence; using the preset corpus segmentation function and the preset analysis function to perform grammar detection on a second sentence input by a user in a new round, and obtain a second sentence detection result, wherein the second sentence detection result is a target dependency relationship between each word in the second sentence; judging whether the second sentence detection result includes only a single entity and the second sentence is a question sentence; when the second sentence detection result includes only a single entity and the second sentence is a question sentence, completing the semantic missing part of the second sentence according to the first sentence detection result to obtain a first completed sentence; judging whether the first completed sentence includes words with unclear reference, wherein the words with unclear reference include pronouns, quantifiers and articles; if the first completed sentence includes words with unclear reference, replacing the words with unclear reference in the first completed sentence according to the first sentence detection result to obtain a second completed sentence.
[0007] Optionally, in a first implementation method of the first aspect of the embodiment of the present invention, a first sentence input by a user is obtained; the first sentence is segmented using a preset corpus segmentation function to obtain a first input sentence; and a grammar check is performed on the first input sentence using a preset analysis function to obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first input sentence.
[0008] Optionally, in a second implementation method of the first aspect of the embodiment of the present invention, the first sentence is segmented to obtain segmented sentences; the segmented corpus in the segmented sentence is matched with a preset corpus, and the preset corpus is a corpus established in a preset intention rule library based on business data; if the segmented corpus matches the preset corpus, the segmented sentence is segmented at the front and back positions of the segmented corpus to obtain segmented sentences, and the segmented sentences are used as the first input sentence; if the segmented corpus does not match the preset corpus, the segmented corpus is directly used as the first input sentence.
[0009] Optionally, in a third implementation method of the first aspect of the embodiment of the present invention, part-of-speech tagging and entity extraction are performed on the words in the first input sentence to obtain a first sentence tagging result; the dependency probability between each of the words is calculated, the words are the words in the first sentence tagging result, and the dependency probability is the frequency of occurrence of a preset dependency relationship; the target dependency relationship between each of the words is determined, and the preset dependency relationship corresponding to the probability with the largest dependency probability weight is the target dependency relationship between the words; and the first sentence detection result is obtained, and the first sentence detection result is the target dependency relationship between each of the words in the first input sentence.
[0010] Optionally, in a fourth implementation method of the first aspect of the embodiment of the present invention, when the second sentence detection result only includes a single entity and the second sentence is a question sentence, the single entity in the second sentence detection result is extracted, and the single entity is used as the first target word; the single entity with the same grammatical structure as the first target word is screened in the first sentence detection result to obtain the second target word; in the first sentence, the second target word is replaced with the first target word to obtain a first completion sentence.
[0011] Optionally, in a fifth implementation of the first aspect of the embodiment of the present invention, a detection result of a first completion sentence is obtained, where the detection result of the first completion sentence is a combination of the detection result of the second sentence and the detection result of the first sentence; and it is determined whether the detection result of the first completion sentence includes pronouns, quantifiers, and articles.
[0012] Optionally, in a sixth implementation method of the first aspect of the embodiment of the present invention, if the detection result of the first completion sentence includes words with unknown reference, the words with unknown reference are extracted and used as third target words; words with the same grammatical structure as the third target words are screened in the detection result of the first sentence to obtain fourth target words; and in the second sentence, the third target words are replaced with the fourth target words to obtain a second completion sentence.
[0013] A second aspect of an embodiment of the present invention provides a device for semantic completion in a multi-round dialogue, comprising: a first acquisition unit, used to use a preset corpus segmentation function and a preset analysis function to perform a grammar check on a first sentence input by a user, and obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first sentence; a second acquisition unit, used to use the preset corpus segmentation function and the preset analysis function to perform a grammar check on a second sentence input by a user in a new round, and obtain a second sentence detection result, wherein the second sentence detection result is a target dependency relationship between each word in the second sentence; a first judgment unit, used to judge the The detection result of the second sentence includes only a single entity and the second sentence is an interrogative sentence; the first completion unit is used to complete the semantic missing part of the second sentence according to the detection result of the first sentence when the detection result of the second sentence includes only a single entity and the second sentence is an interrogative sentence, so as to obtain a first completed sentence; the second judgment unit is used to determine whether the first completed sentence includes words with unclear reference, and the words with unclear reference include pronouns, quantifiers and articles; the second completion unit is used to replace the words with unclear reference in the first completed sentence according to the detection result of the first sentence if the first completed sentence includes words with unclear reference, so as to obtain a second completed sentence.
[0014] Optionally, in a first implementation method of the second aspect of the embodiment of the present invention, the first acquisition unit includes: an acquisition module, used to acquire a first sentence input by a user; a segmentation module, used to perform sentence segmentation on the first sentence using a preset corpus segmentation function to obtain a first input sentence; and a detection module, used to perform grammar detection on the first input sentence using a preset analysis function to obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first input sentence.
[0015] Optionally, in a second implementation method of the second aspect of the embodiment of the present invention, the segmentation module is specifically used to: segment the first sentence to obtain segmented sentences; match the segmented corpus in the segmented sentence with a preset corpus, which is a corpus established in a preset intention rule library based on business data; if the segmented corpus matches the preset corpus, segment the segmented sentence at the front and back positions of the segmented corpus to obtain segmented sentences, and use the segmented sentences as the first input sentence; if the segmented corpus does not match the preset corpus, directly use the segmented corpus as the first input sentence.
[0016] Optionally, in a third implementation manner of the second aspect of the embodiment of the present invention, the detection module is specifically used to: perform part-of-speech tagging and entity extraction on the words in the first input sentence to obtain a first sentence tagging result; calculate the dependency probability between each of the words, the words are the words in the first sentence tagging result, and the dependency probability is the frequency of occurrence of a preset dependency relationship; determine the target dependency relationship between each of the words, and the preset dependency relationship corresponding to the probability with the largest dependency probability weight is the target dependency relationship between the words; obtain the first sentence detection result, and the first sentence detection result is the target dependency relationship between each of the words in the first input sentence.
[0017] Optionally, in a fourth implementation method of the second aspect of the embodiment of the present invention, the first completion unit is specifically used to: when the second sentence detection result only includes a single entity and the second sentence is a question sentence, extract the single entity in the second sentence detection result, and use the single entity as the first target word; screen the single entity with the same grammatical structure as the first target word in the first sentence detection result to obtain the second target word; in the first sentence, replace the second target word with the first target word to obtain a first completion sentence.
[0018] Optionally, in a fifth implementation manner of the second aspect of the embodiment of the present invention, the second judgment unit is specifically used to: obtain the detection result of the first completion sentence, the detection result of the first completion sentence is a combination of the detection result of the second sentence and the detection result of the first sentence; and determine whether the detection result of the first completion sentence contains pronouns, quantifiers, and articles.
[0019] Optionally, in a sixth implementation manner of the second aspect of the embodiment of the present invention, the second completion unit is specifically used to: if the detection result of the first completion sentence includes words with unknown reference, extract the words with unknown reference and use the words with unknown reference as third target words; select words with the same grammatical structure as the third target words in the detection result of the first sentence to obtain fourth target words; and in the second sentence, replace the third target words with the fourth target words to obtain a second completion sentence.
[0020] A third aspect of an embodiment of the present invention provides a device for semantic completion in a multi-round conversation, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for semantic completion in a multi-round conversation based on any one of the above-mentioned embodiments is implemented.
[0021] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method described in the first aspect above.
[0022] It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:
[0023] The embodiment of the present invention improves the accuracy of semantic analysis results by using preset corpus segmentation functions and preset analysis functions to perform grammar detection on multiple rounds of dialogues input by users, and uses the semantics of the context of multiple rounds of dialogues to complete semantically incomplete sentences, thereby improving the accuracy of semantic analysis results, and also improving the accuracy of searching for corresponding response information based on the semantic analysis results. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A schematic diagram of an embodiment of a method for semantic completion in a multi-round conversation of the present invention;
[0025] Figure 2 A schematic diagram of another embodiment of the method for semantic completion in a multi-round conversation of the present invention;
[0026] Figure 3 A schematic diagram of an embodiment of a device for completing semantics in a multi-round conversation of the present invention;
[0027] Figure 4 It is a schematic diagram of another embodiment of the apparatus for completing semantics in a multi-round conversation of the present invention;
[0028] Figure 5 A schematic diagram of an embodiment of a device for completing semantics in a multi-round conversation of the present invention. DETAILED DESCRIPTION
[0029] The present invention provides a method for semantic completion in a multi-round dialogue, which is used to solve the problem of incomplete sentence semantics in a multi-round dialogue, improves the accuracy of semantic analysis results, and also improves the accuracy of searching for corresponding response information based on the semantic analysis results.
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme 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 only 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 should fall within the scope of protection of the present invention.
[0031] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] See also Figure 1 In one embodiment of the present invention, a method for semantic completion in a multi-round conversation includes:
[0033] 101. Perform grammar detection on the first sentence input by the user obtained by using a preset corpus segmentation function and a preset analysis function to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first sentence.
[0034] The server uses a preset corpus segmentation function and a preset analysis function to perform grammar detection on the first sentence input by the acquired user to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first sentence.
[0035] It should be noted that the server uses the preset corpus segmentation function to segment the first sentence, and uses the preset analysis function to perform grammar detection on the first input sentence, both of which are preparations for completing the semantics of the second sentence. The server uses the preset corpus segmentation function to perform preliminary segmentation on the first sentence. Segmentation is the basis of natural language processing. The accuracy of segmentation directly determines the quality of the server's subsequent part-of-speech tagging, syntactic analysis, word vector and text analysis. For a simple first sentence, commas can be used to segment the sentences directly. The server marks the words in the first sentence according to their positions in the sentence. For example, the sentence "I love Shenzhen because it is beautiful" is marked, and the result of the marking is: "I N love N Shenzhen Y because N it is N very N beautiful N", where Y represents segmentation and N represents non-segmentation. It can be regarded as the server making a binary classification of the position between each word in the first sentence to determine whether the first sentence should be segmented.
[0036] It should be noted that the preset analysis function here refers to the dependency analysis function. The server uses the dependency analysis function to perform grammar detection on the first sentence. The dependency analysis function uses the dependency relationship between words in the sentence to express grammar, such as: if one word modifies another word, then the word is said to be dependent on another word. The relationship between words is clarified in the sentence. The server can accurately determine the part of speech of each word in the sentence and the relationship between words, making full preparations for completing the sentence. Before the server performs dependency analysis, it needs to perform part-of-speech tagging on the sentence. The server tags the words in the first sentence according to their positions in the words. The BMES tagging method can be used, where B is a word at the beginning of a word, M is a word in the middle of a word, and the number of words in the middle of a word may be multiple, E is the last word of a word, and S is a word consisting of one word. For example, "MYbank is the most important product of Ant Financial's Micro Loan Division" is labeled, and the result after labeling is "BMMESBMMEBMMMESBMEBE", and the corresponding word segmentation result is "MYbank / is / Ant Financial / Micro Loan Division / the / most / important / product", the part of speech of the corresponding participle is searched in the preset vocabulary library, and the part of speech is tagged for the word segmentation result. When a single entity appears in the sentence (the sentence only includes a subject, a predicate or an object), the single entity is extracted and saved in the first sentence detection result for backup.
[0037] 102. Perform grammar detection on the second sentence of the new round of user input obtained by using the preset corpus segmentation function and the preset analysis function to obtain a second sentence detection result, where the second sentence detection result is the target dependency relationship between each word in the second sentence.
[0038] The server uses the preset corpus segmentation function and the preset analysis function to perform grammar detection on the second sentence of the new round of user input to obtain the second sentence detection result, which is the target dependency relationship between each word in the second sentence.
[0039] The second sentence here is the following sentence of the first sentence, and the first sentence is used as the basis for completing the missing semantic part of the second sentence. The method of grammar detection for the second sentence here is the same as the method of grammar detection for the first sentence, and the detection result is used as the detection result of the second sentence.
[0040] 103. Determine whether the second sentence detection result includes only a single entity and whether the second sentence is a question sentence.
[0041] The server determines whether the second sentence detection result includes only a single entity and the second sentence is a question sentence.
[0042] It is understandable that the second sentence input by the user in a new round may have part of the sentence omitted, such as omitting the predicate and the object. At this time, the server needs to judge the second sentence input in the new round. If the semantic expression in the second sentence input in the new round is incomplete, the second sentence input in the new round will be completed according to the contextual scenarios in multiple rounds of conversations. Therefore, the server first determines whether the analysis result of the second sentence contains only a single entity and the second sentence is a question sentence, so as to determine whether the second sentence input in the new round meets the condition of incomplete semantics.
[0043] 104. When the second sentence detection result includes only a single entity and the second sentence is a question sentence, the semantically missing part of the second sentence is completed according to the first sentence detection result to obtain a first completed sentence.
[0044] When the second sentence detection result includes only a single entity and the second sentence is a question sentence, the server completes the semantically missing part of the second sentence according to the first sentence detection result to obtain a first completed sentence.
[0045] If the second sentence detection result contains a single entity and the second sentence is a question sentence, the server cannot accurately identify the meaning of the second sentence and cannot feedback the corresponding preset response. Therefore, the server completes the second sentence according to the context scenario obtained to obtain a complete semantics of the second sentence, and then the server feedbacks the corresponding answer according to the semantics of the second sentence. The server obtains the first sentence detection result and the second sentence detection result. Both detection results include part-of-speech analysis of the sentence, and extracts the single entity in the second sentence as the first target word. The single entity here refers to a single word or a single phrase in the sentence, for example: the sentence "What about a cold?", in which the word "cold" is the single entity in the sentence. After the single entity in the second sentence is extracted, the single entity with the same grammatical structure as the first target word is selected in the first sentence as the second target word. The same grammatical structure here means that the first target word and the second target word have the same part of speech. For example: the first target word is "cold" and the second target word is "cancer". The first target word and the second target word are both noun parts of speech. It can be said that the grammatical structure of the two is the same. After the server screens out the second target word, in the first sentence, the server replaces the first target word with the second target word to obtain a first completion sentence.
[0046] 105. Determine whether the first completion sentence includes words with unclear reference, which include pronouns, quantifiers and articles.
[0047] The server determines whether the first completion sentence includes words with unclear reference, where the words with unclear reference include pronouns, quantifiers, and articles.
[0048] It should be noted that when the server completes the second sentence of the new round of input and obtains the first completed sentence, it is also necessary to determine whether the first completed sentence includes unclear words. Unclear words will cause the semantics of the second sentence to be unclear. Generally speaking, unclear words include pronouns, quantifiers, and articles. For example: the user's first sentence is "Are Ping An Fu and Fu Man Fen both medical insurance?" The server replies to the first sentence as "Yes." The second sentence of the user's new round of input is "What can be reimbursed for the first type?" In the second sentence of the user's new round of input, there is an unclear word "first type". If the server does not connect the context of multiple rounds of dialogue to supplement the second sentence of the user's new round of input, it will lead to semantic understanding deviation, and the server will not be able to give a correct answer, resulting in the user being unable to proceed to the next step.
[0049] 106. If the first completion sentence includes words with unclear reference, the words with unclear reference in the first completion sentence are replaced according to the detection result of the first sentence to obtain a second completion sentence.
[0050] If the first completion sentence includes words with unclear references, the server replaces the words with unclear references in the first completion sentence according to the first sentence detection result to obtain a second completion sentence.
[0051] If the server determines that the first completion sentence includes words with unclear references, indicating that the first completion sentence is a sentence with unclear semantics, the server needs to complete the first completion sentence again according to the contextual scenarios in multiple rounds of dialogue. First, the server extracts the words with unclear references from the second sentence as the third target words, then selects words with the same part of speech as the third target words in the first sentence as the fourth target words, and finally replaces the fourth target words with the third target words in the second sentence.
[0052] The embodiment of the present invention improves the accuracy of semantic analysis results by using preset corpus segmentation functions and preset analysis functions to perform grammar detection on multiple rounds of dialogues input by users, and uses the semantics of the context of multiple rounds of dialogues to complete semantically incomplete sentences, thereby improving the accuracy of semantic analysis results, and also improving the accuracy of searching for corresponding response information based on the semantic analysis results.
[0053] See also Figure 2 Another embodiment of the method for semantic completion in a multi-round conversation in an embodiment of the present invention includes:
[0054] 201. Obtain a first sentence input by a user.
[0055] The server obtains the first sentence input by the user. In human-computer interaction, the server obtains the sentence input by the user and uses the sentence input by the user as the first sentence to prepare for the completion of the second sentence below.
[0056] 202. Use a preset corpus segmentation function to segment the first sentence to obtain a first input sentence.
[0057] The server uses the preset corpus segmentation function to segment the first sentence to obtain the first input sentence. Specifically, the server segments the first sentence to obtain segmented sentences; the server matches the segmented corpus in the segmented sentence with the preset corpus, which is a corpus established in a preset intent rule library based on business data; if the segmented corpus matches the preset corpus, the server segments the segmented sentence at the front and back positions of the segmented corpus to obtain segmented sentences, and uses the segmented sentences as the first input sentence; if the segmented corpus does not match the preset corpus, the server directly uses the segmented corpus as the first input sentence.
[0058] It should be noted that the server uses the preset corpus segmentation function to segment the first sentence, and uses the preset analysis function to perform grammar detection on the first input sentence, both of which are preparations for completing the semantics of the second sentence. The server uses the preset corpus segmentation function to perform preliminary segmentation on the first sentence. Segmentation is the basis of natural language processing. The accuracy of segmentation directly determines the quality of part-of-speech tagging, syntactic analysis, word vector and text analysis performed by the server later. For a simple first sentence, commas can be used to segment the sentences directly. The server marks the words in the first sentence according to their positions in the sentence. For example, the sentence "I love Shenzhen because it is beautiful" is marked, and the marking result is: "I N love N Shenzhen Y because N it is N very N beautiful N", where Y represents segmentation and N represents non-segmentation. It can be regarded as the server making a binary classification of the position between each word in the first sentence to determine whether it should be segmented.
[0059] After the server segments the first sentence, it obtains separate segmented sentences, and then matches the segmented corpus in the segmented sentence with the preset corpus. The segmented sentence here cannot be segmented, so the segmented corpus in the segmented sentence is further matched to clarify whether the corresponding corpus needs to be segmented. The preset corpus here is the corpus established in the preset intention rule library based on business data. For example, the preset intention rule library is a safe, and the preset corpus can be insurance policies, insured person’s ID number, etc. The server constructs the corpus based on relevant business data. If the segmented corpus matches the preset corpus, the server segments the segmented sentence at the front and back positions of the segmented corpus to obtain the segmented sentence, and uses the segmented sentence as the first input sentence; if the segmented corpus does not match the preset corpus, the server directly uses the segmented corpus as the first input sentence. For example, the sentence "Can I buy e-life insurance for a cold?" is segmented and matched into "Cold / can / be / insured / e-life insurance / ?", where "cold", "insurance" and "e-life insurance" are all preset corpora in the preset intent rule library. The server does not need to segment the segmented corpora that match the preset corpora, but can directly segment them at the front and back positions of the matched segmented corpora, saving the server time for sentence segmentation.
[0060] 203. Perform grammar detection on the first input sentence using a preset analysis function to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first input sentence.
[0061] The server uses a preset analysis function to perform a grammatical check on the first input sentence to obtain a first sentence detection result, which is the target dependency relationship between each word in the first input sentence. Specifically, the server performs part-of-speech tagging and entity extraction on the words in the first input sentence to obtain the first sentence tagging result; the server calculates the dependency probability between each word, the word is the word in the first sentence tagging result, and the dependency probability is the frequency of occurrence of the preset dependency relationship; the server determines the target dependency relationship between each word, and the preset dependency relationship corresponding to the probability with the largest dependency probability weight is the target dependency relationship between the words; the server obtains the first sentence detection result, which is the target dependency relationship between each word in the first input sentence.
[0062] It should be noted that the preset analysis function here refers to the dependency analysis function. The server uses the dependency analysis function to perform grammar detection on the first sentence. The dependency analysis function uses the dependency relationship between words in the sentence to express grammar, such as: if one word modifies another word, then the word is said to be dependent on another word. The relationship between words is clarified in the sentence. The server can accurately determine the part of speech of each word in the sentence and the relationship between words, making full preparations for completing the sentence. Before the server performs dependency analysis, it is necessary to perform part-of-speech tagging on the sentence. The server tags the words in the first sentence according to their positions in the words. The BMES tagging method can be used, where B is a word at the beginning of a word, M is a word in the middle of a word, and the number of words in the middle of a word may be multiple, E is the last word of a word, and S is a word composed of one word. For example, "MYbank is the most important product of Ant Financial's Micro Loan Division" is labeled, and the result after labeling is "BMMESBMMEBMMMESBMEBE", and the corresponding word segmentation result is "MYbank / is / Ant Financial / Micro Loan Division / the / most / important / product", the part of speech of the corresponding participle is searched in the preset vocabulary library, and the part of speech is tagged for the word segmentation result. When a single entity appears in the sentence (the sentence only includes a subject, a predicate or an object), the single entity is extracted and saved in the first sentence detection result for backup.
[0063] 204. Perform grammar detection on the second sentence of the new round of user input obtained by using the preset corpus segmentation function and the preset analysis function to obtain a second sentence detection result, where the second sentence detection result is the target dependency relationship between each word in the second sentence.
[0064] The server uses the preset corpus segmentation function and the preset analysis function to perform grammar detection on the second sentence of the new round of user input to obtain the second sentence detection result, which is the target dependency relationship between each word in the second sentence.
[0065] The second sentence here is the following sentence of the first sentence, and the first sentence is used as the basis for completing the missing semantic part of the second sentence. The method of grammar detection for the second sentence here is the same as the method of grammar detection for the first sentence, and the detection result is used as the detection result of the second sentence.
[0066] 205. Determine whether the second sentence detection result includes only a single entity and the second sentence is a question sentence.
[0067] The server determines whether the second sentence detection result includes only a single entity and the second sentence is a question sentence.
[0068] It is understandable that the second sentence input by the user in a new round may contain partial omissions, such as omitting the predicate and the object. In this case, the server needs to judge the second sentence input in the new round. If the semantic expression in the second sentence input in the new round is incomplete, the second sentence input in the new round will be completed according to the contextual scenarios in multiple rounds of conversations. Therefore, the server first determines whether the analysis result of the second sentence contains only a single entity and the second sentence is a question sentence, to determine whether the second sentence input in the new round meets the condition of incomplete semantics.
[0069] 206. When the second sentence detection result includes only a single entity and the second sentence is a question sentence, the semantically missing part of the second sentence is completed according to the first sentence detection result to obtain a first completed sentence.
[0070] When the second sentence detection result includes only a single entity and the second sentence is a question sentence, the server completes the semantics of the second sentence according to the first sentence detection result to obtain a first completed sentence. Specifically, when the second sentence detection result includes only a single entity and the second sentence is a question sentence, the server extracts the single entity in the second sentence detection result and uses the single entity as the first target word; the server selects the single entity with the same grammatical structure as the first target word in the first sentence detection result to obtain the second target word; in the first sentence, the server replaces the second target word with the first target word to obtain the first completed sentence.
[0071] If the second sentence detection result only contains a single entity and the second sentence is a question, the server cannot accurately identify the meaning of the second sentence and cannot feedback the corresponding preset response. Therefore, the server completes the missing semantic part of the second sentence according to the acquired context to obtain the complete semantics of the second sentence. The server then feedbacks the corresponding answer according to the semantics of the second sentence. The server obtains the first sentence detection result and the second sentence detection result. Both detection results include part-of-speech analysis of the sentence, extracts the single entity in the second sentence as the first target word, and selects the single entity with the same grammatical structure as the first target word in the first sentence detection result as the second target word. In the first sentence, the server replaces the first target word with the second target word to obtain the first completed sentence.
[0072] For example, the first sentence input by the user is "Can I buy e-life insurance for a cold?" The server performs part-of-speech tagging and dependency analysis on the first sentence input by the user, and obtains "Can a cold / nhd / c be insured / vne-life insurance / nbx / y?" Here, nhd and nbx are relevant parts of speech of the preset corpus. For example, the preset intent rule library where the preset corpus is located is the insurance library, nhd represents disease-related words in the insurance library, and nbx represents insurance name-related words in the insurance library; c represents an auxiliary verb; vn represents a gerund; y represents a modal particle, and the extracted single entity is: cold / nhd insurance / vne-life insurance / nbx. The user inputs the second sentence of the new round as "Cancer where?" The server parses this sentence and gets "Cancer / nhd where / y". It is obvious that the second sentence detection result only includes a single entity and the second sentence ends with an interrogative tone, which meets the condition that the second sentence is semantically incomplete. The server then performs semantic supplementation on the second sentence. According to the detection results of the first sentence and the second sentence, it is found that cold / nhd and cancer / nhd are the same type of words. The two are interchanged in the first sentence to get "Can cancer be insured with e-Life Insurance?" to complete the second sentence.
[0073] 207. Determine whether the first completion sentence includes words with unclear reference, which include pronouns, quantifiers and articles.
[0074] The server determines whether the first completion sentence includes words with unclear reference, which include pronouns, quantifiers, and articles. Specifically, the server obtains the detection result of the first completion sentence, which is a combination of the detection result of the second sentence and the detection result of the first sentence; the server determines whether the detection result of the first completion sentence includes pronouns, quantifiers, and articles.
[0075] It should be noted that when the server completes the second sentence of the new round of input and obtains the first completed sentence, it is also necessary to determine whether the first completed sentence includes unclear words. Unclear words will cause the semantics of the second sentence to be unclear. Generally speaking, unclear words include pronouns, quantifiers, and articles. For example: the user's first sentence is "Are Ping An Fu and Fu Man Fen both medical insurance?" The server replies to the first sentence as "Yes." The second sentence of the user's new round of input is "What can be reimbursed for the first type?" In the second sentence of the user's new round of input, there is an unclear word "first type". If the server does not connect the context of multiple rounds of dialogue to supplement the second sentence of the user's new round of input, it will lead to semantic understanding deviation, and the server will not be able to give a correct answer, resulting in the user being unable to proceed to the next step.
[0076] 208. If the first completion sentence includes words with unclear reference, the words with unclear reference in the first completion sentence are replaced according to the first sentence detection result to obtain a second completion sentence.
[0077] If the first completion sentence includes an unclear word, the server replaces the unclear word in the first completion sentence according to the first sentence detection result to obtain a second completion sentence. Specifically, if the first completion sentence detection result includes an unclear word, the server extracts the unclear word and uses the unclear word as the third target word; the server selects words with the same grammatical structure as the third target word in the first sentence detection result to obtain a fourth target word; in the second sentence, the server replaces the third target word with the fourth target word to obtain a second completion sentence.
[0078] If the server determines that the first completion sentence includes words with unclear references, indicating that the first completion sentence is a sentence with unclear semantics, the server needs to complete the first completion sentence again according to the context in multiple rounds of dialogue. First, the server extracts the words with unclear references from the second sentence as the third target words, then selects words with the same part of speech as the third target words in the first sentence as the fourth target words, and finally replaces the fourth target words with the third target words in the second sentence.
[0079] For example, the user's first sentence is "Ping An Fu and Fu Man Fen, are they both medical insurance?" The server performs part-of-speech tagging and dependency analysis on the first sentence input by the user, and obtains "Ping An Fu / nbx, Fu Man Fen / nbx, are they / v medical insurance / nbx / y?" Here nbx is the relevant part of speech of the preset corpus. For example, the preset intent rule library where the preset corpus is located is the insurance library, and nbx represents words such as insurance names in the insurance library; v represents verbs; and y represents modal particles. The second sentence input by the user in the new round is "What can the former reimburse?" The server performs part-of-speech tagging and dependency analysis on the second sentence input by the user in the new round, and obtains "The former / r can / v reimburse / v what / y?" Here r represents a pronoun; v represents a verb; y represents an auxiliary word of mood. In the second sentence input by the user in the new round, there is an unknown word "the former". The server supplements the second sentence input by the user in the new round based on the context of multiple rounds of conversations. Combined with the detection result of the user's first sentence, the former here refers to "Ping An Fu". "Ping An Fu" is directly brought into the second sentence to obtain "What can Ping An Fu reimburse?" A complete second completed sentence is obtained, so that the server can provide feedback and answers based on the second completed sentence.
[0080] The embodiment of the present invention improves the accuracy of semantic analysis results by using preset corpus segmentation functions and preset analysis functions to perform grammar detection on multiple rounds of dialogues input by users, and uses the semantics of the context of multiple rounds of dialogues to complete semantically incomplete sentences, thereby improving the accuracy of semantic analysis results, and also improving the accuracy of searching for corresponding response information based on the semantic analysis results.
[0081] The above describes the method for semantic completion in a multi-round conversation in an embodiment of the present invention. The following describes the device for semantic completion in a multi-round conversation in an embodiment of the present invention. Figure 3 , an embodiment of a device for completing semantics in a multi-round conversation in an embodiment of the present invention includes:
[0082] A first acquisition unit 301 is used to perform grammar detection on a first sentence input by a user obtained by using a preset corpus segmentation function and a preset analysis function to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first sentence;
[0083] The second acquisition unit 302 is used to perform grammar detection on the second sentence of the new round of user input obtained by using the preset corpus segmentation function and the preset analysis function to obtain the second sentence detection result, where the second sentence detection result is the target dependency relationship between each word in the second sentence;
[0084] A first judging unit 303, configured to judge whether the second sentence detection result includes only a single entity and whether the second sentence is a question sentence;
[0085] A first completion unit 304 is used to complete the semantic missing part of the second sentence according to the first sentence detection result to obtain a first completed sentence when the second sentence detection result only includes a single entity and the second sentence is a question sentence;
[0086] The second judging unit 305 is used to judge whether the first completion sentence includes words with unclear reference, where the words with unclear reference include pronouns, quantifiers and articles;
[0087] The second completion unit 306 is configured to replace the unclear words in the first completion sentence according to the first sentence detection result to obtain a second completion sentence if the first completion sentence includes unclear words.
[0088] In the embodiment of the present invention, the first acquisition unit 301 uses the preset corpus segmentation function and the preset analysis function to perform grammar detection on the first sentence input by the user, and obtains the first sentence detection result, and the first sentence detection result is the target dependency relationship between each word in the first sentence; the second acquisition unit 302 uses the preset corpus segmentation function and the preset analysis function to perform grammar detection on the second sentence input by the user in a new round, and obtains the second sentence detection result, and the second sentence detection result is the target dependency relationship between each word in the second sentence; the first judgment unit 303 judges the second sentence detection result. Whether the result only includes a single entity and the second sentence is a question sentence; the first completion unit 304 completes the semantically missing part of the second sentence according to the first sentence detection result to obtain a first completed sentence when the second sentence detection result only includes a single entity and the second sentence is a question sentence; the second judgment unit 305 determines whether the first completed sentence includes words with unclear reference, and the words with unclear reference include pronouns, quantifiers and articles; the second completion unit 306 replaces the words with unclear reference in the first completed sentence according to the first sentence detection result to obtain a second completed sentence.
[0089] The embodiment of the present invention improves the accuracy of semantic analysis results by using preset corpus segmentation functions and preset analysis functions to perform grammar detection on multiple rounds of dialogues input by users, and uses the semantics of the context of multiple rounds of dialogues to complete semantically incomplete sentences, thereby improving the accuracy of semantic analysis results, and also improving the accuracy of searching for corresponding response information based on the semantic analysis results.
[0090] See also Figure 4 Another embodiment of the apparatus for completing semantics in a multi-round conversation in the embodiment of the present invention includes:
[0091] A first acquisition unit 301 is used to perform grammar detection on a first sentence input by a user obtained by using a preset corpus segmentation function and a preset analysis function to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first sentence;
[0092] The second acquisition unit 302 is used to perform grammar detection on the second sentence of the new round of user input obtained by using the preset corpus segmentation function and the preset analysis function to obtain the second sentence detection result, where the second sentence detection result is the target dependency relationship between each word in the second sentence;
[0093] A first judging unit 303, configured to judge whether the second sentence detection result includes only a single entity and whether the second sentence is a question sentence;
[0094] A first completion unit 304 is used to complete the semantic missing part of the second sentence according to the first sentence detection result to obtain a first completed sentence when the second sentence detection result only includes a single entity and the second sentence is a question sentence;
[0095] The second judging unit 305 is used to judge whether the first completion sentence includes words with unclear reference, where the words with unclear reference include pronouns, quantifiers and articles;
[0096] The second completion unit 306 is configured to replace the unclear words in the first completion sentence according to the first sentence detection result to obtain a second completion sentence if the first completion sentence includes unclear words.
[0097] Optionally, the first acquiring unit 301 includes:
[0098] An acquisition module 3011 is used to acquire a first sentence input by a user;
[0099] A segmentation module 3012 is used to segment the first sentence using a preset corpus segmentation function to obtain a first input sentence;
[0100] The detection module 3013 is used to perform grammar detection on the first input sentence using a preset analysis function to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first input sentence.
[0101] Optionally, the segmentation module 3012 is specifically used for:
[0102] Segment the first sentence to obtain segmented sentences;
[0103] Match the segmented corpus in the segmented sentence with the preset corpus, which is the corpus established in the preset intent rule library based on business data;
[0104] If the segmented corpus matches the preset corpus, the segmented sentence is segmented at the front and back positions of the segmented corpus to obtain a segmented sentence, and the segmented sentence is used as the first input sentence;
[0105] If the segmented corpus does not match the preset corpus, the segmented corpus is directly used as the first input sentence.
[0106] Optionally, the detection module 3013 is specifically used for:
[0107] Performing part-of-speech tagging and entity extraction on words in the first input sentence to obtain a first sentence tagging result;
[0108] Calculate the dependency probability between each word, where the word is the word in the first sentence annotation result, and the dependency probability is the frequency of occurrence of the preset dependency relationship;
[0109] Determine the target dependency relationship between each word, and the preset dependency relationship corresponding to the probability with the largest dependency probability weight is the target dependency relationship between the words;
[0110] A first sentence detection result is obtained, where the first sentence detection result is a target dependency relationship between each word in the first input sentence.
[0111] Optionally, the first filling unit 304 is specifically used for:
[0112] When the second sentence detection result includes only a single entity and the second sentence is a question sentence, extracting the single entity in the second sentence detection result and using the single entity as the first target word;
[0113] Selecting a single entity with the same grammatical structure as the first target word from the first sentence detection result to obtain a second target word;
[0114] In the first sentence, the second target word is replaced by the first target word to obtain a first completion sentence.
[0115] Optionally, the second determining unit 305 is specifically configured to:
[0116] Obtaining a detection result of the first completion sentence, where the detection result of the first completion sentence is a combination of the detection result of the second sentence and the detection result of the first sentence;
[0117] It is determined whether the detection result of the first completion sentence includes pronouns, quantifiers, and articles.
[0118] Optionally, the second padding unit 306 is specifically used for:
[0119] If the detection result of the first completion sentence includes words with unclear reference, the words with unclear reference are extracted and used as the third target words;
[0120] Select words with the same grammatical structure as the third target word from the first sentence detection result to obtain a fourth target word;
[0121] In the second sentence, the third target word is replaced by the fourth target word to obtain a second completed sentence.
[0122] In the embodiment of the present invention, the first acquisition unit 301 includes: an acquisition module 3011, which is used to acquire a first sentence input by a user; a segmentation module 3012, which is used to segment the first sentence using a preset corpus segmentation function to obtain a first input sentence; a detection module 3013, which is used to perform a grammar check on the first input sentence using a preset analysis function to obtain a first sentence detection result, and the first sentence detection result is the target dependency relationship between each word in the first input sentence; the second acquisition unit 302 uses the preset corpus segmentation function and the preset analysis function to perform a grammar check on the second sentence of the user's newly acquired input to obtain a second sentence detection result, and the second sentence detection result is the second sentence The target dependency relationship between each word in the sentence; the first judgment unit 303 judges whether the second sentence detection result includes only a single entity and the second sentence is a question sentence; the first completion unit 304 completes the semantic missing part of the second sentence according to the first sentence detection result when the second sentence detection result includes only a single entity and the second sentence is a question sentence, to obtain a first completed sentence; the second judgment unit 305 judges whether the first completed sentence includes words with unclear reference, and the words with unclear reference include pronouns, quantifiers and articles; the second completion unit 306 replaces the words with unclear reference in the first completed sentence according to the first sentence detection result if the first completed sentence includes words with unclear reference, to obtain a second completed sentence.
[0123] The embodiment of the present invention improves the accuracy of semantic analysis results by using preset corpus segmentation functions and preset analysis functions to perform grammar detection on multiple rounds of dialogues input by users, and uses the semantics of the context of multiple rounds of dialogues to complete semantically incomplete sentences, thereby improving the accuracy of semantic analysis results, and also improving the accuracy of searching for corresponding response information based on the semantic analysis results.
[0124] above Figure 3 to Figure 4 The apparatus for semantic completion in a multi-round conversation in an embodiment of the present invention is described in detail from the perspective of modular functional entities. The device for semantic completion in a multi-round conversation in an embodiment of the present invention is described in detail from the perspective of hardware processing.
[0125] Combine the following Figure 5 The following is a detailed introduction to the components of the device for semantic completion in multi-round conversations:
[0126] Figure 51 is a schematic diagram of the structure of a device for semantic completion in a multi-round conversation provided by an embodiment of the present invention. The device 500 for semantic completion in a multi-round conversation may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 501 (for example, one or more processors) and a memory 509, and one or more storage media 508 (for example, one or more mass storage devices) storing application programs 507 or data 506. Among them, the memory 509 and the storage medium 508 can be short-term storage or permanent storage. The program stored in the storage medium 508 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the device for semantic completion in a multi-round conversation. Furthermore, the processor 501 may be configured to communicate with the storage medium 508 to execute a series of instruction operations in the storage medium 508 on the device 500 for semantic completion in a multi-round conversation.
[0127] The device 500 for semantic completion in a multi-round conversation may also include one or more power supplies 502, one or more wired or wireless network interfaces 503, one or more input and output interfaces 504, and / or one or more operating systems 505, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will appreciate that Figure 5 The device structure for semantic completion in a multi-round conversation shown in the figure does not constitute a limitation on the device for semantic completion in a multi-round conversation, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0128] Combine the following Figure 5 The following is a detailed introduction to the components of the device for semantic completion in multi-round conversations:
[0129] The processor 501 is the control center of the device for semantic completion in multiple rounds of dialogue, and can be processed according to the method for semantic completion in multiple rounds of dialogue. The processor 501 uses various interfaces and lines to connect the various parts of the device for semantic completion in the entire multiple rounds of dialogue, and through running or executing the software program and / or module stored in the memory 509, and calling the data stored in the memory 509, the preset corpus segmentation function and the preset analysis function are used to perform grammar detection on the multiple rounds of dialogue input by the user, and the semantics of the context of the multiple rounds of dialogue are used to complete the incomplete sentences, thereby improving the accuracy of the semantic analysis results. The storage medium 508 and the memory 509 are both carriers for storing data. In the embodiment of the present invention, the storage medium 508 can refer to an internal memory with a small storage capacity but a fast speed, and the memory 509 can be an external memory with a large storage capacity but a slow storage speed.
[0130] The memory 509 can be used to store software programs and modules. The processor 501 executes various functional applications and data processing of the device 500 for semantic completion in multiple rounds of dialogue by running the software programs and modules stored in the memory 509. The memory 509 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 the use of the device for semantic completion in multiple rounds of dialogue, etc. In addition, the memory 509 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 non-volatile solid-state storage devices. The program for semantic completion in multiple rounds of dialogue provided in the embodiment of the present invention and the received data stream are stored in the memory, and when needed, the processor 501 calls from the memory 509.
[0131] When loading and executing computer program instructions on a computer, a process or function according to an embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, a computer instruction may be transmitted from a website site, a computer, a server, or a data center to another website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, twisted pair) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media may be any available medium that a computer can store or a data storage device such as a server or a data center that includes one or more available media integrations. Available media may be magnetic media, (e.g., floppy disk, hard disk, tape), optical media (e.g., optical disk), or semiconductor media (e.g., solid state disk (SSD)), etc.
[0132] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0133] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for semantic completion in a multi-round conversation, characterized in that: include: Using a preset corpus segmentation function and a preset analysis function, a grammar check is performed on a first sentence input by the acquired user to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first sentence; Using the preset corpus segmentation function and the preset analysis function, a grammar check is performed on the second sentence of the new round of user input to obtain a second sentence detection result, where the second sentence detection result is a target dependency relationship between each word in the second sentence; Determining whether the second sentence detection result includes only a single entity and the second sentence is a question sentence; When the second sentence detection result includes only a single entity and the second sentence is a question sentence, the semantically missing part of the second sentence is completed according to the first sentence detection result to obtain a first completed sentence; Determining whether the first completion sentence includes words with unclear reference, wherein the words with unclear reference include pronouns, quantifiers, and articles; If the first completion sentence includes words with unclear reference, the words with unclear reference in the first completion sentence are replaced according to the first sentence detection result to obtain a second completion sentence.
2. The method according to claim 1, characterized in that The preset corpus segmentation function and the preset analysis function are used to perform grammar detection on the first sentence input by the acquired user to obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first sentence including: Get the first sentence input by the user; Segmenting the first sentence using a preset corpus segmentation function to obtain a first input sentence; The first input sentence is subjected to grammar detection using a preset analysis function to obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first input sentence.
3. The method according to claim 2, characterized in that The using a preset corpus segmentation function to segment the first sentence to obtain a first input sentence comprises: Segmenting the first sentence to obtain segmented sentences; Matching the segmented corpus in the segmented sentence with the preset corpus, where the preset corpus is corpus established in a preset intention rule library based on business data; If the segmented corpus matches the preset corpus, segmenting the segmented sentence at the front and back positions of the segmented corpus to obtain segmented sentences, and using the segmented sentences as the first input sentence; If the segmented corpus does not match the preset corpus, the segmented corpus is directly used as the first input sentence.
4. The method according to claim 2, characterized in that: The using of the preset analysis function to perform grammar detection on the first input sentence to obtain a first sentence detection result, wherein the first sentence detection result is a target dependency relationship between each word in the first input sentence including: Performing part-of-speech tagging and entity extraction on words in the first input sentence to obtain a first sentence tagging result; Calculating the dependency probability between each of the words, where the words are words in the first sentence annotation result, and the dependency probability is the frequency of occurrence of the preset dependency relationship; Determine a target dependency relationship between each of the words, wherein the preset dependency relationship corresponding to the probability with the largest dependency probability weight is the target dependency relationship between the words; A first sentence detection result is obtained, where the first sentence detection result is the target dependency relationship between each of the words in the first input sentence.
5. The method according to claim 1, characterized in that When the second sentence detection result includes only a single entity and the second sentence is a question sentence, the semantically missing part of the second sentence is completed according to the first sentence detection result to obtain a first completed sentence, including: When the second sentence detection result includes only a single entity and the second sentence is a question sentence, extracting the single entity in the second sentence detection result and using the single entity as the first target word; Selecting the single entity having the same grammatical structure as the first target word from the first sentence detection result to obtain a second target word; In the first sentence, the second target word is replaced by the first target word to obtain a first completion sentence.
6. The method according to any one of claims 1 to 5, characterized in that: The step of determining whether the first completion sentence includes words with unclear reference, wherein the words with unclear reference include pronouns, quantifiers, and articles, includes: Acquire a detection result of a first completion sentence, where the detection result of the first completion sentence is a combination of the detection result of the second sentence and the detection result of the first sentence; It is determined whether the detection result of the first completion sentence includes a pronoun, a quantifier, and an article.
7. The method according to claim 6, characterized in that If the first completion sentence includes an unclear word, the unclear word in the first completion sentence is replaced according to the first sentence detection result to obtain a second completion sentence including: If the detection result of the first completion sentence includes an unknown word, extracting the unknown word and using the unknown word as the third target word; Selecting words with the same grammatical structure as the third target word from the first sentence detection result to obtain a fourth target word; In the second sentence, the third target word is replaced by the fourth target word to obtain a second completion sentence.
8. A device for completing semantics in a multi-round conversation, characterized in that: include: A first acquisition unit is used to perform grammar detection on a first sentence input by a user obtained by using a preset corpus segmentation function and a preset analysis function to obtain a first sentence detection result, where the first sentence detection result is a target dependency relationship between each word in the first sentence; a second acquisition unit, configured to perform grammar detection on the second sentence of the new round of user input acquired by using the preset corpus segmentation function and the preset analysis function, and obtain a second sentence detection result, wherein the second sentence detection result is a target dependency relationship between each word in the second sentence; A first judging unit, configured to judge whether the second sentence detection result includes only a single entity and whether the second sentence is a question sentence; A first completion unit, configured to complete a semantically missing portion of the second sentence according to the first sentence detection result to obtain a first completed sentence when the second sentence detection result includes only a single entity and the second sentence is a question sentence; a second judgment unit, configured to judge whether the first completion sentence includes words with unclear reference, wherein the words with unclear reference include pronouns, quantifiers and articles; The second completion unit is used to replace the unclear words in the first completion sentence according to the first sentence detection result to obtain a second completion sentence if the first completion sentence includes unclear words.
9. A device for completing semantics in a multi-round conversation, characterized in that: include: A memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory to enable the device for semantic completion in a multi-round conversation to execute the method for semantic completion in a multi-round conversation as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computer, enable the computer to execute the steps of the method for semantic completion in a multi-round conversation as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
System and method of processing natural language, and computer program
JP2003281137A
Data processing system for understanding and processing sentences
JP2019121367A