Man-machine conversation method and device, electronic equipment and storage medium

By distinguishing the state of human-computer dialogue and using different generation methods, the problem of insufficient accuracy and universality of human-computer dialogue in the prior art is solved, and more efficient and accurate dialogue processing is achieved.

CN119621885APending Publication Date: 2025-03-14CHONGQING QIYI TIANXIA SCI & TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411576200.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

Existing human-computer dialogue methods have shortcomings in accuracy and versatility, especially in specific areas, with low replies resulting from relying solely on language models and poor universality in dialogue using manual rules.

Method used

By determining whether the current human-computer dialogue state is in the consulting task state, if so, determine the consulting key parameters based on the consulting statement and generate a reply statement; if so, determine the consulting intention category of the consulting statement based on the pre-trained intention classification model, and generate the reply statement using the language model according to the corresponding reply statement generation method.

Benefits of technology

It improves the accuracy and versatility of human-computer dialogue, avoids the problem of low response accuracy in some areas, and the problem of poor versatility of using manual rules for dialogue.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119621885A_ABST
    Figure CN119621885A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a man-machine conversation method and device, electronic equipment and a storage medium. The method comprises the steps that a consultation statement input by a user is acquired; determining whether the current man-machine conversation state is in a consultation task internal state or not; if in the consultation task internal state, based on the consultation statement, determining consultation key parameters; generating reply statements of the consultation statements based on the consultation key parameters; if the consultation statement is not in the consultation task internal state, determining a consultation intention category of the consultation statement based on a pre-trained intention classification model; and according to a preset reply statement generation mode corresponding to the consulting intention category, utilizing a preset language model to generate a reply statement of the consulting statement. According to the embodiment of the invention, the accuracy and universality of man-machine conversation are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a human-computer dialogue method, device, electronic device and computer-readable storage medium. Background Art

[0002] Human-computer dialogue has always been a hot topic in the field of artificial intelligence (AI), and products such as intelligent customer service robots and chatbots are widely used. Human-computer dialogue usually goes through multiple rounds to understand the user's current dialogue status and intentions, which is critical for successfully answering user questions. The current technologies used in human-computer dialogue mainly include:

[0003] 1. Customized rules. For example, determine whether the user's current conversation is an elliptical sentence, whether there are pronouns (he, this, etc.), etc. If so, replace and complete the sentence based on the conversation history of the previous rounds. This solution, on the one hand, is time-consuming to manually define rules, and errors may occur during completion; on the other hand, the rules can only cover a small part of the scenarios. Therefore, the overall effect is limited.

[0004] 2. Direct rewriting of large language models (LLMs). The historical conversations are fed into a large language model, which generates sentences that contain the user's current explicit intentions, and then questions and answers are conducted based on the sentences. Although this is simple, large language models have limited knowledge in the field, and the rewriting effect is not as good as expected, especially for human-computer dialogues in specific scenarios (such as bank intelligent customer service and legal question-and-answer robots). Summary of the invention

[0005] In view of this, in order to solve some or all of the above technical problems, the embodiments of the present application provide a human-computer dialogue method, device, electronic device and computer-readable storage medium.

[0006] In a first aspect, an embodiment of the present application provides a human-computer dialogue method, the method comprising: obtaining a consultation statement input by a user; determining whether the current human-computer dialogue state is in a consultation task state; if in a consultation task state, determining consultation key parameters based on the consultation statement; generating a reply statement for the consultation statement based on the consultation key parameters; if not in a consultation task state, determining the consultation intent category of the consultation statement based on a pre-trained intent classification model; generating a reply statement for the consultation statement according to a preset reply statement generation method corresponding to the consultation intent category and using a preset language model.

[0007] In one possible implementation, if the consultation task is in progress, key consultation parameters are determined based on the consultation statement, including: determining whether the consultation statement contains key consultation parameters; if contained, extracting the key consultation parameters from the consultation statement; if not contained, determining the consultation intent category of the consultation statement based on the intent classification model; if the consultation intent category is a chat category or an incomplete business consultation category, clarifying the parameters of the consultation statement to obtain the key consultation parameters.

[0008] In one possible implementation, after determining the consultation intent category of the consultation statement based on the intent classification model, the method further includes: if the consultation intent category is a complete business consultation category, using a language model to process the consultation statement and generate a reply statement to the consultation statement.

[0009] In one possible implementation, a reply statement to a consultation statement is generated according to a preset method for generating a reply statement corresponding to a consultation intention category and using a preset language model, including: if the consultation intention category is a complete business consultation category, using a language model to process the consultation statement to generate a reply statement to the consultation statement; if the consultation intention category is an incomplete business consultation category, obtaining the user's historical conversation sentences, and using a language model to rewrite the historical conversation sentences and the consultation sentence to obtain a rewritten sentence containing a clear consultation intention; using a language model to process the rewritten sentence to generate a reply statement to the consultation statement.

[0010] In one possible implementation, a language model is used to rewrite historical conversation sentences and consultation sentences to obtain rewritten sentences that contain clear consultation intentions, including: adding historical conversation sentences and consultation sentences to a preset first prompt sentence template to obtain a first prompt sentence for prompting the language model to generate a rewritten sentence; and inputting the first prompt sentence into the language model to obtain a rewritten sentence.

