Question and answer method, electronic device and storage medium

By filtering and correlating historical session data, the problem that new chatbots cannot understand the meaning of the current problem when dealing with multiple historical rounds of conversations is solved, achieving more accurate answer generation.

CN118690007BActive Publication Date: 2024-11-29ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411200818.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-11-29
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

The new chatbots fail to make full use of context information when dealing with multiple rounds of historical conversations, resulting in the inability to accurately understand the meaning of the current problem and thus generate inaccurate answers.

Method used

By obtaining the current question and its related historical session data, filtering out the target historical session data and other historical session data, using the relevance of these data to determine the answers to the current question and ensure the accuracy of the answers.

Benefits of technology

By filtering and correlating historical session data, the robot can more accurately understand the context of the current question, thereby generating more accurate and relevant answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690007B_ABST
    Figure CN118690007B_ABST
Patent Text Reader

Abstract

The present application discloses a question-and-answer method, an electronic device, and a storage medium. The question-and-answer method includes: obtaining a current question and multiple historical conversation data, each historical conversation data includes a historical question and / or an answer to each historical question; determining target historical conversation data related to the current question and other historical conversation data related to the target historical conversation data in multiple historical conversation data, the current question and the target historical conversation data have the same data, the target historical conversation data and the other historical conversation data have the same data, or one of the target historical conversation data and the other historical conversation data is a question and the other is an answer; based on the current question, the target historical conversation data and the other historical conversation data, determine the answer to the current question. The above scheme can improve the accuracy of the answer to the current question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the continuous development of large language model (LLM) technology, the application of new chatbots driven by LLM has been rapidly promoted. Compared with traditional conversational robots, these new chatbots have more natural and coherent conversation capabilities, and are closer to human thinking and expression habits. In addition, they have a higher level of intelligence and can better understand and answer various types of questions. This new technology has broad application prospects and provides users with a more intelligent and convenient communication experience. However, when processing historical multi-round conversations, these robots often fail to make full use of contextual information, resulting in an inability to accurately understand the meaning of the current question.

[0003] In view of the existing technical defects, how to provide a solution that can generate more accurate answers to current problems is a technical problem that needs to be solved urgently by technical personnel in this field. Summary of the invention

[0004] The present application at least provides a question-answering method, an electronic device, and a storage medium.

[0005] The present application provides a question-and-answer method, including: obtaining a current question and multiple historical conversation data, each historical conversation data including a historical question and / or an answer to each historical question; determining target historical conversation data related to the current question and other historical conversation data related to the target historical conversation data in the multiple historical conversation data, the current question and the target historical conversation data have the same data, the target historical conversation data and the other historical conversation data have the same data, or one of the target historical conversation data and the other historical conversation data is a question and the other is an answer; based on the current question, the target historical conversation data and the other historical conversation data, determining the answer to the current question.

[0006] The present application provides a question-and-answer device, including: an acquisition module, a first determination module and a second determination module; the acquisition module is used to acquire a current question and multiple historical conversation data, each historical conversation data includes a historical question and / or an answer to each historical question; the first determination module is used to determine target historical conversation data related to the current question and other historical conversation data related to the target historical conversation data among the multiple historical conversation data, the current question and the target historical conversation data have the same data, the target historical conversation data and the other historical conversation data have the same data, or one of the target historical conversation data and the other historical conversation data is a question and the other is an answer; the second determination module is used to determine the answer to the current question based on the current question, the target historical conversation data and the other historical conversation data.

[0007] The present application provides an electronic device, including a memory and a processor, wherein the processor is used to execute program instructions stored in the memory to implement the above-mentioned question-and-answer method.

[0008] The present application provides a computer-readable storage medium on which program instructions are stored. When the program instructions are executed by a processor, the above-mentioned question-and-answer method is implemented.

[0009] The above scheme obtains the current question and multiple historical conversation data, and determines the answer to the current question based on the current question, the determined target historical conversation data and other historical conversation data. The target historical conversation data determined by the present application has the same data as the current question, and the correlation between the target historical conversation data screened out from the historical conversation data and the current question can be utilized. The target historical conversation data determined by the present application and one of the other determined historical conversation data is a question, and the other is an answer. The correlation between the other historical conversation data screened out from the historical conversation data and the target historical conversation data can be utilized, thereby making the answer to the current question determined based on multiple historical conversation data with correlations and the answer to the current question more accurate.

[0010] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.

[0012] Figure 1 It is a flowchart of an embodiment of the question-answering method of the present application;

[0013] Figure 2 It is a schematic diagram of a relationship map in an embodiment of the question-answering method of the present application;

[0014] Figure 3 This is a schematic diagram of the relationship between the current question and the historical conversation in the first embodiment of the question-answering method of the present application;

[0015] Figure 4 is a schematic diagram of a chat window in an embodiment of the question-answering method of the present application;

[0016] Figure 5 It is a structural diagram of an embodiment of the question-answering device of the present application;

[0017] Figure 6 It is a structural schematic diagram of an embodiment of the electronic device of the present application;

[0018] Figure 7 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0019] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0020] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0021] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the objects associated before and after are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of, for example, including at least one of A, B, and C, can mean including any one or more elements selected from the set consisting of A, B, and C.

[0022] The present application provides some question-and-answer methods and question-and-answer devices. The application scenarios of the question-and-answer method include but are not limited to online customer service, intelligent assistants, and intelligent question-and-answer. The execution subject of the question-and-answer method may be a question-and-answer device or a dialogue system. For example, the question-and-answer device may be arranged in a terminal device or a server or other processing device, wherein the terminal device may be a device for question-and-answer, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, etc. In some possible implementations, the question-and-answer method may be implemented by a processor calling computer-readable instructions stored in a memory.

[0023] See also Figure 1 , Figure 1 1 is a flowchart of an embodiment of the question-answering method of the present application. Specifically, the question-answering method may include the following steps:

[0024] Step S11: Obtain the current question and multiple historical conversation data.

[0025] Each historical conversation data includes historical questions and / or answers to each historical question.

[0026] The current question may be the question currently input by the user in the current dialogue interface. The current dialogue interface may be a chat interface of the dialogue system, a specific control in a program or website with a dialogue function, etc., which may be preset according to actual application needs, and this application does not limit this. Specifically, the current question may be a question that the user asks the dialogue system at the current moment.

[0027] The number of multiple historical conversation data may be one or several. The present application takes multiple council conversation data as several as an example. For each historical conversation data, the historical conversation data may include historical questions, historical answers, or historical questions and historical answers. In some application scenarios, when a historical conversation data includes both historical questions and historical answers, the historical answer is the answer to the historical question output by the dialogue system, and the historical question and the historical answer are in the same dialogue relationship. In other application scenarios, when the historical answer included in one historical conversation data is the answer to the historical question included in another historical conversation data, the one historical conversation data and the other historical conversation data are in the same dialogue relationship. Specifically, the historical conversation data may be a historical question or a historical answer generated before the time when the current question was generated, or it may be a historical question and a historical answer generated before the time when the current question was generated. It can be understood that the historical question and / or historical answer may be a historical question, a historical answer, or a historical question and a historical answer.

