A dialogue reply generation method, device and equipment and storage medium
Patent Information
- Application Number
- CN202311587740.5
- 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
[0003]但是,在模型训练阶段需要大量的训练语料,还要进行人工标注,耗费大量的人力物力和时间成本,且对于多轮对话无法准确的继承前轮对话中的信息导致回复的准确率也比较低
[0020]本公开实施例提供了一种对话回复生成方法,包括:获取当前轮对话的当前语句;在预先构建的语义空间包括的多个语义节点中确定和当前轮对话对应的第一语义节点,并在从第一语义节点出发的至少一个跳转边中确定预设字符和当前语句匹配的目标边,其中,语义空间还包括多个跳转边,每个跳转边用于连接两个语义节点且携带有预设字符;基于目标边指向的第二语义节点和第一语义节点收集的槽位信息,生成当前语句的回复语句,完成当前轮对话。本公开提供的方法,通过在预先构建的语义空间内进行语义节点间的跳转,确定当前轮对话所对应的语义节点,生成回复语句,有效提高了对话回复的准确率,在一定程度上减少了人力物力和时间成本。
Smart Images

Figure CN117609452B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for generating dialogue responses. Background Technology
[0002] With the development of artificial intelligence, human-computer interaction methods that enable real-time dialogue with users through dialogue systems have gradually become a research focus. Currently, most human-computer interaction methods use neural network models, which are trained using a large amount of dialogue history in the early stages, and then generate dialogue responses directly from the trained model.
[0003] However, the model training phase requires a large amount of training data and manual annotation, which consumes a lot of manpower, material resources and time. Furthermore, it cannot accurately inherit information from previous rounds of dialogue in multi-turn dialogues, resulting in a relatively low accuracy rate of responses. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides a method, apparatus, device, and storage medium for generating dialogue responses, which effectively improves the accuracy of dialogue responses and reduces manpower, material resources, and time costs to a certain extent.
[0005] In a first aspect, embodiments of this disclosure provide a method for generating dialogue responses, including:
[0006] Get the current statement in the current round of dialogue;
[0007] In a pre-constructed semantic space, a first semantic node corresponding to the current round of dialogue is determined from multiple semantic nodes. In at least one jump edge originating from the first semantic node, a target edge matching the current statement with a preset character is determined. The semantic space also includes multiple jump edges, each jump edge being used to connect two semantic nodes and carrying a preset character.
[0008] Based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, a response statement for the current statement is generated to complete the current round of dialogue.
[0009] Secondly, embodiments of this disclosure provide a dialogue response generation apparatus, comprising:
[0010] The acquisition unit is used to acquire the current statement in the current round of dialogue;
[0011] The first determining unit is configured to determine the first semantic node corresponding to the current round of dialogue among a plurality of semantic nodes included in a pre-constructed semantic space, wherein the plurality of semantic nodes are connected by jump edges, and the jump edges include preset characters;
[0012] The second determining unit is used to determine, in at least one jump edge connected to the first semantic node, a target edge that matches the preset character and the current statement;
[0013] The generation unit is used to generate a response statement for the current statement based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, thereby completing the current round of dialogue.
[0014] Thirdly, embodiments of this disclosure provide an electronic device, including:
[0015] Memory;
[0016] Processor; and
[0017] Computer programs;
[0018] The computer program is stored in the memory and configured to be executed by the processor to implement the dialogue response generation method as described above.
[0019] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the dialogue response generation method described above.
[0020] This disclosure provides a dialogue response generation method, comprising: obtaining the current statement of the current round of dialogue; determining a first semantic node corresponding to the current round of dialogue from multiple semantic nodes included in a pre-constructed semantic space, and determining a target edge matching a preset character and the current statement from at least one jump edge originating from the first semantic node, wherein the semantic space further includes multiple jump edges, each jump edge connecting two semantic nodes and carrying a preset character; generating a response statement for the current statement based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, thereby completing the current round of dialogue. The method provided by this disclosure, by performing jumps between semantic nodes within a pre-constructed semantic space to determine the semantic node corresponding to the current round of dialogue and generating a response statement, effectively improves the accuracy of dialogue responses and reduces manpower, material resources, and time costs to a certain extent. Attached Figure Description
[0021] 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.
[0022] 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.
[0023] Figure 1 A schematic diagram illustrating an application scenario provided by an embodiment of this disclosure;
[0024] Figure 2 A flowchart illustrating a dialogue response generation method provided in an embodiment of this disclosure;
[0025] Figure 3 A schematic diagram of the structure of a semantic space provided in an embodiment of this disclosure;
[0026] Figure 4 for Figure 2 The diagram shows a detailed flowchart of S203 in a dialogue response generation method.
[0027] Figure 5 This is a schematic diagram of the structure of a dialogue response generation device provided in an embodiment of the present disclosure;
[0028] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0029] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0030] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0031] To address the aforementioned technical problems, this disclosure provides a dialogue response generation method. By using a pre-constructed semantic space for navigation between semantic nodes, the previous semantic node of each dialogue round is determined. The semantic node corresponding to the current dialogue round is then determined based on the semantic node pointed to by the navigation edge of the previous semantic node. Response statements are generated based on the statement pairs included in the semantic node corresponding to the current dialogue round. By leveraging the connections between semantic nodes, the method fully considers the relevance between each dialogue round, effectively improving the efficiency and accuracy of response statement generation. Detailed explanation is provided through one or more of the following embodiments.
[0032] Specifically, the dialogue response generation method can be executed by the terminal or the server. Specifically, the terminal or server can... For example, in one application scenario, such as... Figure 1 As shown, server 12 constructs a semantic space. Terminal 11 obtains the semantic space from server 12 and generates a response statement for the current statement using the pre-constructed semantic space. In another application scenario, server 12 constructs a semantic space. Further, server 12 generates a response statement for the current statement using the pre-constructed semantic space. In yet another application scenario, terminal 11 constructs a semantic space. Further, terminal 11 generates a response statement for the current statement using the pre-constructed semantic space.
[0033] It is understood that the dialogue response generation method provided in this disclosure is not limited to the possible scenarios described above. The following detailed explanation uses the example of a terminal constructing a semantic space and generating a response statement for the current statement using the pre-constructed semantic space.
[0034] Figure 2 This is a flowchart illustrating a dialogue response generation method provided in an embodiment of the present disclosure, applied to a terminal deploying a human-computer interaction intelligent system, specifically including, as follows: Figure 2 The following steps S201 to S203 are shown:
[0035] S201. Obtain the current statement in the current round of dialogue.
[0036] Understandably, obtaining the current statement in the current round of dialogue typically involves the user initiating a session. A session includes at least one round of dialogue. The current round of dialogue may be the first round of the session or a subsequent round. In this solution, "current round of dialogue," "previous round of dialogue," "previous round of dialogue," and "historical round of dialogue" refer to one or more rounds of dialogue within a session. The current statement can be a statement in different forms, such as audio or text, emitted by the user in the current round of dialogue. For example, the current statement might be "book a flight." It is understood that the statements output by the user and the terminal during an interaction constitute a round of dialogue. The application scenario of this embodiment is to obtain the statement emitted by one end in a round of dialogue, denoted as the current statement in the current round of dialogue.
[0037] S202. Determine the first semantic node corresponding to the current round of dialogue among the multiple semantic nodes included in the pre-constructed semantic space, and determine the target edge that matches the preset character and the current statement in at least one jump edge starting from the first semantic node.
[0038] The semantic space also includes multiple jump edges, each jump edge connecting two semantic nodes and carrying a preset character; the multiple semantic nodes are connected by jump edges, and the jump edges include preset characters.
[0039] The semantic space is associated with refrigerator food management and is constructed based on data samples corresponding to refrigerator food management.
[0040] Understandably, a semantic space can be pre-constructed. Specifically, each semantic node in the semantic space and the preset characters carried by the transition edges between semantic nodes can be manually configured. This approach is suitable for small-scale dialogue scenarios. Alternatively, it can be based on a specific vertical domain, such as refrigerator food management, by collecting data samples from that domain and constructing the semantic space through model training. The specific construction method of the semantic space is not elaborated here and can be determined according to user needs. The semantic space includes a root semantic node, multiple semantic nodes, and multiple transition edges. Each semantic node includes at least one transition edge originating from it, and each transition edge carries preset characters. These preset characters represent the transition relationship between the two semantic nodes connected by the transition edge. The preset characters can be words, incomplete sentences, or complete sentences, such as addresses. Multiple semantic nodes can be connected and transitioned between each other through transition edges. The first semantic node can be the root semantic node or a historical semantic node.
[0041] Understandably, based on the above S201, the first semantic node corresponding to the current round of dialogue is determined among the multiple semantic nodes included in the semantic space. The second semantic node corresponding to the current round of dialogue can be determined from the first semantic node. The first semantic node can be regarded as the previous semantic node and serves as the query node for the current round of dialogue. The second semantic node can be regarded as the current semantic node.
[0042] Optionally, determining the first semantic node corresponding to the current round of dialogue from among multiple semantic nodes in the pre-constructed semantic space can be achieved through the following steps:
[0043] Multiple historical semantic nodes are determined from the multiple semantic nodes included in the semantic space, wherein the multiple historical semantic nodes include the semantic nodes corresponding to the previous round of dialogue; the first semantic node is determined from the multiple historical semantic nodes.
[0044] The plurality of historical semantic nodes include at least some of the semantic nodes involved in the target dialogue task corresponding to the current dialogue, and at least some of the semantic nodes may include the root semantic node.
[0045] Understandably, determining whether the current dialogue round is the first round (the first dialogue after the human-computer interaction system is activated) is crucial. If the current round is the first round, the root semantic node is directly used as the first semantic node corresponding to that round. If the current round is not the first round, meaning at least one previous round of dialogue has been completed before the current round, multiple historical semantic nodes are obtained. These historical semantic nodes correspond to semantic nodes from previous dialogues generated before the current round. This can be done by using semantic nodes corresponding to all previous dialogues from the first round to the current round, or by using a certain number of semantic nodes corresponding to previous dialogues generated before the current round in chronological order. The number of historical semantic nodes is not limited and can be determined according to user needs. After obtaining multiple historical semantic nodes, a first semantic node is selected from these nodes.
[0046] Optionally, determining the first semantic node among the plurality of historical semantic nodes can be achieved through the following steps:
[0047] Multiple historical semantic nodes are sorted according to their time identifiers to obtain sorted historical semantic nodes; the current historical semantic node is determined from the sorted historical semantic nodes; the preset characters of each jump edge starting from the current historical semantic node are semantically matched with the current statement, and the matching degree is calculated; if the matching degree is greater than or equal to a preset threshold, the current historical semantic node is determined as the first semantic node; or, if the matching degree is less than the preset threshold, the next historical semantic node is determined, until the first semantic node is determined or all the multiple historical semantic nodes are traversed.
[0048] Understandably, multiple historical semantic nodes are sorted by time to obtain a sorted set of historical semantic nodes. After each round of dialogue determines the corresponding semantic node, a time marker is added to that semantic node, which represents the generation time of that round of dialogue, such as the time when the current statement is obtained. Subsequently, a current historical semantic node is determined from the sorted set of historical semantic nodes, for example, by traversing multiple historical semantic nodes in chronological order. After determining the current historical semantic node, the semantic matching degree between the preset characters carried by each jump edge originating from the current historical semantic node and the current statement is calculated. If the current historical semantic node has a jump edge with a matching degree greater than or equal to a preset threshold, then the current historical semantic node is directly determined as the first semantic node, and the jump edge is determined as the target edge. Alternatively, a certain number of current historical semantic nodes are selected from the multiple historical semantic nodes, and the matching degree between the preset characters carried by each jump edge originating from the current historical semantic node and the current statement is calculated. All matching degrees are sorted in descending order, and the current historical semantic node corresponding to the jump edge with the largest matching degree value that is greater than the preset threshold is taken as the first semantic node. If all the matching degrees of the current historical semantic node are less than the preset threshold, then continue to traverse from multiple historical semantic nodes to determine the next historical semantic node. Then calculate the matching degree between the preset character carried by each jump edge from the next historical semantic node and the current statement, until the first semantic node is determined or multiple historical semantic nodes have been traversed.
[0049] Among them, the plurality of historical semantic nodes also include third semantic nodes in an incomplete state, and any semantic node pointed to by all the jump edges originating from the third semantic node in the incomplete state is not the semantic node corresponding to the previous round of dialogue.
[0050] Understandably, each historical semantic node also includes a state identifier, which includes an incomplete state and a completed state. An incomplete state means that none of the semantic nodes pointed to by multiple jump edges originating from that semantic node are historical semantic nodes corresponding to the current round of dialogue (or nodes not traversed in the current round of dialogue), and that the third semantic node is not a semantic node corresponding to a previous round of dialogue. Multiple historical semantic nodes also include third semantic nodes in an incomplete state. Understandably, each jump edge in the semantic space points to a semantic node. A semantic node in an incomplete state actually means that there are no other semantic nodes to jump to from that semantic node in this session, or that all jump edges originating from that semantic node have not been traversed as target edges in this session. However, some jump edges originating from that semantic node may have been traversed as target edges in other sessions. In one possibility, the dialogue round corresponding to the third semantic node and the current dialogue belong to different dialogue tasks. In another possibility, the dialogue round corresponding to the third semantic node and the current dialogue belong to the same dialogue task, but the dialogue round corresponding to the third semantic node is not the previous dialogue round. For example, the dialogue task has 10 dialogue rounds, and the previous dialogue rounds refer to the 4th to 10th dialogue rounds. The dialogue round corresponding to the third semantic node may be the 2nd dialogue round.
[0051] Optionally, the determination of the current historical semantic node from the sorted historical semantic nodes can be achieved through the following steps:
[0052] Traverse the sorted historical semantic nodes; if the root semantic node is included among the historical semantic nodes, and the first semantic node is still not determined when traversing the root semantic node, then the third semantic node is directly determined as the current historical semantic node.
[0053] Understandably, when traversing each historical semantic node after sorting, if the first semantic node is still not determined when traversing the root semantic node, or if the first semantic node is still not determined after traversing a certain number of historical semantic nodes, then the third semantic node is determined as the current historical semantic node. Multiple historical semantic nodes may include at least one third semantic node. In this case, at least one third semantic node can be sorted by time, and the current historical semantic node is determined by traversing the at least one third semantic node after sorting.
[0054] Understandably, the matching degree between the preset characters carried by all jump edges originating from the first semantic node and the current statement is obtained. The jump edge with the highest matching degree value that is greater than a preset threshold is determined as the target edge. Understandably, the same first semantic node may have multiple target edges, and different target edges point to different semantic nodes. When there are multiple target edges for the first semantic node, a final target edge can be determined from these multiple target edges, or subsequent step S203 can be performed for each target edge to generate a response statement corresponding to each target edge, and the final response statement for the current statement can be determined based on each response statement.
[0055] S203. Based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, generate the response statement for the current statement to complete the current round of dialogue.
[0056] Understandably, based on the above S202, the second semantic node pointed to by the target edge is determined. The second semantic node is the semantic node corresponding to the current round of dialogue. The first semantic node and the second semantic node are connected by the target edge. After the semantic node corresponding to each round of dialogue is determined, key information from the current round of dialogue and / or previous rounds of dialogue is collected as the slot information of the semantic node. For example, for a task-type dialogue related to refrigerator food management, the slot information can be the specific food, food-related data, and refrigerator-related information involved in previous rounds of dialogue. For example, if the previous round of dialogue is a task-type dialogue related to refrigerator food management: "u: The watermelon is in the refrigerator. m: Okay, the watermelon is recorded," the slot information collected by the semantic node corresponding to the previous round of dialogue includes watermelon and refrigerator. Then, when the user says the current statement "put it in the freezer," it can be seen that the slot information collected by the semantic node includes watermelon, refrigerator, and freezer. Obtain the slot information collected by the first semantic node, generate the response statement for the current statement based on the slot information and the second semantic node, and complete the current round of dialogue. The current round of dialogue includes the current statement issued by one end and the response statement issued by the other end in response to the current statement. The second semantic node can also be marked as a completed state, and the time identifier of the second semantic node can be the time when the current statement was issued.
[0057] For example, see Figure 3 , Figure 3This is a schematic diagram of the structure of a semantic space provided in an embodiment of the present disclosure. The semantic space includes a root semantic node and semantic nodes 1 to 9. Semantic nodes 1 to 6 are marked as completed and are the semantic nodes corresponding to the previous round of dialogue. After obtaining the current statement of the current round of dialogue, if the current round of dialogue is not the first round of dialogue, the root semantic node and semantic nodes 1 to 6 are taken as historical semantic nodes. The six historical semantic nodes are sorted according to time. Each historical semantic node is traversed, and the latest determined semantic node is taken as the current historical semantic node. The matching degree between the preset character carried by each jump edge starting from the current historical semantic node and the current statement is calculated. In one possible scenario, semantic node 6 is the most recently determined semantic node. If semantic node 6 does not have a jump edge matching the current statement, then follow jump edge 1 from semantic node 6 to semantic node 5. Semantic node 6 and semantic node 5 are connected by jump edge 1. Check if semantic node 5 has a jump edge matching the current statement. When traversing from semantic node 6 and semantic node 5 to the root semantic node, if the calculated matching degree is still less than the preset threshold, meaning the first semantic node is still not determined after traversing 3 semantic nodes, in this case, you can start from the root semantic node and continue traversing semantic nodes 1 to 4 in the connection order until the first semantic node is determined or all historical semantic nodes have been traversed. Alternatively, when traversing to... If the first semantic node is still not determined from the root semantic node, the third semantic node in an incomplete state is obtained from the remaining untraversed historical semantic nodes. For example, semantic node 4, where each jump edge from semantic node 4 does not point to any semantic node, is directly used as the current historical semantic node instead of traversing semantic nodes 1 to 3. If semantic node 4 has a jump edge with a matching degree greater than a preset threshold, then semantic node 4 is determined as the first semantic node. If semantic node 4 does not have a jump edge with a matching degree greater than the preset threshold, then semantic nodes 3 to 1 are traversed in connection order starting from semantic node 4 until the first semantic node is determined or all historical semantic nodes are traversed. Another possible case is that semantic node 4 is the most recently determined semantic node. If the first semantic node is still not determined after traversing 3 semantic nodes starting from semantic node 4 (i.e., after traversing semantic node 2), the remaining untraversed third semantic nodes in an incomplete state can be used as the current historical semantic node. The subsequent steps for determining the first semantic node are explained above and will not be repeated here.
[0058] This disclosure provides a dialogue response generation method that determines the first semantic node corresponding to the current round of dialogue by jumping between semantic nodes in a pre-constructed semantic space, and determines the second semantic node corresponding to the current round of dialogue based on the semantic node pointed to by the jump edge of the first semantic node. A response statement is generated based on the statements included in the semantic node corresponding to the current round of dialogue, the previous rounds of dialogue collected by the first semantic node, and the slot information of the current round of dialogue. Through the connection relationship between semantic nodes, the semantic nodes corresponding to previous rounds of dialogue can be traced back, fully considering the correlation between each round of dialogue, reducing ambiguity of statements, accurately rewriting the current statement to generate a complete statement, and then generating a response statement based on the complete statement, effectively improving the efficiency and accuracy of response statement generation.
[0059] Based on the above embodiments, Figure 4 for Figure 1 The diagram illustrates a detailed process flow of S203 in a dialogue response generation method. Optionally, based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, a response statement for the current statement is generated, specifically including, as follows: Figure 4 The following steps S401 to S402 are shown:
[0060] The semantic node further includes statement pairs, each statement pair comprising at least one first statement and at least one second statement, wherein the at least one first statement has the same semantic meaning.
[0061] Understandably, semantic nodes also include statement pairs, which consist of at least one first statement and at least one second statement. At least one first statement has the same semantics, such as "How is the weather tomorrow?" or "Is the weather good tomorrow?" which represent the weather tomorrow. At least one second statement may also contain statements with the same semantics, or they may be completely different statements. For example, the second statement may contain statements with the semantics of "The weather is very good tomorrow" or "The weather is nice tomorrow", which represent the weather tomorrow, or the second statement may contain statements with the semantics of "Where would you like to inquire about the weather?" which represent the location.
[0062] S401. Rewrite the current statement based on at least one first statement included in the second semantic node pointed to by the target edge and the slot information collected by the first semantic node to generate the complete statement of the current statement.
[0063] Understandably, the second semantic node to which the target edge points is determined, and the target statement is determined in at least one first statement included in the second semantic node. Then, the current statement is rewritten based on the target statement and the slot information collected by the first semantic node to generate the complete statement of the current statement. For example, if the previous dialogue was "Book a plane ticket" and "Okay, where are you departing from?", and the current statement of the current dialogue is "Beijing", in this case, the current statement needs to be converted into a complete statement, such as "Book a plane ticket departing from Beijing".
[0064] Optionally, the above S401 can be implemented through the following steps:
[0065] If the current statement is an incomplete statement, the default information of the current statement is determined from the slot information collected by the first semantic node; the current statement is rewritten according to at least one first statement included in the second semantic node pointed to by the target edge and the default information to generate the complete statement.
[0066] Understandably, when the current statement is incomplete, the default information for the current statement is determined from the slot information collected by the first semantic node. Based on the example above, the first semantic node is the semantic node corresponding to the previous round of dialogue, and the collected slot information is "Strawberry," "Book a flight," and "Depart." "Book a flight" and "Depart" from the slot information are used as the default information for the current statement. Subsequently, the current statement is rewritten based on the target statement and the default information to generate a complete statement.
[0067] S402. Determine the response statement of the complete statement in at least one second statement included in the second semantic node.
[0068] Understandably, based on the above S401, after generating the complete statement of the current statement, a reply template is selected from at least one second statement included in the second semantic node to generate a reply statement of the complete statement. For example, based on the above example, the generated reply statement is "Okay, where to?" or "Okay, where is the destination?", completing the current round of dialogue. At this time, the current round of dialogue is "Book a flight from Beijing" and "Okay, where is the destination?".
[0069] Optionally, determining the response statement of the complete statement in at least one second statement included in the second semantic node in S402 above can be achieved through the following steps:
[0070] If the complete statement is a query statement, then query the complete statement to generate query results; determine the target statement that matches the complete statement in at least one second statement included in the second semantic node; generate a response statement for the complete statement based on the target statement and the query results.
[0071] Understandably, if the current statement or the complete statement rewritten based on the current statement is a query statement, such as "Is Beijing Airport still usable?", then the query will query the question asked by the complete statement and generate the query result. For example, if the query determines that Beijing Airport is in normal use, then the response statement will be generated based on the second statement used as the response template and the query result. For example, the generated response statement might be "Beijing Airport is in normal use. Do you want to book a ticket departing from Beijing?", thus completing the current round of dialogue. At this point, the current round of dialogue consists of "Is Beijing Airport still usable?" and "Beijing Airport is in normal use. Do you want to book a ticket departing from Beijing?".
[0072] The present disclosure provides a dialogue response generation method that utilizes slot information to collect key information from previous dialogues, thereby fully considering the correlation between multiple rounds of dialogue and effectively improving the efficiency and accuracy of response statement generation.
[0073] Figure 5 This is a schematic diagram of a dialogue response generation device provided in an embodiment of the present disclosure. The dialogue response generation device provided in this embodiment can execute the processing flow provided in the dialogue response generation method embodiment, such as... Figure 5 As shown, the dialogue response generation device 500 includes an acquisition unit 501, a determination unit 502, and a generation unit 503, wherein:
[0074] The acquisition unit 501 is used to acquire the current statement of the current round of dialogue;
[0075] The determining unit 502 is configured to determine a first semantic node corresponding to the current round of dialogue among a plurality of semantic nodes included in a pre-constructed semantic space, and to determine a target edge that matches the current statement with a preset character in at least one jump edge connected to the first semantic node. The semantic space further includes a plurality of jump edges, each jump edge being used to connect two semantic nodes and carrying a preset character.
[0076] The generation unit 503 is used to generate a response statement for the current statement based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, thereby completing the current round of dialogue.
[0077] Optionally, the determining unit 502 is used for:
[0078] Multiple historical semantic nodes are determined from the multiple semantic nodes included in the semantic space, wherein the multiple historical semantic nodes include the semantic nodes corresponding to the previous round of dialogue;
[0079] The first semantic node is determined from the plurality of historical semantic nodes.
[0080] Optionally, the determining unit 502 is used for:
[0081] Multiple historical semantic nodes are sorted according to their time identifiers to obtain sorted historical semantic nodes.
[0082] Determine the current historical semantic node from the sorted plurality of historical semantic nodes;
[0083] The preset characters of each jump edge starting from the current historical semantic node are semantically matched with the current statement, and the matching degree is calculated.
[0084] If the matching degree is greater than or equal to a preset threshold, the current historical semantic node is determined as the first semantic node; or, if the matching degree is less than the preset threshold, the next historical semantic node is determined until the first semantic node is determined or all the historical semantic nodes are traversed.
[0085] Optionally, the plurality of historical semantic nodes in the device 500 includes a third semantic node in an incomplete state. The third semantic node in an incomplete state refers to a semantic node pointed to by any of the jump edges originating from the third semantic node that is not the semantic node corresponding to the previous round of dialogue.
[0086] Optionally, the determining unit 502 is used for:
[0087] Traverse the sorted historical semantic nodes;
[0088] If the root semantic node is included among the multiple historical semantic nodes, and the first semantic node is still not determined when traversing to the root semantic node, then the third semantic node is directly determined as the current historical semantic node.
[0089] Optionally, the semantic node in the device 500 further includes a statement pair, which includes at least one first statement and at least one second statement, wherein the at least one first statement has the same semantics.
[0090] Optionally, the generating unit 503 is used for:
[0091] The current statement is rewritten based on at least one first statement included in the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, to generate the complete statement of the current statement;
[0092] The response statement of the complete statement is determined in at least one second statement included in the second semantic node.
[0093] Optionally, the generating unit 503 is used for:
[0094] If the complete statement is a query statement, then query the complete statement to generate query results;
[0095] In at least one second statement included in the second semantic node, a target statement that matches the complete statement is determined;
[0096] A response statement is generated based on the target statement and the query result to form the complete statement.
[0097] Optionally, the generating unit 503 is used for:
[0098] If the current statement is an incomplete statement, the default information of the current statement is determined from the slot information collected by the first semantic node;
[0099] The current statement is rewritten based on at least one first statement included in the second semantic node pointed to by the target edge and the default information to generate the complete statement.
[0100] Figure 5 The dialogue response generation device shown in the embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0101] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. The electronic device can be a refrigerator, and its semantic space is associated with the refrigerator's food management. See below for details. Figure 6 The diagram illustrates a structural schematic suitable for implementing the electronic device 600 in the embodiments of this disclosure. The electronic device 600 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), wearable electronic devices, etc., as well as fixed terminals such as digital TVs, desktop computers, smart home devices, etc. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0102] like Figure 6As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603 to implement the dialogue response generation method as described in the embodiments of this disclosure. The RAM 603 also stores various programs and data required for the operation of electronic device 600. The processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0103] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0104] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts, thereby implementing the dialogue response generation method as described above. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, it performs the functions defined in the methods of embodiments of this disclosure.
[0105] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0106] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0107] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0108] Optionally, when one or more of the above-described procedures are executed by the electronic device, the electronic device may also perform other steps described in the above embodiments.
[0109] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0110] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0111] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0112] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0113] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0114] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or gateway that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or gateway. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or gateway that includes said element.
[0115] 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 dialogue responses, characterized in that, include: Get the current statement in the current round of dialogue; In a pre-constructed semantic space, a first semantic node corresponding to the current round of dialogue is determined from multiple semantic nodes. In at least one jump edge originating from the first semantic node, a target edge matching the current statement with a preset character is determined. The semantic space also includes multiple jump edges, each jump edge being used to connect two semantic nodes and carrying a preset character. Based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, a response statement for the current statement is generated to complete the current round of dialogue. The slot information includes information collected from the previous round of dialogue, and the current round of dialogue and the previous round of dialogue belong to the same dialogue task. The step of determining the first semantic node corresponding to the current round of dialogue from among multiple semantic nodes in the pre-constructed semantic space includes: Multiple historical semantic nodes are determined from the multiple semantic nodes included in the semantic space, wherein the multiple historical semantic nodes include the semantic nodes corresponding to the previous round of dialogue; Multiple historical semantic nodes are sorted according to their time identifiers to obtain sorted historical semantic nodes. Determine the current historical semantic node from the sorted plurality of historical semantic nodes; The preset characters of each jump edge starting from the current historical semantic node are semantically matched with the current statement, and the matching degree is calculated. If the matching degree is greater than or equal to a preset threshold, the current historical semantic node is determined as the first semantic node; or, if the matching degree is less than the preset threshold, the next historical semantic node is determined until the first semantic node is determined or all the historical semantic nodes are traversed.
2. The method according to claim 1, characterized in that, The plurality of historical semantic nodes also includes third semantic nodes in an incomplete state. The third semantic node in an incomplete state refers to a semantic node to which any semantic node pointed to by any of the jump edges originating from the third semantic node is not a semantic node corresponding to the previous round of dialogue. Determining the current historical semantic node from the sorted plurality of historical semantic nodes includes: Traverse the sorted historical semantic nodes; In the case where the plurality of historical semantic nodes include a root semantic node, if the first semantic node is not determined when traversing to the root semantic node, the third semantic node is directly determined as the current historical semantic node.
3. The method according to claim 1, characterized in that, The semantic node also includes statement pairs, each consisting of at least one first statement and at least one second statement, wherein the at least one first statement has the same semantic meaning. The step of generating a response statement for the current statement based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node includes: The current statement is rewritten based on at least one first statement included in the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, to generate the complete statement of the current statement; The response statement of the complete statement is determined in at least one second statement included in the second semantic node.
4. The method according to claim 3, characterized in that, The step of determining the response statement of the complete statement in at least one second statement included in the second semantic node includes: If the complete statement is a query statement, then query the complete statement to generate query results; In at least one second statement included in the second semantic node, a target statement that matches the complete statement is determined; A response statement is generated based on the target statement and the query result to form the complete statement.
5. The method according to claim 3, characterized in that, The step of rewriting the current statement based on at least one first statement included in the second semantic node pointed to by the target edge and the slot information collected by the first semantic node to generate the complete statement of the current statement includes: If the current statement is an incomplete statement, the default information of the current statement is determined from the slot information collected by the first semantic node; The current statement is rewritten based on at least one first statement included in the second semantic node pointed to by the target edge and the default information to generate the complete statement.
6. The method according to claim 1, characterized in that, The semantic space is associated with refrigerator food management, and it is constructed based on data samples corresponding to refrigerator food management.
7. A dialogue response generation device, characterized in that, include: The acquisition unit is used to acquire the current statement in the current round of dialogue; The determining unit is configured to determine a first semantic node corresponding to the current round of dialogue among multiple semantic nodes included in a pre-constructed semantic space, and to determine a target edge that matches the current statement with a preset character in at least one jump edge connected to the first semantic node. The semantic space further includes multiple jump edges, each jump edge being used to connect two semantic nodes and carrying a preset character. The generation unit is used to generate a response statement for the current statement based on the second semantic node pointed to by the target edge and the slot information collected by the first semantic node, thereby completing the current round of dialogue. The slot information includes information collected from the previous round of dialogue, and the current round of dialogue and the previous round of dialogue belong to the same dialogue task. The determining unit is further configured to: Multiple historical semantic nodes are determined from the multiple semantic nodes included in the semantic space, wherein the multiple historical semantic nodes include the semantic nodes corresponding to the previous round of dialogue; the multiple historical semantic nodes are sorted according to time identifiers to obtain sorted multiple historical semantic nodes; the current historical semantic node is determined from the sorted multiple historical semantic nodes; the preset characters of each jump edge starting from the current historical semantic node are semantically matched with the current statement, and the matching degree is calculated; if the matching degree is greater than or equal to a preset threshold, the current historical semantic node is determined as the first semantic node; or, if the matching degree is less than the preset threshold, the next historical semantic node is determined, until the first semantic node is determined or the multiple historical semantic nodes are traversed.
8. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the dialogue response generation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the dialogue response generation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Dialogue management method, dialogue management system and device, and storage medium
CN114428844A