[0011] In one possible implementation, if the consultation intention category is a complete business consultation category, a language model is used to process the consultation statement to generate a reply statement for the consultation statement, including: adding the consultation statement to a second prompt statement template containing a preset business knowledge base name to obtain a second prompt statement; inputting the second prompt statement into the language model to generate a reply statement for the consultation statement; using the language model, the rewritten statement is processed to generate a reply statement for the consultation statement, including: adding the rewritten statement to a third prompt statement template containing the business knowledge base name to obtain a third prompt statement; inputting the third prompt statement into the language model to generate a reply statement for the consultation statement.

[0012] In one possible implementation, a reply statement to the consultation statement is generated according to a preset method for generating a reply statement corresponding to the consultation intent category using a preset language model, including: if the consultation intent category is a small talk category, adding the consultation statement to a fourth prompt statement template containing a preset small talk knowledge base name to obtain a fourth prompt statement; inputting the fourth prompt statement into the language model to generate a reply statement to the consultation statement.

[0013] In a second aspect, an embodiment of the present application provides a human-computer dialogue device, which includes: an acquisition module for acquiring a consultation statement input by a user; a first determination module for determining whether the current human-computer dialogue state is in a consultation task state; a second determination module for determining consultation key parameters based on the consultation statement if it is in a consultation task state; a first generation module for generating a reply statement to the consultation statement based on the consultation key parameters; a third determination module for determining the consultation intent category of the consultation statement based on a pre-trained intent classification model if it is not in a consultation task state; and a second generation module for generating a reply statement to the consultation statement using a preset language model in accordance with a preset reply statement generation method corresponding to the consultation intent category.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a memory for storing a computer program; a processor for executing the computer program stored in the memory, and when the computer program is executed, the method of any embodiment of the human-computer interaction method of the first aspect of the present application is implemented.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, a method as in any embodiment of the human-computer interaction method of the first aspect described above is implemented.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program, which includes a computer-readable code. When the computer-readable code runs on a device, the processor in the device implements a method as in any embodiment of the human-computer interaction method of the first aspect mentioned above.

[0017] The human-computer dialogue method, device, electronic device and computer-readable storage medium provided in the embodiment of the present application determine whether the current human-computer dialogue state is in the consultation task state. If so, determine the consultation key parameters based on the consultation statement, and generate a reply statement for the consultation statement based on the consultation key parameters; if not, determine the consultation intent category of the consultation statement based on the pre-trained intention classification model, and generate a reply statement for the consultation statement using a preset language model in accordance with the reply statement generation method corresponding to the consultation intent category. The embodiment of the present application achieves the distinction between the consultation task state and the consultation task state, generates reply statements in different ways according to different states, generates reply statements according to the consultation key parameters when in the consultation task state, and generates reply statements according to the consultation key parameters when in the consultation task state, and uses the language model to generate reply statements according to the intention category because the user's consultation intention may be unclear, thereby avoiding the problem of low reply accuracy in certain fields caused by the existing human-computer dialogue method completely relying on the language model, and the problem of poor versatility of using artificial rules for dialogue. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0020] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0021] Figure 1 A flowchart of a human-computer dialogue method provided in an embodiment of the present application;

[0022] Figure 2 A flowchart of another human-computer dialogue method provided in an embodiment of the present application;

[0023] Figure 3 A flowchart of another human-computer dialogue method provided in an embodiment of the present application;

[0024] Figure 4 A flowchart of another human-computer dialogue method provided in an embodiment of the present application;

[0025] Figure 5 A flowchart of another human-computer dialogue method provided in an embodiment of the present application;

[0026] Figure 6 An exemplary flow chart for generating a reply statement provided in an embodiment of the present application;

[0027] Figure 7 A schematic diagram of the structure of a human-computer dialogue device provided in an embodiment of the present application;

[0028] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that unless otherwise specifically stated, the relative arrangement of the components and steps, the numerical expressions and the numerical values ​​described in these embodiments do not limit the scope of the present application.

[0030] Those skilled in the art will understand that the terms "first" and "second" in the embodiments of the present application are only used to distinguish between different steps, devices, modules and other objects, and do not represent any specific technical meanings, nor do they indicate the logical order between them.

[0031] It should also be understood that in this embodiment, “plurality” may refer to two or more than two, and “at least one” may refer to one, two or more than two.

[0032] It should also be understood that any component, data or structure mentioned in the embodiments of the present application can generally be understood as one or more, unless explicitly limited or otherwise indicated in the context.

[0033] In addition, the term "and / or" in this application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0034] It should also be understood that the description of the various embodiments in this application focuses on the differences between the various embodiments, and the same or similar aspects thereof can be referenced to each other, and for the sake of brevity, they will not be described one by one.

[0035] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the present application, its application, or uses.

[0036] Technologies, circuits, and devices known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, the above-mentioned technologies, circuits, and devices should be considered as part of the specification.

[0037] It should be noted that like reference numerals and letters refer to similar items in the following figures, and therefore, once an item is defined in one figure, it need not be further discussed in subsequent figures.

[0038] It should be noted that, in the absence of conflict, the embodiments in this application and the features in the embodiments can be combined with each other. To facilitate the understanding of the embodiments of the present application, the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0039] In order to solve the technical problem of low accuracy of human-computer dialogue in the prior art, the present application provides a human-computer dialogue method, which can generate reply statements in different ways according to the consultation task status, thereby improving the accuracy and versatility of human-computer dialogue.