[0028] The multiple historical conversation data may be conversation data generated before the generation time of the current question. The multiple historical conversation data may be in the current dialogue interface or may not be in the current dialogue interface. In the case where the multiple historical conversation data are not in the current face-to-face interface, obtaining the multiple historical conversation data includes: determining a database for storing the multiple historical conversation data, and obtaining the multiple historical conversation data from the database. In some application scenarios, the relationship between the multiple historical conversation data and the current question may be that the multiple historical conversation data and the current question belong to the same user, or that the multiple historical conversation data and the current question belong to conversation data generated within a preset time period, or that the multiple historical conversation data and the current question are conversation data generated by the same dialogue system. The way to obtain the current question may be to obtain the question sent to the dialogue system at the current moment from the chat interface of the dialogue system. It can be understood that the current question may be equivalent to the conversation data of the dialogue system at the current moment. The dialogue system may be a question-and-answer system.

[0029] Step S12: Determine target historical conversation data related to the current question and other historical conversation data related to the target historical conversation data among the multiple historical conversation data.

[0030] The current question and the target historical session data have the same data, the target historical session data and the other historical session data have the same data, or one of the target historical session data and the other historical session data is a question and the other is an answer.

[0031] The above step S12 may be to filter out target historical conversation data related to the current question and other historical conversation data related to the target historical conversation data from a plurality of historical conversation data.

[0032] There may be several target historical conversation data. Several may be one or more. Each target historical conversation data is one of multiple historical conversation data. The target historical conversation data may be a historical question and / or a historical answer. The relationship between each target historical conversation data and the current question is that the same data exists in the current question and the target historical conversation data. Specifically, the same data in the current question and the target historical conversation data may be the same summary, the same topic, the same emotional intent, and the same tag information, etc. The data of the current question and the data in the target historical conversation data are at least partially the same. It can be understood that the existence of the same data between the conversation data may be the existence of at least part of the data in the two conversation data. Specifically, the existence of at least part of the data in the two conversation data may be the existence of the same summary, the same topic, the same emotional intent, and the same tag information, etc. in the two conversation data.

[0033] The number of other historical session data may be several. Several may be one or more. Each other historical session data may be a historical session data other than the target historical session data among the multiple historical session data. In some application scenarios, the target historical session data has the same data as the other historical session data. The existence of the same data in the target historical session data and the other historical session data may refer to the existence of the same data between the above-mentioned session data. For one other session data, the existence of the same data in the target historical session data and the other historical session data may be that at least part of the data in the target historical session data and the other historical session data is the same. In other application scenarios, one of the target historical session data and the other historical session data is a question, and the other is an answer. The target historical session data and the other historical session data are in the same dialogue relationship. In the case where one of the target historical session data and the other historical session data is a question, and the other is an answer, the target historical session data may be the answer to the other historical session data, and the target historical session data may also be the question of the other historical session data.

[0034] Step S13: Determine the answer to the current question based on the current question, target historical conversation data and other historical conversation data.

[0035] The above step S13 may be to input the current question, all target historical conversation data, and all other historical conversation data as inputs to the language model corresponding to the dialogue system, and obtain the answer to the current question output by the large language model. It is understandable that the language model may be a large language model (LLM). For example, the language model may be GPT, Wenxinyiyan, etc., or may be other language models that can generate the answer to the current question, and the present application does not limit this. In some application scenarios, the reference weights of the input target historical conversation data and other historical conversation data in determining the answer to the current question are different. The reference weight of the target historical conversation data is greater than the reference weight of other historical conversation data. It is understandable that for the generation of the answer to the current question, the target historical conversation data requires the language model to pay more attention than other historical conversation data, so that the answer to the current question output by the language model is more accurate.

[0036] The above scheme obtains the current question and multiple historical conversation data, and determines the answer to the current question based on the current question, the determined target historical conversation data and other historical conversation data. The target historical conversation data determined by the present application has the same data as the current question, and the correlation between the target historical conversation data screened out from the historical conversation data and the current question can be utilized. The target historical conversation data determined by the present application and one of the other determined historical conversation data is a question, and the other is an answer. The correlation between the other historical conversation data screened out from the historical conversation data and the target historical conversation data can be utilized, thereby making the answer to the current question determined based on multiple historical conversation data with correlations and the answer to the current question more accurate.

[0037] In some embodiments, the above step S11 may include the following steps: first, obtain multiple historical conversations; then, split each historical conversation separately to obtain questions of each historical conversation and answers of each historical conversation; then, use each split question and each answer as historical conversation data, each historical conversation data includes a question or an answer.

[0038] Get multiple historical sessions. The multiple historical sessions may be at least two historical sessions. The historical session may be a session before the occurrence time of the current session. The current session is the session where the current question is located. Each historical session includes a historical question and a historical answer. There may be several current sessions. In the case of multiple current sessions, there may be multiple chat interfaces in the same dialogue system, and the user may send the current question to the dialogue system at the same time in the multiple chat interfaces, so that the dialogue system feeds back the answer to the current question to the user in the multiple chat interfaces. At this time, each current session is the current question and the answer to the current question in each chat interface, and the answer to the current question is also the current answer. In some application scenarios, the method of obtaining multiple historical sessions may be to directly use the historical sessions contained in the chat interface in the dialogue system. In other application scenarios, the method of obtaining multiple historical sessions may also be to obtain all historical sessions stored in the local database. The local database may include a local database. All historical sessions stored in the local database may be all historical sessions that have occurred in the dialogue system.

[0039] For each historical conversation, the historical conversation is split according to historical questions and historical answers, and the historical questions in the historical conversation are used as the questions of the historical conversation, and the answers in the historical conversation are used as the historical answers. In some application scenarios, for multiple historical conversations, the total number of questions obtained for each historical conversation is the same as the total number of the multiple historical conversations. For multiple historical conversations, the total number of answers obtained for each historical conversation is the same as the total number of the multiple historical conversations. In other application scenarios, for one historical conversation among multiple historical conversations, the historical conversation may only contain historical questions or historical answers after being split.

[0040] Each split question and each split answer are respectively used as historical session data, and each historical session data includes a question or an answer. In some application scenarios, each split question is used as each historical session data, and each historical session data includes a historical question. In other application scenarios, each split answer is used as each historical session data, and each historical session data includes a historical answer. It can be understood that for any historical session data, when the historical session data includes a historical answer, there is another historical session data that includes a historical question, and the relationship between the historical session data including the historical answer and the historical session data including the historical question may be the same session relationship, that is, the historical question and the historical answer are split from the same historical session. It can be understood that there may be the same session relationship between any two historical session data. In other application scenarios, when a historical session may only contain historical questions or historical answers after being split, the split questions or split answers as historical session data will not have the same session relationship with other historical session data.

