CN117421402A - Dialogue processing method and device and electronic equipment - Google Patents

Dialogue processing method and device and electronic equipment Download PDF

Info

Publication number
CN117421402A
CN117421402A CN202311311439.1A CN202311311439A CN117421402A CN 117421402 A CN117421402 A CN 117421402A CN 202311311439 A CN202311311439 A CN 202311311439A CN 117421402 A CN117421402 A CN 117421402A
Authority
CN
China
Prior art keywords
dialogue
history
current
term
question
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311311439.1A
Other languages
Chinese (zh)
Inventor
李涛
苗彩敬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202311311439.1A priority Critical patent/CN117421402A/en
Publication of CN117421402A publication Critical patent/CN117421402A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/335Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure provides a dialogue processing method, a dialogue processing device and electronic equipment, relates to the technical field of artificial intelligence, and particularly relates to the technical fields of deep learning, natural language processing, intelligent searching and the like. The specific implementation scheme is as follows: acquiring a current problem in a current dialogue process and a dialogue object corresponding to the current problem; acquiring a short-term history dialogue in the current dialogue process; acquiring a long-term history dialogue matched with a current problem in a history dialogue process of a dialogue object; according to the current question, the short-term history dialogue and the long-term history dialogue, the answer corresponding to the current question is determined, so that when the answer is generated, the information in the current question is considered, the related information in the current dialogue process and the history dialogue process is considered, and the accuracy of the generated answer is improved.

Description