[0040] Figure 1 A flowchart of a human-computer dialogue method provided in an embodiment of the present application. The method can be applied to a server, that is, the server receives an inquiry statement input by a user, executes the method based on the inquiry statement, generates a reply statement, and feeds back the reply statement to a terminal device used by the user. In addition, the method can also be executed by one or more electronic devices such as a smart phone, a laptop computer, a desktop computer, a portable computer, etc.

[0041] In addition, the execution subject of the present method may be hardware or software. When the execution subject is hardware, the execution subject may be one or more of the electronic devices. For example, a single electronic device may execute the present method, or a plurality of electronic devices may cooperate with each other to execute the present method. When the execution subject is software, the present method may be implemented as a plurality of software or software modules, or as a single software or software module. No specific limitation is made herein.

[0042] like Figure 1 As shown, the method specifically includes:

[0043] Step 101: Obtain a consultation statement input by a user.

[0044] In some embodiments, the inquiry statement input by the user may be a statement of various fields and types. For example, the inquiry statement may be an inquiry statement input by the user when booking an air ticket.

[0045] Step 102, determining whether the current human-computer dialogue state is in the consultation task state.

[0046] In some embodiments, the state in the consultation task is at least one round of human-computer dialogue currently being executed, which is a task performed by the user for a specific consultation service. For example, if a keyword representing a certain service is extracted from the consultation sentence input by the user, it is determined that the user is currently consulting a specific service, and the consultation task is entered at this time. In the consultation task, the electronic device and the user have at least one round of human-computer dialogue.

[0047] Optionally, if it is determined that the current human-computer dialogue state is out of task, you can continue to determine whether the consultation statement is a question-and-answer type statement. If so, determine that the consultation statement is a question-and-answer type statement (for example, the statement "What is the URL of xxx website?"); otherwise, determine that the consultation statement is a chat type statement (for example, "Hello").

[0048] Optionally, the consultation statement may be preprocessed first to normalize the format of the consultation statement for easy identification and processing. As an example, the preprocessing method may include text preprocessing such as traditional and simplified Chinese characters, letter case conversion, and extraction, normalization, and desensitization of special fields such as mobile phone numbers, IP addresses, etc.

[0049] Step 103: If the system is in the consultation task state, determine the key consultation parameters based on the consultation statement.

[0050] In some embodiments, the dialogue rules for the current consulting task can be pre-set, and according to the rules, the key consultation parameters can be extracted from the consulting statement. As an example, a canvas-based dialogue rule setting method can be used to set a set of dialogue rules for the current consulting task, and by executing the rules, the key consultation parameters can be extracted from the consulting statement. As an example, a set of dialogue rules for booking air tickets can be set in advance using canvas, and according to the dialogue rules, parameters such as booking time, starting point, end point, seat type, etc. can be extracted from the consulting statement, and these parameters are the key consultation parameters.

[0051] Step 104, generating a reply statement to the consultation statement based on the consultation key parameters.

[0052] In some embodiments, a reply statement corresponding to the key consultation parameters can be generated according to the dialogue rules of the current consultation task. For example, if the consultation statement includes the starting point and the destination of the ticket, the reply statement can include the flight information from the starting point to the destination, and further output a statement asking the user about the flight time. Through at least one round of dialogue, the user's consultation question is answered.

[0053] Step 105: If the system is not in the consultation task state, determine the consultation intent category of the consultation sentence based on a pre-trained intent classification model.

[0054] In some embodiments, if it is determined based on the consultation statement that the user is not currently in the consultation task, the intent classification model can be used to determine the user's true consultation intention. For example, if the last consultation task has been completed, and the consultation statement currently input by the user does not contain the keywords for consulting a specific business, it is determined that the user is not in the consultation task state. At this time, in order to clarify the user's true consultation intention, the intent classification model can be used to determine the consultation intention category of the consultation statement.

[0055] The intent classification model can be pre-trained, that is, a large number of user historical conversations are collected as sample data in advance, and the corresponding annotation category of each sample data is set. By adjusting the parameters of the initial model, the error between the predicted consultation intent category actually output by the model and the actual annotated category is gradually reduced until the training end condition is met, and the intent classification model is obtained. The structure of the intent classification model can be set according to actual needs. For example, a deep learning model of the BERT (Bidirectional Encoder Representations from Transformers) type can be used as the intent classification model.

[0056] Optionally, the consultation intention categories may include a complete business consultation category, an incomplete business consultation category, and a chat category.

[0057] Step 106, generating a reply statement to the consultation statement according to a preset method of generating a reply statement corresponding to the consultation intention category and using a preset language model.

[0058] In some embodiments, different consultation intent categories can set different reply statement generation methods, and a language model is required when generating reply statements. Among them, the language model can be various types of generative large language models, such as ChatGPT, etc. As an example, if the consultation intent category is an incomplete business category, that is, the complete business needs cannot be clearly defined from the consultation statement input by the user, then it is necessary to use the language model to rewrite the consultation statement, and then input the rewritten consultation statement into the language model to obtain a reply statement.

[0059] For another example, if the consultation intent category is a complete business category, that is, the business needs can be clearly identified from the consultation sentence input by the user, then the consultation sentence is converted into a prompt sentence according to a prompt sentence template, and the prompt sentence is input into the language model to obtain a reply sentence.

[0060] The human-computer dialogue method provided in the embodiment of the present application determines whether the current human-computer dialogue state is in the consultation task state. If so, based on the consultation sentence, determine the consultation key parameters, and generate a reply sentence for the consultation sentence based on the consultation key parameters; if not, determine the consultation intent category of the consultation sentence based on the pre-trained intent classification model, and generate a reply sentence for the consultation sentence using a preset language model in accordance with the reply sentence generation method corresponding to the consultation intent category. The embodiment of the present application achieves the distinction between the consultation task state and the consultation task state, and generates reply sentences in different ways according to different states. When in the consultation task state, a reply sentence is generated according to the consultation key parameters. When in the consultation task state, since the user's consultation intention may be unclear, the intent classification model is used to determine the intent category, and the language model is used to generate a reply sentence according to the intent category, thereby avoiding the problem of low reply accuracy in certain fields caused by the existing human-computer dialogue method completely relying on the language model, and the problem of poor versatility of using artificial rules for dialogue.

[0061] In some optional implementations, such as Figure 2 As shown, step 103 includes:

[0062] Step 1031, determining whether the consultation statement contains consultation key parameters.

[0063] Specifically, the pre-set dialogue rules corresponding to the current consultation task can be determined, and the dialogue rules can be used to determine whether the consultation statement contains the consultation key parameters. The dialogue rules can be set in advance through tools such as canvas. If the consultation statement contains the consultation key parameters, step 1032 is executed, otherwise, step 1033 is executed.

[0064] Step 1032, extracting consulting key parameters from the consulting statement.

[0065] As an example, a set of dialogue rules for booking air tickets can be set up in advance using the canvas. According to the dialogue rules, parameters such as booking time, starting point, destination, seat type, etc. can be extracted from the consultation statement. These parameters are the key consultation parameters. It should be noted that since at least one round of human-computer dialogue is required when the consultation task is in the state, it is necessary to judge and extract the key consultation parameters for the consultation statement input by the user during each round of dialogue.

[0066] Step 1033, based on the intention classification model, determine the consultation intention category of the consultation statement.

[0067] Specifically, the intention classification model is the same as the intention classification model described in the above step 105. Optionally, the consultation intention category may include a complete business consultation category, an incomplete business consultation category, and a chat category.

[0068] Step 1034, if the consultation intention category is a casual chat category or an incomplete business consultation category, the consultation statement is parameter clarified to obtain the consultation key parameters.

[0069] The chat category may be a category where the consultation statement does not contain any actual business requirements. The incomplete business consultation category may be a category where the consultation statement only contains a part of the actual business requirements. Consultation statements in the incomplete business consultation category cannot be directly used to generate reply statements.

[0070] For example, in the consultation task state, if the user inputs the consultation sentence "Hello", the consultation sentence is judged to be a small talk category. If the user inputs the consultation sentence "I want to order this" or "I have a problem with my account", the intention of the consultation sentence is unclear and it is impossible to determine what specific service the user needs. In this case, the consultation sentence is judged to be an incomplete service consultation category.

[0071] When the consultation intention category is small talk or incomplete business consultation, it means that the user's true intention cannot be confirmed in the current consultation task. At this time, the consultation statement can be clarified. There are various methods for parameter clarification. For example, prompt statements can be continued to be output to guide the user to enter the key consultation parameters; or a pre-trained language model can be used to input the historical consultation sentences entered by the user in the current consultation task into the language model to generate the key consultation parameters.

[0072] For example, in the consultation task state, if the user inputs the consultation sentence "I want to order this", the reply sentence "Please enter the name of the reserved product" can be output to the user, and then the user continues to enter the consultation sentence. If the name of the product can be extracted from the sentence entered by the user, the name of the product can be used as the consultation key parameter. Then, the next round of dialogue can be continued in the consultation task.

[0073] This embodiment uses intent classification to classify the consultation statement if it is unable to extract the consultation key parameters from the currently input consultation statement when in the consultation task state. In the case of chat category or incomplete business consultation category, the consultation statement parameters are clarified to obtain complete consultation key parameters, thereby improving the accuracy and efficiency of generating reply statements.

[0074] In some optional implementations, such as Figure 2 As shown, after step 1033, the method further includes:

[0075] Step 1035, if the consultation intention category is a complete business consultation category, the consultation sentence is processed using a language model to generate a reply sentence for the consultation sentence.

[0076] Specifically, this step is performed when the consultation key parameters cannot be extracted from the consultation statement, and the intention recognition model is used to determine that the consultation statement is a complete business consultation category. That is, the currently input consultation statement can express a complete business consultation question, but because it does not contain the consultation key parameters corresponding to the current consultation task state (for example, it is currently in the task of booking a flight ticket, but the consultation key parameters related to booking a flight ticket cannot be extracted from the consultation statement), it is necessary to use the language model to generate the corresponding reply statement. The consultation statement can be directly input into the language model, or the consultation statement can be added to the prompt statement template to generate a prompt statement. The generated prompt statement facilitates the prompt language model to generate a reply statement more accurately. After the prompt statement is input into the language model, a reply statement can be generated. As an example, if the consultation statement entered by the user is "What will the weather be like tomorrow" in the consultation task state, the intention classification model classifies the statement as a complete business consultation category, and then the language model can be used to generate a reply statement representing tomorrow's weather conditions.

[0077] Optionally, a business knowledge base may be provided, and the language model retrieves business information corresponding to the consultation statement from the business knowledge base, combines the information with the consultation statement, and generates a reply statement.

[0078] Optionally, if the consulting intention category is determined to be a complete business consulting category, and the user is determined to have proposed a new consulting business based on the content of the consulting statement, the currently executed consulting task can be exited, that is, the dialogue state is changed to a state outside the consulting task. Subsequently, the new consulting statement is re-determined whether it is in a new task state.

[0079] This embodiment uses a language model to generate a reply statement when the consultation intention category is determined to be a complete business consultation category when the consultation sentence does not contain key consultation parameters, thereby achieving accurate replies to questions raised by users within the consultation task, thereby improving the efficiency and accuracy of human-computer dialogue.

[0080] In some optional implementations, such as Figure 3 As shown, step 106 includes:

[0081] Step 1061, if the consultation intention category is a complete business consultation category, the consultation sentence is processed using a language model to generate a reply sentence for the consultation sentence.

[0082] That is, when the consultation task is out of the state, if the consultation intention category is a complete business consultation category, the language model can be used to generate a reply statement. For example, if the consultation statement is a question-and-answer type statement "What is the URL of xxx website", the intention classification model determines that the statement is a complete business category, then the consultation statement can be input into the language model to generate a corresponding reply statement. This step is the same as the execution method of step 1035 above, and will not be repeated here.

[0083] Step 1062, if the consultation intention category is an incomplete business consultation category, obtain the user's historical conversation sentences, and use the language model to rewrite the historical conversation sentences and consultation sentences to obtain the rewritten sentences containing clear consultation intentions.

[0084] Among them, the incomplete business consultation category can be a category in which only a part of the actual business needs are included in the consultation sentence. The consultation sentence of the incomplete business consultation category cannot be directly used to generate a reply sentence. At this time, the historical conversation sentences with the user can be obtained, and the historical conversation sentences and the currently input consultation sentences can be input into the language model together. The language model performs semantic analysis on the historical conversation sentences and the current consultation sentences to generate a rewritten sentence. Since the language model combines the semantics of the historical conversation sentences and the current consultation sentences, the generated rewritten sentence can more accurately represent the user's true intention.

[0085] As an example, if the user currently wants to book a flight, but the input inquiry sentence only contains "booking" information, if the historical dialogue sentence contains relevant sentences about taking a plane, the rewritten sentence can make clear the user's intention to book a flight.

[0086] Optionally, if after rewriting historical dialogue sentences and consultation sentences using a language model, no rewritten sentence containing a clear consultation intent can be obtained, prompt sentences can continue to be output to guide the user to input the sentence again to extract the clear intent therefrom.

[0087] Step 1063, using the language model, the rewritten sentence is processed to generate a reply sentence for the consultation sentence.

[0088] Specifically, the rewritten sentence can be directly input into the language model, or the rewritten sentence can be added to the prompt sentence template to generate a prompt sentence, and the generated prompt sentence facilitates the prompt language model to generate a reply sentence more accurately. After the prompt sentence is input into the language model, the reply sentence can be generated.

[0089] This embodiment uses a language model to generate reply sentences when the consultation intention category is a complete business consultation category and an incomplete business consultation category. In particular, in the case of an incomplete business consultation category, historical dialogue sentences are used to rewrite the consultation sentences. This enables the method to adapt to more scenarios, accurately identify the intent of various consultation sentences, generate highly accurate reply sentences, and improve the versatility of the human-computer dialogue method.

[0090] In some optional implementations, such as Figure 4 As shown, step 1062 includes:

[0091] Step 10621, adding the historical dialogue sentences and the consultation sentences into the preset first prompt sentence template, and obtaining the first prompt sentence for prompting the language model to generate the rewritten sentence.

[0092] The first prompt sentence template may include variables representing historical dialogue sentences and consultation sentences, and sentences prompting to rewrite the historical dialogue sentences and consultation sentences to guide the language model to rewrite.

[0093] For example, the first prompt statement template is as follows:

[0094] The historical conversation sentence input by user {id} is: {historyContent}, and the currently input consultation sentence is: {presentContent}. Please analyze the semantics of the historical conversation sentence and the currently input consultation sentence to derive the real intention of user {id}'s consultation.

[0095] After adding the historical dialogue statements and consultation statements, as well as the user ID to the first prompt statement template, the first prompt statement (prompt) can be obtained.

[0096] Step 10622, input the first prompt sentence into the language model to obtain a rewritten sentence.

[0097] Specifically, under the prompt of the first prompt sentence, the language model can perform semantic analysis on the historical dialogue sentences and the currently input consultation sentences, and the output rewritten sentences can represent the user's true intention.

[0098] This embodiment sets a first prompt sentence template and uses the template to generate a first prompt sentence, so that the language model can perform semantic analysis on historical dialogue sentences and currently input consultation sentences in a more targeted manner, thereby improving the accuracy of the rewritten sentence.

[0099] In some optional implementations, step 1061 may be performed as follows:

[0100] First, the consulting statement is added to the second prompt statement template including the preset business knowledge base name to obtain the second prompt statement.

[0101] The business knowledge base contains information required for various consulting services, and the required business problems can be retrieved from the business knowledge base. For example, the business knowledge base may contain various information required for booking air tickets, and the information required by users when booking air tickets can be found from the business knowledge base.

[0102] The second prompt statement template may include the name of the business knowledge base, and the generated second prompt statement may include the name of the business knowledge base. The language model may retrieve information corresponding to the consultation statement from the business knowledge base, and generate a reply statement based on the retrieved information.

[0103] As an example, the second prompt statement template is as follows:

[0104] The query statement entered by user {id} is: {presentContent}, please select <businessdatabase>Retrieve the information required by the user and generate a reply statement to the user.

[0105] After adding the consultation statement, user ID and business knowledge base name to the second prompt statement template, the second prompt statement can be obtained.

[0106] Then, the second prompt sentence is input into the language model to generate a reply sentence to the consultation sentence.

[0107] Optionally, in the above step 1035, the same method as in the present embodiment may be used, that is, in the consulting task state, the business knowledge base may also be used to generate a reply statement to the consulting statement by the language model.

[0108] The above step 1063 may be performed as follows:

[0109] First, the rewritten statement is added to the third prompt statement template including the business knowledge base name to obtain the third prompt statement.

[0110] As an example, the third prompt statement template is as follows:

[0111] The current rewritten statement is: {rewriteContent}, please refer to the business knowledge base <businessdatabase>Retrieve the information required by the user and generate a reply statement to the user.

[0112] After the rewritten statement and the business knowledge base name are added to the second prompt statement template, the third prompt statement can be obtained.

[0113] Then, the third prompt sentence is input into the language model to generate a reply sentence to the consultation sentence.

[0114] This embodiment sets up a business knowledge base. When using a language model to generate a reply statement, when performing semantic analysis on a consultation statement of a complete business consultation type or a statement after intention rewriting, the information required by the user can be retrieved from the business knowledge base, thereby further improving the accuracy of the reply statement generated and sent to the user.

[0115] In some optional implementations, such as Figure 5 As shown, step 106 includes:

[0116] Step 1064, if the consultation intention category is the small talk category, add the consultation statement to the fourth prompt statement template containing the preset small talk knowledge base name to obtain a fourth prompt statement.

[0117] The chat category may be a category of content that does not contain any actual business requirements in the consulting statement. The chat knowledge base contains information required for dealing with user chats, and the conversation content required for the chat can be retrieved from the chat knowledge base.

[0118] The fourth prompt statement template may include the name of the chat knowledge base, and the generated fourth prompt statement may include the name of the chat knowledge base. The language model may retrieve the statement corresponding to the chat content input by the user from the chat knowledge base, and generate a reply statement based on the retrieved statement.

[0119] As an example, the fourth prompt statement template is as follows:

[0120] The query statement entered by user {id} is: {presentContent}, please go to the chat knowledge base <chatdatabase>Retrieve the information required by the user and generate a reply statement to the user.

[0121] After adding the consultation statement, user ID and chat knowledge base name to the fourth prompt statement template, the fourth prompt statement can be obtained.

[0122] Step 1065, input the fourth prompt sentence into the language model to generate a reply sentence of the consultation sentence.

[0123] For example, when the consultation sentence input by the user is the chat content "Hello", the language model can retrieve the sentence used for greeting from the chat knowledge base, and the generated reply sentence can be "I am xxx, I can provide you with professional consulting services, what questions do you have?".

[0124] This embodiment sets up a small talk knowledge base. When generating reply statements using a language model, relevant information can be retrieved from the small talk knowledge base when performing semantic analysis on small talk-type consultation statements, thereby further improving the accuracy of generating reply statements sent to users.

[0125] Based on the above embodiments, Figure 6 An exemplary flow chart for generating a reply statement is shown. First, the consultation statement input by the user is preprocessed to obtain a standardized consultation statement. Then, the task status of the preprocessed statement is determined. If it is an in-task status, the canvas process is used to extract the consultation key parameters. If the extraction is successful, a reply statement is generated and replied to the user based on the consultation key parameters and the pre-set dialogue rules.

[0126] If the extraction fails, the user's intention in the current conversation cannot be determined. Therefore, the intention classification model can be used to classify the consultation sentence. If it is an incomplete business category or a chat category, a prompt sentence can be output to prompt the user to enter the accurate consultation intention. The user re-enters the sentence according to the prompt sentence, and the key consultation parameters are extracted from the re-entered sentence to achieve parameter clarification. Then, based on the key consultation parameters and the pre-set conversation rules, a reply sentence is generated and replied to the user. If it is a complete business category, the language model is used to generate a reply sentence in combination with the business knowledge base and replied to the user.

[0127] If the task status is judged to be out-of-task, the consultation sentence is classified using the intent classification model. If it is an incomplete business category, the intent is rewritten based on the historical conversation sentence using the language model to obtain a rewritten sentence with a clear intent. Then, in combination with the business knowledge base, the reply sentence is generated using the language model and replied to the user. If it is a complete business category, in combination with the business knowledge base, the reply sentence is generated using the language model and replied to the user. If it is a casual chat category, in combination with the casual chat knowledge base, the reply sentence is generated using the language model and replied to the user.