[0041] It is understandable that a question or an answer included in each historical session data may be a historical question or a historical answer included in each historical session data. In some application scenarios, when there is a same session relationship between any historical session data and other historical session data, one of the historical session data and the other historical session data includes a historical question, and the other includes a historical answer, and the historical question and the historical answer belong to the same historical session. Exemplarily, the any historical session data may be represented as A, and the other historical session data may be represented as a. The historical session data A and the historical session data a belong to the same historical session. Among them, the historical session data A may be a historical question, and the historical session data a may be a historical answer. In other application scenarios, when there is no same session relationship between any historical session data and other historical session data, one of the historical session data and the other historical session data includes a historical question, and the other includes a historical answer, and the historical question and the historical answer do not belong to the same historical session, and the historical session corresponding to the any historical session data only includes one historical question or one historical answer. Exemplarily, any historical session may include at least one historical session data. Each historical session data may be regarded as a historical message, and a historical session may include at least one historical message. Each historical message may be any historical question or any historical answer. The current session may include the current question and the current answer. Both the current question and the current answer may be regarded as a current message.

[0042] It can be considered that when a historical conversation is split into at least one historical conversation data, each historical conversation data includes a historical question or a historical answer, compared to directly considering the contextual relationship based on the entire historical conversation, the present application uses historical conversation data to avoid using historical questions with low relevance or historical answers with low relevance in the historical conversation as factors for determining the current answer, thereby affecting the accuracy of the current answer.

[0043] In some embodiments, the above step S12 may include the following steps: First, extract label information for the current question and multiple historical session data to obtain the first label information in the current question and the second label information in each historical session data. Then, determine the correlation between the second label information of each historical session data. Next, construct a relationship graph between each historical session data, wherein each node in the relationship graph is a historical session data, and the edge between each node is determined based on the correlation between the second label information of each historical session data. Subsequently, match the first label information with the relationship graph to obtain the target historical session data and other historical session data.

[0044] Extract label information from the current question and multiple historical conversation data to obtain first label information in the current question and second label information in each historical conversation data. In some application scenarios, the current question and multiple historical conversation data can be simultaneously input into the language model, or the current question and multiple historical conversation data can be input into the language model separately to obtain the first label information in the current question and the second label information in each historical conversation data output by the language model. The language model can be the above-mentioned large language model.

[0045] In some application scenarios, the current question and multiple historical conversation data are used as data to be extracted, and the data to be extracted are input into the language model to extract label information, and the label information in the data to be extracted output by the language model is obtained. The label information in the data to be extracted includes the first label information in the current question and the second label information in each historical conversation data. In other application scenarios, the data to be extracted is screened from the current question and multiple historical conversation data, and the data to be extracted is input into the language model to extract label information, and the label information in the data to be extracted output by the language model is obtained.

[0046] The local database may also include a local database. The local database is used to store at least part of the label information of the historical messages in the historical session. The local database may also be used to store the label information of the current message in the current session. It is understandable that the label area in the local database can store the label information corresponding to part of the historical session data. The step of filtering the data to be extracted from the current question and multiple historical session data may be: for each candidate historical session data, query the local database whether the label information of the candidate historical session data is stored. The candidate historical session data is one of the multiple historical session data. In response to the label information of the candidate historical session data not being stored in the local database, the candidate historical session data is used as the message to be extracted. Specifically, multiple historical session data are obtained, and each historical session data is encoded according to the content to obtain the encoding value corresponding to each historical session data. Exemplarily, the encoding method may be data encoding or character encoding. Exemplarily, the encoding method may be md5 value encoding or cryptographic hash function SHA-1 encoding. The encoding value corresponding to each historical session data may be unique. Specifically, the encoding value corresponding to each historical session data may represent a unique ID information. In some application scenarios, the encoding value corresponding to each historical session data is stored as an identifier in an identification area in a local database. An identification area in the local database may correspond to a label area. The label area corresponding to each identification area may store label information of the historical session data. For any historical session data, in the local database, the encoding value corresponding to the historical session data may be used to perform an ID query, determine the identification area corresponding to the historical session data, and use the identification area corresponding to the historical session data as the target identification area. Based on the target identification area, the label area corresponding to the target identification area is determined, and the label area corresponding to the target identification area is used as the target label area. In response to the target label area not storing label information, the historical session data is determined as data to be extracted. In other application scenarios, the current question is encoded according to the content to obtain the encoding value corresponding to the current question. The current question is directly used as data to be extracted. After the steps of waiting for the above-mentioned data to be extracted to be input into the language model for label information extraction and obtaining the label information in each data to be extracted output by the language model are completed, the encoding value corresponding to each data to be extracted is stored in each identification area in the local database, and the label information in each data to be extracted is stored in the label area corresponding to each identification area in the local database.

[0047] The specific process of inputting the data to be extracted into the language model for label information extraction may be: processing each data to be extracted including each historical conversation data and the current question. In some application scenarios, each data to be extracted including each historical conversation data and the current question does not have label information, or the value of the label information is empty. In other application scenarios, the current question and the M rounds of historical conversations closest to the generation time of the current question are directly taken as the data to be extracted for the input language model. The M rounds of historical conversations contain at most 2×M historical conversation data. Then, the data to be extracted are passed into the encoding module of the language model for extracting label information, and the semantic understanding ability of the language model is used to perform at least one label encoding operation on each data to be extracted to obtain the label information in each data to be extracted output by the language model. At least one label encoding operation includes reference elimination, entity object extraction, and relationship extraction. The order of the above label encoding operations is not limited here. Reference elimination is to process the pronouns in each data to be extracted, and replace the pronouns with the name of a specific entity object, license plate number, etc. Exemplarily, the pronouns can be "she" or "it", etc. For example, the current question may be "How does it need to control its diet?", and the pronoun may be "it". It can be seen from the data to be extracted that the pronoun refers to the "cat" in the data to be extracted, including the historical conversation data. Reference elimination can eliminate ambiguity, making the label information in the data to be extracted more accurate and specific. Entity object extraction can be to identify the entity name, concept name and other information in the data to be extracted, and classify and categorize them to obtain entity object label elements. For example, the name, place name, and item name of the entity object are extracted from the data to be extracted as the entity object label element in the label information. Relation extraction can be the relationship between each entity or entity and event in each data to be extracted. Relation extraction is performed on any data to be extracted to obtain the relationship label element in the label information. Relation extraction can be relationship extraction. Exemplarily, the relationship label element can be the social relationship between each entity. The social relationship can be the social relationship between any two entity objects. For the above-mentioned label encoding operations, the label information corresponding to each data to be extracted can be obtained. The label information corresponding to any data to be extracted includes at least one label element. At least one tag element includes at least one entity object tag element and / or relationship tag element. Specifically, the tag information corresponding to any data to be extracted can be stored in the form of a string in the tag area corresponding to the identification area of ​​the data to be extracted in the local database. Exemplarily, the string form of each tag information can be {tag element 1, tag element 2}, or it can be simply expressed as {tag 1, tag 2}.In some application scenarios, if any of the data to be extracted cannot be labeled, empty label information {} is returned as the label information in the data to be extracted and stored in the label area corresponding to the identification area of ​​the data to be extracted in the local database. It can be understood that the label information in each data to be extracted includes the label information in the current question and the label information in each historical session data. The label information in the current question is the first label information. The label information in each historical session data is the second label information.

