Method for generating conversation graph, conversation method, device, equipment and storage medium
Patent Information
- Application Number
- CN202311587707.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-11-24
AI Technical Summary
为了能够使会话机器人像真人一样为用户提供全面丰富的应答服务,往往需要建立数据量巨大的会话语料,极大的数据体量会带来诸多问题,例如:增大数据存储、维护、更新和校验等方面的管理难度,消耗较大的人力成本和时间成本
[0063]本公开实施例提供的技术方案与现有技术相比具有如下优点:
Smart Images

Figure CN117609512B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of human-computer interaction, and in particular to methods for generating interaction graphs, interaction methods, apparatus, devices, and storage media. Background Technology
[0002] With the development of computer technology, human-computer interaction is becoming increasingly common. To enable chatbots to provide comprehensive and rich response services to users like real people, it is often necessary to build massive amounts of conversational data. This massive data volume brings many problems, such as increased management difficulty in data storage, maintenance, updating, and verification, and significant consumption of human and time costs. More importantly, the large data volume also leads to reduced efficiency in query and response statements.
[0003] Therefore, there is an urgent need for a method to reduce the amount of conversation data. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a method for generating a conversation graph, a conversation method, an apparatus, a device, and a storage medium.
[0005] Firstly, this disclosure provides a method for generating a conversation graph, including:
[0006] Acquire multiple conversation corpora; wherein, one of the conversation corpora includes multi-turn question-and-answer dialogue statements;
[0007] Entity recognition of words in the query statements of each of the aforementioned conversation statements is performed to obtain multiple key entities;
[0008] The key entities are categorized according to their types, resulting in various entity types;
[0009] Template nodes and template edges are constructed based on the entity type, and a session graph is constructed from the template nodes and template edges; wherein, the template node includes a pair of question and answer statements, and the template edge is used to represent the jump topic between two connected template nodes.
[0010] In another embodiment of this disclosure, the entity recognition of words in the query statements of each of the conversation statements is performed to obtain multiple key entities, including:
[0011] Determine the intent of the queries in each of the aforementioned conversation statements;
[0012] Based on the intent of the inquiry, the multiple inquiry statements are divided into different statement groups;
[0013] Within the same statement group, entity recognition is performed on the words in each of the query statements to obtain multiple key entities.
[0014] In another embodiment of this disclosure, constructing a template node based on the entity type includes:
[0015] Semantic fill is performed on the entity type to obtain multiple template query statements with different query intentions;
[0016] For each of the template query statements, determine the corresponding template answer statement;
[0017] The template query statement and its corresponding template answer statement are identified as the template node.
[0018] In another embodiment of this disclosure, constructing template edges based on the entity type includes:
[0019] Determine the preceding and following template nodes corresponding to the two query statements in two consecutive rounds of question and answer;
[0020] For the template query statement in the previous template node, obtain the corresponding target query statement in the next template node;
[0021] Determine the target entity type used to guide the topic from the entity types of the target query statement;
[0022] The target entity type is determined as the template edge that points from the previous template node to the next template node.
[0023] In another embodiment of this disclosure, the method further includes:
[0024] Key conversational statements, including multi-round question-and-answer sessions, are set within the multiple conversational corpora.
[0025] Data extraction of the key conversation statements is performed based on the triplet extraction algorithm to obtain semantically complete multi-turn question and answer statements and key statements used to continue the conversation in the question and answer statements between the previous and next rounds.
[0026] Each of the aforementioned question and answer statements is designated as an instance node;
[0027] The key statement between every two question and answer statements is used as an instance edge between the corresponding two instance nodes.
[0028] The instance node and the instance edge are added to the session graph.
[0029] In another embodiment of this disclosure, the method further includes:
[0030] In the session graph, the instance nodes and instance edges are determined to have a higher priority than the template nodes and template edges.
[0031] In another embodiment of this disclosure, the data extraction of key conversational statements based on the triplet extraction algorithm to obtain semantically complete multi-turn question-and-answer statements and key statements used to continue the conversation between consecutive rounds of question-and-answer statements includes:
[0032] Based on the triplet extraction algorithm, the first original question and answer statement, the second original question statement following the first original question and answer statement, and the second original answer statement responding to the second original question statement are extracted from the key conversation statements.
[0033] The first original question-and-answer statement, the second original question statement, and the second original answer statement are each adjusted into statements that are complete and semantically unchanged to obtain the final question-and-answer statement;
[0034] The second original query statement is filtered for noise to obtain the key statement.
[0035] Secondly, this disclosure also provides a session method, including:
[0036] Obtain a conversation graph; wherein the conversation graph is generated according to the method of the first aspect described above;
[0037] When a current query statement to be answered is obtained, the first node matching the current query statement is searched in the session graph. The first node includes: a first template node or a first instance node.
[0038] The current query statement is answered based on the answer statement in the first node.
[0039] In another embodiment of this disclosure, the method further includes:
[0040] After answering the current query statement, obtain a new query statement that continues the current query statement;
[0041] Based on the keywords in the new query statement, target edges that match the new query statement are determined from among the multiple edges corresponding to the first node; wherein, the target edges include: target template edges or target instance edges;
[0042] Determine the second node connected by the target edge;
[0043] The new query statement is answered based on the answer statement in the second node.
[0044] Thirdly, this disclosure also provides an apparatus for generating a conversation graph, comprising:
[0045] The conversation data acquisition module is used to acquire multiple conversation data; wherein, one of the conversation data includes conversation statements with multiple rounds of question and answer;
[0046] The entity processing module is used to perform entity recognition on the query statements in each of the aforementioned conversation statements to obtain multiple key entities;
[0047] The classification module is used to classify multiple key entities according to their categories, resulting in various entity types;
[0048] The graph construction module is used to construct template nodes and template edges based on the entity type, and to construct a session graph from the template nodes and template edges; wherein, the template node includes a pair of question and answer statements, and the template edge is used to represent the jump topic between the two connected template nodes.
[0049] Fourthly, this disclosure also provides a conversational device, including:
[0050] The graph acquisition module is used to acquire a session graph; wherein the session graph is generated according to the method described in the first aspect above;
[0051] The node lookup module is used to find a first node that matches the current query statement in the session graph when a current query statement to be answered is obtained. The first node includes: a first template node or a first instance node.
[0052] The answer module is used to answer the current query statement based on the answer statement in the first node.
[0053] Fifthly, this disclosure also provides an electronic device, including:
[0054] processor;
[0055] Memory, used to store executable instructions;
[0056] The processor is configured to read executable instructions from memory and execute the executable instructions to implement the session graph generation method of the first aspect above, or to implement the session method of the second aspect above.
[0057] Sixthly, this disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the session graph generation method of the first aspect above, or to implement the session method of the second aspect above.
[0058] In a seventh aspect, this disclosure also provides a refrigerator, comprising at least one of the following:
[0059] The conversation graph generation apparatus described in the third aspect above;
[0060] The conversation device described in the fourth aspect above;
[0061] The electronic equipment described in the fifth aspect above;
[0062] The computer-readable storage medium described in the sixth aspect above.
[0063] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0064] The method for generating a conversation graph according to this disclosure includes: acquiring multiple conversation corpora; wherein, a conversation corpus includes multi-turn question-and-answer conversation statements; performing entity recognition on the question statements in each conversation statement to obtain multiple key entities; classifying the multiple key entities according to categories to obtain multiple entity types; constructing template nodes and template edges based on entity types, and constructing a conversation graph from the template nodes and template edges; wherein, a template node includes a pair of question-and-answer statements, and a template edge is used to represent the topic jump between two connected template nodes. This technical solution first classifies the key entities in the conversation statements into multiple entity types. The same entity type can represent multiple key entities, thus significantly reducing the data volume compared to key entities; in short, a smaller number of entity types represent a larger number of key entities. Based on this, constructing template nodes and template edges using entity types also allows for the representation of a large number of conversation statements and topic jumps between conversation statements with a smaller number of template nodes and template edges. Therefore, this solution can significantly reduce the data volume of the conversation corpus through the conversation graph. Attached Figure Description
[0065] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0066] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0067] Figure 1 A schematic flowchart illustrating a method for generating a conversation graph according to an embodiment of this disclosure;
[0068] Figure 2 A comparative schematic diagram of two different conversation maps provided in the embodiments of this disclosure;
[0069] Figure 3A schematic flowchart of another method for generating a conversation graph provided in the disclosed embodiments;
[0070] Figure 4 A schematic diagram of a conversation graph provided in an embodiment of this disclosure;
[0071] Figure 5 A flowchart illustrating a session method provided in an embodiment of this disclosure;
[0072] Figure 6 A schematic diagram of the structure of a conversation graph generation apparatus provided in an embodiment of this disclosure;
[0073] Figure 7 This is a schematic diagram of the structure of a conversation device provided in an embodiment of the present disclosure;
[0074] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0075] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0076] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0077] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0078] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0079] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0080] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0081] Figure 1 This is a flowchart illustrating a method for generating a conversation graph according to an embodiment of the present disclosure.
[0082] In some embodiments of this disclosure, Figure 1 The method shown can be applied to devices that generate conversation maps in devices with human-computer interaction functions, such as refrigerators, air conditioners, and audio equipment. The device that generates conversation maps can be, for example, a controller in a device with human-computer interaction functions, but is not limited to this.
[0083] like Figure 1 As shown, the method for generating this session graph may include the following steps.
[0084] S102. Obtain multiple conversation data; where each conversation data includes conversational statements from multiple rounds of question and answer.
[0085] This embodiment can capture a large amount of conversation data from the network. To enhance the adaptability of the human-computer interaction service to different application scenarios, such as food management and the use of smart home appliances, and to improve the targeting and professionalism of the human-computer interaction service, this embodiment can obtain conversation data that matches a specified scenario by setting keywords. For example, it can collect conversation data about food management from different food-related websites. Each of these conversation data sets includes at least one round of question-and-answer dialogue statements; that is, each conversation data set consists of at least one pair of question and answer statements.
[0086] This example uses the application scenario of food management within a refrigerator to illustrate an implementation of acquiring multiple conversational data. In this food management scenario, conversational data related to food management is collected. This data can cover aspects such as the nutritional components, storage methods, preparation methods, suitable populations, and types of food. Specific examples include: Can diabetics eat watermelon? Is beef suitable for people with high blood pressure? Watermelon is a high-sugar fruit, and diabetics are advised to consume it in small amounts. Watermelon is rich in various vitamins and has the effect of balancing blood pressure and regulating heart function. Beef is rich in protein and amino acids, which can improve the body's disease resistance. Methods for preparing beef are also discussed. By utilizing the conversational data from this food management scenario and the conversation graph generated in subsequent steps, the system can be specifically targeted at this particular food management scenario. This allows multi-turn conversations based on the conversation graph to be reasonably controlled within the scope of food management, avoiding absurd or inaccurate human-computer interactions and improving the intelligence and controllability of human-computer interactions.
[0087] In practical applications, it has been found that in the same application scenario, users' queries are largely similar, with many similar questions. A large number of conversational statements conform to a certain template, with only a small number of conversational statements existing as exceptions. Therefore, it is considered to categorize the massive amount of conversational statements into a single type, extract templated semantic expressions, and use a small number of templated statements to summarize a large number of specific conversational statements. In this case, this embodiment can refer to the following steps S104 to S108 to process the conversational statements to achieve templated representation.
[0088] S104. Perform entity recognition on the query statements in each conversation to obtain multiple key entities.
[0089] There are several ways to perform entity recognition on query statements. For example, the query statement can be matched with entities in a pre-defined entity database to obtain the key entities in the query statement.
[0090] S106. Classify multiple key entities according to their types to obtain various entity types.
[0091] Entity type refers to the category to which an entity belongs after being classified according to its type. It can be understood that a large number of key entities can be identified based on a large corpus of conversations. Each key entity can be assigned a specific entity type; for example, the entity type of the key entity "watermelon" is "fruit," the entity type of the key entity "sugar content" is "nutritional components," and the entity type of the key entity "diabetes" is "health topic."
[0092] This embodiment can group key entities of the same type into one category, thereby obtaining multiple distinct entity types. One entity type corresponds to multiple key entities of the same type.
[0093] S108. Construct template nodes and template edges based on entity types, and construct a conversation graph using template nodes and template edges; wherein, a template node includes a pair of question and answer statements, and a template edge is used to represent the topic of transition between two connected template nodes.
[0094] In this embodiment, key entities in the conversational statements can be extracted, and each key entity can be replaced with its corresponding entity type. Semantic filling is then performed on each entity type. It is understood that for similar but different conversational statements, the same filled statement can be obtained after the above replacement and semantic filling process. For example, for the following multiple conversational statements: "Can diabetics eat watermelon?", "Can diabetics eat pineapple?", "Is it okay for people with high blood pressure to eat bananas?", the key entities "diabetes" and "high blood pressure" all correspond to the entity type "health topic", and the key entities "watermelon," "pineapple," and "banana" all correspond to the entity type "fruit". After replacing and semantically filling the above conversational statements, the same statement "[Health topic] Can I eat [fruit]?" is obtained. Furthermore, this embodiment can use the filled statements adapted to different conversational statements as the result of statement templates, called template statements. It is understood that, according to the intent of the conversational statement (asking or answering), template statements can include template question statements and template answer statements.
[0095] Based on this, this embodiment constructs template nodes by combining template query statements and their corresponding template answer statements.
[0096] In multi-turn conversations, the user takes the lead. Within consecutive turns, the contextual content of the conversation is sequential and complementary. While topic transitions are somewhat arbitrary, they generally don't deviate from the main theme. For example, in a conversation about food management, the conversation typically revolves around this theme rather than suddenly shifting to topics like weather or gossip. Based on this, this embodiment extracts target key entities from the multi-turn question-and-answer conversation statements to guide the topic. These target key entities can guide topic changes between two rounds of question-and-answer. Correspondingly, the entity type corresponding to the target key entity can guide transitions between template nodes. Therefore, the entity type corresponding to the target key entity is determined as a template edge, and the two template nodes whose topics are guided by this edge are connected through the template edge.
[0097] According to the above embodiments, a small number of template nodes and template edges can be extracted from a large amount of conversation data, and the template nodes and template edges can be used to form a conversation graph.
[0098] In a practical test, refer to Figure 2 As shown, the conversation graph composed of the original conversation data is as follows: Figure 2As shown in (a) above, it includes 2.8 million nodes and 98 million edges, representing a massive data volume. In contrast, the conversation graph generated after processing the conversation data according to this embodiment consists of template nodes and template edges, as shown below. Figure 2 As shown in (b), only 35 template nodes and 522 template edges are included, which significantly reduces the amount of data.
[0099] The method for generating a conversation graph provided in this disclosure includes: acquiring multiple conversation corpora; wherein, a conversation corpus includes multi-turn question-and-answer conversation statements; performing entity recognition on the question statements in each conversation statement to obtain multiple key entities; classifying the multiple key entities according to categories to obtain multiple entity types; constructing template nodes and template edges based on entity types, and constructing a conversation graph from the template nodes and template edges; wherein, a template node includes a pair of question-and-answer statements, and a template edge is used to represent the topic jump between two connected template nodes. This technical solution first classifies the key entities in the conversation statements into multiple entity types. The same entity type can represent multiple key entities, thus significantly reducing the data volume compared to key entities after classification; in short, a smaller number of entity types represent a larger number of key entities. Based on this, constructing template nodes and template edges using entity types also allows for the representation of a large number of conversation statements and topic jumps between conversation statements with a smaller number of template nodes and template edges. Therefore, this solution can significantly reduce the data volume of the conversation corpus through the conversation graph.
[0100] Regarding step S104 in the above embodiments, a method is provided here to perform entity recognition of words in the query statements of each conversation statement to obtain multiple key entities, including the following:
[0101] Determine the intent of the queries in each conversation. In one example, a pre-trained intent recognition model (such as the BERT model) can be used to identify the intent of the queries and obtain the query intent.
[0102] Based on the query intent, multiple query statements are divided into different statement groups. Within the same statement group, entity recognition is performed on the words in each query statement to obtain multiple key entities.
[0103] It is understandable that queries with the same intent tend to have a high degree of similarity in terms of structure and semantics. This embodiment groups multiple queries with the same intent into the same query group, clustering similar queries together. This facilitates the extraction of key entities of the same type when performing entity recognition on queries within a group, thus simplifying the classification process. Furthermore, compared to performing entity recognition on all queries indiscriminately, this embodiment, by dividing queries into different groups, ensures that the word segmentation methods and word-to-preset entity matching results are similar when performing entity recognition on similar queries within a group. This reduces the difficulty of entity recognition and improves recognition efficiency.
[0104] After obtaining all the key entities corresponding to the conversation corpus, the key entities are classified according to their types to obtain multiple entity types; template nodes and template edges that make up the conversation graph are constructed based on the entity types.
[0105] This embodiment provides a method for constructing template nodes based on entity types.
[0106] Semantic fill is performed on entity types to obtain various template query statements with different query intentions; corresponding template answer statements are determined for each template query statement; and the template query statements and their corresponding template answer statements are determined as template nodes.
[0107] In a specific embodiment, multiple different entity types can be arbitrarily combined, and then semantically filled into the multiple different entity types in each combination according to the statement structure to obtain the filled statement. If it is determined that the filled statement is semantically complete and can express a certain query intent, the filled statement is saved as a template query statement. Multiple template query statements with different query intents are obtained in this way.
[0108] Based on the above approach, template query statements can be understood as a way to organize and summarize various query statements with the same intent but different specific content by semantically filling in entity types, forming a templated form of statement. One template query statement can represent multiple query statements with the same intent but different expressions. For example, the template query statement "[Health Topic] Can I eat [Fruit]?" can represent a large number of queries such as "Can diabetics eat watermelon?", "Can diabetics eat pineapple?", and "Is it okay for people with high blood pressure to eat bananas?".
[0109] Then, corresponding template response statements are determined for each template query statement. Considering that in actual human-computer interactions, the response statements to queries are standardized response statements with uniform expression and format, retrieved from a pre-set database, one approach is to directly determine the response statement as the template response statement. Alternatively, in another approach, since these response statements have standardized characteristics, the aforementioned query statements are still used, and their responses are generally affirmative or negative (yes or no) plus relevant reasons. Therefore, in order to further reduce the amount of data, this embodiment can perform key entity replacement and semantic filling on the response statements to generate template response statements that can match different response statements.
[0110] Generate template query statements and template answer statements in the above manner, and then save the template query statement and its corresponding template answer statement as a pair of question and answer statements into the template node.
[0111] In multi-turn conversations, the conversations are often conversational, and the content of each conversation is sequential and supplementary. For example, the current question is "Can diabetics eat pineapple?" and the next question is "What about watermelon?" The question "What about watermelon?" is both a statement that guides the continuation of the topic and a semantically incomplete ellipsis. As mentioned earlier, the complete meaning of this question is "Can diabetics eat watermelon?" Since each template node contains a semantically complete statement, but actual conversations often contain many semantically incomplete statements like the one described above, this embodiment can establish a template edge between template nodes. The incomplete statements represented by the template edge guide the continuation of the topic, and the template node pointed to by the template edge determines the semantically complete template statement corresponding to the ellipsis.
[0112] Based on the above embodiments, the embodiment for constructing template edges based on entity type can be referred to as follows.
[0113] Determine the preceding and following template nodes corresponding to two query statements in two adjacent rounds of question and answer; for the template query statement in the preceding template node, obtain the corresponding target query statement in the following template node; determine the target entity type used to guide the topic from the entity type of the target query statement; determine the target entity type as the template edge pointing from the preceding template node to the following template node.
[0114] In this embodiment, different users may initiate the same query, but the subsequent queries following the same query may vary. For example, the same query, "Can diabetics eat watermelon?", may be followed by queries with different focuses, such as: "What about high blood pressure?", "Can I eat beef?", "What is the sugar content of watermelon?", and "What varieties of watermelon are delicious?"
[0115] Since the question statements have been processed into template question statements through the aforementioned embodiments, this embodiment does not need to use the original question statements in the conversation corpus to extract the entities that guide the topic through cumbersome processing such as entity recognition and classification. Instead, the entities that guide the topic can be directly determined from the template question statements.
[0116] In this case, this embodiment can be implemented in the preceding template node P corresponding to each pair of consecutive query statements. i and the next template node P i+1 Establish template edges between them. When establishing template edges, perform template query statements Q in the previous template node. i Retrieve the template query statement Q from the next template node. i The corresponding target query statement Q i+1 Target query statement Q i+1 In the template query statement Q i The next query statement that follows, the target query statement Q i+1 It follows from the previous template query statement Q i The topic will be linked, and the topic will also be redirected. The connection between the two statements is indicated by the same entity, while the redirection is indicated by the difference in entity types between them. For example, in the two template queries, "[Health Topic] Can I eat [fruit]?" and "[What are the [Nutritional Components] of [Fruit]?", the entity type "fruit" indicates the connection between the two statements, while the entity type "Nutritional Components" indicates the redirection.
[0117] This embodiment uses the template query statement Q. i And the target query statement Q i+1 The entity types are compared and semantic analysis is performed between them to identify entities that are different from the template query Q in the entity type of the target query. i The target entity type is the entity type used to guide topic navigation. The target entity type is defined as the template edge pointing from the previous template node to the next. Using the template queries "[Health Topic] Can I eat [fruit]?" and "[What are the [Nutritional Components] of [Fruit]?", the template edge between their respective template nodes can be "Nutritional Components".
[0118] According to the above embodiments, template edges can be constructed between every two template nodes. Furthermore, a session graph is formed by multiple template nodes and multiple template edges.
[0119] Considering that a small portion of the conversation data is an exception and does not conform to any templated statement, or that to meet personalized user needs, it is necessary to specifically set up some special question-and-answer sessions that exist independently outside of template nodes and template edges, this disclosure provides another method for generating conversation graphs, such as... Figure 3 The method further includes steps S302 to S310, based on steps S102 to S108 provided in the foregoing embodiments.
[0120] S302. In multiple conversational corpora, key conversational statements including multi-turn question-and-answer sequences are set. In one example scenario, it is necessary to recommend a new breed of beef specifically for diabetics to users. When a user asks, "Can diabetics eat beef?", an answer statement about this new breed of beef can be provided. Therefore, in this embodiment, this multi-turn question-and-answer conversational statement can be set as a key conversational statement.
[0121] S304. Based on the triplet extraction algorithm, extract key conversational statements to obtain semantically complete multi-round question-and-answer statements and key statements used to continue the conversation between the two rounds of question-and-answer statements.
[0122] In one embodiment, the first original question-and-answer statement (which can be represented as Q) in the current round of the conversation can be extracted from key conversation statements based on a triplet extraction algorithm. i A i The second original question following the first original question and answer statement (which can be represented as Q) i+1 ), and the second original answer statement in response to the second original query statement (which can be represented as A). i+1 ).
[0123] The first original question-and-answer statement, the second original inquiry statement, and the second original answer statement are each adjusted to be complete and semantically unchanged, resulting in the final question-and-answer statement. Specifically, the first original question-and-answer statement, the second original inquiry statement, and the second original answer statement may be colloquial expressions. In this embodiment, these statements are adjusted to be complete and semantically unchanged, namely: the target question-and-answer statement (Q'). i A' i ), Target query statement Q' i+1 and its target answer statement A' i+1 And, a question-and-answer statement (Q') consists of a target query and an answer statement. i+1 A' i+1This leads to the final two rounds of question-and-answer statements: (Q' i A' i ) and (Q' i+1 A' i+1 ).
[0124] The second original query statement Q above i+1 Noise filtering is performed to obtain the key statements. In other words, from the second original query statement Q... i+1 Extract keywords and generate semantically invariant key statements based on the keywords. These key statements are used to continue the conversation between the two rounds of question and answer.
[0125] S306. Each question-and-answer statement is designated as an instance node. Each instance node includes a pair of question-and-answer statements, including entity nodes corresponding to key conversational statements in multi-round question-and-answer sessions, such as: (Q'1, A'1), (Q'2, A'2)...(Q'...). i A' i ), ……
[0126] S308. Treat the key statement between every two question and answer statements as the instance edge between the corresponding two instance nodes.
[0127] S310. Add the instance nodes and instance edges to the session graph.
[0128] At this point, the session graph can include template nodes and template edges, as well as instance nodes and instance edges. (See reference...) Figure 4 This shows a portion of the session graph. For easy distinction, template nodes and template edges are represented by solid lines, while instance nodes and instance edges are represented by dashed lines. However, it should be understood that both are actual nodes and edges that exist in the session graph.
[0129] In this embodiment, instance nodes and instance edges are prioritized over template nodes and template edges in the conversation graph. This prioritization allows for the provision of response statements from instance nodes to the user first during human-computer interaction using the conversation graph.
[0130] Reference Figure 5 The embodiments disclosed herein are optimized based on the above embodiments and can be combined with various optional solutions in one or more of the above embodiments to provide a session method that can be implemented using the session graph generated by the foregoing embodiments.
[0131] like Figure 5 As shown, the session method may include the following steps.
[0132] S502. Obtain the conversation graph; wherein the conversation graph is generated according to the conversation graph generation method provided in the foregoing embodiments. The conversation graph includes nodes and edges between nodes, wherein nodes include template nodes and instance nodes. A pair of question-and-answer statements included in a template node are templated statements: a template query statement and a template answer statement; a pair of question-and-answer statements included in an instance node are target query statements after semantically completing the second original query statement. Corresponding to the nodes, edges include template edges and instance edges. Template edges use templated entity types to represent the jump topics between two connected template nodes, and instance edges use key statements to represent the jump topics between two connected instance nodes.
[0133] S504. When a current query statement awaiting a response is obtained, the first node matching the current query statement is searched in the session graph. The first node includes either the first template node or the first instance node.
[0134] Specifically, the current query is matched with statements in the nodes of the session graph based on semantic similarity. The current query may match both the first template node and the first instance node. In this case, the instance node is determined as the first node that ultimately matches the current query, since the instance node has a higher priority than the template node.
[0135] S506. Respond to the current query statement based on the response statement in the first node.
[0136] In a multi-turn conversation scenario, this embodiment may also include the following:
[0137] After answering the current query, obtain a new query that continues the current query; based on the keywords in the new query, determine the target edge that matches the new query from the multiple edges corresponding to the first node; the target edge includes: target template edge or target instance edge; determine the second node connected by the target edge; and answer the new query based on the answer statement in the second node.
[0138] In summary, the conversation method provided in this embodiment of the present disclosure, when a current query statement to be answered is obtained, searches for a first node matching the current query statement in a pre-acquired conversation graph. Since the nodes in the conversation graph store question and answer statements, the current query statement is answered according to the answer statement in the first node, which can improve the efficiency and accuracy of querying and answering statements.
[0139] Furthermore, in multi-turn conversation scenarios, for a new query statement that continues, the second node corresponding to the new query statement can be quickly located by finding the matching target edge in the conversation graph. Then, the new query statement can be answered based on the answer statement in the second node, which can improve the efficiency and accuracy of query response statements.
[0140] This disclosure also provides a refrigerator for implementing the session graph generation method and session method provided in the above embodiments.
[0141] In this embodiment, the method for generating a refrigerator-based conversation graph may include:
[0142] Acquire multiple conversation corpora; each conversation corpus includes multi-turn question-and-answer dialogue statements; perform entity recognition on the question statements in each dialogue statement to obtain multiple key entities; classify the multiple key entities according to their categories to obtain multiple entity types; construct template nodes and template edges based on entity types, and construct a conversation graph from the template nodes and template edges; wherein each template node includes a pair of question-and-answer statements, and the template edge is used to represent the topic jump between the two connected template nodes.
[0143] In this embodiment, based on the actual application of refrigerators, the conversation data obtained above can be a conversation about food management. Then, according to the above embodiment, a conversation graph oriented towards food management is generated, which enhances the adaptability between the conversation graph and the specific scenario of food management.
[0144] In this embodiment, the refrigerator-based session method may include:
[0145] Obtain the aforementioned session graph; when a current query statement awaiting a response is obtained, find the first node in the session graph that matches the current query statement, the first node including: a first template node or a first instance node; respond to the current query statement based on the response statement in the first node.
[0146] In this embodiment, since the conversation graph can be specifically targeted at the specific scenario of food management in the refrigerator, during the multi-round conversation between the user and the refrigerator, the conversation graph can ensure that the conversation is reasonably controlled within the scope of food management, thereby improving the intelligence and controllability of human-computer conversation and enabling better intelligent management of food in the refrigerator.
[0147] Figure 6 This is a schematic diagram of the structure of a conversation graph generation device provided in an embodiment of the present disclosure.
[0148] In some embodiments of this disclosure, Figure 6The device shown can be applied to devices with human-computer interaction capabilities, such as air conditioners and audio equipment, to implement a method for generating a conversation graph. The conversation graph generation device can be, for example, a controller in a device with human-computer interaction capabilities, but is not limited to this.
[0149] like Figure 6 As shown, the session map generation device 600 may include the following modules.
[0150] The conversation data acquisition module 610 is used to acquire multiple conversation data; wherein, one of the conversation data includes conversation statements with multiple rounds of question and answer;
[0151] The entity processing module 620 is used to perform entity recognition on the query statements in each of the conversation statements to obtain multiple key entities;
[0152] The classification module 630 is used to classify multiple key entities according to their categories to obtain multiple entity types;
[0153] The graph construction module 640 is used to construct template nodes and template edges based on the entity type, and to construct a session graph from the template nodes and template edges; wherein, the template node includes a pair of question and answer statements, and the template edge is used to represent the jump topic between the two connected template nodes.
[0154] In one embodiment, the entity processing module 620 is further configured to:
[0155] Determine the intent of the queries in each of the aforementioned conversation statements;
[0156] Based on the intent of the inquiry, the multiple inquiry statements are divided into different statement groups;
[0157] Within the same statement group, entity recognition is performed on the words in each of the query statements to obtain multiple key entities.
[0158] In one embodiment, the map construction module 640 is further configured to:
[0159] Semantic fill is performed on the entity type to obtain multiple template query statements with different query intentions;
[0160] For each of the template query statements, determine the corresponding template answer statement;
[0161] The template query statement and its corresponding template answer statement are identified as the template node.
[0162] In one embodiment, the map construction module 640 is further configured to:
[0163] Determine the preceding and following template nodes corresponding to the two query statements in two consecutive rounds of question and answer;
[0164] For the template query statement in the previous template node, obtain the corresponding target query statement in the next template node;
[0165] Determine the target entity type used to guide the topic from the entity types of the target query statement;
[0166] The target entity type is determined as the template edge that points from the previous template node to the next template node.
[0167] In one embodiment, the session graph generation apparatus further includes an incorporation module, which is used to:
[0168] Key conversational statements, including multi-round question-and-answer sessions, are set within the multiple conversational corpora.
[0169] Data extraction of the key conversation statements is performed based on the triplet extraction algorithm to obtain semantically complete multi-turn question and answer statements and key statements used to continue the conversation in the question and answer statements between the two rounds.
[0170] Each of the aforementioned question and answer statements is identified as an instance node;
[0171] The key statement between every two question and answer statements is used as an instance edge between the corresponding two instance nodes.
[0172] The instance node and the instance edge are added to the session graph.
[0173] In one embodiment, the session graph generation apparatus further includes a priority determination module, which is used to:
[0174] In the session graph, the instance nodes and instance edges are determined to have a higher priority than the template nodes and template edges.
[0175] In one embodiment, the joining module is further configured to:
[0176] Based on the triplet extraction algorithm, the first original question and answer statement, the second original question statement following the first original question and answer statement, and the second original answer statement responding to the second original question statement are extracted from the key conversation statements.
[0177] The first original question-and-answer statement, the second original question statement, and the second original answer statement are each adjusted into statements that are complete and semantically unchanged to obtain the final question-and-answer statement;
[0178] The second original query statement is filtered for noise to obtain the key statement.
[0179] It should be noted that, Figure 6 The conversation graph generation apparatus 600 shown can execute each step in any of the above method embodiments and achieve each process and effect in any of the above method embodiments, which will not be elaborated here.
[0180] Figure 7 This is a schematic diagram of the structure of a conversation device provided in an embodiment of this disclosure.
[0181] In some embodiments of this disclosure, Figure 7 The device shown can be applied to devices with human-computer interaction capabilities, such as air conditioners, refrigerators, and audio equipment, to implement a conversational method. The conversational device can be, for example, a controller in a device with human-computer interaction capabilities, but is not limited to this.
[0182] like Figure 7 As shown, the session device 700 may include the following modules.
[0183] The graph acquisition module 710 is used to acquire a session graph; wherein the session graph is generated according to the above-described session graph generation method;
[0184] The node lookup module 720 is used to find a first node that matches the current query statement in the session graph when a current query statement to be answered is obtained. The first node includes: a first template node or a first instance node.
[0185] The answer module 730 is used to answer the current query statement based on the answer statement in the first node.
[0186] In one embodiment, the answer module 730 is further configured to:
[0187] After answering the current query statement, obtain a new query statement that continues the current query statement;
[0188] Based on the keywords in the new query statement, target edges that match the new query statement are determined from among the multiple edges corresponding to the first node; wherein, the target edges include: target template edges or target instance edges;
[0189] Determine the second node connected by the target edge;
[0190] The new query statement is answered based on the answer statement in the second node.
[0191] It should be noted that, Figure 7The session device 700 shown can execute the steps in any of the above method embodiments and achieve the processes and effects in any of the above method embodiments, which will not be elaborated here.
[0192] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Figure 8 As shown, the detection device may include a processor 801 and a memory 802 storing computer program instructions.
[0193] Specifically, the processor 801 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.
[0194] Memory 802 may include a mass storage device for information or instructions. For example, and not limitingly, memory 802 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 802 may include removable or non-removable (or fixed) media. Where appropriate, memory 802 may be internal or external to the integrated gateway device. In a particular embodiment, memory 802 is a non-volatile solid-state memory. In a particular embodiment, memory 802 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0195] The processor 801 can perform the steps in any of the above method embodiments by reading and executing the computer program instructions stored in the memory 802.
[0196] In one example, the detection device may also include a transceiver 803 and a bus 804. Wherein, as... Figure 8As shown, the processor 801, memory 802 and transceiver 803 are connected via bus 804 and communicate with each other.
[0197] Bus 804 includes hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 804 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.
[0198] This disclosure also provides a computer-readable storage medium that can store a computer program. When the computer program is executed by a processor, the processor enables the processor to implement the session graph generation method and session method provided in this disclosure.
[0199] The aforementioned storage medium may, for example, include a memory 802 containing computer program instructions, which can be executed by the processor 801 of the detection device to complete the session map generation method and session method provided in this embodiment. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0200] This disclosure also provides a refrigerator, including at least one of the following:
[0201] The conversation graph generation apparatus described in the above embodiments;
[0202] The conversation device described in the above embodiments;
[0203] The electronic device described in the above embodiments;
[0204] The computer-readable storage medium described in the above embodiments.
[0205] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating a conversation graph, characterized in that, include: Acquire multiple conversation corpora; wherein, one of the conversation corpora includes multi-turn question-and-answer dialogue statements; Entity recognition of words in the query statements of each of the aforementioned conversation statements is performed to obtain multiple key entities; The key entities are categorized according to their types, resulting in various entity types; Template nodes and template edges are constructed based on the entity type, and a session graph is constructed from the template nodes and template edges; wherein, the template node includes a pair of question and answer statements, and the template edge is used to represent the jump topic between two connected template nodes; The method further includes: Key conversational statements, including multi-round question-and-answer sessions, are set within the multiple conversational corpora. Data extraction of the key conversation statements is performed based on the triplet extraction algorithm to obtain semantically complete multi-turn question and answer statements and key statements used to continue the conversation in the question and answer statements between the previous and next rounds. Each of the aforementioned question and answer statements is designated as an instance node; The key statement between every two question and answer statements is used as an instance edge between the corresponding two instance nodes. The instance node and the instance edge are added to the session graph.
2. The method according to claim 1, characterized in that, The entity recognition of words in the query statements of each of the aforementioned conversation statements yields multiple key entities, including: Determine the intent of the queries in each of the aforementioned conversation statements; Based on the intent of the inquiry, the multiple inquiry statements are divided into different statement groups; Within the same statement group, entity recognition is performed on the words in each of the query statements to obtain multiple key entities.
3. The method according to claim 1, characterized in that, The construction of template nodes based on the entity type includes: Semantic fill is performed on the entity type to obtain multiple template query statements with different query intentions; For each of the template query statements, determine the corresponding template answer statement; The template query statement and its corresponding template answer statement are identified as the template node.
4. The method according to claim 3, characterized in that, The construction of template edges based on the entity type includes: Determine the preceding and following template nodes corresponding to the two query statements in two consecutive rounds of question and answer; For the template query statement in the previous template node, obtain the corresponding target query statement in the next template node; Determine the target entity type used to guide the topic from the entity types of the target query statement; The target entity type is determined as the template edge that points from the previous template node to the next template node.
5. The method according to claim 1, characterized in that, The method further includes: In the session graph, the instance nodes and instance edges are determined to have a higher priority than the template nodes and template edges.
6. The method according to claim 1, characterized in that, The triplet extraction algorithm is used to extract key conversational statements to obtain semantically complete multi-turn question-and-answer statements and key statements used to continue the conversation between consecutive rounds of question-and-answer statements, including: Based on the triplet extraction algorithm, the first original question and answer statement, the second original question statement following the first original question and answer statement, and the second original answer statement responding to the second original question statement are extracted from the key conversation statements. The first original question-and-answer statement, the second original question statement, and the second original answer statement are each adjusted into statements that are complete and semantically unchanged to obtain the final question-and-answer statement; The second original query statement is filtered for noise to obtain the key statement.
7. A conversation method, characterized in that, include: Obtain a session graph; wherein the session graph is generated by the method according to any one of claims 1 to 6; When a current query statement to be answered is obtained, the first node matching the current query statement is searched in the session graph. The first node includes: a first template node or a first instance node. The current query statement is answered based on the answer statement in the first node.
8. The method according to claim 7, characterized in that, The method further includes: After answering the current query statement, obtain a new query statement that continues the current query statement; Based on the keywords in the new query statement, target edges that match the new query statement are determined from among the multiple edges corresponding to the first node; wherein, the target edges include: target template edges or target instance edges; Determine the second node connected by the target edge; The new query statement is answered based on the answer statement in the second node.
9. A conversation map generation apparatus, characterized in that, include: The conversation data acquisition module is used to acquire multiple conversation data; wherein, one of the conversation data includes conversation statements with multiple rounds of question and answer; The entity processing module is used to perform entity recognition on the query statements in each of the aforementioned conversation statements to obtain multiple key entities; The classification module is used to classify multiple key entities according to their categories, resulting in various entity types; The graph construction module is used to construct template nodes and template edges based on the entity type, and to construct a session graph from the template nodes and template edges; wherein, the template node includes a pair of question and answer statements, and the template edge is used to represent the jump topic between the two connected template nodes; The device further includes a feeding module, the feeding module being used for: Key conversational statements, including multi-round question-and-answer sessions, are set within the multiple conversational corpora. Data extraction of the key conversation statements is performed based on the triplet extraction algorithm to obtain semantically complete multi-turn question and answer statements and key statements used to continue the conversation in the question and answer statements between the previous and next rounds. Each of the aforementioned question and answer statements is designated as an instance node; The key statement between every two question and answer statements is used as an instance edge between the corresponding two instance nodes. The instance node and the instance edge are added to the session graph.
10. A conversational device, characterized in that, include: A graph acquisition module is used to acquire a session graph; wherein the session graph is generated by the method according to any one of claims 1 to 6; The node lookup module is used to find a first node that matches the current query statement in the session graph when a current query statement to be answered is obtained. The first node includes: a first template node or a first instance node. The answer module is used to answer the current query statement based on the answer statement in the first node.
11. An electronic device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the session graph generation method according to any one of claims 1-6, or to implement the session method according to any one of claims 7-8.
12. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the session graph generation method according to any one of claims 1-6, or the session method according to any one of claims 7-8.
13. A refrigerator, characterized in that, include: At least one of the following: The conversation graph generation apparatus according to claim 9; The conversation device as described in claim 10 above; The electronic device according to claim 11 above; The computer-readable storage medium as described in claim 12.
Citation Information
Patent Citations
Intelligent question and answer generation method and device, electronic equipment and storage medium
CN116204618A
Method, device and medium for constructing knowledge graph based on session
CN116415663A