[0128] Figure 7 This is a schematic diagram of the structure of a human-computer dialogue device provided in an embodiment of the present application. Specifically comprising:

[0129] The acquisition module 701 is used to acquire the consultation sentence input by the user;

[0130] The first determination module 702 is used to determine whether the current human-computer dialogue state is in the consultation task state;

[0131] The second determination module 703 is used to determine the consultation key parameters based on the consultation statement if the consultation task is in the state;

[0132] A first generating module 704 is used to generate a reply statement to the consultation statement based on the consultation key parameters;

[0133] The third determination module 705 is used to determine the consultation intention category of the consultation sentence based on the pre-trained intention classification model if the consultation task is not in the consultation task state;

[0134] The second generating module 706 is used to generate a reply statement to the consultation statement according to a preset reply statement generating method corresponding to the consultation intention category and using a preset language model.

[0135] In some optional implementations, the second determination module includes: a first determination unit, used to determine whether the consultation statement contains consultation key parameters; an extraction unit, used to extract the consultation key parameters from the consultation statement if it is contained; a second determination unit, used to determine the consultation intent category of the consultation statement based on the intention classification model if it is not contained; and an execution unit, used to clarify the parameters of the consultation statement to obtain the consultation key parameters if the consultation intent category is a chat category or an incomplete business consultation category.

[0136] In some optional implementations, the device further includes: a third generation module, which is used to process the consultation statement using a language model and generate a reply statement to the consultation statement if the consultation intention category is a complete business consultation category.

[0137] In some optional implementations, the second generation module includes: a first generation unit, which is used to use a language model to process the consultation statement and generate a reply statement for the consultation statement if the consultation intention category is a complete business consultation category; a rewriting unit, which is used to obtain the user's historical conversation sentences and use a language model to rewrite the historical conversation sentences and consultation sentences to obtain a rewritten sentence containing a clear consultation intention if the consultation intention category is an incomplete business consultation category; a second generation unit, which is used to use a language model to process the rewritten sentence and generate a reply statement for the consultation statement.

[0138] In some optional implementations, the rewriting unit includes: a first generating subunit, used to add historical dialogue sentences and consultation sentences to a preset first prompt sentence template to obtain a first prompt sentence for prompting a language model to generate a rewritten sentence; and a second generating subunit, used to input the first prompt sentence into the language model to obtain the rewritten sentence.

[0139] In some optional implementations, the first generation unit includes: a third generation sub-unit, used to add the consultation statement to a second prompt statement template containing a preset business knowledge base name to obtain a second prompt statement; a fourth generation sub-unit, used to input the second prompt statement into a language model to generate a reply statement for the consultation statement; the second generation unit includes: a fifth generation sub-unit, used to add the rewritten statement to a third prompt statement template containing a business knowledge base name to obtain a third prompt statement; a sixth generation sub-unit, used to input the third prompt statement into a language model to generate a reply statement for the consultation statement.

[0140] In some optional implementations, the second generation module includes: a third generation unit, which is used to add the consultation statement to a fourth prompt statement template containing a preset chat knowledge base name to obtain a fourth prompt statement if the consultation intention category is a chat category; and a fourth generation unit, which is used to input the fourth prompt statement into a language model to generate a reply statement to the consultation statement.

[0141] The human-machine dialogue device provided in this embodiment can be as follows Figure 7 The human-computer dialogue device shown in can execute all the steps of the above human-computer dialogue methods, thereby achieving the technical effects of the above human-computer dialogue methods. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0142] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, Figure 8 The electronic device 800 shown includes: at least one processor 801, a memory 802, at least one network interface 804 and other user interfaces 803. The various components in the electronic device 800 are coupled together via a bus system 805. It is understood that the bus system 805 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 805 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 805 is not described in detail. Figure 8 Various buses are labeled as bus system 805 .

[0143] The user interface 803 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).

[0144] It can be understood that the memory 802 in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DRRAM). The memory 802 described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0145] In some implementations, the memory 802 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 8021 and an application program 8022 .

[0146] The operating system 8021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 8022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present application can be included in the application 8022.

[0147] In this embodiment, by calling the program or instruction stored in the memory 802, specifically, the program or instruction stored in the application 8022, the processor 801 is used to execute the method steps provided by each method embodiment, for example, including:

[0148] Obtain the consultation sentence input by the user; determine whether the current human-computer dialogue state is within the consultation task state; if it is within the consultation task state, determine the consultation key parameters based on the consultation sentence; generate a reply sentence for the consultation sentence based on the consultation key parameters; if it is not within the consultation task state, determine the consultation intent category of the consultation sentence based on a pre-trained intent classification model; generate a reply sentence for the consultation sentence according to a preset reply sentence generation method corresponding to the consultation intent category and using a preset language model.

[0149] The method disclosed in the above embodiment of the present application can be applied to the processor 801, or implemented by the processor 801. The processor 801 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 801. The above processor 801 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 802, and the processor 801 reads the information in the memory 802 and completes the steps of the above method in combination with its hardware.

[0150] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the above functions of the present application, or a combination thereof.

[0151] For software implementation, the technology described above in this article can be implemented by a unit that performs the functions described above in this article. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0152] The electronic device provided in this embodiment may be Figure 8 The electronic device shown in can execute all the steps of the above-mentioned human-computer dialogue methods, thereby achieving the technical effects of the above-mentioned human-computer dialogue methods. Please refer to the above related description for details. For the sake of brevity, it will not be repeated here.

[0153] The embodiment of the present application also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.

[0154] When one or more programs in the storage medium can be executed by one or more processors, the human-computer interaction method executed on the electronic device side can be implemented.

[0155] The processor is used to execute the program stored in the memory to implement the following steps of the human-computer dialogue method performed on the electronic device side:

[0156] Obtain the consultation sentence input by the user; determine whether the current human-computer dialogue state is within the consultation task state; if it is within the consultation task state, determine the consultation key parameters based on the consultation sentence; generate a reply sentence for the consultation sentence based on the consultation key parameters; if it is not within the consultation task state, determine the consultation intent category of the consultation sentence based on a pre-trained intent classification model; generate a reply sentence for the consultation sentence according to a preset reply sentence generation method corresponding to the consultation intent category and using a preset language model.

[0157] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different circuits to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0158] The steps of the circuits or algorithms described in conjunction with the embodiments disclosed herein may be implemented using hardware, software modules executed by a processor, or a combination of the two. The software modules may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0159] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.

[0160] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.< / chatdatabase> < / businessdatabase> < / businessdatabase>

Claims

1. A human-computer dialogue method, characterized in that: The method comprises: Get the consultation statement entered by the user; Determine whether the current human-computer dialogue state is within the consultation task state; If the state is within the consultation task, determining the consultation key parameters based on the consultation statement; Based on the consultation key parameters, generating a reply statement to the consultation statement; If the state is not in the consultation task, determining the consultation intent category of the consultation sentence based on a pre-trained intent classification model; According to a preset method of generating a reply statement corresponding to the consultation intention category, a reply statement to the consultation statement is generated using a preset language model.

2. The method according to claim 1, characterized in that If the state is within the consultation task, determining the consultation key parameters based on the consultation statement includes: Determining whether the consulting statement contains consulting key parameters; If included, extracting the consulting key parameters from the consulting statement; If not included, determining the consulting intent category of the consulting statement based on the intent classification model; If the consultation intention category is a casual chat category or an incomplete business consultation category, parameters of the consultation statement are clarified to obtain the consultation key parameters.

3. The method according to claim 2, characterized in that After determining the consultation intention category of the consultation statement based on the intention classification model, the method further includes: If the consultation intention category is a complete business consultation category, the consultation statement is processed using the language model to generate a reply statement for the consultation statement.

4. The method according to claim 1, characterized in that The method of generating a reply statement corresponding to the consultation intention category according to a preset method of generating a reply statement and using a preset language model comprises: If the consultation intention category is a complete business consultation category, the consultation sentence is processed using the language model to generate a reply sentence for the consultation sentence; If the consultation intention category is an incomplete business consultation category, obtaining the user's historical conversation sentences, and using the language model to rewrite the historical conversation sentences and the consultation sentences to obtain a rewritten sentence containing a clear consultation intention; The rewritten sentence is processed using the language model to generate a reply sentence for the consultation sentence.

5. The method according to claim 4, characterized in that The method of rewriting the historical dialogue sentences and the consultation sentences by using the language model to obtain rewritten sentences containing clear consultation intentions includes: Adding the historical dialogue sentence and the consultation sentence into a preset first prompt sentence template to obtain a first prompt sentence for prompting the language model to generate a rewritten sentence; The first prompt sentence is input into the language model to obtain the rewritten sentence.

6. The method according to claim 4, characterized in that If the consultation intention category is a complete business consultation category, the consultation statement is processed using the language model to generate a reply statement for the consultation statement, including: Adding the consulting statement to a second prompt statement template including a preset business knowledge base name to obtain a second prompt statement; Inputting the second prompt sentence into the language model to generate a reply sentence of the consultation sentence; The step of processing the rewritten sentence by using the language model to generate a reply sentence of the consultation sentence includes: Adding the rewritten statement to a third prompt statement template including the name of the business knowledge base to obtain a third prompt statement; The third prompt sentence is input into the language model to generate a reply sentence of the consultation sentence.

7. The method according to claim 1, characterized in that The method of generating a reply statement corresponding to the consultation intention category according to a preset method of generating a reply statement and using a preset language model comprises: If the consultation intention category is the small talk category, the consultation statement is added to a fourth prompt statement template including a preset small talk knowledge base name to obtain a fourth prompt statement; The fourth prompt sentence is input into the language model to generate a reply sentence of the consultation sentence.

8. A human-computer dialogue device, characterized in that: The device comprises: An acquisition module is used to acquire the consultation sentence input by the user; The first determination module is used to determine whether the current human-computer dialogue state is in the consultation task state; A second determination module is used to determine the key consultation parameters based on the consultation statement if the consultation task is in the state; A first generating module, used for generating a reply statement of the consultation statement based on the consultation key parameters; A third determination module is used to determine the consultation intention category of the consultation sentence based on a pre-trained intention classification model if the consultation task is not in the consultation task state; The second generating module is used to generate a reply statement to the consultation statement according to a preset reply statement generating method corresponding to the consultation intention category and using a preset language model.

9. An electronic device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program stored in the memory, and when the computer program is executed, the human-computer dialogue method described in any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the human-computer dialogue method described in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Intelligent dialogue method and system, electronic equipment, storage medium and program product

    CN120849568A