[0048] The correlation between the second label information of each historical session data is used to indicate whether the second label information of each historical session data has the same label element and / or whether each historical session data belongs to the same dialogue relationship. In some application scenarios, the at least one label element may also include a session label element. The session label element is used to identify that the historical session data belongs to one of the historical sessions. In the case where the at least one label element includes a session label element, the correlation between the second label information of each historical session data is used to indicate whether the second label information of each historical session data has the same label element.

[0049] The correlation between the second tag information of each historical session data may be determined by matching the tag elements in the second tag information of each historical session data to obtain a historical matching relationship, which is the relationship between the tag elements in the second tag information of each historical session data.

[0050] The historical matching relationship can be an overlapping label relationship or a same-conversation relationship. In response to the fact that the second label information of any two historical conversation data has the same label element, the historical matching relationship between the second label information of any two historical conversation data is determined to be an overlapping label relationship. In other application scenarios, determining that the historical matching relationship between the second label information of any two historical conversation data is an overlapping label relationship can be directly performing a similarity algorithm on any two historical conversation data or on the second label information of any two historical conversation data. If the determined similarity is greater than a similarity threshold, the historical matching relationship of the two historical conversation data is determined to be an overlapping label relationship. Exemplarily, the similarity algorithm can use cosine similarity or edit distance, etc. In response to the fact that any two historical conversation data belong to the same historical conversation, the historical matching relationship between the second label information of any two historical conversation data is determined to be a same-conversation relationship.

[0051] Each historical conversation data is taken as each node in the relationship graph. The edges between each node are determined based on each of the above historical matching relationships. The historical matching relationship between the second label information of any two historical conversation data is determined as the edge between any two nodes corresponding to the any two historical conversation data. Based on the edges between each node, a relationship graph between each historical conversation data is constructed. In some application scenarios, different preset edge weights are set for each edge according to the different historical matching relationships mentioned above. The edge weight corresponding to the overlapping label relationship can be greater than the edge weight corresponding to the same conversation relationship. Based on the edges between each node and each node and the edge weights, a relationship graph between each historical conversation data is constructed.

[0052] In some embodiments, the third label information of each node in the relationship graph is the second label information of each historical session data. The above step of matching the first label information with the relationship graph to obtain the target historical session data and other historical session data may include the following steps: First, match each third label information in the relationship graph with the first label information to obtain the first type of node and the second type of node in the relationship graph, the first type of node is the node corresponding to the third label information that overlaps with the first label information, and the second type of node is the node that has a connection relationship with the first type of node. Subsequently, based on the historical session data corresponding to the first type of node and the second type of node, the target historical session data and other historical session data are obtained.

[0053] In some application scenarios, the second label information of the historical session data corresponding to each node in the relationship graph is obtained. The second label information of the historical session data corresponding to each node is used as the third label information of each node in the relationship graph. The third label information in the relationship graph is matched with the first label information to obtain the first type of node in the relationship graph. Specifically, each third label information having a current matching relationship with the first label information is determined, and each third label information having a current matching relationship with the first label information is used as each first target label information. The current matching relationship may be the relationship between the label element in the first label information and the label element in the third label information of any node. The current matching relationship may be an overlapping label relationship or a same conversation relationship. When it is determined that there is at least one third label information having a current matching relationship with the first label information, the node corresponding to the first target label information is determined as a first type of node. Based on the historical session data corresponding to the first type of node and the second type of node, the step of obtaining the target historical session data and other historical session data is: based on the historical session data corresponding to the first type of node, the target historical session data is obtained. And, based on the historical session data corresponding to the second type of node, other historical session data is obtained. Based on the historical conversation data corresponding to the first type of node, the target historical conversation data is obtained. Specifically, the historical conversation data corresponding to the first type of node is used as the target historical conversation data. Each third label information in the relationship graph is matched with the first target label information to obtain the second type of node in the relationship graph. Specifically, the label information having a historical matching relationship with the first target label information is determined as the second target label information. In the case where it is determined that there is at least one label information having a historical matching relationship with the first target label information, the node corresponding to the second target label information is determined as the second type of node. Based on the historical conversation data corresponding to the second type of node, other historical conversation data is obtained. Specifically, the historical conversation data corresponding to the second type of node is used as the above-mentioned other historical conversation data. Among them, the label information having a historical matching relationship with the first target label information is an overlapping label relationship and / or a same conversation relationship in the above-mentioned historical matching relationship with the first target label information. In other application scenarios, in the case where it is not determined that there is at least one label information having a historical matching relationship with the first target label information, the first preset number of historical conversation data closest to the generation time of the current problem is directly taken. The first preset number of historical conversation data is used as other historical conversation data. It can be understood that the first type of node is a node corresponding to the third label information that overlaps with the first label information, that is, the label information in the historical session data corresponding to the first type of node has an overlapping label relationship with the first label information. The second type of node is a node that has a connection relationship with the first type of node, and the connection relationship can be a direct connection or an indirect connection between the first type of node and the second type of node in the relationship graph.If there is a direct connection between the first type of node and the second type of node, then there is the above-mentioned overlapping label relationship or the above-mentioned same-dialogue relationship between the third label information of the first type of node and the third label information of the second type of node.

[0054] In other application scenarios, in the step of matching the first label information with the relationship graph to obtain the target historical conversation data and other historical conversation data, if the third label information having a current matching relationship with the first label information is not determined, the second preset number of historical conversation data closest to the time when the current question was generated is directly taken. The second preset number of historical conversation data is used as the target historical conversation data and other historical conversation data. The above step S13 can be based on the second preset number of historical conversation data and the current question to determine the answer to the current question. The second preset number of historical conversation data and the current question are used as input to the language model corresponding to the dialogue system to obtain the answer to the current question output by the large language model.

[0055] See also Figure 2 , Figure 2 It is a schematic diagram of the relationship map in an embodiment of the question-answering method of the present application.

[0056] The first label information is the label information of the current question. The first label information can be {label 1, label 2}. Figure 2 The three historical conversations shown include six historical conversation data. In each historical conversation data, the second label information of each historical conversation data is the third label information of each node in the relationship graph. The third label information of the node of historical question 1 is {label 1}, the third label information of the node of historical answer 1 is {label 6}, the third label information of the node of historical question 2 is {label 3}, the third label information of the node of historical answer 2 is {label 3, label 4}, the third label information of the node of historical question 3 is {label 5, label 6}, and the third label information of the node of historical answer 3 is {label 7}. In the relationship graph, the nodes can be directly connected. Specifically, there is the above-mentioned overlapping label relationship or the above-mentioned same-dialogue relationship between the third label information of each directly connected node, that is, there is the above-mentioned overlapping label relationship or the above-mentioned same-dialogue relationship between the edges of each directly connected node. The edge between the node of historical question 1 and the node of historical answer 1 has a same-dialogue relationship. The edge between the node of historical question 2 and the node of historical answer 2 has a same-dialogue relationship. The edge between the node of historical question 3 and the node of historical answer 3 has a same-dialogue relationship. The edge between the node of historical question 3 and the node of historical answer 1 has an overlapping label relationship. Figure 2As shown, the first type of node is the node of historical question 1. The historical session data corresponding to the node of historical question 1 (that is, historical question 1) is used as the target historical session data. The second type of node can be the node of historical answer 1 that is directly connected to the node of historical question 1. The historical session data corresponding to the node of historical answer 1 (that is, historical answer 1) is used as other historical session data. The second type of node can also be the node of historical question 3 and the node of historical answer 3 that are indirectly connected to the node of historical question 1. The historical session data corresponding to the node of historical question 3 (that is, historical question 3) and the historical session data corresponding to the node of historical answer 3 (that is, historical answer 3) are respectively used as other historical session data.

[0057] In other application scenarios, after constructing the relationship graph between each historical conversation data, the reference node is added to the relationship graph to obtain an advanced relationship graph. The current question is used as the reference node in the advanced relationship graph. The other nodes in the advanced relationship graph except the reference node are candidate nodes. The process of adding the reference node to the relationship graph to obtain the advanced relationship graph includes: taking each node in the relationship graph as each candidate node and the edge between each node as the edge between each candidate node, and retaining them in the advanced relationship graph. The current question is used as the reference node. Based on the above current matching relationship, the edge between the reference node and each candidate node is determined. The reference node and the edge between the reference node and each candidate node are added to the relationship graph to obtain an advanced relationship graph. In some application scenarios, different preset edge weights are set for the edge between the reference node and each candidate node according to the above current matching relationship. The edge weight corresponding to the overlapping label relationship can be greater than the edge weight corresponding to the same dialogue relationship. The reference node and the edges between the reference node and each candidate node, as well as the weights of the edges between the reference node and each candidate node, are added to the relationship graph to obtain an advanced relationship graph. The above-mentioned step of matching the first label information with the relationship graph to obtain the target historical session data and other historical session data may also include: in the advanced relationship graph, the candidate node that has a connection relationship with the reference node is used as the target node. The target node includes a first type of node and a second type of node. Specifically, for each candidate node, in the advanced relationship graph, the candidate node that has a direct connection relationship with the reference node is used as the first type of node in the target node. In the advanced relationship graph, the candidate node that has an indirect connection relationship with the reference node is used as the second type of node in the target node. The historical session data corresponding to the first type of node in the target node is determined as the target historical session data. The historical session data corresponding to the second type of node in the target node is determined as other historical session data.

[0058] In some embodiments, after the above step S13, the above question-answering method may further include the following steps: first, the current question and the answer to the current question are respectively taken as a current session data. Then, each current session data is respectively taken as a newly added node in the relationship graph. Subsequently, based on the correlation between the fourth label information of each current session data and the third label information of each original node in the relationship graph, the edge between each newly added node and each original node is determined.

[0059] The answer to the current question may refer to the current answer. In some application scenarios, there may be multiple current sessions. Each current session includes the current question and the current answer. Each current session data is the current question and the current answer included in all current sessions. The current question and the current answer are respectively taken as a current session data. The label information of each current session data in the current session is taken as the fourth label information.

[0060] Before the step of determining the edge between each newly added node and each original node based on the correlation between the fourth label information of each current session data and the third label information of each original node in the relationship graph, the fourth label information of each current session data is determined. Specifically, the answer to the current question in each current session, that is, the current session data corresponding to each current answer, is input into the language model to obtain the label information in each current answer output by the language model, and the label information in each current answer is used as the fourth label information. And, the first label information in the current question in each current session is used as the fourth label information. Therefore, each fourth label information includes the label information in each current question and the label information in each current answer. In some application scenarios, each current session data is used as a newly added node in the relationship graph. Based on the correlation between the fourth label information of each current session data and the third label information of each original node in the relationship graph, the edge between each newly added node and each original node is determined. The newly added nodes are each current answer and each current question in each of the current session data. The edges between each newly added node and each original node are the edges between the nodes of each current answer and the nodes of each historical session data in the relationship map, and the edges between the nodes of each current question and the nodes of each historical session data in the relationship map. It can be understood that the edges between each newly added node and each original node are added to the above-mentioned relationship map to obtain the final relationship map. Specifically, the answer to the current question in each current session, that is, the current session data corresponding to each current answer, is input into the language model to obtain the label information in each current answer output by the language model, and the label information in each current answer is used as the fourth label information. Each fourth label information only includes the label information in each current answer. In other application scenarios, the current answers in each current session data are respectively used as newly added nodes in the advanced relationship map. There may be multiple reference nodes in the advanced relationship map. Based on the correlation between the fourth label information of the current answer in each current session data and the third label information of the original candidate nodes in the advanced relationship map, the edges between each newly added node and the original candidate nodes are determined. Based on the correlation between the fourth label information of the current answer in each current session data and the first label information of each original reference node in the advanced relationship map, the edges between each newly added node and each original reference node are determined. The newly added nodes are each current answer in each of the current session data. The edges between each newly added node and each original node are the edges between the nodes of each current answer and the nodes of each historical session data in the relationship map. It can be understood that each newly added node and the edges between each newly added node and each original node are added to the above-mentioned advanced relationship map to obtain the final relationship map.It can be considered that obtaining the final relationship graph can achieve that after executing the above step S13, when the dialogue system receives a new question, the label information of the new question is matched with the final relationship graph, and the target historical conversation data corresponding to the new question and other historical conversation data corresponding to the new question are determined, so that the answer to the new question generated by the dialogue system is more accurate.

[0061] In some embodiments, the above-mentioned step of obtaining target historical session data and other historical session data based on the historical session data corresponding to the first type of nodes and the second type of nodes may include the following steps: First, the total number of nodes of the first type of nodes and the second type of nodes is obtained. Then, in response to the total number of nodes being less than a preset number, a number of nodes are selected from the third type of nodes in the relationship graph as replacement nodes, so that the sum of the total number of nodes and the number of replacement nodes is equal to the preset number, and the third type of nodes are nodes other than the first type of nodes and the second type of nodes in the relationship graph. Subsequently, the historical session data corresponding to the first type of nodes is used as the target historical session data, and the historical session data corresponding to the second type of nodes and the replacement nodes is used as other historical session data.

[0062] In some application scenarios, the historical session data corresponding to the first type of nodes is directly determined as the target historical session data, and the historical session data corresponding to the second type of nodes is directly determined as the other historical session data. In other application scenarios, the target historical session data and other historical session data are screened out from the historical session data corresponding to the first type of nodes and the historical session data corresponding to the second type of nodes. The target historical session data may be the historical session data corresponding to at least one first type of node. The other historical session data may be the historical session data corresponding to at least one second type of node.

[0063] The total number of nodes may be the sum of the number of nodes of each first-class node and the number of nodes of each second-class node in the relationship graph or the advanced relationship graph. Exemplarily, the number of nodes of each first-class node is 5, the number of nodes of each second-class node is 6, and the total number of nodes is 11. The way to obtain the total number of nodes of the first-class nodes and the second-class nodes is to calculate the sum of the number of nodes of each first-class node and the number of nodes of each second-class node in the relationship graph or the advanced relationship graph, and take the sum as the total number of nodes. The preset number may represent the expected number between the target historical conversation data and other historical conversation data. It can be understood that the number between the target historical conversation data and other historical conversation data used to determine the answer to the current question in the above step S13 is a preset number. That is, the number of historical conversation data used to determine the answer to the current question is a preset number. The above step S13 may be to use the preset number of historical conversation data and the current question as the input of the language model to obtain the answer to the current question output by the language model. In the process of determining the answer to the current question, the number of each historical conversation data input into the language model is fixed. It can be understood that the preset number of historical session data is at least a part of the above preset number of historical session data.

[0064] The value corresponding to the number of replacement nodes is the difference obtained by subtracting the total number of nodes from the preset number. The number of replacement nodes is the replacement number. In some application scenarios, the replacement node can be a random node in each third-class node in the relationship map or the advanced relationship map. In other application scenarios, the replacement node can be a node obtained by screening in each third-class node according to a preset screening method. The preset screening method can be to sort the third-class nodes of the relationship map according to the distance from the occurrence time of the current problem, and use the third-class nodes closest to the occurrence time of the current problem as each replacement node. The preset screening method can also be to use the preset screening method to use the third-class node closest to the occurrence time of the current problem as the first replacement node. According to the label information in the historical session data of the first replacement node and the label information in the corresponding historical session data of each third-class node in the relationship map, the target historical session data and the other historical session data are obtained. Exemplarily, the preset number of historical session data is 20, that is, the preset number is 20. And the total number of nodes obtained is 11. The number of replacement nodes is 9. When the total number of nodes is less than the preset number, several nodes are randomly selected from the third type of nodes in the relationship graph or selected according to a preset screening method as replacement nodes. The historical session data corresponding to the first type of nodes is used as the target historical session data, and the historical session data corresponding to the second type of nodes and the replacement nodes is used as other historical session data.

[0065] In some embodiments, the above-mentioned step of obtaining the target historical session data and other historical session data based on the historical session data corresponding to the first type of nodes and the second type of nodes may include the following steps: first, obtaining the total number of nodes of the first type of nodes and the second type of nodes. Then, in response to the total number of nodes being greater than the preset number, obtaining the first type of reference information, the second type of reference information and / or the third type of reference information, the first type of reference information including the recall weight of the first type of nodes and the second type of nodes, the second type of reference information including the matching weight between the third label information corresponding to the first type of nodes and the second type of nodes and the first label information, the third type of reference information including the session generation time of the historical session data corresponding to each node in the first type of nodes and the second type of nodes, and the recall weight of the first type of nodes is greater than the recall weight of the second type of nodes. Subsequently, based on the first type of reference information, the second type of reference information and / or the third type of reference information, each node in the first type of nodes and the second type of nodes is screened. Next, the historical session data corresponding to the nodes retained in the first type of nodes are used as the target historical session data, and the historical session data corresponding to the nodes retained in the second type of nodes are used as other historical session data.

[0066] In some embodiments, the first tag information includes at least one tag element, and the third tag information includes at least one tag element. The method for obtaining the second type of reference information may include the following steps: obtaining the total number of tag elements in the first tag information. Then, screening the candidate tag elements from the third tag information, the candidate tag elements are the same tag elements between the third tag information and the first tag information. Subsequently, the ratio between the total number of tag elements in the candidate tag elements and the total number of tag elements in the first tag information is determined as the matching weight of the first type of node. Then, based on the matching weight of the first type of node, the matching weight of the second type of node is determined.

[0067] The second category of reference information includes the matching weight between the third label information corresponding to the first category of nodes and the first label information, and the matching weight between the third label information corresponding to the second category of nodes and the first label information. Get the total number of label elements in the first label information. Exemplarily, the first label information in the above current problem is {label 1, label 2}. The total number of label elements obtained in the first label information of the current problem is 2. For the third label information corresponding to each node in the first category of nodes, filter out candidate label elements from the third label information corresponding to the node in the first category of nodes. The candidate label elements are the same label elements between the third label information corresponding to the node and the first label information. Calculate the ratio between the total number of label elements in the candidate label elements and the total number of label elements in the first label information, and determine the ratio as the matching weight of the node in the first category of nodes. Figure 2The nodes in the first type of nodes shown may be nodes corresponding to historical question 1. The candidate label element obtained by screening the third label information corresponding to the historical question 1 node is label 1. For the historical question 1 node, the total number of label elements in the candidate label element is 1. The ratio between the total number of label elements in the candidate label element calculated and the total number of label elements in the first label information is one-half. The matching weight of the node corresponding to historical question 1 may be one-half. In some application scenarios, based on the matching weight of the first type of node, determining the matching weight of the second type of node may be directly determining the matching weight of any one of the first type of nodes as the matching weight of the node in the second type of node that has a connection relationship with the node in the first type of node. In other application scenarios, based on the matching weight of the first type of node, determining the matching weight of the second type of node may also be first determining, for any one of the first type of nodes, the node in each node of the second type of node that is directly connected to the node in the first type of node as the first matching node. The node in each node of the second type of node that is indirectly connected to the node is determined as the second matching node. The connection weight of the first matching node is greater than the connection weight of the second matching node. In some other application scenarios, the connection weight of the first matching node is the above-mentioned edge weight in the relationship graph. The matching weight of the node in the first type of node is multiplied by the connection weight of each first matching node, and the product obtained is the matching weight of each first matching node in the second type of node. The matching weight of the node in the first type of node is multiplied by the connection weight of each second matching node, and the product obtained is the matching weight of each second matching node in the second type of node.

[0068] In some application scenarios, when the total number of nodes is greater than a preset number, the first type of reference information is obtained. Based on the first type of reference information, each node in the first type of nodes and the second type of nodes is screened. Specifically, the recall weight of the first type of nodes is greater than the recall weight of the second type of nodes. Each node in the first type of nodes and each node in the second type of nodes are sorted according to the size of the recall weight to obtain a node sorting table. In the node sorting table, a preset number of nodes ranked before the weight ranking are used as the nodes retained in the first type of nodes and the nodes retained in the second type of nodes. Each ranking in the node sorting table can correspond to a screening weight. It can be understood that the screening weight of each ranking in the node sorting table is the recall weight.

[0069] Please refer to Figure 3 , Figure 3 It is a schematic diagram of the relationship between the current question and the historical conversation in an embodiment of the question-answering method of the present application.