Dialogue processing method and device and electronic equipment
Technical Field
The disclosure relates to the technical field of artificial intelligence, in particular to the technical fields of deep learning, natural language processing, intelligent searching and the like, and particularly relates to a dialogue processing method, a dialogue processing device and electronic equipment.
Background
The current dialogue processing method is realized by adopting a question-answer dialogue model. The question-answer dialogue model is a complex system constructed based on a large amount of data and a powerful algorithm, and aims to simulate human intelligence. The question-answer dialogue model extracts useful information and knowledge from a large amount of data by learning, and is used for generating answers and the like. However, the current question-answer dialogue model only considers information in the current question when generating an answer, which results in low accuracy of the generated answer.
Disclosure of Invention
The disclosure provides a dialogue processing method, a dialogue processing device and electronic equipment.
According to an aspect of the present disclosure, there is provided a dialog processing method, the method including: acquiring a current problem in a current dialogue process and a dialogue object corresponding to the current problem; acquiring a short-term history dialogue in the current dialogue process; acquiring a long-term history dialogue matched with the current problem in the history dialogue process of the dialogue object; and determining an answer corresponding to the current question according to the current question, the short-term history dialogue and the long-term history dialogue.
According to another aspect of the present disclosure, there is provided a dialogue processing apparatus including: the first acquisition module is used for acquiring a current problem in a current dialogue process and a dialogue object corresponding to the current problem; the second acquisition module is used for acquiring a short-term history dialogue in the current dialogue process; a third obtaining module, configured to obtain a long-term history dialogue matching the current problem in a history dialogue process of the dialogue object; and the first determining module is used for determining an answer corresponding to the current question according to the current question, the short-term history dialogue and the long-term history dialogue.
According to another aspect of the present disclosure, there is provided an electronic device including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the dialog processing method set forth above in the present disclosure.
According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to execute the dialog processing method proposed above of the present disclosure.
According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the steps of the dialog processing method proposed above by the present disclosure.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure;
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure;
FIG. 3 is a flow diagram of a dialog process;
FIG. 4 is a schematic diagram according to a third embodiment of the present disclosure;
fig. 5 is a block diagram of an electronic device for implementing a dialog processing method of an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The current dialogue processing method is realized by adopting a question-answer dialogue model. The question-answer dialogue model is a complex system constructed based on a large amount of data and a powerful algorithm, and aims to simulate human intelligence. The question-answer dialogue model extracts useful information and knowledge from a large amount of data by learning, and is used for generating answers and the like. However, the current question-answer dialogue model only considers information in the current question when generating an answer, which results in low accuracy of the generated answer.
In view of the above problems, the present disclosure provides a dialogue processing method, a device and an electronic device.
Fig. 1 is a schematic diagram of a first embodiment of the present disclosure, and it should be noted that the dialog processing method of the embodiment of the present disclosure may be applied to a dialog processing device, which may be disposed in an electronic device, so that the electronic device may perform a dialog processing function.
The electronic device may be any device with computing capability, for example, may be a personal computer (Personal Computer, abbreviated as PC), a mobile terminal, a server, etc., and the mobile terminal may be, for example, a vehicle-mounted device, a mobile phone, a tablet computer, a personal digital assistant, a wearable device, a smart speaker, a robot, etc., and have various hardware devices such as an operating system, a touch screen, and/or a display screen.
The dialogue processing device may be software in the electronic device. For example, search software, chat software, dialogue software, etc. The dialogue object can log in the software through account numbers and the like to perform dialogue with the software.
In the following embodiments, an execution body is described as an example of an electronic device. The electronic device may be a hardware device used when the dialogue object logs in the software through the account, or a background server corresponding to the software, etc.
As shown in fig. 1, the dialog processing method may include the steps of:
step 101, obtaining a current problem in a current dialogue process and a dialogue object corresponding to the current problem.
In the embodiments of the present disclosure, the current session may refer to a session in which a session object is ongoing with an electronic device. The current dialogue process may include one or more rounds of dialogue. The current question may be a question currently posed by the dialog object.
Step 102, a short-term history dialogue in the current dialogue process is obtained.
In the embodiment of the present disclosure, the electronic device performs the process of step 102 may be, for example, acquiring multiple historical dialogs in the current dialog process, and a turn of the historical dialogs; acquiring the turn of the current dialogue to which the current problem belongs; for each round of history dialogue, acquiring a round difference value between the round of history dialogue and the round of current dialogue; in the case where the round difference is within the round difference range, the history dialogue is determined to be a short-term history dialogue.
In one round of history conversations, a question of a conversation object and an answer of the electronic device may be included. The turn of the history dialogue refers to what number of dialogues the history dialogue is in the current dialog process. It should be noted that, the current dialogue to which the current problem belongs is the last dialogue in the current dialogue process, and is the latest dialogue in the current dialogue process.
In one example, the minimum round difference in the round difference range may be 1, and the maximum round difference may be a preset value. The preset value can be determined according to actual needs, conversation scenes and the like. The dialogue scene, for example, chat scene, knowledge solution scene, medical scene, etc., may be set according to actual needs.
Under the condition that the minimum round difference value is 1 and the maximum round difference value is a preset value N, assuming that the round of the current dialogue is M, the short-term historical dialogue can be the historical dialogues of M-N rounds in the current dialogue process, and the historical dialogues of M-1 rounds.
The setting of the round difference range can be combined with historical dialogues of a plurality of rounds which are closer to the current dialog to determine an answer corresponding to the current question. The historical dialogues of a plurality of rounds, which are closer to the current dialog, are generally the same dialog as the dialog subject of the current question, so that the matching degree between the answer obtained by determination and the current question can be further improved.
In another example, the minimum round difference in the round difference range may be K, and the maximum round difference may be a preset value. Under the condition that the minimum round difference value is K, K is larger than 1, and the maximum round difference value is a preset value N, assuming that the round of the current dialogue is M, the short-term historical dialogue can be the historical dialogues of M-N rounds in the current dialogue process, and the historical dialogues of M-K rounds.
In general, the historical conversations of 3 rounds, 5 rounds, etc. that are closer to the current conversation are considered for determining the answer corresponding to the current question. Therefore, based on the determination of the round difference range, the answer corresponding to the current question can be determined by combining 3 rounds or the historical dialogues before 5 rounds, so that the answer corresponding to the current question can be determined by combining the historical dialogues of more rounds, and the matching degree between the answer and the current question is further improved.
Step 103, obtaining a long-term history dialogue matched with the current problem in the history dialogue process of the dialogue object.
The long-term history dialogue can be a history dialogue selected from history dialogue processes of dialogue objects by combining the current problems for the electronic equipment. Wherein the long-term history dialogue matching the current question may include, for example, at least one of: including historical dialogs of keywords in the current question, historical dialogs that are the same as the current question topic, etc.
Step 104, determining an answer corresponding to the current question according to the current question, the short-term history dialogue and the long-term history dialogue.
In the embodiment of the present disclosure, the process of executing step 104 by the electronic device may be, for example, determining a prompt text corresponding to the current problem according to the short-term history dialogue and the long-term history dialogue; and inputting the prompt text and the current question into a question-answer dialogue model, and obtaining an answer corresponding to the current question output by the question-answer dialogue model.
In one example, the determining, by the electronic device, the prompt text corresponding to the current problem may be, for example, performing abstract extraction processing on the short-term history dialogue, to obtain a short-term dialogue abstract corresponding to the short-term history dialogue; and performing splicing processing on the short-term dialogue abstract and the long-term history dialogue to obtain a prompt text corresponding to the current problem.
The short-term history dialogues are generally more in number, and the long-term history dialogues matched with the current questions are generally less in number, so that in order to reduce the processing amount when determining the answers and increase the weight of the long-term history dialogues, the short-term history dialogues can be subjected to abstract processing, key information in the short-term history dialogues can be extracted, the processing amount of the short-term history dialogues when determining the answers can be reduced, the answer determining speed can be further improved, and the accuracy of the obtained answers can be determined.
In another example, the determining, by the electronic device, the prompt text corresponding to the current problem may be, for example, performing a summary extraction process on the short-term history dialogue, to obtain a short-term dialogue summary corresponding to the short-term history dialogue; performing abstract extraction processing on the long-term history dialogue to obtain a long-term dialogue abstract corresponding to the long-term history dialogue; and performing splicing processing on the short-term conversation abstract and the long-term conversation abstract to obtain a prompt text corresponding to the current problem.
Under the condition that the number of short-term history dialogues and long-term history dialogues is large, abstract extraction processing is carried out on the short-term history dialogues and the long-term history dialogues, key information in the short-term history dialogues and the long-term history dialogues is extracted, processing capacity in answer determination can be further reduced, and answer determination speed is further improved.
The electronic device inputs the prompt text and the current question into the question-answer dialogue model, and performs answer determination processing by combining the large calculation amount of the question-answer dialogue model and external knowledge in the prompt text, so that the matching degree between the answer obtained by determination and the current question can be further improved.
According to the dialogue processing method, the current problem in the current dialogue process and the dialogue object corresponding to the current problem are obtained; acquiring a short-term history dialogue in the current dialogue process; acquiring a long-term history dialogue matched with a current problem in a history dialogue process of a dialogue object; according to the current question, the short-term history dialogue and the long-term history dialogue, the answer corresponding to the current question is determined, so that when the answer is generated, the information in the current question is considered, the related information in the current dialogue process and the history dialogue process is considered, and the accuracy of the generated answer is improved.
In the process of determining the long-term history dialogue matched with the current problem in the history dialogue process of the dialogue object, the matched long-term history dialogue can be determined by combining the first vector representation of the current problem and the second vector representation of the history problem in each round of history dialogue in the history dialogue process, so that the accuracy of determining the obtained long-term history dialogue is further improved, and the accuracy of determining the obtained answer is further improved. As shown in fig. 2, fig. 2 is a schematic diagram of a second embodiment according to the present disclosure, and the embodiment shown in fig. 2 may include the following steps:
step 201, obtaining a current problem in a current dialogue process and a dialogue object corresponding to the current problem.
Step 202, a short-term history dialogue in the current dialogue process is obtained.
And 203, carrying out vectorization processing on the current problem, and acquiring a first vector representation of the current problem.
In the embodiment of the present disclosure, the process of executing step 203 by the electronic device may be, for example, inputting the current problem into a preset vectorization network, and obtaining a vector representation output by the vectorization network; the vector representation is determined as the first vector representation of the current problem.
Step 204, obtaining a second vector representation of the historical problems in each round of historical conversations in the historical conversations of the conversation object.
In the embodiment of the disclosure, a second vector representation of the history problems in each round of history conversations in the history conversations of each conversation object is prestored in the electronic device. The electronic device may query, based on the identification of the conversation object, a second vector representation of historical problems in each round of historical conversations in the historical conversation process of the conversation object.
Wherein, in the above example, correspondingly, prior to step 204, the electronic device may perform the following process: acquiring each round of history dialogue in the history dialogue process of a dialogue object; for each round of history dialogue, carrying out vectorization processing on history problems in the history dialogue, and obtaining a second vector representation of the history problems; each round of history dialogs in the history dialogs of the dialog object is stored, along with a second vector representation of history questions in each round of history dialogs.
The process of vectorizing the history problem in the history dialogue by the electronic device may be, for example, determining the number of processable words of the vectorizing network; performing truncation processing on the history problems according to the number of the processable words; inputting the history problem after the truncation treatment into a vectorization network to obtain vector representation output by the vectorization network; the vector representation is determined as a second vector representation of the history problem.
The method comprises the steps of acquiring and storing second vector representations of historical problems in each round of historical conversations in the historical conversations of each conversation object in advance, and facilitating the electronic equipment to acquire the second vector representations of the historical problems in each round of historical conversations in the historical conversations of the conversation object through inquiry, so that the acquiring time of the second vector representations is shortened, the acquiring efficiency is improved, and the determining efficiency of long-term historical conversations is further improved.
In step 205, the second vector representation of each historical problem is compared with the first vector representation of the current problem to determine the vector similarity between each second vector representation and the first vector representation.
In step 206, the corresponding history problem is determined as the target history problem by representing the corresponding history problem by the second vector having the similarity greater than or equal to the similarity threshold.
In step 207, a long-term history dialogue is determined from the target history dialogue including the target history question.
In the embodiment of the present disclosure, the step 207 may be performed by the electronic device, for example, in a case where the number of target history dialogs is multiple and the total word number of the target history dialogs is greater than a preset word number threshold, performing a descending order sorting process on the multiple target history dialogs according to the vector similarity, to obtain a sorting result; and selecting a front target historical dialogue from the sorting result according to a preset word number threshold value, and determining the front target historical dialogue as a long-term historical dialogue.
Wherein, in the case where the number of target history dialogues is single; or, in the case that the number of the target history dialogs is a plurality of, and the total word number of the target history dialogs is less than or equal to the preset word number threshold, the target history dialogs are directly determined as long-term history dialogs.
The target history dialogue is required to be truncated according to the vector similarity due to word number limitation which can be processed by the question-answer dialogue model, and the target history dialogue with larger vector similarity can be reserved, so that the matching degree between the long-term history dialogue and the current problem is improved.
Step 208, determining an answer corresponding to the current question according to the current question, the short-term history dialogue and the long-term history dialogue.
In the embodiment of the disclosure, in the case that the long-term history dialogue is determined by the electronic device in combination with the first vector representation of the current problem to represent the second vector representation of each history problem, in order to timely update the stored second vector representation of each history problem, the first vector representation of the current problem may be stored to determine the long-term history dialogue, so as to improve the accuracy of determining the subsequent long-term history dialogue. Correspondingly, after step 208, the electronic device may perform the following process: after dialogue response processing is carried out according to the answers corresponding to the current questions, determining the current dialogue to which the current questions belong according to the current questions and the answers corresponding to the current questions; a first vector representation of the current dialog and a current problem in the current dialog is stored.
It should be noted that, for details of step 201 to step 202 and step 208, reference may be made to step 101 to step 102 and step 104 in the embodiment shown in fig. 1, and detailed description thereof will not be provided here.
According to the dialogue processing method, the current problem in the current dialogue process and the dialogue object corresponding to the current problem are obtained; acquiring a short-term history dialogue in the current dialogue process; vectorizing the current problem to obtain a first vector representation of the current problem; acquiring a second vector representation of the history problems in each round of history conversations in the history conversations of the conversation object; comparing the second vector representation of each historical problem with the first vector representation of the current problem to determine the vector similarity between each second vector representation and the first vector representation; determining a corresponding historical problem as a target historical problem by using a second vector with the corresponding vector similarity being greater than or equal to a similarity threshold; determining a long-term history dialogue based on the target history dialogue including the target history question; according to the current question, the short-term history dialogue and the long-term history dialogue, determining an answer corresponding to the current question, so that the long-term history dialogue of the current question can be determined by combining vector representation; and then, combining the long-term history dialogue and the short-term history dialogue, determining the answer corresponding to the current question, and further improving the accuracy of the generated answer.
The following examples are illustrative. As shown in fig. 3, a flow diagram of the dialog process is shown. In fig. 3, the following steps may be included: (1) Obtaining a problem (current problem), and performing an Embedding calculation on the problem to obtain a first vector representation of the problem. (2) Performing dialogue segmentation processing on the history dialogue of the dialogue object corresponding to the problem to obtain multiple rounds of history dialogue; performing an Embedding calculation on the historical problems in the multi-round historical conversations to obtain a second vector representation of the historical problems; a dialog index (which includes, in the dialog index, a second-vector representation of historical questions in each round of history dialog in the history dialog process of the dialog object) is created based on the second-vector representations of the respective history questions. (3) Based on the first vector representation of the question, the dialog index is retrieved, and a retrieval result (long-term history dialog) is obtained. (4) Acquiring the current n rounds of conversations in the current conversation process to which the problem belongs; according to the current n rounds of dialogue and the search result, organizing dialogue prompt. (5) And returning an answer (an answer corresponding to the current question) according to the organization dialogue prompt request big model. (6) And according to the answers, updating the current n rounds of conversations, and adding the questions and the answers to the current n rounds of conversations. (7) The current dialogue is indexed according to the answer (based on the question and the answer, a second vector representation of each stored historical question is updated).
In order to implement the above embodiment, the present disclosure further provides a dialog processing device. As shown in fig. 4, fig. 4 is a schematic diagram according to a third embodiment of the present disclosure. The dialogue processing device 40 may include: a first acquisition module 401, a second acquisition module 402, a third acquisition module 403, and a first determination module 404.
The first obtaining module 401 is configured to obtain a current problem in a current dialogue process and a dialogue object corresponding to the current problem; a second obtaining module 402, configured to obtain a short-term history session in the current session process; a third obtaining module 403, configured to obtain a long-term history dialogue matching the current problem in a history dialogue process of the dialogue object; a first determining module 404, configured to determine an answer corresponding to the current question according to the current question, the short-term history dialogue, and the long-term history dialogue.
As one possible implementation manner of the embodiment of the present disclosure, the second obtaining module 402 is specifically configured to obtain a plurality of historical dialogs in the current dialog process and a turn of the historical dialogs; acquiring the turn of the current dialogue to which the current problem belongs; for each round of history dialogue, acquiring a round difference value between the round of history dialogue and the round of current dialogue; and in the case that the round difference value is within the round difference value range, determining the history dialogue as the short-term history dialogue.
As one possible implementation manner of the embodiment of the present disclosure, the third obtaining module 403 includes: a first acquisition unit, a second acquisition unit, a first determination unit, a second determination unit, and a third determination unit; the first obtaining unit is used for carrying out vectorization processing on the current problem and obtaining a first vector representation of the current problem; the second obtaining unit is used for obtaining a second vector representation of the history problems in each round of history dialogue in the history dialogue process of the dialogue object; the first determining unit is used for comparing the second vector representation of each historical problem with the first vector representation of the current problem, and determining the vector similarity between each second vector representation and the first vector representation; the second determining unit is configured to determine, as a target history problem, a second vector representing a corresponding history problem, where the similarity of the corresponding vector is greater than or equal to a similarity threshold; the third determining unit is configured to determine the long-term history dialogue according to a target history dialogue including the target history problem.
As a possible implementation manner of the embodiment of the present disclosure, the third determining unit is specifically configured to, when the number of the target history dialogs is multiple and the total word number of the target history dialogs is greater than a preset word number threshold, perform a descending order sorting process on the multiple target history dialogs according to vector similarity, to obtain a sorting result; and selecting a front target historical dialogue from the sorting result according to the preset word number threshold value, and determining the front target historical dialogue as the long-term historical dialogue.
As one possible implementation manner of the embodiments of the present disclosure, the apparatus further includes: the device comprises a fourth acquisition module, a fifth acquisition module and a first storage module; the fourth obtaining module is used for obtaining each round of history dialogue in the history dialogue process of the dialogue object; the fifth obtaining module is configured to perform vectorization processing on the history problems in the history dialogue for each round of history dialogue, and obtain a second vector representation of the history problems; the first storage module is used for storing each round of history dialogue in the history dialogue process of the dialogue object and a second vector representation of history problems in each round of history dialogue.
As one possible implementation manner of the embodiments of the present disclosure, the apparatus further includes: a second determination module and a second storage module; the second determining module is configured to determine, after performing a dialogue response process according to an answer corresponding to the current question, a current dialogue to which the current question belongs according to the current question and the answer corresponding to the current question; the second storage module is configured to store the current dialogue and a first vector representation of a current problem in the current dialogue.
As one possible implementation manner of the embodiments of the present disclosure, the first determining module 404 is specifically configured to determine, according to the short-term history dialogue and the long-term history dialogue, a prompt text corresponding to the current problem; and inputting the prompt text and the current question into a question-answer dialogue model, and obtaining an answer corresponding to the current question output by the question-answer dialogue model.
As a possible implementation manner of the embodiment of the present disclosure, the first determining module 404 is specifically further configured to perform a summary extraction process on the short-term history session, and obtain a short-term session summary corresponding to the short-term history session; and performing splicing processing on the short-term dialogue abstract and the long-term history dialogue to obtain a prompt text corresponding to the current problem.
According to the dialogue processing device, the current problem in the current dialogue process and the dialogue object corresponding to the current problem are obtained; acquiring a short-term history dialogue in the current dialogue process; acquiring a long-term history dialogue matched with a current problem in a history dialogue process of a dialogue object; according to the current question, the short-term history dialogue and the long-term history dialogue, the answer corresponding to the current question is determined, so that when the answer is generated, the information in the current question is considered, the related information in the current dialogue process and the history dialogue process is considered, and the accuracy of the generated answer is improved.
In the technical scheme of the disclosure, the related processes of collecting, storing, using, processing, transmitting, providing, disclosing and the like of the personal information of the user are performed on the premise of proving the consent of the user, and all the processes accord with the regulations of related laws and regulations, and the public welfare is not violated.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 5 illustrates a schematic block diagram of an example electronic device 500 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 5, the electronic device 500 includes a computing unit 501 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 502 or a computer program loaded from a storage unit 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 may also be stored. The computing unit 501, ROM 502, and RAM 503 are connected to each other by a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
A number of components in electronic device 500 are connected to I/O interface 505, including: an input unit 506 such as a keyboard, a mouse, etc.; an output unit 507 such as various types of displays, speakers, and the like; a storage unit 508 such as a magnetic disk, an optical disk, or the like; and a communication unit 509 such as a network card, modem, wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 501 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 501 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the respective methods and processes described above, such as a dialogue processing method. For example, in some embodiments, the dialog processing method may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 500 via the ROM 502 and/or the communication unit 509. When a computer program is loaded into RAM 503 and executed by computing unit 501, one or more steps of the dialog processing method described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the dialog processing method by any other suitable means (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (19)

1. A dialog processing method, the method comprising:
acquiring a current problem in a current dialogue process and a dialogue object corresponding to the current problem;
acquiring a short-term history dialogue in the current dialogue process;
acquiring a long-term history dialogue matched with the current problem in the history dialogue process of the dialogue object;
and determining an answer corresponding to the current question according to the current question, the short-term history dialogue and the long-term history dialogue.
2. The method of claim 1, wherein the acquiring short-term history dialogs in the current dialog process comprises:
acquiring multiple rounds of history conversations in the current conversation process and the rounds of the history conversations;
acquiring the turn of the current dialogue to which the current problem belongs;
for each round of history dialogue, acquiring a round difference value between the round of history dialogue and the round of current dialogue;
and in the case that the round difference value is within the round difference value range, determining the history dialogue as the short-term history dialogue.
3. The method of claim 1, wherein the obtaining a long-term history dialogue that matches the current question during a history dialogue of the dialogue object comprises:
carrying out vectorization processing on the current problem to obtain a first vector representation of the current problem;
acquiring a second vector representation of the history problems in each round of history conversations in the history conversations of the conversation object;
comparing the second vector representation of each historical problem with the first vector representation of the current problem, and determining the vector similarity between each second vector representation and the first vector representation;
Determining a corresponding historical problem as a target historical problem by using a second vector with the corresponding vector similarity being greater than or equal to a similarity threshold;
the long-term history dialogue is determined from a target history dialogue that includes the target history question.
4. A method according to claim 3, wherein said determining said long-term history dialogue from a target history dialogue comprising said target history question comprises:
when the number of the target historical dialogues is multiple and the total word number of the target historical dialogues is greater than a preset word number threshold, performing descending order sorting processing on the multiple target historical dialogues according to the vector similarity to obtain a sorting result;
and selecting a front target historical dialogue from the sorting result according to the preset word number threshold value, and determining the front target historical dialogue as the long-term historical dialogue.
5. A method according to claim 3, wherein, prior to obtaining the second vector representation of the history problems in each round of history conversations during the history conversations of the conversation object, the method further comprises:
acquiring each round of history dialogue in the history dialogue process of the dialogue object;
for each round of history dialogue, carrying out vectorization processing on history problems in the history dialogue, and obtaining a second vector representation of the history problems;
Storing each round of historical conversations in a historical conversation process of the conversation object, and a second vector representation of historical problems in each round of historical conversations.
6. A method according to claim 3, wherein after determining an answer corresponding to the current question from the current question, the short-term history dialogue, and the long-term history dialogue, the method further comprises:
after dialogue response processing is carried out according to the answers corresponding to the current questions, determining the current dialogue to which the current questions belong according to the current questions and the answers corresponding to the current questions;
a first vector representation of the current dialog and a current problem in the current dialog is stored.
7. The method of claim 1, wherein the determining an answer corresponding to the current question from the current question, the short-term history dialogue, and the long-term history dialogue comprises:
determining a prompt text corresponding to the current problem according to the short-term history dialogue and the long-term history dialogue;
and inputting the prompt text and the current question into a question-answer dialogue model, and obtaining an answer corresponding to the current question output by the question-answer dialogue model.
8. The method of claim 7, wherein the determining the prompt text corresponding to the current question from the short-term history dialogue and the long-term history dialogue comprises:
performing abstract extraction processing on the short-term history dialogue to obtain a short-term dialogue abstract corresponding to the short-term history dialogue;
and performing splicing processing on the short-term dialogue abstract and the long-term history dialogue to obtain a prompt text corresponding to the current problem.
9. A dialog processing device, the device comprising:
the first acquisition module is used for acquiring a current problem in a current dialogue process and a dialogue object corresponding to the current problem;
the second acquisition module is used for acquiring a short-term history dialogue in the current dialogue process;
a third obtaining module, configured to obtain a long-term history dialogue matching the current problem in a history dialogue process of the dialogue object;
and the first determining module is used for determining an answer corresponding to the current question according to the current question, the short-term history dialogue and the long-term history dialogue.
10. The apparatus of claim 9, wherein the second acquisition module is configured to,
Acquiring multiple rounds of history conversations in the current conversation process and the rounds of the history conversations;
acquiring the turn of the current dialogue to which the current problem belongs;
for each round of history dialogue, acquiring a round difference value between the round of history dialogue and the round of current dialogue;
and in the case that the round difference value is within the round difference value range, determining the history dialogue as the short-term history dialogue.
11. The apparatus of claim 9, wherein the third acquisition module comprises: a first acquisition unit, a second acquisition unit, a first determination unit, a second determination unit, and a third determination unit;
the first obtaining unit is used for carrying out vectorization processing on the current problem and obtaining a first vector representation of the current problem;
the second obtaining unit is used for obtaining a second vector representation of the history problems in each round of history dialogue in the history dialogue process of the dialogue object;
the first determining unit is used for comparing the second vector representation of each historical problem with the first vector representation of the current problem, and determining the vector similarity between each second vector representation and the first vector representation;
The second determining unit is configured to determine, as a target history problem, a second vector representing a corresponding history problem, where the similarity of the corresponding vector is greater than or equal to a similarity threshold;
the third determining unit is configured to determine the long-term history dialogue according to a target history dialogue including the target history problem.
12. The apparatus of claim 11, wherein the third determining unit is specifically configured to,
when the number of the target historical dialogues is multiple and the total word number of the target historical dialogues is greater than a preset word number threshold, performing descending order sorting processing on the multiple target historical dialogues according to the vector similarity to obtain a sorting result;
and selecting a front target historical dialogue from the sorting result according to the preset word number threshold value, and determining the front target historical dialogue as the long-term historical dialogue.
13. The apparatus of claim 11, wherein the apparatus further comprises: the device comprises a fourth acquisition module, a fifth acquisition module and a first storage module;
the fourth obtaining module is used for obtaining each round of history dialogue in the history dialogue process of the dialogue object;
the fifth obtaining module is configured to perform vectorization processing on the history problems in the history dialogue for each round of history dialogue, and obtain a second vector representation of the history problems;
The first storage module is used for storing each round of history dialogue in the history dialogue process of the dialogue object and a second vector representation of history problems in each round of history dialogue.
14. The apparatus of claim 11, wherein the apparatus further comprises: a second determination module and a second storage module;
the second determining module is configured to determine, after performing a dialogue response process according to an answer corresponding to the current question, a current dialogue to which the current question belongs according to the current question and the answer corresponding to the current question;
the second storage module is configured to store the current dialogue and a first vector representation of a current problem in the current dialogue.
15. The apparatus of claim 9, wherein the first determining means is specifically configured to,
determining a prompt text corresponding to the current problem according to the short-term history dialogue and the long-term history dialogue;
and inputting the prompt text and the current question into a question-answer dialogue model, and obtaining an answer corresponding to the current question output by the question-answer dialogue model.
16. The apparatus of claim 15, wherein the first determining means is further operable in particular to,
Performing abstract extraction processing on the short-term history dialogue to obtain a short-term dialogue abstract corresponding to the short-term history dialogue;
and performing splicing processing on the short-term dialogue abstract and the long-term history dialogue to obtain a prompt text corresponding to the current problem.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 8.
18. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1 to 8.
19. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 8.
CN202311311439.1A 2023-10-10 2023-10-10 Dialogue processing method and device and electronic equipment Pending CN117421402A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311311439.1A CN117421402A (en) 2023-10-10 2023-10-10 Dialogue processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311311439.1A CN117421402A (en) 2023-10-10 2023-10-10 Dialogue processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117421402A true CN117421402A (en) 2024-01-19

Family

ID=89523962

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311311439.1A Pending CN117421402A (en) 2023-10-10 2023-10-10 Dialogue processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117421402A (en)

Similar Documents

Publication Publication Date Title
CN112487173B (en) Man-machine conversation method, device and storage medium
CN114549874B (en) Training method of multi-target image-text matching model, image-text retrieval method and device
CN113657289B (en) Training method and device of threshold estimation model and electronic equipment
CN112528641A (en) Method and device for establishing information extraction model, electronic equipment and readable storage medium
CN112307188A (en) Dialog generation method, system, electronic device and readable storage medium
CN112632251B (en) Reply content generation method, device, equipment and storage medium
CN114494747A (en) Model training method, image processing method, device, electronic device and medium
CN112506359B (en) Method and device for providing candidate long sentences in input method and electronic equipment
CN115905497B (en) Method, device, electronic equipment and storage medium for determining reply sentence
CN114238611B (en) Method, apparatus, device and storage medium for outputting information
CN117421402A (en) Dialogue processing method and device and electronic equipment
CN112817463A (en) Method, equipment and storage medium for acquiring audio data by input method
CN115840867A (en) Generation method and device of mathematical problem solving model, electronic equipment and storage medium
CN113408280A (en) Negative example construction method, device, equipment and storage medium
CN113239054A (en) Information generation method, related device and computer program product
CN117421400A (en) Dialogue interaction method and device and electronic equipment
CN116257611B (en) Question-answering model training method, question-answering processing device and storage medium
CN116244432B (en) Pre-training method and device for language model and electronic equipment
CN116069914B (en) Training data generation method, model training method and device
CN116049372B (en) Man-machine conversation method and device and electronic equipment
CN114416937B (en) Man-machine interaction method, device, equipment, storage medium and computer program product
CN115982466B (en) Method, device, equipment and storage medium for retrieving data
CN113377921B (en) Method, device, electronic equipment and medium for matching information
CN117421403A (en) Intelligent dialogue method and device and electronic equipment
CN116244413A (en) New intention determining method, apparatus and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination