Conversation processing method and device, equipment and storage medium
Through the analysis of intention and entity association in the dialogue data, the authenticity of the user's dialogue statements is evaluated, which solves the problem of user dialogue statement information deviating from the facts and improves the accuracy of retrospective analysis.
Patent Information
- Application Number
- CN202410217693.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-27
- Publication Date
- 2024-09-17
AI Technical Summary
The information contained in the user's dialogue statements deviates from the facts and affects the accuracy of the retrospective analysis. It is difficult to accurately assess the authenticity of the user's dialogue statements with existing technology.
By obtaining the intention set and named entity set in the dialogue data, we perform correlation analysis to establish the correlation between entities, and combine it with the correlation in the agent's dialogue statement to evaluate the authenticity of the user's dialogue statement.
It achieves accurate scoring of user dialogue sentences and improves the accuracy and authenticity of event retrospective analysis.
Smart Images

Figure CN118657147A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of natural language processing, and in particular to a dialogue processing method, apparatus, device and storage medium. Background Art
[0002] In some business scenarios, it is usually necessary to use the conversation between the agent and the user to conduct a retrospective analysis of an event to locate the key factors affecting the business and improve the business quality. However, factors such as the user's individual language expression ability, thinking ability, and memory subjectivity may cause the user's conversation statements to contain information that deviates from the facts of the event, affecting the authenticity of the user's conversation statements and ultimately affecting the accuracy of the retrospective analysis results.
[0003] Therefore, accurately evaluating the authenticity of user conversation statements in order to better assist event retrospective analysis is one of the hot issues in the field of natural language processing technology. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a dialogue processing method, apparatus, device and storage medium for accurately evaluating the authenticity of user dialogue statements to better assist event retrospective analysis.
[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for processing a conversation, including:
[0007] Acquire an intention set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes an agent dialogue sentence and a user dialogue sentence, the intention set includes the intention of the agent dialogue sentence and the intention of the user dialogue sentence, and the named entity set includes entities in the agent dialogue sentence and entities in the user dialogue sentence;
[0008] Performing association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set;
[0009] performing association analysis on entities in the user dialogue sentences based on the intention of the user dialogue sentences to obtain a second association relationship between entities in the user dialogue sentences;
[0010] The user dialogue sentence is scored based on the first association relationship and the second association relationship.
[0011] In a second aspect, an embodiment of the present application provides a dialog processing device, including:
[0012] an acquisition unit, configured to acquire an intention set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes an agent dialogue sentence and a user dialogue sentence, the intention set includes an intention of the agent dialogue sentence and an intention of the user dialogue sentence, and the named entity set includes entities in the agent dialogue sentence and entities in the user dialogue sentence;
[0013] An analyzing unit, configured to perform association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set;
[0014] The analysis unit is further configured to perform association analysis on entities in the user dialogue sentence based on the intention of the user dialogue sentence to obtain a second association relationship between entities in the user dialogue sentence;
[0015] An evaluation unit, wherein the user scores the user dialogue statement based on the first association relationship and the second association relationship.
[0016] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the dialogue processing method as described in the first aspect.
[0017] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the dialogue processing method described in the first aspect.
[0018] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps in the dialogue processing method described in the first aspect.
[0019] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0020] Since the entities in the dialogue corpus contain important information about the event, the associations between these entities can be used to accurately describe the event; secondly, the associations between entities are usually affected by the intent of the dialogue. In the dialogue corpus surrounding the same event, the relationship between entities in dialogue sentences with the same or similar intent is very small, and the dialogue corpus also contains agent dialogue sentences. Therefore, the overall association of the named entity set in the dialogue corpus describes the event content more objectively and realistically; based on this, by comparing the association with the association between entities in the user's dialogue sentence, the difference between the two can be used to determine whether the event content described by the association between entities in the user's dialogue sentence is true, and then accurately score the user's dialogue sentence. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0022] Figure 1 A flowchart of a conversation processing method provided for one embodiment of the present application;
[0023] Figure 2 A flowchart of a conversation processing method provided for another embodiment of the present application;
[0024] Figure 3 A flowchart of a conversation processing method provided for another embodiment of the present application;
[0025] Figure 4 A schematic diagram of the structure of a conversation processing device provided by an embodiment of the present application;
[0026] Figure 5 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0028] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the terms used in this way can be interchanged where appropriate so that the embodiments of the present application are implemented in a sequence other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.
[0029] This application has conducted a lot of research on dialogue data of different events and found that: since named entities (named entities, referred to as entities) are entities identified by names (such as names of people, places, names of organizations, time, etc.), the entities in the dialogue data contain important information about the events, and the associations between these entities can be used to accurately describe the events; secondly, the associations between entities are usually affected by the intention of the dialogue. In the dialogue data around the same event, the relationship between entities in dialogue sentences with the same or similar intentions is very small. Therefore, by comparing the associations between entities in objective and more authentic dialogue sentences with the associations between entities in user dialogue sentences with unknown authenticity, the authenticity of the user dialogue sentences can be accurately evaluated.
[0030] Based on this, an embodiment of the present application provides a conversation processing method. Since the conversation data also includes the agent's conversation sentences, the event content described by the overall association relationship of the named entity set of the conversation data is more objective and true. By comparing the association relationship with the association relationship between entities in the user's conversation sentence, the difference between the two can be used to determine whether the event content described by the association relationship between entities in the user's conversation sentence is true, and then the user's conversation sentence can be accurately scored to better perform event retrospective analysis.
[0031] It should be understood that the dialogue processing method provided in the embodiment of the present application can be executed by an electronic device, specifically by software in the electronic device. The electronic device can be a terminal device, such as a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, a smart home appliance, a smart watch, a vehicle terminal, an aircraft, etc.; or, the electronic device can also be a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0032] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0033] See also Figure 1 , is a flow chart of a conversation processing method provided by an embodiment of the present application, the method may include the following steps:
[0034] S102, obtaining an intent set and a named entity set of the dialogue corpus.
[0035] The dialogue material includes the dialogue statements between the agent and the user about the target event, that is, the dialogue material includes the agent dialogue statements and the user dialogue statements. The target event described in the embodiment of the present application may include various events related to the business, such as complaint events, financial service events, advertising push events, transaction events, etc.
[0036] The dialogue data can be the historical dialogue data obtained after the dialogue between the agent and the user ends, or it can be the real-time dialogue data obtained during the dialogue between the agent and the user. The dialogue data includes the agent dialogue sentences belonging to the agent and the user dialogue sentences belonging to the user. The agent described in the embodiment of the present application can be a manual agent or an intelligent agent, such as a chat robot.
[0037] The intent set includes the intent of the agent's dialogue sentences and the user's dialogue sentences in the dialogue corpus. The intent set can be obtained by performing intent recognition on each dialogue sentence in the dialogue corpus, such as by performing intent recognition on a pre-trained intent recognition model. Among them, the intent recognition model can adopt various language models commonly used in the field, such as BERT, Roberta, etc., which are not limited in the embodiments of the present application. Of course, the intent entity recognition of the dialogue sentence can also be implemented by other intent entity recognition methods commonly used in the field, which are not limited in the embodiments of the present application.
[0038] In one embodiment, for each dialogue sentence in the dialogue corpus, the dialogue sentence and its speaker role are concatenated and input into the intent recognition model for intent recognition, and the intent of the dialogue sentence is obtained and added to the intent set. For example, the agent dialogue sentence is "Are you Ms. XX?", and the agent dialogue sentence and its speaker role are concatenated to obtain the text "Agent_Are you Ms. XX?", and the text is input into the intent recognition model for intent recognition, and the intent "Ask for name" is obtained.
[0039] The named entity set includes entities in the agent's dialogue sentences and entities in the user's dialogue sentences in the dialogue corpus. The named entity set can be obtained by performing named entity recognition on each dialogue sentence in the dialogue corpus, such as by performing named entity recognition on a pre-trained entity recognition model. Among them, the entity recognition model can adopt various language models commonly used in the field, such as BERT, Roberta, etc., which are not limited in the embodiments of the present application. Of course, named entity recognition of dialogue sentences can also be implemented by other named entity recognition methods commonly used in the field, which are not limited in the embodiments of the present application.
[0040] In one embodiment, for each dialogue sentence in the dialogue corpus, the dialogue sentence and its speaker role are spliced and input into the entity recognition model for named entity recognition, and the entity in the dialogue sentence is obtained and added to the named entity set. For example, the user dialogue sentence is "Zhang San did not come to class today", and the user dialogue sentence and its speaker role are spliced to obtain the text "User_Zhang San did not come to class today", and the text is input into the entity recognition model for named entity recognition, and the obtained entity information includes: [Zhang San / nr, today / t, did not come / v, class / vi]. Among them, Zhang San, today, did not come, and class are all entities, nr indicates that "Zhang San" is a person's name, t indicates that "today" is a time, v indicates that "did not come" is a verb, and vi indicates that "class" is an intransitive verb.
[0041] S104, performing association analysis on the named entity set based on the intent set to obtain a first association relationship between entities in the named entity set.
[0042] Since the association relationship between entities is affected by the dialogue intent, in order to more accurately evaluate the authenticity of the user's dialogue sentence, in one embodiment, for each intent in the intent set, an entity (called a third entity) whose dialogue sentence has the intent can be selected from the named entity set, and an association analysis can be performed on the second entity to obtain the first association relationship corresponding to the intent. In other words, the number of first association relationships is M, where M is a positive integer, and each first association relationship corresponds to an intent in the intent set. Each first association relationship is obtained by performing an association analysis on the third entity in the named entity set based on the corresponding intent, and the third entity is an entity identified from the dialogue context with the intent.
[0043] The association analysis of the named entity set can be obtained by using various association analysis algorithms, which can be selected according to actual needs. In one embodiment, for each intent in the intent set, the intent and the second entity corresponding to the intent can be input into a pre-trained association analysis model for association analysis to obtain the first association relationship between the second entities corresponding to the intent. Among them, the association analysis model can adopt various deep learning models with association analysis capabilities commonly used in the field, such as Flat models, etc., which are not limited to this embodiment of the present application.
[0044] For example, the conversation data between the agent and the user about the logistics query event and the intent and entity of each conversation sentence are as follows:
[0045]
[0046] The second entities corresponding to the intention "check logistics" include "logistics progress", "logistics order number" and "112233". By inputting the intention "check logistics" and its corresponding second entity into the association analysis model for association analysis, the following first association relationship can be obtained: logistics progress→logistics order number→112233.
[0047] Of course, the first association relationship can also be obtained through other association analysis algorithms, such as association analysis methods in statistics, etc., and the embodiments of the present application are not limited to this.
[0048] S106, performing association analysis on entities in the user dialogue sentence based on the intention of the user dialogue sentence to obtain a second association relationship between the entities in the user dialogue sentence.
[0049] Since the association relationship between entities is affected by the intention of the conversation, in order to more accurately evaluate the authenticity of the user conversation sentences, in one embodiment, when the conversation corpus contains multiple user conversation sentences and the intentions of these user conversation sentences are different, the user conversation sentences in the user conversation corpus can be grouped according to the intention to obtain multiple groups, each group having a corresponding intention; further, for each group, an association analysis is performed on the entities in the user conversation sentences of the group based on the intention corresponding to the group, and a second association relationship corresponding to the intention can be obtained.
[0050] The specific implementation of the above S106 is similar to the specific implementation of the above S104 and will not be repeated here.
[0051] S108: Score the user dialogue statement based on the first association relationship and the second association relationship.
[0052] The score of the user's dialogue statement indicates whether the user's dialogue statement is true.
[0053] Since the dialogue corpus also includes the agent's dialogue sentences, the event content described by the overall association relationship of the named entity set of the dialogue corpus is more objective and true. By comparing the association relationship with the association relationship between entities in the user's dialogue sentences, the difference between the two can be used to determine whether the event content described by the association relationship between entities in the user's dialogue sentences is true, and then the user's dialogue sentences can be accurately scored.
[0054] In one embodiment, if Figure 2 As shown, the above S108 includes the following steps:
[0055] S181, encoding the named entity set based on the first association relationship to obtain a first event vector.
[0056] Since the named entity set contains all the important information in the dialogue corpus, the first association relationship describes the event content of the target event involved in the dialogue corpus as a whole, and thus the first event vector is used to describe the target event involved in the dialogue corpus from the perspective of the dialogue as a whole.
[0057] As an example, when the intent set includes M intents and each intent has a corresponding first association relationship, the above S181 may include the following steps: determining the intent of the user dialogue sentence as the target intent; based on the first association relationship corresponding to the target intent, encoding the third entity in the named entity set to obtain a first event vector.
[0058] Therefore, the first event vector obtained reflects the association relationship between entities in the dialogue sentences with the same intention as the user's dialogue sentence. Since the relationship between entities in the dialogue sentences with the same intention in the dialogue corpus around the same event is very small, when calculating the similarity between the first event vector and the second event vector, it is equivalent to comparing the association relationship between entities in the dialogue sentences with the same intention, which can further improve the evaluation accuracy.
[0059] S182, encoding entities in the user dialogue sentence based on the second association relationship to obtain a second event vector.
[0060] Since the second association relationship describes the target event from the user's perspective, the second event vector is used to describe the target event from the user's perspective.
[0061] In the embodiment of the present application, the above S181 and S182 can be encoded through various encoding methods, and the encoding method used by S181 and S182 is the same to ensure the accuracy of the evaluation result.
[0062] As an example, the first event vector and the second event vector can be encoded in the following manner: Step A1, creating a corresponding first node for an entity in a named entity set in a preset coordinate system, creating a first connecting edge between the created first nodes based on a first association relationship to obtain a first event graph, and graph encoding the first event graph to obtain a first event vector; Step A2, creating a corresponding second node for an entity in a user dialogue statement in a preset coordinate system, creating a second connecting edge between the created second nodes based on a second association relationship to obtain a second event graph, and graph encoding the second event graph to obtain a second event vector.
[0063] The horizontal axis of the preset coordinate system represents the time when the dialogue sentence to which the entity belongs is generated, and the vertical axis of the preset coordinate system represents the distance between entities. In practical applications, the graph coding of the event graph can be implemented using the commonly used image coding methods in the art, such as entropy coding, transform coding, and encoding using a pre-trained graph coding model. The specific selection can be based on actual needs, and the embodiments of the present application do not limit this.
[0064] For example, taking the encoding of a named entity set as an example, the entities in the named entity set are sorted in ascending order according to the generation time of the corresponding dialogue sentences; then, for the first entity, 0 is used as the ordinate of the entity, and the generation time of the dialogue sentence to which the entity belongs is used as the horizontal coordinate of the entity, and a corresponding first node is created for the entity in the preset coordinate system; then, for the second entity, the distance between the entity and the first entity is used as the ordinate of the entity, and the generation time of the dialogue sentence to which the entity belongs is used as the horizontal coordinate of the entity, and a corresponding first node is created for the entity in the preset coordinate system; and so on, until the first nodes corresponding to all entities in the named entity set are created. Further, based on the first association relationship between the entities in the named entity set, a first connecting edge is created between the first nodes corresponding to the associated entities, thereby obtaining a first event graph; finally, the first event graph is graph-encoded to obtain a first event vector.
[0065] In this embodiment, whether for the named entity set or the entities in the user dialogue sentence, the relationship between entities is represented in the form of a graph, which can realize the visual display of the relationship between entities, help relevant personnel to sort out the dialogue material, and quickly obtain relevant information of the target event and the difference between the two relationships from the graph. Secondly, using graph coding to encode the graph can improve the encoding efficiency, and the obtained event vector can more accurately describe the relationship between entities expressed in the graph, providing strong data support for the subsequent evaluation of the authenticity of the user dialogue sentence.
[0066] As another example, the first event vector and the second event vector can be encoded in the following manner: Step B1, based on the first association relationship, obtain N first entities from the named entity set, and encode the N first entities by word vectors to obtain N first word vectors, and concatenate the N first word vectors to obtain a first event vector, wherein N is a positive integer, the N first entities are associated with each other, and the N first entities are related to the target event; Step B2, based on the second association relationship, obtain N second entities from the user dialogue sentence, and encode the N second entities by word vectors to obtain N second word vectors, and concatenate the N second word vectors to obtain a second event vector, wherein the N second entities are associated with each other, and the N second entities are related to the target event.
[0067] The N first entities and the N second entities each include at least one of the following entities: a time entity indicating the time at which an event occurs, a location entity indicating the location at which the event occurs, a character entity indicating a character related to the event, and an emotion entity indicating the character's emotion.
[0068] In practical applications, in order to make the first event vector more accurately describe the target event, before the above step B1, the intention of the dialogue sentences to which the above N first entities belong may be encoded by word vectors to obtain the word vector of the intention. Accordingly, in step B1, the N first word vectors are concatenated with the word vector of the intention to obtain the first event vector.
[0069] Similarly, in order to make the second event vector more accurately describe the target event, before the above step B2, the intention of the dialogue sentences to which the N second entities belong may be encoded by word vectors to obtain the word vector of the intention. Accordingly, in step B2, the N second word vectors are concatenated with the word vector of the intention to obtain the second event vector.
[0070] In addition, word vector encoding can be implemented using the word vector encoding method commonly used in this field. For example, the entity to be encoded is input into a pre-trained language model to obtain the corresponding word vector.
[0071] For example, taking the encoding of entities in user dialogue sentences as an example, the N second entities obtained from the user dialogue sentences include the time entity "afternoon", the character entity "Zhang San", and the emotion entity "angry". The intention of the user dialogue sentence is "refuse to repay". After encoding these texts with word vectors, the encoded word vectors are horizontally spliced in the order of time → character → emotion → intention to obtain the second event vector.
[0072] In this method, since the N first entities contain important information about the event, the first event vector obtained by encoding these first entities with word vectors and then splicing them together can more accurately describe the target event, providing strong data support for the subsequent scoring of user dialogue sentences. Similarly, since the N second entities contain important information about the event, the second event vector obtained by encoding these second entities with word vectors and then splicing them together can more accurately describe the target event, also providing strong data support for the subsequent scoring of user dialogue sentences.
[0073] S183: Determine the similarity between the first event vector and the second event vector.
[0074] The above S183 can be implemented in various ways, which can be selected according to actual needs, and the embodiment of the present application does not limit this. For example, the Euclidean distance between the first event vector and the second event vector is calculated, or the similarity between the first event vector and the second event vector is calculated using the iForest algorithm.
[0075] S184, scoring the user dialogue sentences based on the similarity.
[0076] If the similarity is less than the preset threshold, it is determined that the user's memory of the target event is distorted, and then the authenticity of the user's dialogue statement is low and deviates from the facts; if the similarity is greater than or equal to the preset threshold, it is determined that the user's memory of the target event is true, and then the authenticity of the user's dialogue statement is high and close to the facts.
[0077] In this implementation, by encoding the first association relationship and the second association relationship into corresponding event vectors respectively, the comparison and authenticity evaluation are performed, which is more efficient and the evaluation result is more accurate.
[0078] The present application embodiment shows a specific implementation of the above S108. Of course, it should be understood that the above S108 can also be implemented in other ways, and the present application embodiment does not limit this. For example, directly comparing the first association relationship and the second association relationship, and evaluating the authenticity of the user's dialogue statement based on the comparison result, etc.
[0079] The dialogue processing method provided in the embodiment of the present application has the following advantages: since the entities in the dialogue corpus contain important information about the event, the association relationship between these entities can be used to accurately describe the event; secondly, the association relationship between entities is usually affected by the intention of the dialogue. In the dialogue corpus surrounding the same event, the relationship between entities in dialogue sentences with the same or similar intentions is very small, and the dialogue corpus also contains agent dialogue sentences. Therefore, the event content described by the overall association relationship of the named entity set of the dialogue corpus is more objective and true; based on this, by comparing the association relationship with the association relationship between entities in the user dialogue sentence, the difference between the two can be used to determine whether the event content described by the association relationship between entities in the user dialogue sentence is true, thereby accurately scoring the user dialogue sentence.
[0080] In another embodiment of the present application, in order to more accurately perform a retrospective analysis of a target event, Figure 3 As shown, after the above S108, the above dialogue processing method may further include the following steps:
[0081] S110: If the score of the user dialogue statement is less than a preset threshold, the first dialogue information is compared with the second dialogue information to obtain difference information.
[0082] The first dialogue information includes the entity and intention of the user dialogue sentence. The second dialogue information includes the entity and intention of the context dialogue sentence of the user dialogue sentence. The difference information includes the difference in entity and intention between the user dialogue sentence and its context dialogue sentence.
[0083] S112, based on the difference information, correct the user dialogue statement.
[0084] In one embodiment, the above S112 may include the following steps: if the difference information indicates that the first dialogue information is different from the second dialogue information, and the frequency of occurrence of the first dialogue information in the dialogue text is less than the frequency of occurrence of the second dialogue information in the dialogue text, then the user dialogue statement is corrected based on the second dialogue information; or, if the difference information indicates that the first dialogue information is different from the second dialogue information, and the generation time of the context dialogue statement is later than the generation time of the user dialogue statement, then the user dialogue statement is corrected based on the second dialogue information.
[0085] For example, the intention of the user dialogue sentence "I will repay next month" is "repay", and the intention of the context dialogue sentence "I have already changed it" is "refuse to repay". If the intention "repay" appears 3 times in the dialogue corpus, and the intention "refuse to repay" appears 4 times in the dialogue corpus, then the user dialogue sentence is corrected based on the intention "refuse to repay", for example, the user dialogue sentence is corrected to "I will not repay next month"; or, if the generation time of the context dialogue sentence is later than the generation time of the user dialogue sentence, then the user dialogue sentence is corrected based on the intention "refuse to repay", for example, the user dialogue sentence is corrected to "I will not repay next month".
[0086] For another example, the user dialogue sentence "I will repay next month" contains the entity "next month", and the context dialogue sentence "I will repay next week" contains the entity "next week". If the entity "next month" appears once in the dialogue corpus, and the entity "next week" appears twice in the dialogue corpus, then the user dialogue sentence is corrected based on the entity "next week", for example, the user dialogue sentence is corrected to "I will repay next week"; or, if the context dialogue sentence is generated later than the user dialogue sentence, then the user dialogue sentence is corrected based on the entity "next week", for example, the user dialogue sentence is corrected to "I will repay next week".
[0087] In another embodiment, the above S112 may include the following steps: based on the difference information, outputting a guiding sentence to the user, the guiding sentence is used to guide the user to correct the user dialogue sentence; receiving a response sentence input by the user for the guiding sentence; and correcting the user dialogue sentence based on the response sentence.
[0088] For example, the intention of the user dialogue sentence "I will repay next month" is "repay", and the intention of the context dialogue sentence "I have already changed" is "refuse to repay". If the two are different, the guiding sentence "Are you sure you want to repay" is output to guide the user to confirm whether to repay; if the response sentence input by the user is received, "Sure, you can check, I repaid it yesterday, bill number No. 123123", then after verifying the content of the response sentence, the user dialogue sentence is corrected to "I have already repaid yesterday".
[0089] For another example, the user dialogue sentence "I will repay next month" contains the entity "next month", and the context dialogue sentence "I will repay next week" contains the entity "next week". If the two are different, the guiding sentence "Are you sure you will repay next week" is output to guide the user to confirm the repayment time; if the response sentence "Sure, I will definitely repay next week" input by the user is received, the user dialogue sentence is corrected to "I will repay next week".
[0090] The dialogue processing method provided in this embodiment can repair the user's memory of the target event, improve the authenticity of the user's dialogue sentences, and further improve the accuracy of backtracking the target event based on the dialogue material by utilizing the difference in dialogue information between the user's dialogue sentences and their context dialogue sentences when the score of the user's dialogue sentences is low.
[0091] In another embodiment of the present application, after S108 above, the conversation processing method provided by any of the above examples may further include the following steps: generating a user portrait of the user based on the score of the user conversation statement and the second association relationship; and storing the user portrait in a user portrait library.
[0092] For example, if the score of a user dialogue sentence is low, and the second association relationship between entities in the user dialogue sentence is "repay → next week → next month → refuse to repay → repay → next week", the user portrait generated for the user is "overdue repayment" and stored in the user portrait library.
[0093] For another example, if the score of a user dialogue sentence is low, and the second association relationship between entities in the user dialogue sentence is “angry→unsatisfied→complaint→unresolved”, the user portrait generated for the user is “difficult to communicate” and stored in the user portrait library.
[0094] The dialogue processing method provided in this embodiment uses the score of the user dialogue statement and the second association relationship to generate a corresponding user portrait for the user, which is helpful for providing corresponding services to the user in the future to improve the service quality. For example, if the target event is a repayment event, and the generated user portrait is "delayed repayment", then when providing financial services to such users in the future, the credit assessment strategy for such users can be optimized. For another example, if the target event is an after-sales service event, and the generated user portrait is "difficult to communicate", then when providing after-sales services to such users in the future, the after-sales service speech for such users can be optimized.
[0095] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0096] Based on the same inventive concept, the present application embodiment also provides a dialogue processing device. Figure 4 , is a structural diagram of a dialogue processing device 400 provided in an embodiment of the present application. The device 400 includes: an acquisition unit 410, an analysis unit 420 and an evaluation unit 430.
[0097] The acquisition unit 410 is used to acquire an intention set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes agent dialogue sentences and user dialogue sentences, the intention set includes the intention of the agent dialogue sentences and the intention of the user dialogue sentences, and the named entity set includes entities in the agent dialogue sentences and entities in the user dialogue sentences.
[0098] The analyzing unit 420 is used to perform association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set.
[0099] The analyzing unit 420 is further configured to perform association analysis on entities in the user dialogue sentence based on the intention of the user dialogue sentence to obtain a second association relationship between entities in the user dialogue sentence.
[0100] The evaluation unit 430 scores the user dialogue statement based on the first association relationship and the second association relationship.
[0101] In another embodiment, the evaluation unit is specifically used for:
[0102] Encoding the named entity set based on the first association relationship to obtain a first event vector;
[0103] Encoding the entities in the user dialogue sentence based on the second association relationship to obtain a second event vector;
[0104] A similarity between the first event vector and the second event vector is determined, and the user dialogue sentence is scored based on the similarity.
[0105] In another embodiment, the first event vector and the second event vector are encoded in the following manner:
[0106] Creating a corresponding first node for an entity in the named entity set in a preset coordinate system, creating a first connection edge between the created first nodes based on the first association relationship to obtain a first event graph, and performing graph encoding on the first event graph to obtain the first event vector;
[0107] Creating corresponding second nodes for entities in the user dialogue sentence in a preset coordinate system, creating second connecting edges between the created second nodes based on the second association relationship to obtain a second event graph, and performing graph encoding on the second event graph to obtain a second event vector;
[0108] The horizontal axis of the preset coordinate system represents the time when the dialogue sentence to which the entity belongs is generated, and the vertical axis of the preset coordinate system represents the distance between the entities.
[0109] In another embodiment, the first event vector and the second event vector are encoded in the following manner:
[0110] Based on the first association relationship, N first entities are obtained from the named entity set, and word vector encoding is performed on the N first entities to obtain N first word vectors, and the N first word vectors are concatenated to obtain the first event vector, wherein the N first entities are associated with each other, and the N first entities are related to the target event involved in the dialogue corpus;
[0111] Based on the second association relationship, N second entities are obtained from the user dialogue sentence, and the N second entities are encoded with word vectors to obtain N second word vectors, and the N second word vectors are concatenated to obtain the second event vector, wherein the N second entities are associated with each other and are related to the target event.
[0112] In another embodiment, the N first entities and the N second entities each include at least one of the following entities: a time entity representing the time when an event occurs, a place entity representing the place where the event occurs, a character entity representing characters related to the event, and an emotion entity representing the characters' emotions.
[0113] In another embodiment, the number of the first association relationships is M, each first association relationship corresponds to an intent in the intent set, each first association relationship is obtained by performing an association analysis on a third entity in the named entity set based on the corresponding intent, and the third entity is an entity identified from a dialogue sentence having the intent;
[0114] The evaluation unit encodes the first event vector in the following manner:
[0115] Determining the intent of the user dialogue sentence as a target intent;
[0116] Based on the first association relationship corresponding to the target intent, a third entity in the named entity set is encoded to obtain a first event vector.
[0117] In another embodiment, the dialogue processing device 400 further includes:
[0118] a comparing unit, configured to compare the first dialogue information with the second dialogue information to obtain difference information if the score of the user dialogue statement is less than a preset threshold, wherein the first dialogue information includes the entity and intent of the user dialogue statement, and the second dialogue information includes the entity and intent of the context dialogue statement of the user dialogue statement;
[0119] A correction unit is used to correct the user dialogue statement based on the difference information.
[0120] In another embodiment, the correction unit is specifically used for:
[0121] If the difference information indicates that the first dialogue information is different from the second dialogue information, and the appearance frequency of the first dialogue information in the dialogue corpus is less than the appearance frequency of the second dialogue information in the dialogue corpus, then modifying the user dialogue statement based on the second dialogue information; or,
[0122] If the difference information indicates that the first dialogue information is different from the second dialogue information, and the generation time of the context dialogue sentence is later than the generation time of the user dialogue sentence, the user dialogue sentence is modified based on the second dialogue information.
[0123] In another embodiment, the correction unit is specifically used for:
[0124] Based on the difference information, output a guiding sentence to the user;
[0125] receiving a response sentence input by the user in response to the guiding sentence;
[0126] Based on the response statement, the user dialogue statement is modified.
[0127] In another embodiment, the dialogue processing device 400 further includes:
[0128] A generating unit, configured to generate a user portrait of the user based on the score of the user dialogue sentence and the second association relationship;
[0129] A storage unit is used to store the user portrait in a user portrait library.
[0130] Obviously, the dialogue processing device provided in the embodiment of the present application can be used as the above Figure 1 The execution subject of the dialogue processing method shown in the figure can thus realize the dialogue processing device in Figure 1 The functions realized are as follows. Since the principles are the same, they will not be described in detail.
[0131] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0132] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0133] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0134] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a dialogue processing device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0135] Acquire an intent set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes an agent dialogue sentence and a user dialogue sentence, the intent set includes the intent of the agent dialogue sentence and the intent of the user dialogue sentence, and the named entity set includes entities in the agent dialogue sentence and entities in the user dialogue sentence;
[0136] Performing association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set;
[0137] performing association analysis on entities in the user dialogue sentences based on the intention of the user dialogue sentences to obtain a second association relationship between entities in the user dialogue sentences;
[0138] The user dialogue sentence is scored based on the first association relationship and the second association relationship.
[0139] The above application Figure 1The method performed by the dialogue processing device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by a hardware integrated logic circuit in the processor or a software instruction. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a 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-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art 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, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0140] The electronic device may also perform Figure 1 The method and the dialog processing device are implemented in Figure 1 , Figure 2 , Figure 3 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0141] Of course, in addition to software implementation, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0142] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:
[0143] Acquire an intent set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes an agent dialogue sentence and a user dialogue sentence, the intent set includes the intent of the agent dialogue sentence and the intent of the user dialogue sentence, and the named entity set includes entities in the agent dialogue sentence and entities in the user dialogue sentence;
[0144] Performing association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set;
[0145] performing association analysis on entities in the user dialogue sentences based on the intention of the user dialogue sentences to obtain a second association relationship between entities in the user dialogue sentences;
[0146] The user dialogue sentence is scored based on the first association relationship and the second association relationship.
[0147] The embodiment of the present application also proposes a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps in the dialogue processing method provided in the embodiment of the present application.
[0148] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0149] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0150] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0151] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0152] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A method for processing a conversation, characterized in that: include: Acquire an intent set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes an agent dialogue sentence and a user dialogue sentence, the intent set includes the intent of the agent dialogue sentence and the intent of the user dialogue sentence, and the named entity set includes entities in the agent dialogue sentence and entities in the user dialogue sentence; Performing association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set; performing association analysis on entities in the user dialogue sentences based on the intention of the user dialogue sentences to obtain a second association relationship between entities in the user dialogue sentences; The user dialogue sentence is scored based on the first association relationship and the second association relationship.
2. The method according to claim 1, characterized in that The scoring of the user dialogue statement based on the first association relationship and the second association relationship includes: Encoding the named entity set based on the first association relationship to obtain a first event vector; Encoding the entities in the user dialogue sentence based on the second association relationship to obtain a second event vector; A similarity between the first event vector and the second event vector is determined, and the user dialogue sentence is scored based on the similarity.
3. The method according to claim 2, characterized in that The first event vector and the second event vector are encoded in the following manner: Creating a corresponding first node for an entity in the named entity set in a preset coordinate system, creating a first connection edge between the created first nodes based on the first association relationship to obtain a first event graph, and performing graph encoding on the first event graph to obtain the first event vector; Creating corresponding second nodes for entities in the user dialogue sentence in a preset coordinate system, creating second connecting edges between the created second nodes based on the second association relationship to obtain a second event graph, and performing graph encoding on the second event graph to obtain a second event vector; The horizontal axis of the preset coordinate system represents the generation time of the dialogue sentence to which the entity belongs, and the vertical axis of the preset coordinate system represents the distance between the entities.
4. The method according to claim 2, characterized in that: The first event vector and the second event vector are encoded in the following manner: Based on the first association relationship, N first entities are obtained from the named entity set, and word vector encoding is performed on the N first entities to obtain N first word vectors, and the N first word vectors are concatenated to obtain the first event vector, wherein the N first entities are associated with each other, and the N first entities are related to the target event involved in the dialogue corpus; Based on the second association relationship, N second entities are obtained from the user dialogue sentence, and the N second entities are word vector encoded to obtain N second word vectors, and the N second word vectors are concatenated to obtain the second event vector, wherein the N second entities are associated with each other and are related to the target event.
5. The method according to claim 4, characterized in that The N first entities and the N second entities each include at least one of the following entities: a time entity representing the time when an event occurs, a location entity representing the location where the event occurs, a character entity representing a character related to the event, and an emotion entity representing the character's emotion.
6. The method according to claim 2, characterized in that The number of the first association relationships is M, each first association relationship corresponds to an intent in the intent set, each first association relationship is obtained by performing an association analysis on a third entity in the named entity set based on the corresponding intent, and the third entity is an entity identified from a dialogue sentence having the intent; The encoding of the named entity set based on the first association relationship to obtain a first event vector includes: Determining the intent of the user dialogue sentence as a target intent; Based on the first association relationship corresponding to the target intent, a third entity in the named entity set is encoded to obtain a first event vector.
7. The method according to claim 1, characterized in that After scoring the user dialogue statement based on the first association relationship and the second association relationship, the method further includes: If the score of the user dialogue statement is less than a preset threshold, the first dialogue information is compared with the second dialogue information to obtain difference information, wherein the first dialogue information includes the entity and intent of the user dialogue statement, and the second dialogue information includes the entity and intent of the context dialogue statement of the user dialogue statement; Based on the difference information, the user dialogue statement is modified.
8. The method according to claim 7, characterized in that The step of modifying the user dialogue statement based on the difference information includes: If the difference information indicates that the first dialogue information is different from the second dialogue information, and the appearance frequency of the first dialogue information in the dialogue corpus is less than the appearance frequency of the second dialogue information in the dialogue corpus, then modifying the user dialogue statement based on the second dialogue information; or, If the difference information indicates that the first dialogue information is different from the second dialogue information, and the generation time of the context dialogue sentence is later than the generation time of the user dialogue sentence, the user dialogue sentence is modified based on the second dialogue information.
9. The method according to claim 7, characterized in that: The step of modifying the user dialogue statement based on the difference information includes: Based on the difference information, output a guiding sentence to the user; receiving a response sentence input by the user in response to the guiding sentence; Based on the response statement, the user dialogue statement is modified.
10. The method according to any one of claims 1 to 9, characterized in that After scoring the user dialogue statement based on the first association relationship and the second association relationship, the method further includes: Generating a user profile of the user based on the score of the user dialogue sentence and the second association relationship; The user portrait is stored in a user portrait library.
11. A dialogue processing device, characterized in that: include: an acquisition unit, configured to acquire an intention set and a named entity set of a dialogue corpus, wherein the dialogue corpus includes an agent dialogue sentence and a user dialogue sentence, the intention set includes an intention of the agent dialogue sentence and an intention of the user dialogue sentence, and the named entity set includes entities in the agent dialogue sentence and entities in the user dialogue sentence; An analyzing unit, configured to perform association analysis on the named entity set based on the intention set to obtain a first association relationship between entities in the named entity set; The analysis unit is further configured to perform association analysis on entities in the user dialogue sentence based on the intention of the user dialogue sentence to obtain a second association relationship between entities in the user dialogue sentence; An evaluation unit, wherein the user scores the user dialogue statement based on the first association relationship and the second association relationship.
12. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the dialogue processing method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the dialog processing method as claimed in any one of claims 1 to 10.
14. A computer program product, characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute part or all of the steps in the dialog processing method according to any one of claims 1 to 10.