[0070] like Figure 3As shown, the historical question included in historical session 1 is question 1, and the historical answer is answer 1. Because there is an overlapping label relationship between the label information of the current question and the label information of question 1, question 1 in historical session 1 is a first-class node. Historical session 1 is directly recalled, and question 1 and answer 1 in historical session 1 can be directly used as the above-mentioned target historical session data. In some application scenarios, question 1 in historical session 1 can be used as a first-class node, and answer 1 in historical session 1 can be used as a second-class node. In other application scenarios, both question 1 and answer 1 in historical session 1 can be used as first-class nodes. It can be understood that the recall weight of question 1 in historical session 1 is the recall weight of the first-class node. The recall weight of answer 1 in historical session 1 can be the recall weight of the first-class node or the recall weight of the second-class node. In the case where the recall weight of answer 1 in historical session 1 is the recall weight of the second-class node, the recall weight of question 1 in historical session 1 can be used as the recall weight of answer 1 in historical session 1. Because there is an overlapping label relationship between the label information of question N-1 in historical session 3 and the label information of answer 1 in historical session 1, question N-1 in historical session 3 is taken as the second type of node, and historical session 3 is indirectly recalled. The recall weight of indirect recall is the recall weight of the second type of node. Because question N-2 and answer N-2 in historical session 2 do not belong to the historical session data corresponding to each node in the first type of node and do not belong to the historical session data corresponding to each node in the second type of node, historical session 2 will not be recalled. The current question directly recalls the number of historical sessions corresponding to each node in the first type of node based on the recall weight of the first type of node, and takes the number of historical sessions corresponding to each node in the first type of node as the target historical session data. The current question indirectly recalls the number of historical sessions corresponding to each node in the second type of node based on the recall weight of the second type of node, and takes the number of historical sessions corresponding to each node in the second type of node as other historical session data.

[0071] In some application scenarios, when the total number of nodes is greater than a preset number, the second type of reference information is obtained. Based on the second type of reference information, each node in the first type of node and the second type of node is screened. Specifically, each node in the first type of node and each node in the second type of node are sorted according to the size of the matching weight to obtain a node sorting table. In the node sorting table, a preset number of nodes ranked before the weight ranking are used as the nodes retained in the first type of node and the nodes retained in the second type of node. Each ranking in the node sorting table can correspond to a screening weight. It can be understood that the screening weight of each ranking in the node sorting table is the matching weight of each node in the first type of node or the matching weight of each node in the second type of node.

[0072] In some application scenarios, the session generation time of the historical session data is the occurrence time of the above historical session data. When the total number of nodes is greater than the preset number, the third type of reference information is obtained. Based on the third type of reference information, each node in the first type of node and the second type of node is screened. Specifically, according to the time sequence of the session generation time of the historical session data corresponding to each node in the first type of node and the session generation time of the historical session data corresponding to each node in the second type of node, each node in the first type of node and each node in the second type of node are sorted to obtain a node sorting table. In the node sorting table, the preset number of nodes ranked before the weight ranking are used as the nodes retained in the first type of node and the nodes retained in the second type of node. Each ranking in the node sorting table can correspond to a screening weight. It can be understood that the screening weight of each ranking in the node sorting table is the time weight of each node in the first type of node or the time weight of each node in the second type of node. Among them, for each node in the first type of node and the second type of node, the occurrence time of the historical session data corresponding to the node is closer to the occurrence time of the current problem, and the time weight of the node is greater.

[0073] It can be understood that the above-mentioned step of obtaining the first type of reference information, the second type of reference information and / or the third type of reference information can be to obtain any one, any two or all three of the three reference information. The above-mentioned step of screening each node in the first type of node and the second type of node based on the first type of reference information, the second type of reference information and / or the third type of reference information can be to screen each node in the first type of node and the second type of node based on any one, any two or all three of the three reference information. For the case of obtaining any two or all three of the three reference information, please refer to the above-mentioned contents of obtaining any one, which will not be repeated here. For the case of screening each node in the first type of node and the second type of node based on any two or all three of the three reference information, please refer to the above-mentioned contents, which will not be repeated here.

[0074] It can be considered that the current question and the target historical conversation data in the filtered historical conversation and other historical conversation data are passed to the language model for generating the answer encoding module to generate the answer to the current question. The language model can be pre-trained. The input data is encoded using the semantic understanding ability of the pre-trained language model. During the encoding process, the large language model learns the semantic structure and contextual relationship of the language and applies it to generate answers. In other application scenarios, the input of the language model can also be the information of the current question and the dialogue prompt template and the target historical conversation data in the filtered historical conversation and other historical conversation data. Considering the consistency of context and semantics, the language model generates a more accurate answer to the current question. It should be noted that the performance and result quality of the large language model encoding module will be affected by the training data.

[0075] See also Figure 4 , Figure 4 It is a schematic diagram of a chat window in an embodiment of the question-answering method of the present application.

[0076] The user can enter the current question in the current question input area. When the user has finished entering the current question, click Send, and the dialogue system can obtain the current question. The historical conversation data can be the historical conversation data in the current chat window, or the historical conversation data in multiple historical chat windows and the historical conversation data in the current chat window. The dialogue system can be a chat robot application driven by a large language model (LLM). The dialogue system can use historical conversation screening technology to obtain target historical conversation data and other historical conversation data to determine that the current answer is more accurate. Through historical conversation screening, the dialogue system can extract the most relevant information and context from the massive data based on the current question and the historical conversation target historical conversation data and other historical conversation data, and generate the current answer corresponding to the current question. The dialogue system can not only understand the user's current question, but also provide more accurate and targeted answers with the help of valuable target historical conversation data and other historical conversation data context information in the historical conversation. The dialogue system can be widely used in many fields, such as online customer service, intelligent assistants, intelligent question and answer, etc.

[0077] The above scheme obtains the current question and multiple historical conversation data, and determines the answer to the current question based on the current question, the determined target historical conversation data and other historical conversation data. The target historical conversation data determined by the present application has the same data as the current question, and the correlation between the target historical conversation data screened out from the historical conversation data and the current question can be utilized. The target historical conversation data determined by the present application and one of the other determined historical conversation data is a question, and the other is an answer. The correlation between the other historical conversation data screened out from the historical conversation data and the target historical conversation data can be utilized, thereby making the answer to the current question determined based on multiple historical conversation data with correlations and the answer to the current question more accurate.

[0078] See also Figure 5 , Figure 5 It is a structural diagram of an embodiment of the question-and-answer device of the present application. The question-and-answer device 50 includes an acquisition module 51, a first determination module 52, and a second determination module 53. The acquisition module 51 is used to acquire the current question and multiple historical conversation data, each of which includes historical questions and / or answers to each historical question; the first determination module 52 is used to determine the target historical conversation data related to the current question and other historical conversation data related to the target historical conversation data among the multiple historical conversation data, the current question and the target historical conversation data have the same data, the target historical conversation data and the other historical conversation data have the same data, or one of the target historical conversation data and the other historical conversation data is a question and the other is an answer; the second determination module 53 is used to determine the answer to the current question based on the current question, the target historical conversation data and the other historical conversation data.

[0079] The above scheme obtains the current question and multiple historical conversation data, and determines the answer to the current question based on the current question, the determined target historical conversation data and other historical conversation data. The target historical conversation data determined by the present application has the same data as the current question, and the correlation between the target historical conversation data screened out from the historical conversation data and the current question can be utilized. The target historical conversation data determined by the present application and one of the other determined historical conversation data is a question, and the other is an answer. The correlation between the other historical conversation data screened out from the historical conversation data and the target historical conversation data can be utilized, thereby making the answer to the current question determined based on multiple historical conversation data with correlations and the answer to the current question more accurate.

[0080] Please refer to the question-and-answer method for the functions performed by each module, which will not be repeated here.

