Conversation method, apparatus and computer program product
By receiving and merging user-input dialogue information and context cache information to generate reply information, it solves the problems of mechanization and high complexity in traditional conversation methods, improves the naturalness of human-computer interaction and conversation success rate, and reduces the cost of knowledge base Maintenance costs.
Patent Information
- Application Number
- CN202111402647.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-19
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-11-19
AI Technical Summary
In the traditional human-computer multi-round conversation method, the rule-based method achieves a mechanized process with low naturalness, while the method based entirely on statistical models has high computational complexity and difficult to control the degree of freedom, resulting in a heavy design and development workload and poor user experience. , and it is difficult to correct unsatisfactory responses, and requires massive prediction collection and sorting, making implementation complex.
By receiving the dialogue information input by the user, entity extraction and syntax analysis are performed. If it cannot be directly matched, the context cache information is obtained for fusion, the question type is determined and corresponding fusion processing is performed, and the reply information is generated. If the fusion cannot be performed, a rhetorical question is generated to Get more information.
It improves the success rate of multi-round sessions, reduces the workload of knowledge base managers, reduces post-maintenance costs, and achieves more natural human-computer interaction.
Smart Images

Figure CN114239602B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence recognition and classification technology, and in particular to a conversation method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] Human-machine multi-round conversation is an important part of natural language interactive robots, and also one of the difficulties. There are two main traditional interaction methods: one is to use rule-based methods, such as slot filling method, finite automaton method, etc.; the other is to use dialogue management technology based on statistical models and machine learning for training, such as Bayesian network, graph model method, etc.
[0003] With the development of the robot field becoming more and more intelligent, the original rule-based human-computer interaction method to achieve the dialogue process is relatively mechanical, and the naturalness of human-computer interaction is low. The human-computer interaction method based entirely on statistical models has a high computational algorithm complexity, and the degree of freedom cannot be controlled by humans. When an unsatisfactory answer appears, it is difficult to correct it. In addition, this method requires the collection and organization of a large amount of expectations, and the implementation is complex. Therefore, using these two traditional interaction methods for multi-round human-computer conversations requires a large workload of design and development, and the user experience is not high, and neither can guarantee that the natural language interaction between humans and machines can be carried out effectively. Summary of the invention
[0004] Based on this, it is necessary to provide a conversation method, apparatus, computer device, storage medium and computer program product to address the above technical issues.
[0005] In a first aspect, the present application provides a conversation method. The method comprises:
[0006] Receiving first dialogue information input by a user;
[0007] Performing entity extraction on the first conversation information to obtain entity extraction results; matching the entity extraction results in a preset knowledge base;
[0008] If there is a matching result, the corresponding answer in the preset knowledge base is output as reply information;
[0009] If there is no matching result, obtaining stored context cache information, the context cache information including the second dialogue information input by the user received in the current dialogue, and the grammatical analysis results of each of the second dialogue information;
[0010] If the first dialogue information can be fused with the context cache information, the first dialogue information is fused with the context cache information to obtain fused dialogue information, the fused dialogue information is used as the first dialogue information, and the step of extracting entities from the first dialogue information is returned.
[0011] In one embodiment, if the first dialog information can be merged with the context cache information, merging the first dialog information with the context cache information to obtain merged dialog information includes:
[0012] Determining a question type of the first dialogue information;
[0013] If the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information;
[0014] The first dialogue information is fused with the context cache information using a fusion method corresponding to the question type of the first dialogue information to obtain fused dialogue information.
[0015] In one embodiment, the method of determining the question type of the first dialogue information includes:
[0016] Performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
[0017] Determining the sentence structure and the part of speech of each word of the first dialogue information according to the syntactic analysis result;
[0018] Based on the sentence structure and the part of speech of each word, a question type of the first dialogue information is determined.
[0019] In one embodiment, determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word includes:
[0020] If it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the question type of the first dialogue information is missing a subject;
[0021] If there are words whose part of speech is a pronoun, it is determined that the question type of the first dialogue information is unclear reference.
[0022] In one embodiment, determining the question type of the first dialogue information further includes:
[0023] If the entity of the first dialogue information is different from the entity in the context cache information, it is determined that the question type of the first dialogue information is entity transformation.
[0024] In one embodiment, the adopting a fusion method corresponding to the question type of the first dialogue information to fuse the first dialogue information with the context cache information to obtain the fused dialogue information includes:
[0025] If the question type is missing subject, searching for a subject from the context cache information, and completing the subject into the first dialogue information to obtain fused dialogue information;
[0026] If the question type is unclear reference, based on the position of the pronoun in the first dialogue information, searching for a word matching the pronoun from the context cache information, and replacing the pronoun in the first dialogue information with the word to obtain fused dialogue information;
[0027] If the question type is entity transformation, the entity in the first dialogue information is replaced with the entity in the context cache information to obtain fused dialogue information, or the entity in the first dialogue information is replaced with the entity in the context cache information to obtain fused dialogue information.
[0028] In one embodiment, the method further comprises:
[0029] If the question type does not belong to a fusionable question type, it is determined that the first dialogue information cannot be fused with the context cache information, a rhetorical question is determined based on the first dialogue information, and the rhetorical question is replied as reply information.
[0030] In a second aspect, the present application also provides a conversation device. The device comprises:
[0031] An entity matching module is used to receive first dialogue information input by a user; perform entity extraction on the first dialogue information to obtain an entity extraction result, and match the entity extraction result in a preset knowledge base;
[0032] a matching result judgment module, configured to output the corresponding answer in the preset knowledge base as a reply message if a matching result exists; and to obtain the stored context cache information if no matching result exists, wherein the context cache information includes the second dialogue information input by the user received in the current dialogue, and the grammatical analysis results of each of the second dialogue information;
[0033] An information fusion module is used to fuse the first dialogue information with the context cache information if the first dialogue information can be fused with the context cache information to obtain fused dialogue information, use the fused dialogue information as the first dialogue information, and return to the step of extracting entities from the first dialogue information.
[0034] In one of the embodiments, if the first dialogue information can be fused with the context cache information, the information fusion module fuses the first dialogue information with the context cache information to obtain the fused dialogue information, including: determining the question type of the first dialogue information; if the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information; using a fusion method corresponding to the question type of the first dialogue information to fuse the first dialogue information with the context cache information to obtain the fused dialogue information.
[0035] In one embodiment, the information fusion module determines the question type of the first dialogue information in the following manner: performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result; determining the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result; and determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word.
[0036] In one embodiment, when the information fusion module determines the problem type of the first dialogue information based on the sentence structure and the part of speech of each word, it includes: if it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the problem type of the first dialogue information is missing subject; if there are words whose part of speech is pronoun, determining the problem type of the first dialogue information is unclear reference.
[0037] In one of the embodiments, when the information fusion module determines the question type of the first dialogue information based on the sentence structure and the part of speech of each word, it also includes: if the entity of the first dialogue information is different from the entity in the context cache information, determining that the question type of the first dialogue information is an entity transformation.
[0038] In one embodiment, the information fusion module, when adopting a fusion method corresponding to the question type of the first dialogue information to fuse the first dialogue information with the context cache information to obtain the fused dialogue information, includes:
[0039] For, if the question type is missing subject, searching for a subject from the context cache information, completing the subject in the first dialogue information, and obtaining fused dialogue information; if the question type is unclear reference, based on the position of the pronoun in the first dialogue information, searching for a word matching the pronoun from the context cache information, and replacing the pronoun in the first dialogue information with the word, and obtaining fused dialogue information; if the question type is entity transformation, replacing the entity in the first dialogue information with the entity in the context cache information, and obtaining fused dialogue information, or replacing the entity in the context cache information with the entity in the first dialogue information, and obtaining fused dialogue information.
[0040] In one of the embodiments, the device further comprises: a rhetorical question module;
[0041] The rhetorical question module is used to determine that the first dialogue information cannot be fused with the context cache information if the question type does not belong to the fusionable question type, determine a rhetorical question based on the first dialogue information, and reply with the rhetorical question as reply information.
[0042] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0043] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0044] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0045] The above-mentioned conversation method, device, computer equipment, storage medium and computer program product can perform grammatical analysis based on the historical conversation information received in this conversation, and store the analysis results in the context cache information in chronological order. When receiving the conversation information input by the user and needing to reply to it, the conversation information that cannot directly get the answer is automatically merged with the context cache information, and the best answer is found based on the merged conversation information. Using this conversation method, when receiving conversation information that cannot directly get the answer, the complete conversation information can be merged by analyzing and extracting the previous context cache information, so as to match the reply information that is more in line with the current conversation context to the user based on the complete conversation information, greatly improving the success rate of multiple rounds of conversations. At the same time, since this conversation process does not require manual corpus addition or external logic for the entire conversation process, it reduces the workload of knowledge base managers and reduces the maintenance cost of the knowledge base in the later stage. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 An application environment diagram of a conversation method in an embodiment;
[0047] Figure 2 A flowchart of a conversation method in one embodiment;
[0048] Figure 3 A flowchart of the steps of fusing the first dialogue information with the context cache information to obtain the fused dialogue information if the first dialogue information can be fused with the context cache information in one embodiment;
[0049] Figure 4 is a flow chart of a conversation method in another embodiment;
[0050] Figure 5 is a structural block diagram of a conversation device in one embodiment;
[0051] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0053] The conversation method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the client uses the network to communicate with the server 104 through the terminal 102. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The user enters the first dialogue information on the terminal 102, and the server 104 extracts the entity of the first dialogue information, obtains the entity extraction result, and matches the entity extraction result in the pre-stored knowledge base. If there is no matching result, the server 104 will obtain the stored context cache information, merge the context cache information with the first dialogue information, and perform the entity extraction and matching process according to the fused information. When the matching result is obtained, the answer stored in the preset knowledge base is used as the reply information, and the reply information is output to the terminal 102 through the network. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart robots, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0054] In one embodiment, Figure 2 As shown, a session method is provided, which is applied to Figure 1 Taking the server 104 in the example as an example, the following steps are included:
[0055] Step 202: Receive first dialogue information input by the user.
[0056] The first dialogue information is information input by the user according to the question that the user needs to consult. It can be understood that the first dialogue information can be text information or voice information input by the user, and the present invention is not limited to this.
[0057] Specifically, the first dialogue information input by the user through the smart terminal is received, wherein the first dialogue information is information input by the user according to the question that the user needs to consult.
[0058] Step 204: extract entities from the first dialogue information to obtain entity extraction results; and match the entity extraction results in a preset knowledge base.
[0059] Among them, entity extraction, also known as named entity recognition, has two keywords for entity extraction tasks: find&classify, which means finding named entities and classifying them. That is, given a piece of text, entity words are extracted from it. Entity words are noun words such as names of people, places, organizations, time, etc. In the specific code implementation, we all define in advance which types of entity words to extract, which depends on the specific training data set. For example, in the People's Daily data set, three types of entities are defined: names of people, places, and organizations. After the model training is completed, our task is to extract the three types of entity words from the input sentences and identify which type of entity the words belong to.
[0060] The entity extraction result is the entity words in the first conversation information detected by the algorithm, and the classification information of the entity words obtained by querying the entity words. It can be understood that entity extraction can be implemented using methods such as SoftMax, CRF, Span pointer network, etc., and the present invention is not limited to this.
[0061] Specifically, the server has a predefined entity extraction algorithm, wherein the entity extraction algorithm is obtained through training based on specific data of the corresponding business field. The corresponding entity extraction algorithm is used to perform entity extraction on the first dialogue information input by the user to obtain entity words and classification information corresponding to the entity words.
[0062] In one embodiment, the terminal is an intelligent robot:
[0063] User asked: How much is the annual fee for the gold card?
[0064] The intelligent robot transmits "How much is the annual fee for a gold card" to the server through the network. The server takes "How much is the annual fee for a gold card" as the first dialogue information input by the user and performs entity extraction on the first dialogue information. The entity extraction result is: gold card (credit card), which means that the entity is detected to be a gold card, and the gold card is classified as a credit card.
[0065] The preset knowledge base is the question-answer pair information generated and recorded according to the in-house business rules corresponding to the application field. For example, in the field of financial investment, the preset knowledge base records common financial management questions related to financial investment and the answers corresponding to the questions.
[0066] Specifically, a query is performed in a preset knowledge base based on entity words and entity word classifications, the queried question and answer pairs are matched with the first dialogue information input by the user using a matching algorithm, and it is determined whether there is a matching result based on a preset matching degree threshold.
[0067] The preset matching threshold can be determined according to business needs. For example, if it is a routine guidance operation, the matching threshold can be set to 75%; if it is actually handling a specific business, the matching threshold can be set to 85% to 95%.
[0068] Step 206: If there is a matching result, the corresponding answer in the preset knowledge base is output as reply information.
[0069] Specifically, when the matching calculation value obtained after the matching calculation is compared with the matching degree threshold, if the matching calculation value is greater than the matching degree threshold, it is considered that there is a matching result, and the answer in the queried question and answer information is output to the terminal as reply information.
[0070] Step 208: if there is no matching result, the stored context cache information is obtained, the context cache information includes the second dialogue information input by the user received in the current dialogue, and the grammatical analysis results of each second dialogue information.
[0071] The second dialogue information is the dialogue information input by the user in the previous rounds of conversations in this conversation. The grammatical analysis result of the second dialogue information is the analysis result obtained by performing syntactic analysis and part-of-speech analysis on the dialogue information input by the user in the previous rounds of conversations. Specifically, the syntactic analysis result is the subject, predicate, object, attributive, adverbial, complement and other related sentence trunk information corresponding to the sentence obtained by splitting the sentence according to the syntactic structure. The part-of-speech analysis result is the part-of-speech information obtained by analyzing the part of speech of each word such as noun, verb, auxiliary verb, etc. after segmenting the sentence.
[0072] Specifically, when the matching calculation value obtained after the matching calculation is compared with the matching degree threshold, if the matching calculation value is less than the matching degree threshold, it is considered that there is no matching result, and the server reads the pre-stored context cache information.
[0073] In one embodiment, the context cache information also includes corresponding reply information output by the server according to the dialog information.
[0074] In one of the embodiments, the upper limit of the cache capacity of the context cache information is set according to the business requirements of the application field and the actual performance of the system. If the context cache information exceeds the preset upper limit, the system will use the new context cache information to overwrite the original context cache information.
[0075] Step 210, if the first dialogue information can be fused with the context cache information, the first dialogue information is fused with the context cache information to obtain fused dialogue information, the fused dialogue information is used as the first dialogue information, and the process returns to the step of extracting entities from the first dialogue information.
[0076] Specifically, after obtaining the first dialogue information and the context cache information and determining whether the two information can be fused, the two are fused to obtain fused dialogue information, the dialogue information is used as the first dialogue information, and the new first dialogue information returns to step 206 to repeat the steps. Information fusion refers to the process of modifying or supplementing the first dialogue information using information related to the first dialogue information in the context cache information.
[0077] The above conversation method can perform grammatical analysis based on the historical conversation information received in this conversation, and store the analysis results in the context cache information in chronological order. When receiving the conversation information input by the user and needing to reply to it, the conversation information that cannot directly get the answer is automatically merged with the context cache information, and the best answer is found based on the merged conversation information. Using this conversation method, when receiving conversation information that cannot directly get the answer, the complete conversation information can be merged by analyzing and extracting the previous context cache information, so as to match the reply information that is more in line with the current conversation context to the user based on the complete conversation information, greatly improving the success rate of multiple rounds of conversations. At the same time, since this conversation process does not require manual corpus addition or external logic for the entire conversation process, it reduces the workload of knowledge base managers and reduces the maintenance cost of the knowledge base in the later stage.
[0078] In one embodiment, Figure 3 As shown, step 210, if the first dialogue information can be merged with the context cache information, the first dialogue information is merged with the context cache information to obtain the merged dialogue information, including the following steps:
[0079] Step 302: Determine the question type of the first dialogue information.
[0080] Among them, if the first dialogue information cannot be matched to a corresponding question-answer pair in the preset knowledge base, it is considered that there is a problem in the first dialogue information.
[0081] Specifically, when it is determined that the first dialogue information does not match a corresponding question-answer pair in the preset knowledge base, it is determined what type of question the question in the first dialogue information belongs to.
[0082] Step 304: If the question type is a fusionable question type, determine whether the first dialog information can be fused with the context cache information.
[0083] If the problem in the first dialogue information can be solved by fusing the first dialogue information with the context cache information, such problem is classified as a fusible problem type. It can be understood that in this embodiment, the fusible problem types include but are not limited to missing subject, unclear reference, entity transformation, etc.
[0084] Specifically, after judging the question in the first dialogue information and determining that it is a fusionable question type, it is determined that the first dialogue information can be fused with the context cache information.
[0085] Step 306 , using a fusion method corresponding to the question type of the first dialogue information, the first dialogue information is fused with the context cache information to obtain fused dialogue information.
[0086] Specifically, a corresponding fusion method is determined according to the determined question type of the first dialogue information, and the first dialogue information is fused with the context cache information using the corresponding fusion method to obtain fused information. Each question type has a corresponding fusion method.
[0087] In this embodiment, when the user's first conversation information cannot obtain a matching result in the preset knowledge base, the problem existing in the first conversation information is automatically judged to determine the problem type, and the context cache information is fused with the first conversation information according to the fusion scheme corresponding to the problem type to obtain the fused conversation information. The conversation method in this embodiment can automatically solve the problem that the first conversation information cannot obtain a matching result from the preset knowledge base, thereby improving the success rate of the conversation and enhancing the user experience.
[0088] In one embodiment, step 302, determining the question type of the first dialogue message, includes the following steps:
[0089] Step 1: Perform syntactic analysis on the first dialogue information to obtain a syntactic analysis result.
[0090] Specifically, the first dialogue information is split according to the syntactic structure to obtain a syntactic analysis result, wherein the syntactic analysis result is the main sentence information of the subject, predicate, object, attributive, adverbial, complement, etc. corresponding to the first dialogue information.
[0091] Step 2: Determine the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result.
[0092] Specifically, the sentence structure of the first dialogue information is first determined according to the syntactic analysis result; the first dialogue information is segmented, and the component of each word in the sentence, such as subject, predicate, object, pronoun, etc., is determined according to the sentence structure and the syntactic analysis result.
[0093] Step 3: Determine the question type of the first dialogue information based on the sentence structure and the part of speech of each word.
[0094] Specifically, the question type of the first dialogue information is judged according to the sentence structure and the part of speech of the words, and the question type of the first dialogue information is determined.
[0095] In one embodiment, step 3, determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word, includes the following steps:
[0096] If the sentence structure lacks a subject based on the part of speech of each word, the problem type of the first dialogue information is determined to be missing subject; if there are words whose part of speech is a pronoun, the problem type of the first dialogue information is determined to be unclear reference.
[0097] Specifically, if the word parts of speech in the first dialogue information do not have a subject, it is determined that the sentence structure of the first dialogue information lacks a subject, and the problem type of the first dialogue information is defined as missing subject. If there is a word with a pronoun part of speech among the words in the first dialogue information, and the pronoun has no suitable referent in the first information, the problem type of the first dialogue information is defined as unclear reference.
[0098] In the above embodiment, the sentence structure of the first dialogue information and the part of speech of each word are determined through the syntactic analysis result, thereby determining the question type of the first dialogue information. Using the method in this embodiment, the question type of the first dialogue information can be quickly and accurately determined, which is helpful for subsequent determination of whether the first dialogue information can be fused with the context cache information, and subsequent search for a fusion method corresponding to the question type.
[0099] In one embodiment, step 302, determining the question type of the first dialogue message, further includes: if the entity of the first dialogue message is different from the entity in the context cache information, determining the question type of the first dialogue message is entity transformation.
[0100] The entities in the context cache are entities extracted from the previous round of conversation information in this conversation.
[0101] Specifically, the entity words extracted from the first dialogue information are compared with the entity words extracted from the previous round of conversation information. If the two are different, it is determined that the question type of the first dialogue information is entity transformation.
[0102] In this embodiment, the type of question in the first dialogue information is determined by comparing the entity words in the current round of conversation with the entity words in the previous round of conversation cached in the context cache information. Using the method in this embodiment, it is possible to automatically determine whether the entity in the first dialogue information has changed through the first dialogue information and the context cache information, thereby quickly and accurately determining the type of question in the first dialogue information, which is helpful for subsequent determination of whether the first dialogue information can be fused with the context cache information, and subsequent search for a fusion method corresponding to the type of question.
[0103] In one embodiment, step 306, using a fusion method corresponding to the question type of the first dialogue information, fuses the first dialogue information with the context cache information to obtain fused dialogue information, including the following steps:
[0104] Step 1: If the question type is missing subject, find the subject from the context cache information, complete the subject into the first dialogue information, and obtain the fused dialogue information.
[0105] Specifically, when it is determined that the question type of the first dialogue information is missing subject, the context cache information is obtained, the subject information in the previous round of conversation is searched in the context cache information, and the subject is completed in the first dialogue information to obtain the fused dialogue information.
[0106] In one embodiment, taking bank credit card business processing as the application environment and the terminal as an intelligent robot as an example:
[0107] The context cache contains the session information from previous rounds:
[0108] User: Hello, I would like to apply for a credit card.
[0109] Among them, the sentence analysis: subject (I), predicate (want to do), object (information card). Participle: hello (particle), I (noun), want to do (verb), Zhang (quantifier), credit card (noun)
[0110] Robot: OK, our bank now has three types of cards: gold card, silver card and ordinary card.
[0111] User: How much is the annual fee for the Silver Card?
[0112] Among them, the sentence analysis is: subject (silver card), predicate (need), object (how much annual fee). Participles: silver card (noun), need (verb), how much (question word), annual fee (noun).
[0113] Robot: 200 yuan per year.
[0114] The dialogue information entered by the user at this time is used as the first dialogue information:
[0115] User: Is there any free insurance?
[0116] Among them, the sentence structure analysis: subject (no), predicate (gift), object (insurance). Participle: have (verb), give (verb), insurance (noun).
[0117] At this time, the server can know from the grammatical analysis result that the question type of the first dialogue information is missing subject, so it obtains the previous round of conversation information in the context cache information:
[0118] User: How much is the annual fee for the Silver Card?
[0119] Among them, the sentence analysis is: subject (silver card), predicate (need), object (how much annual fee). Participles: silver card (noun), need (verb), how much (question word), annual fee (noun).
[0120] Robot: 200 yuan per year.
[0121] From the conversation information, we find that the subject is the silver card, and we complete the silver card to the subject position of the first conversation information, and the fused conversation information is: Does the silver card come with free insurance?
[0122] Step 2: If the question type is unclear reference, based on the position of the pronoun in the first dialogue information, find a word matching the pronoun from the context cache information, and replace the pronoun in the first dialogue information with the word to obtain the fused dialogue information.
[0123] Specifically, after determining that the question type of the first dialogue information is unclear reference, determine the position of the pronoun in the first dialogue information, obtain context cache information, search for words matching the pronoun in the previous round of conversation in the context cache information, use the words to replace the pronoun in the first dialogue information, and obtain the fused dialogue information.
[0124] In one embodiment, taking bank credit card business processing as the application environment and the terminal as an intelligent robot as an example:
[0125] The context cache contains the session information from previous rounds:
[0126] User: Hello, I would like to apply for a credit card.
[0127] Among them, the sentence analysis: subject (I), predicate (want to do), object (information card). Participle: hello (particle), I (noun), want to do (verb), Zhang (quantifier), credit card (noun)
[0128] Robot: OK, our bank now has three types of cards: gold card, silver card and ordinary card.
[0129] User: How much is the annual fee for the Silver Card?
[0130] Among them, the sentence analysis is: subject (silver card), predicate (need), object (how much annual fee). Participles: silver card (noun), need (verb), how much (question word), annual fee (noun).
[0131] Robot: 200 yuan per year.
[0132] The dialogue information entered by the user at this time is used as the first dialogue information:
[0133] User: Does it come with free insurance?
[0134] Among them, the sentence structure analysis: subject (it), predicate (have gift), object (insurance). Participle: it (pronoun), have (verb), gift (verb), insurance (noun).
[0135] At this time, the server can know from the grammatical analysis result that the question type of the first dialogue information is unclear reference, so it obtains the previous round of conversation information in the context cache information:
[0136] User: How much is the annual fee for the Silver Card?
[0137] Among them, the sentence analysis is: subject (silver card), predicate (need), object (how much annual fee). Participles: silver card (noun), need (verb), how much (question word), annual fee (noun).
[0138] Robot: 200 yuan per year.
[0139] The noun "silver card" is found from the conversation information, and the pronoun "it" in the first conversation information is replaced with "silver card" to obtain the fused conversation information: Does the silver card come with free insurance?
[0140] Step 3: If the question type is entity transformation, replace the entity in the first dialogue information with the entity in the context cache information to obtain the fused dialogue information, or replace the entity in the context cache information with the entity in the first dialogue information to obtain the fused dialogue information.
[0141] Specifically, when it is determined that the question type of the first dialogue information is entity transformation, the context cache information is obtained, and the entity words extracted in the previous round of conversation are searched in the context cache information, and the entity words in the first dialogue information are replaced with the entity words to obtain the fused dialogue information. Alternatively, the entity in the first dialogue information is replaced with the entity in the previous round of conversation information, and other information in the previous round of conversation information is retained to obtain the fused dialogue information.
[0142] In one embodiment, taking bank credit card business processing as the application environment and the terminal as an intelligent robot as an example:
[0143] The context cache contains the session information from previous rounds:
[0144] User: Hello, I would like to apply for a credit card.
[0145] Among them, the sentence analysis: subject (I), predicate (want to do), object (information card). Participle: hello (particle), I (noun), want to do (verb), Zhang (quantifier), credit card (noun)
[0146] Robot: OK, our bank now has three types of cards: gold card, silver card and ordinary card.
[0147] User: How much is the annual fee for the gold card?
[0148] Among them, sentence pattern analysis: subject (gold card, annual fee), object (how much). Word segmentation: gold card (noun), annual fee (noun), how much (interrogative word). Entity extraction: gold card (credit card).
[0149] Machine: 800 yuan a year, but comes with a life accident insurance worth 5 million yuan as a gift.
[0150] Take the dialogue information input by the user at this time as the first dialogue information:
[0151] User: What about the silver card?
[0152] Among them, sentence pattern analysis: none. Word segmentation: silver card (noun), what about (interrogative word). Entity extraction: silver card (credit card).
[0153] Specifically, taking "What about the silver card?" as the first dialogue information, no matching result can be obtained in the preset knowledge base, so obtain the previous round of conversation information in the context cache information:
[0154] User: How much is the annual fee for the gold card?
[0155] Among them, sentence pattern analysis: subject (gold card, annual fee), object (how much). Word segmentation: gold card (noun), annual fee (noun), how much (interrogative word). Entity extraction: gold card (credit card).
[0156] Machine: 800 yuan a year, but comes with a life accident insurance worth 5 million yuan as a gift.
[0157] It can be seen that the entity in the previous round of conversation information is the gold card (credit card). Replace the entity silver card in the first dialogue information with the entity in the previous round of conversation information to obtain the fused dialogue information: How much is the annual fee for the silver card?
[0158] In the above embodiment, after determining the problem type of the first dialogue information, according to the fusion method corresponding to the problem type, fuse the first dialogue information with the statement cache information to obtain the fused dialogue information. Using the method of this embodiment, when the first dialogue information cannot obtain a matching result in the preset knowledge base, it can automatically fuse with the context cache information according to the fusion method corresponding to the problem type of the first dialogue information, and use the statement cache information to solve the problems existing in the first dialogue information. There is no need for manual anticipation addition or processing logic for the entire conversation process, which improves the success rate of multi-round conversations while reducing the workload of knowledge base management personnel and greatly reducing the后期 maintenance cost of the knowledge base.
[0159] In one of the embodiments, step 306, after fusing the first dialogue information with the context cache information using a fusion method corresponding to the question type of the first dialogue information, obtaining the fused dialogue information, further includes: if the question type does not belong to a fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a rhetorical question based on the first dialogue information, and replying with the rhetorical question as reply information.
[0160] Specifically, if it is determined that the question type of the first dialogue information does not belong to the fusible question type, the first dialogue information cannot solve its own problem by fusing with the context cache information. At this time, a rhetorical question is generated according to the first dialogue information, and the rhetorical question is replied as reply information.
[0161] In one embodiment, taking bank credit card business processing as the application environment and the terminal as an intelligent robot as an example:
[0162] The information entered by the user at this time is the first dialogue information:
[0163] User: Hello, I want to apply for a card.
[0164] Among them, the sentence structure analysis: subject (I), predicate (want to do), object (card). Participle: hello (particle), I (noun), want to do (verb), Zhang (quantifier), card (noun).
[0165] Entity extraction: empty
[0166] Specifically, the specific information of the card is not clear here, and the system does not generate the context cache information of this conversation. At this time, the question type of the first conversation information does not belong to the fusion question type. At this time, the server generates a counter-question based on the unclear information in the first conversation information, that is, what card do you want to apply for? The counter-question is output as the reply information to the intelligent robot terminal to reply to the user's question.
[0167] In this embodiment, when it is determined that the question type of the first dialogue information does not belong to the type of fused question, the server generates a corresponding rhetorical question based on the unclear information in the first dialogue information, and uses the rhetorical question as reply information to reply to the user's question. Using the method in this embodiment, when the first dialogue information is unclear, a corresponding rhetorical question can be generated, and more information can be obtained through the user's reply to the rhetorical question, so as to obtain the most matching reply information. There is no need to manually add anticipation or external logic to the entire conversation process, which not only improves the success rate of multiple rounds of conversations, but also reduces the workload of knowledge base managers, greatly reducing the maintenance cost of the knowledge base in the later stage.
[0168] In one embodiment, if Figure 4As shown, a session method is provided, comprising the following steps:
[0169] This embodiment involves a terminal and a server. Taking the terminal as an intelligent robot as an example, it is applied in a banking business processing environment. The intelligent robot communicates with the server through a network, receives the dialogue information input by the user, and sends the dialogue information to the server through the network. The server includes a data storage system, which stores a preset knowledge base and context cache information. The context cache information includes the second dialogue information input by the user received in this dialogue, and the grammatical analysis results of each second dialogue information. The second dialogue information is the dialogue information input by the user in the previous rounds of conversations in this dialogue. The preset knowledge base is the question-answer pair information generated and recorded according to the internal business rules corresponding to the application field.
[0170] The intelligent robot receives the dialogue information input by the user, sends the dialogue information to the server through the network, and the server uses the received dialogue information as the first dialogue information; extracts keywords in the first dialogue information, compares the extracted keywords with the keywords in the context cache information, and determines whether the dialogue context has changed.
[0171] If the conversation context changes, context cache information of the current conversation context is created in the server, and then syntax analysis is performed on the first conversation information; if the conversation context does not change, syntax analysis is directly performed on the first conversation information.
[0172] Sentences in the first dialogue information are segmented, and the part of speech of each word in the first dialogue information is determined according to the syntactic analysis result. Entities are extracted from the first dialogue information at the same time. The analysis result is recorded in the context cache information of the created current conversation context.
[0173] According to the extracted entity query preset knowledge base, the first dialogue information is matched with the question and answer information obtained according to the entity query to determine whether there is a matching result. If there is a matching result, the answer information in the matching result is returned to the intelligent robot as reply information; if there is no matching result, the question type in the first dialogue information is determined.
[0174] If the existing question type is a missing subject, the subject is found from the context cache information to complete the first dialogue information; if the existing question type is unclear reference, the corresponding reference word is found from the context cache information to replace it; if the existing question type is an entity change, the corresponding entity word is found from the context cache information to replace it. If the existing question type does not belong to the above three types, a rhetorical question is generated according to the first dialogue information, and the rhetorical question is sent to the intelligent robot to ask the user a rhetorical question to further collect information. The user replies to the answer dialogue information according to the rhetorical question, and the intelligent robot sends the answer dialogue information to the server. The server uses the received answer dialogue information as the new first dialogue information and returns to determine whether the statement is sent to change the step. Until the end of the session.
[0175] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0176] Based on the same inventive concept, the embodiment of the present application also provides a conversation device for implementing the conversation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more conversation device embodiments provided below can refer to the limitations on the conversation method above, and will not be repeated here.
[0177] In one embodiment, Figure 5 As shown, a conversation device is provided, including: an entity matching module 402, a matching result judgment module 404 and an information fusion module 406, wherein:
[0178] The entity matching module 402 is used to receive the first dialogue information input by the user; perform entity extraction on the first dialogue information to obtain entity extraction results, and match the entity extraction results in a preset knowledge base.
[0179] The matching result judgment module 404 is used to output the corresponding answer in the preset knowledge base as a reply message if there is a matching result; if there is no matching result, obtain the stored context cache information, the context cache information includes the second dialogue information input by the user received in this dialogue, and the grammatical analysis results of each second dialogue information.
[0180] The information fusion module 406 is used to fuse the first dialogue information with the context cache information if the first dialogue information can be fused with the context cache information to obtain fused dialogue information, use the fused dialogue information as the first dialogue information, and return to the step of extracting entities from the first dialogue information.
[0181] The above-mentioned conversation device can perform grammatical analysis based on the historical conversation information received in this conversation, and store the analysis results in the context cache information in chronological order. When receiving the conversation information input by the user and needing to reply to it, the conversation information that cannot directly give an answer is automatically merged with the context cache information, and the best answer is found based on the merged conversation information. When using this conversation device, when receiving conversation information that cannot directly give an answer, the complete conversation information can be merged by analyzing and extracting the previous context cache information, so as to match the reply information that is more in line with the current conversation context to the user based on the complete conversation information, greatly improving the success rate of multiple rounds of conversations. At the same time, since this conversation process does not require manual corpus addition or external logic for the entire conversation process, the workload of knowledge base managers is reduced, and the maintenance cost of the knowledge base in the later stage is reduced.
[0182] In one of the embodiments, if the first dialogue information can be fused with the context cache information, the information fusion module fuses the first dialogue information with the context cache information to obtain the fused dialogue information, including: determining the question type of the first dialogue information; if the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information; using a fusion method corresponding to the question type of the first dialogue information to fuse the first dialogue information with the context cache information to obtain the fused dialogue information.
[0183] In one embodiment, the information fusion module determines the question type of the first dialogue information in the following manner: performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result; determining the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result; and determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word.
[0184] In one embodiment, when the information fusion module determines the problem type of the first dialogue information based on the sentence structure and the part of speech of each word, it includes: if it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the problem type of the first dialogue information is missing subject; if there are words whose part of speech is pronoun, determining the problem type of the first dialogue information is unclear reference.
[0185] In one of the embodiments, when the information fusion module determines the question type of the first dialogue information based on the sentence structure and the part of speech of each word, it also includes: if the entity of the first dialogue information is different from the entity in the context cache information, determining that the question type of the first dialogue information is an entity transformation.
[0186] In one embodiment, when the information fusion module adopts a fusion method corresponding to the question type of the first dialogue information to fuse the first dialogue information with the context cache information to obtain the fused dialogue information, the information fusion module includes:
[0187] If the question type is missing subject, the subject is found from the context cache information, and the subject is completed in the first dialogue information to obtain the fused dialogue information; if the question type is unclear reference, based on the position of the pronoun in the first dialogue information, the word matching the pronoun is found from the context cache information, and the word replaces the pronoun in the first dialogue information to obtain the fused dialogue information; if the question type is entity transformation, the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information, or, the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information.
[0188] In one of the embodiments, the conversation device further includes: a counter-question module;
[0189] The rhetorical question module is used to determine that the first dialogue information cannot be fused with the context cache information if the question type does not belong to the fusionable question type, determine the rhetorical question based on the first dialogue information, and reply with the rhetorical question as reply information.
[0190] Each module in the above conversation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0191] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store preset knowledge base data and context cache information data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a conversation method is implemented.
[0192] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0193] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0194] Receiving first dialogue information input by a user;
[0195] Performing entity extraction on the first dialogue information to obtain entity extraction results; matching the entity extraction results in a preset knowledge base;
[0196] If there is a matching result, the corresponding answer in the preset knowledge base is output as a reply message;
[0197] If there is no matching result, obtaining stored context cache information, the context cache information including second dialogue information input by the user received in the current dialogue, and syntax analysis results of each second dialogue information;
[0198] If the first dialogue information can be fused with the context cache information, the first dialogue information is fused with the context cache information to obtain fused dialogue information, the fused dialogue information is used as the first dialogue information, and the step of extracting entities from the first dialogue information is returned.
[0199] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0200] Determine the question type of the first dialogue message;
[0201] If the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information;
[0202] The first dialogue information is fused with the context cache information using a fusion method corresponding to the question type of the first dialogue information to obtain fused dialogue information.
[0203] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0204] Performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
[0205] Determine the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
[0206] Based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
[0207] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0208] If it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the question type of the first dialogue information is missing a subject;
[0209] If there is a word whose part of speech is a pronoun, it is determined that the question type of the first dialogue information is unclear reference.
[0210] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0211] If the entity of the first dialogue information is different from the entity in the context cache information, it is determined that the question type of the first dialogue information is entity transformation.
[0212] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0213] If the question type is missing subject, find the subject from the context cache information, complete the subject into the first dialogue information, and obtain the fused dialogue information;
[0214] If the question type is unclear reference, based on the position of the pronoun in the first dialogue information, find a word matching the pronoun from the context cache information, and replace the pronoun in the first dialogue information with the word to obtain the fused dialogue information;
[0215] If the question type is entity transformation, the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information, or the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information.
[0216] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0217] If the question type does not belong to a fusionable question type, it is determined that the first dialogue information cannot be fused with the context cache information, a rhetorical question is determined based on the first dialogue information, and the rhetorical question is replied as reply information.
[0218] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0219] Receiving first dialogue information input by a user;
[0220] Performing entity extraction on the first dialogue information to obtain entity extraction results; matching the entity extraction results in a preset knowledge base;
[0221] If there is a matching result, the corresponding answer in the preset knowledge base is output as a reply message;
[0222] If there is no matching result, obtaining stored context cache information, the context cache information including second dialogue information input by the user received in the current dialogue, and syntax analysis results of each second dialogue information;
[0223] If the first dialogue information can be fused with the context cache information, the first dialogue information is fused with the context cache information to obtain fused dialogue information, the fused dialogue information is used as the first dialogue information, and the step of extracting entities from the first dialogue information is returned.
[0224] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0225] Determine the question type of the first dialogue message;
[0226] If the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information;
[0227] The first dialogue information is fused with the context cache information using a fusion method corresponding to the question type of the first dialogue information to obtain fused dialogue information.
[0228] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0229] Performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
[0230] Determine the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
[0231] Based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0233] If it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the question type of the first dialogue information is missing a subject;
[0234] If there is a word whose part of speech is a pronoun, it is determined that the question type of the first dialogue information is unclear reference.
[0235] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0236] If the entity of the first dialogue information is different from the entity in the context cache information, it is determined that the question type of the first dialogue information is entity transformation.
[0237] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0238] If the question type is missing subject, find the subject from the context cache information, complete the subject into the first dialogue information, and obtain the fused dialogue information;
[0239] If the question type is unclear reference, based on the position of the pronoun in the first dialogue information, find a word matching the pronoun from the context cache information, and replace the pronoun in the first dialogue information with the word to obtain the fused dialogue information;
[0240] If the question type is entity transformation, the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information, or the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information.
[0241] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0242] If the question type does not belong to a fusionable question type, it is determined that the first dialogue information cannot be fused with the context cache information, a rhetorical question is determined based on the first dialogue information, and the rhetorical question is replied as reply information.
[0243] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0244] Receiving first dialogue information input by a user;
[0245] Performing entity extraction on the first dialogue information to obtain entity extraction results; matching the entity extraction results in a preset knowledge base;
[0246] If there is a matching result, the corresponding answer in the preset knowledge base is output as a reply message;
[0247] If there is no matching result, obtaining stored context cache information, the context cache information including second dialogue information input by the user received in the current dialogue, and syntax analysis results of each second dialogue information;
[0248] If the first dialogue information can be fused with the context cache information, the first dialogue information is fused with the context cache information to obtain fused dialogue information, the fused dialogue information is used as the first dialogue information, and the step of extracting entities from the first dialogue information is returned.
[0249] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0250] Determine the question type of the first dialogue message;
[0251] If the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information;
[0252] The first dialogue information is fused with the context cache information using a fusion method corresponding to the question type of the first dialogue information to obtain fused dialogue information.
[0253] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0254] Performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
[0255] Determine the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
[0256] Based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
[0257] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0258] If it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the question type of the first dialogue information is missing a subject;
[0259] If there is a word whose part of speech is a pronoun, it is determined that the question type of the first dialogue information is unclear reference.
[0260] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0261] If the entity of the first dialogue information is different from the entity in the context cache information, it is determined that the question type of the first dialogue information is entity transformation.
[0262] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0263] If the question type is missing subject, find the subject from the context cache information, complete the subject into the first dialogue information, and obtain the fused dialogue information;
[0264] If the question type is unclear reference, based on the position of the pronoun in the first dialogue information, find a word matching the pronoun from the context cache information, and replace the pronoun in the first dialogue information with the word to obtain the fused dialogue information;
[0265] If the question type is entity transformation, the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information, or the entity in the first dialogue information is replaced with the entity in the context cache information to obtain the fused dialogue information.
[0266] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0267] If the question type does not belong to a fusionable question type, it is determined that the first dialogue information cannot be fused with the context cache information, a rhetorical question is determined based on the first dialogue information, and the rhetorical question is replied as reply information.
[0268] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0269] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0270] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0271] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A conversational method, It is characterized in that The method comprises: Receiving first dialogue information input by a user; Performing entity extraction on the first conversation information to obtain entity extraction results; matching the entity extraction results in a preset knowledge base; If there is a matching result, the corresponding answer in the preset knowledge base is output as reply information; If there is no matching result, obtaining stored context cache information, the context cache information including the second dialogue information input by the user received in the current dialogue, and the grammatical analysis results of each of the second dialogue information; Determining a question type of the first dialogue information; If the question type belongs to a fusionable question type, determining that the first dialogue information can be fused with the context cache information; If the question type is missing subject, searching for a subject from the context cache information, and completing the subject into the first dialogue information to obtain fused dialogue information; If the question type is unclear reference, based on the position of the pronoun in the first dialogue information, searching for a word matching the pronoun from the context cache information, and replacing the pronoun in the first dialogue information with the word to obtain fused dialogue information; If the question type is entity transformation, replace the entity in the first dialogue information with the entity in the context cache information to obtain fused dialogue information, or replace the entity in the context cache information with the entity in the first dialogue information to obtain fused dialogue information; The fused conversation information is used as the first conversation information, and the process returns to the step of performing entity extraction on the first conversation information.
2. The method according to claim 1, It is characterized in that The method of determining the question type of the first dialogue information includes: Performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result; Determining the sentence structure and the part of speech of each word of the first dialogue information according to the syntactic analysis result; Based on the sentence structure and the part of speech of each word, a question type of the first dialogue information is determined.
3. The method according to claim 2, It is characterized in that The determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word includes: If it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the question type of the first dialogue information is missing a subject; If there are words whose part of speech is a pronoun, it is determined that the question type of the first dialogue information is unclear reference.
4. The method according to claim 3, It is characterized in that The determining the question type of the first dialogue information further includes: If the entity of the first dialogue information is different from the entity in the context cache information, it is determined that the question type of the first dialogue information is entity transformation.
5. The method according to claim 1, It is characterized in that The method further comprises: If the question type does not belong to a fusionable question type, it is determined that the first dialogue information cannot be fused with the context cache information, a rhetorical question is determined based on the first dialogue information, and the rhetorical question is replied as reply information.
6. A conversation device, It is characterized in that The device comprises: An entity matching module is used to receive first dialogue information input by a user; perform entity extraction on the first dialogue information to obtain an entity extraction result, and match the entity extraction result in a preset knowledge base; a matching result judgment module, configured to output the corresponding answer in the preset knowledge base as a reply message if a matching result exists; and to obtain the stored context cache information if no matching result exists, wherein the context cache information includes the second dialogue information input by the user received in the current dialogue, and the grammatical analysis results of each of the second dialogue information; an information fusion module, configured to determine a question type of the first dialogue information; if the question type belongs to a fusionable question type, determine that the first dialogue information can be fused with the context cache information; if the question type is missing subject, find a subject from the context cache information, complete the subject in the first dialogue information, and obtain fused dialogue information; if the question type is unclear reference, based on the position of the pronoun in the first dialogue information, find a word matching the pronoun from the context cache information, and replace the pronoun in the first dialogue information with the word, and obtain fused dialogue information; if the question type is entity transformation, replace the entity in the first dialogue information with the entity in the context cache information, and obtain fused dialogue information, or replace the entity in the context cache information with the entity in the first dialogue information, and obtain fused dialogue information; use the fused dialogue information as the first dialogue information, and return to the step of extracting entities from the first dialogue information.
7. The device according to claim 6, It is characterized in that The information fusion module determines the question type of the first dialogue information in the following manner: performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result; determining a sentence structure and a part of speech of each word of the first dialogue information according to the syntactic analysis result; and determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word.
8. The device according to claim 7, It is characterized in that When the information fusion module determines the problem type of the first dialogue information based on the sentence structure and the part of speech of each word, it includes: if it is determined based on the part of speech of each word that the sentence structure lacks a subject, determining the problem type of the first dialogue information is missing subject; if there are words whose part of speech is a pronoun, determining the problem type of the first dialogue information is unclear reference.
9. The device according to claim 8, It is characterized in that When the information fusion module determines the question type of the first dialogue information based on the sentence structure and the part of speech of each word, it also includes: if the entity of the first dialogue information is different from the entity in the context cache information, determining that the question type of the first dialogue information is entity transformation.
10. The device according to claim 6, It is characterized in that The device also includes: a counter-question module; The rhetorical question module is used to determine that the first dialogue information cannot be fused with the context cache information if the question type does not belong to the fusionable question type, determine a rhetorical question based on the first dialogue information, and reply with the rhetorical question as reply information.
11. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
13. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