[0081] See also Figure 6 , Figure 66 is a schematic diagram of the structure of an embodiment of an electronic device of the present application. The electronic device 60 includes a memory 61 and a processor 62, and the processor 62 is used to execute program instructions stored in the memory 61 to implement the steps in the above-mentioned question-answering method embodiment. In a specific implementation scenario, the electronic device 60 may include but is not limited to: a multi-camera device, a microcomputer, and a server. In addition, the electronic device 60 may also include a mobile device such as a laptop computer and a tablet computer, which is not limited here.

[0082] Specifically, the processor 62 is used to control itself and the memory 61 to implement the steps in the above-mentioned question-answer method embodiment. The processor 62 can also be called a CPU (Central Processing Unit). The processor 62 may be an integrated circuit chip with signal processing capabilities. The processor 62 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 62 can be implemented by an integrated circuit chip.

[0083] The above scheme obtains the current question and multiple historical conversation data, and determines the answer to the current question based on the current question, the determined target historical conversation data and other historical conversation data. The target historical conversation data determined by the present application has the same data as the current question, and the correlation between the target historical conversation data screened out from the historical conversation data and the current question can be utilized. The target historical conversation data determined by the present application and one of the other determined historical conversation data is a question, and the other is an answer. The correlation between the other historical conversation data screened out from the historical conversation data and the target historical conversation data can be utilized, thereby making the answer to the current question determined based on multiple historical conversation data with correlations and the answer to the current question more accurate.

[0084] See also Figure 7 , Figure 7 The computer-readable storage medium 70 stores program instructions 701, which implement the steps in any of the above-mentioned question-answering method embodiments when executed by a processor.

[0085] The above scheme obtains the current question and multiple historical conversation data, and determines the answer to the current question based on the current question, the determined target historical conversation data and other historical conversation data. The target historical conversation data determined by the present application has the same data as the current question, and the correlation between the target historical conversation data screened out from the historical conversation data and the current question can be utilized. The target historical conversation data determined by the present application and one of the other determined historical conversation data is a question, and the other is an answer. The correlation between the other historical conversation data screened out from the historical conversation data and the target historical conversation data can be utilized, thereby making the answer to the current question determined based on multiple historical conversation data with correlations and the answer to the current question more accurate.

[0086] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0087] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0088] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0089] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0090] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A question-answering method, characterized in that: The method comprises: Obtaining a current question and a plurality of historical conversation data, each of the historical conversation data including a historical question and / or an answer to each of the historical questions; Determine target historical session data related to the current question and other historical session data related to the target historical session data among the multiple historical session data, wherein the current question and the target historical session data have the same data, the target historical session data and the other historical session data have the same data, or one of the target historical session data and the other historical session data is a question and the other is an answer; Determine an answer to the current question based on the current question, the target historical session data, and the other historical session data; The determining of target historical session data related to the current question and other historical session data related to the target historical session data among the plurality of historical session data includes: Extracting label information from the current question and the plurality of historical conversation data to obtain first label information in the current question and second label information in each of the historical conversation data; Determining the correlation between the second tag information of each of the historical session data; Constructing a relationship graph between the historical session data, wherein each node in the relationship graph is a respective historical session data, and the edge between each node is determined based on the correlation between the second label information of each historical session data; The first tag information is matched with the relationship graph to obtain the target historical session data and the other historical session data.

2. The method according to claim 1, characterized in that The third label information of each node in the relationship graph is the second label information of each historical session data, and the first label information is matched with the relationship graph to obtain the target historical session data and the other historical session data, including: Matching each of the third label information in the relationship graph with the first label information to obtain a first type of node and a second type of node in the relationship graph, wherein the first type of node is a node corresponding to the third label information that overlaps with the first label information, and the second type of node is a node that has a connection relationship with the first type of node; Based on the historical session data corresponding to the first type of nodes and the second type of nodes, the target historical session data and the other historical session data are obtained.

3. The method according to claim 2, characterized in that The obtaining the target historical session data and the other historical session data based on the historical session data corresponding to the first type of nodes and the second type of nodes includes: Obtain the total number of nodes of the first category and the second category; In response to the total number of nodes being less than a preset number, selecting a number of nodes from a third type of nodes in the relationship graph as replacement nodes, so that the sum of the total number of nodes and the number of the replacement nodes is equal to the preset number, the third type of nodes being nodes in the relationship graph other than the first type of nodes and the second type of nodes; The historical session data corresponding to the first type of nodes is used as the target historical session data, and the historical session data corresponding to the second type of nodes and the replacement nodes is used as the other historical session data.

4. The method according to claim 2, characterized in that: The obtaining the target historical session data and the other historical session data based on the historical session data corresponding to the first type of nodes and the second type of nodes includes: Obtain the total number of nodes of the first category and the second category; In response to the total number of nodes being greater than a preset number, first-category reference information, second-category reference information and / or third-category reference information are obtained, wherein the first-category reference information includes recall weights of the first-category nodes and the second-category nodes, the second-category reference information includes matching weights between third label information corresponding to the first-category nodes and the second-category nodes and the first label information, the third-category reference information includes session generation time of historical session data corresponding to each node in the first-category nodes and the second-category nodes, and the recall weight of the first-category nodes is greater than the recall weight of the second-category nodes; Based on the first category of reference information, the second category of reference information and / or the third category of reference information, screening each node in the first category of nodes and the second category of nodes; The historical session data corresponding to the nodes retained in the first type of nodes are used as the target historical session data, and the historical session data corresponding to the nodes retained in the second type of nodes are used as the other historical session data.

5. The method according to claim 4, characterized in that The first tag information includes at least one tag element, the third tag information includes at least one tag element, and the method for acquiring the second type of reference information includes: Obtaining the total number of tag elements in the first tag information; Filtering and obtaining a candidate tag element from the third tag information, where the candidate tag element is the same tag element between the third tag information and the first tag information; Determine the ratio between the total number of label elements in the candidate label elements and the total number of label elements in the first label information as the matching weight of the first type of nodes; Based on the matching weights of the first-category nodes, matching weights of the second-category nodes are determined.

6. The method according to any one of claims 1 to 5, characterized in that After determining the answer to the current question based on the current question, the target historical session data, and the other historical session data, the method further includes: The current question and the answer to the current question are respectively used as a current session data; Each of the current session data is used as a newly added node in the relationship graph; Based on the correlation between the fourth label information of each current session data and the third label information of each original node in the relationship graph, the edges between each newly added node and each original node are determined.

7. The method according to any one of claims 1 to 5, characterized in that The acquisition of the current question and multiple historical session data includes: Get multiple historical sessions; Splitting each of the historical conversations respectively to obtain questions and answers of each of the historical conversations; The split questions and answers are respectively used as historical conversation data, and each historical conversation data includes a question or an answer.

8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores program instructions, and the processor retrieves the program instructions from the memory to execute the method according to any one of claims 1 to 7.

9. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, they are used to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Group chat conversation processing method and device, and electronic equipment

    CN111078856A

  • Data processing method and device and electronic equipment

    CN117807197A