CN114547274B - Multi-turn question and answer method, device and equipment - Google Patents

Multi-turn question and answer method, device and equipment Download PDF

Info

Publication number
CN114547274B
CN114547274B CN202210440996.2A CN202210440996A CN114547274B CN 114547274 B CN114547274 B CN 114547274B CN 202210440996 A CN202210440996 A CN 202210440996A CN 114547274 B CN114547274 B CN 114547274B
Authority
CN
China
Prior art keywords
information
rewriting
rewritten
dialogue
current round
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.)
Active
Application number
CN202210440996.2A
Other languages
Chinese (zh)
Other versions
CN114547274A (en
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.)
Alibaba Damo Institute Hangzhou Technology Co Ltd
Original Assignee
Alibaba Damo Institute Hangzhou 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 Alibaba Damo Institute Hangzhou Technology Co Ltd filed Critical Alibaba Damo Institute Hangzhou Technology Co Ltd
Priority to CN202210440996.2A priority Critical patent/CN114547274B/en
Publication of CN114547274A publication Critical patent/CN114547274A/en
Application granted granted Critical
Publication of CN114547274B publication Critical patent/CN114547274B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • 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 Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

The application provides a method, a device and equipment for multi-turn question answering. According to the method, for a new round of initiated conversation, the current round of conversation information and historical conversation information are input into a context rewriting model, and the trained context rewriting model is used for determining an object to be rewritten and a corresponding rewriting operation type in the current round of conversation information and a key text for rewriting in the historical conversation information; rewriting the current round of dialogue information by using a key text according to the objects to be rewritten in the current round of dialogue information and the rewriting operation types corresponding to the objects to be rewritten, and generating candidate dialogue information; and one candidate dialogue information with better quality is used as the rewritten target dialogue information, so that the omitted key information in the current round of dialogue is completely supplemented, the designated information is replaced by the designated complete content information, the problems of designation and omission in multiple rounds of questions and answers are solved, the corresponding reply information is obtained based on the rewritten target dialogue information, and the quality and the accuracy of the reply information are improved.

Description

Multi-turn question and answer method, device and equipment
Technical Field
The application relates to the technical field of computers, in particular to a method, a device and equipment for multi-turn question answering.
Background
A Table data based human-computer interaction system (Table QA) is a function of converting a natural Language problem input by a user into a corresponding Structured Query Language (SQL) statement, and finding a result corresponding to the SQL statement in a data Table for storing Table data in a database and feeding back the result to the user. Because the Table is a common data storage structure in daily work and life, the Table QA system has a wide application scenario, such as data query, statistics, and screening, and can be applied to various application fields, such as government affairs, finance, energy, and the like. The key technology for realizing the Table QA system is to convert the natural language problem into a corresponding SQL statement, namely Text-to-SQL language conversion.
In a practical application scenario, a user often interacts with the system in a multi-turn question-answering mode, redundant contents often exist in historical multi-turn question-answering contents, and information already appearing in the historical conversations can be omitted or referred to by other contents in the current conversation. In order to make a Dialog system have a memory capability, some important information in a Dialog history is usually stored through Dialog State Tracking (DST for short), but a DST-related method is often complex and cannot be applied to an online human-computer interaction system.
In the existing man-machine interaction system, the contents of the dialogs in the current round and the contents of the historical dialogs in the historical round are all spliced together and then input into a Text-to-SQL language conversion model, extra noise is introduced, and SQL sentences obtained through conversion are inaccurate, so that the quality of response information given by the man-machine interaction system is poor, and the accuracy is low.
Disclosure of Invention
The application provides a method, a device and equipment for multi-turn question answering, which are used for solving the problems of poor quality and low accuracy of reply information given by a current human-computer interaction system.
In a first aspect, the present application provides a method for multiple rounds of question answering, comprising:
responding to a conversation request, and if determining that at least one round of historical conversation exists before the current round of conversation, acquiring current round of conversation information and historical conversation information of the at least one round of historical conversation;
inputting the current round of dialogue information and the historical dialogue information into a context rewriting model, and determining an object to be rewritten in the current round of dialogue information, a rewriting operation type corresponding to the object to be rewritten, and a key text for rewriting in the historical dialogue information by using the context rewriting model;
according to the object to be rewritten in the current round of dialog information and the rewriting operation type corresponding to the object to be rewritten, the current round of dialog information is rewritten by using the key text, and candidate dialog information is generated;
according to the quality information of the candidate dialogue information, taking one of the candidate dialogue information as target dialogue information after the current round of dialogue information is rewritten;
and acquiring reply information corresponding to the target dialogue information, and feeding back the reply information.
In a second aspect, the present application provides a device for multiple rounds of question answering, comprising:
the information acquisition module is used for responding to the conversation request, and acquiring the conversation information of the current round and the historical conversation information of at least one historical conversation if at least one historical conversation is determined to exist before the current round of conversation;
the rewriting prediction module is used for inputting the current round of dialogue information and the historical dialogue information into a context rewriting model, and determining an object to be rewritten in the current round of dialogue information, a rewriting operation type corresponding to the object to be rewritten and a key text for rewriting in the historical dialogue information by using the context rewriting model;
the rewriting module is used for rewriting the current round of dialogue information by using the key text according to the current round of dialogue information and the object to be rewritten and the rewriting operation type corresponding to the object to be rewritten, so as to generate candidate dialogue information;
the selection module is used for taking one candidate dialogue information as target dialogue information after the current round of dialogue information is rewritten according to the quality information of the candidate dialogue information;
and the reply module is used for acquiring reply information corresponding to the target dialogue information and feeding back the reply information.
In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon computer-executable instructions for implementing the method of the first aspect when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method of the first aspect described above.
According to the method, the device and the equipment for multi-turn question answering, for a new turn of initiated conversation (the turn of conversation), historical conversation information of at least one turn of historical conversation existing before the turn of conversation is obtained, the turn of conversation information and the historical conversation information are input into a context rewriting model, and an object to be rewritten in the turn of conversation information, a rewriting operation type corresponding to the object to be rewritten and a key text for rewriting in the historical conversation information are determined by using the trained context rewriting model; rewriting the current round of dialogue information by using a key text according to the object to be rewritten in the current round of dialogue information and the rewriting operation type corresponding to the object to be rewritten, and generating candidate dialogue information; according to the quality information of the candidate dialogue information, one candidate dialogue information with better quality is used as the target dialogue information after the current round of dialogue information is rewritten, the key information omitted in the current round of dialogue can be completely supplemented, the designated information is replaced by the designated complete content information, the current round of dialogue information is rewritten into high-quality expression, the problems of designation and omission in multiple rounds of questions and answers are solved, the corresponding reply information is obtained based on the rewritten target dialogue information, and the quality and the accuracy of the reply information are improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
FIG. 1 is an exemplary diagram of a plurality of rounds of question and answer content provided herein;
FIG. 2 is a schematic diagram of an exemplary network architecture upon which the present application is based;
FIG. 3 is a flow chart of a method for multiple rounds of question answering according to an exemplary embodiment of the present application;
FIG. 4 is a flow chart of a method for multiple rounds of question answering provided in another exemplary embodiment of the present application;
FIG. 5 is a block diagram of a framework used by a context rewrite model provided by an exemplary embodiment of the present application;
FIG. 6 is a block diagram of context-to-SQL language transformations based on a context rewrite model in accordance with an illustrative embodiment;
FIG. 7 is a schematic diagram of an apparatus for multiple rounds of question answering according to an exemplary embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an example embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terms referred to in this application are explained first:
data table: the data table in the Structured Query Language (SQL) database is used for storing data, the data to be stored is permanently stored after the data is stored in the corresponding data table of the database, and the data content of the data can be acquired by accessing the data table of the query database.
Data elements: also referred to as a schema of the data table, refers to information such as table names, column names, values, etc. in the data table.
Table QA: a man-machine interaction system based on table data (or table knowledge) achieves the functions of converting natural language questions input by a user into SQL statements, finding results corresponding to the SQL statements in a data table used for storing the table data in a database and feeding the results back to the user. Such as a question-answering/dialogue system based on tabular data.
Text-to-SQL language conversion model: is the core technology of Table QA system, a way of language understanding (semantic parsing) for converting human natural language described questions (Text) into computer executable SQL statements. By utilizing the model, free interaction between a person and a table/database can be realized, and a user does not need to learn complex SQL grammar. Further, a table/database based question-answering/dialogue system may be implemented depending on the model.
token: each word (or character) obtained after the text is subjected to word segmentation (tokenization) in natural language processing.
Furthermore, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following examples, "plurality" means two or more unless specifically limited otherwise.
The multi-turn question answering method provided by the application can be applied to a man-machine interaction system in various application fields, such as a question answering/dialogue system based on table data (table knowledge or a database).
In an actual human-computer interaction system, a user often interacts with the system in a multi-turn question-answering mode, redundant contents often exist in historical multi-turn question-answering contents, and information already appearing in the historical conversations can be omitted or referred to by other contents in the current conversation.
Illustratively, taking the example of the multi-turn question-answer content shown in fig. 1, in this example, "they" in the current (third) turn of the dialog refer to the queried players based on the history of the two turns of the dialog, i.e., "poker players with height over 200 cm", and the complete question of the current turn of the dialog can be expressed as "what the average height of poker players with height over 200cm is".
In a traditional human-computer interaction system, all three rounds of conversation contents are spliced and input into a Text-to-SQL language conversion model, a large amount of extra noise is introduced, and SQL sentences obtained through conversion are inaccurate, so that the quality of response information given by the human-computer interaction system is poor, and the accuracy is low.
In order to solve the technical problems, the application provides a method for multi-turn question answering, which comprises the steps of inputting the dialog information of the current turn and the historical dialog information into a context rewriting model, and determining an object to be rewritten in the dialog information of the current turn, a rewriting operation type corresponding to the object to be rewritten and a key text for rewriting in the historical dialog information by using the trained context rewriting model; rewriting the current round of dialogue information by using a key text according to the object to be rewritten in the current round of dialogue information and the rewriting operation type corresponding to the object to be rewritten, and generating candidate dialogue information; according to the quality information of the candidate dialogue information, one candidate dialogue information with better quality is used as the target dialogue information after the current round of dialogue information is rewritten, the key information omitted in the current round of dialogue can be completely supplemented, the designated information is replaced by the designated complete content information, the current round of dialogue information is rewritten into high-quality expression, the problems of designation and omission in multiple rounds are solved, the corresponding reply information is obtained based on the rewritten target dialogue information, and the quality and the accuracy of the reply information are improved.
Fig. 2 is a schematic diagram of an exemplary network architecture based on the present application, and the network architecture shown in fig. 2 may specifically include a server and a terminal.
The server may be a server cluster arranged in the cloud, and the server stores historical dialogue data and data stored in a database for implementing data query of human-computer interaction, such as form data for implementing form question-answering/dialogue. The server also stores relevant model data such as a context rewriting model, a Text-to-SQL language conversion model and the like, and can realize various operation functions such as model training, multi-turn question-answer man-machine interaction and the like through the operation logic preset in the server.
The terminal may specifically be a hardware device having a network communication function, an operation function, and an information display function, and includes, but is not limited to, a smart phone, a tablet computer, a desktop computer, an internet of things device, and the like.
And through communication interaction with the server, the terminal sends the current round of dialogue information input by the user to the server. After the server acquires the current round of dialog information input by the user, if at least one round of historical dialog of the current dialog exists before the current round of dialog, acquiring the historical dialog information of the at least one round of historical dialog, and rewriting the current round of dialog information according to the historical dialog information through a trained context rewriting model to obtain rewritten target dialog information; inputting the target dialogue information into a Text-to-SQL language conversion model, and converting the target dialogue information into a corresponding SQL statement; and inquiring the data table according to the SQL sentence to obtain reply information, and feeding the reply information back to the terminal.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 3 is a flowchart of a method for multiple rounds of question answering according to an exemplary embodiment of the present application. The method for multiple rounds of question answering provided by the embodiment can be particularly applied to the aforementioned server. As shown in fig. 3, the method comprises the following specific steps:
step S301, responding to the dialogue request, and if it is determined that at least one round of historical dialogue exists before the current round of dialogue, acquiring the current round of dialogue information and historical dialogue information of at least one round of historical dialogue.
In practical application, a user can input conversation content on an interactive page provided on a terminal, and the terminal can display reply information fed back by the service to the user through the interactive page. After the user inputs a new turn of conversation content on the terminal, the terminal sends a conversation request to the server, wherein the conversation request comprises the current turn of conversation text information input by the user and is used for requesting the server to give out reply information according to the current turn of conversation text information.
The server extracts a current round of dialog text information in response to the dialog request and determines whether one or more rounds of historical dialog exist before the current round of dialog based on the stored historical dialog data. And if the fact that at least one round of historical conversation exists before the current round of conversation is determined, obtaining historical conversation information of at least one round of historical conversation.
For example, the current round of dialog information acquired by the server may be a word segmentation result corresponding to the current round of dialog text information, that is, a token sequence obtained after the current round of dialog text is segmented.
Illustratively, in the present embodiment, the word segmentation for the chinese text is a sequence of converting a sentence into a single character (e.g., a single chinese character, a single number, a single letter). A participle for english text is a sequence that converts a sentence into a single word (an english word).
For example, for "what their average height is", the token sequence after the word segmentation processing for the sentence is { he, his, her, average, body, height, yes, more, less }.
For example, for "how many players have a height exceeding 200 cm", the token sequence after the word segmentation processing for the sentence is { have, many, few, play, home, body, height, super, 2, 0, 0, c, m }
Step S302, inputting the current round of dialogue information and the historical dialogue information into a context rewriting model, and determining an object to be rewritten in the current round of dialogue information, a rewriting operation type corresponding to the object to be rewritten, and a key text for rewriting in the historical dialogue information by using the context rewriting model.
After acquiring the current round of dialogue information and the historical dialogue information of one or more rounds of historical dialogue of the current interaction, inputting the current round of dialogue information and the historical dialogue information into a trained context rewriting model, judging whether the text information at each position in the current round of dialogue information is reserved, replaced or deleted and the position before which the key information in the historical dialogue needs to be inserted by using the context rewriting model, and extracting the key information which is possibly added into the current round of dialogue information from the historical dialogue information as a key text for rewriting the current round of dialogue information.
In this embodiment, the context rewrite model is a pre-trained neural network model, and is configured to determine, according to the input current round of dialog information and historical dialog information, a rewrite position type and a rewrite operation type corresponding to each position in the current round of dialog information, and a candidate position type corresponding to each position in the historical dialog information, so that an object to be rewritten, a rewrite operation type corresponding to the object to be rewritten, and a key text for rewriting in the historical dialog information can be further determined in the current round of dialog information.
The object to be rewritten can be an insertion position to be inserted or a text to be rewritten.
The position to be inserted is a position corresponding to any token in the current round of dialogue information, and each token in the current round of dialogue information corresponds to one position. Critical information in the historical dialog needs to be inserted before the position to be inserted.
The current round of dialog information may include one or more texts to be rewritten, and one text to be rewritten includes one or more consecutive tokens in the current round of dialog information. The key text for overwriting in the historical dialog information may be one or more key texts, each key text including one or more consecutive tokens in the historical dialog information.
Illustratively, the type of rewrite operation includes at least one of: insert, delete, replace, leave intact.
The type of the rewriting operation corresponding to the position to be inserted is insertion, and the type of the rewriting operation corresponding to the text to be rewritten may be any of deletion, replacement, and keeping the original state.
For a target position for which the type of rewrite operation is insert, each target position to be inserted is processed individually, and a candidate token may be inserted into the position.
And step S303, rewriting the current round of dialog information by using the key text according to the object to be rewritten in the current round of dialog information and the rewriting operation type corresponding to the object to be rewritten, and generating candidate dialog information.
After the objects to be rewritten and the rewriting operation types corresponding to the objects to be rewritten in the current round of dialog information are determined, and the key texts for rewriting in the historical dialog information are determined, the current round of dialog information is automatically rewritten, and rewritten candidate dialog information is generated.
For example, the current round of dialog information may include one or more texts to be rewritten, the key text for rewriting in the historical dialog information may be one or more key texts, and all possible rewriting manners may be given in an enumeration manner according to a rewriting operation type corresponding to an object to be rewritten, so as to generate all possible candidate dialog information.
In an actual interactive system, the dialog content is usually simple, and the dialog information in the current round usually includes a text to be rewritten with a rewriting operation type of replacement, or includes a position to be inserted.
For example, if only one position to be inserted is included in the current round of dialog information, all sequences of the key texts may be arranged and combined, all possible arrangement modes are enumerated to obtain corresponding combined texts, and each combined text is inserted into the position to be inserted in the current round of dialog information to obtain corresponding candidate dialog information.
For example, if only one text to be rewritten is included in the current round of dialog information and the type of the rewrite operation of the text to be rewritten is replacement, all sequences of the key texts may be arranged and combined, all possible arrangement modes are enumerated to obtain corresponding combined texts, and each combined text is used to replace the text to be rewritten in the current round of dialog information to obtain corresponding candidate dialog information.
For example, taking the multiple rounds of question-answering content shown in fig. 1 as an example, it can be determined using the context rewrite model that: the objects to be rewritten in the dialog information of the current round are 'them', and the corresponding rewriting operation types are: and (6) replacing. The key texts in the historical dialog information include: "height over 200 cm" and "poker player". At least the following candidate dialog information may be generated by way of enumeration: "what the average height of the poker player is over 200 cm", "what the average height of the poker player is over 200 cm".
Exemplarily, if the dialog information of the current round includes a plurality of objects to be rewritten (including a position to be inserted and a type of rewrite operation as a replaced text to be rewritten) that need to use a key text, each object to be rewritten corresponds to at least one key text, and candidate dialog information corresponding to each rewrite mode is generated by enumerating all possible rewrite modes.
And step S304, according to the quality information of the candidate dialogue information, taking one of the candidate dialogue information as the target dialogue information after the current round of dialogue information is rewritten.
After rewriting the current round of session information to obtain candidate session information, if there are a plurality of candidate session information, sorting is performed according to the quality information of the candidate session information, and one candidate session information with better quality is used as the target session information after rewriting the current round of session information.
If there is only one candidate session information, the candidate session information is directly rewritten as the current session information.
The target dialogue information after the current round of dialogue information is rewritten supplements the omitted key information in the current round of dialogue completely, replaces the indicated information with the indicated complete content information, and is a high-quality expression text.
And step S305, acquiring the reply information corresponding to the target conversation information, and feeding back the reply information.
After the target dialogue information after the current-round dialogue information is rewritten is determined, the corresponding reply information is generated based on the target dialogue information, and a high-quality reply to the current-round dialogue of the user can be acquired. And the server feeds back the acquired reply information to the terminal.
In this embodiment, for a new round of initiated dialog (the current round of dialog), obtaining historical dialog information of at least one round of historical dialog before the current round of dialog, inputting the current round of dialog information and the historical dialog information into a context rewrite model, and determining an object to be rewritten in the current round of dialog information, a rewrite operation type corresponding to the object to be rewritten, and a key text for rewriting in the historical dialog information by using the trained context rewrite model; rewriting the current round of dialogue information by using a key text according to the object to be rewritten in the current round of dialogue information and the rewriting operation type corresponding to the object to be rewritten, and generating candidate dialogue information; according to the quality information of the candidate dialogue information, one candidate dialogue information with better quality is used as the target dialogue information after the current round of dialogue information is rewritten, the key information omitted in the current round of dialogue can be completely supplemented, the designated information is replaced by the designated complete content information, the current round of dialogue information is rewritten into high-quality expression, the problems of designation and omission in multiple rounds of questions and answers are solved, the corresponding reply information is obtained based on the rewritten target dialogue information, and the quality and the accuracy of the reply information are improved.
In an alternative embodiment, the context rewriting model is used to determine whether text information at each position in the current round of dialog information is retained, replaced or deleted, and before which position key information in the historical dialog needs to be inserted, and extract key information that may be added in the current round of dialog information from the historical dialog information as key text for rewriting the current round of dialog information.
Specifically, the dialog information and the historical dialog information of the current round are input into a context rewriting model, and classification processing is performed through the context rewriting model, so that a classification result including the following information is obtained:
the method comprises the steps that a rewriting position type and a rewriting operation type corresponding to each position in the dialog information of the current round and a candidate position type corresponding to each position in the historical dialog information, wherein the rewriting position type is any one of a rewriting starting position, a rewriting ending position and a non-rewriting starting and stopping position; the candidate position category is any one of a candidate start position, a candidate end position, and a non-candidate start/end position.
Further, according to the classification result, an object to be rewritten in the current round of dialog information, a rewriting operation type corresponding to the object to be rewritten, and a key text in the historical dialog information are determined.
Referring to fig. 4, fig. 4 is a flowchart of a method for multiple rounds of question answering according to another exemplary embodiment of the present application. As shown in fig. 4, the method comprises the following specific steps:
step S401, responding to the dialogue request, and if it is determined that at least one round of historical dialogue exists before the current round of dialogue, acquiring the current round of dialogue information and historical dialogue information of at least one round of historical dialogue.
In practical application, a user can input conversation content on an interactive page provided on a terminal, and the terminal can display reply information fed back by the service to the user through the interactive page. After the user inputs a new turn of conversation content on the terminal, the terminal sends a conversation request to the server, wherein the conversation request comprises the current turn of conversation text information input by the user and is used for requesting the server to give out reply information according to the current turn of conversation text information.
The server extracts a current round of dialog text information in response to the dialog request and determines whether one or more rounds of historical dialog exist before the current round of dialog based on the stored historical dialog data. And if the fact that at least one round of historical conversation exists before the current round of conversation is determined, obtaining historical conversation information of at least one round of historical conversation.
For example, the current round of dialog information acquired by the server may be a word segmentation result corresponding to the current round of dialog text information, that is, a token sequence obtained after the current round of dialog text is segmented.
Optionally, obtaining a current round of dialog text and at least one historical dialog text of historical dialog; and respectively carrying out word segmentation on the current round of dialogue text and the historical dialogue text of each round of historical dialogue to obtain a token sequence of the current round of dialogue text and a token sequence of the historical dialogue text of each round of historical dialogue.
Illustratively, in the present embodiment, the word segmentation for the chinese text is a sequence of converting a sentence into a single character (e.g., a single chinese character, a single number, a single letter). A participle for english text is a sequence that converts a sentence into a single word (an english word).
For example, for "what their average height is", the token sequence after the word segmentation processing for the sentence is { he, his, her, average, body, height, yes, more, less }.
For example, for "how many players have a height exceeding 200 cm", the token sequence after the word segmentation processing for the sentence is { have, many, few, play, home, body, height, super, 2, 0, 0, c, m }
Through steps S402-S404, based on the context rewrite model, a target token to be rewritten in the current round of dialog information, a rewrite operation type corresponding to the target token, and a candidate token for rewriting in the historical dialog information are determined.
Step S402, inputting the current round of dialogue information and historical dialogue information into a context rewriting model, and performing classification processing through the context rewriting model to obtain a classification result containing the following information: the rewriting position type and the rewriting operation type corresponding to each position in the dialog information of the current round, and the candidate position type corresponding to each position in the historical dialog information.
The rewrite position type is any one of a rewrite start position, a rewrite end position, and a non-rewrite start/stop position.
The candidate position category is any one of a candidate start position, a candidate end position, and a non-candidate start/end position.
In this embodiment, the context rewriting model is a pre-trained neural network model, and is configured to determine, according to the input current round of session information and historical session information, whether text information at each position in the current round of session information is to be retained, replaced, or deleted, and which position needs to be preceded by key information in the historical session, and extract, from the historical session information, key information that may be supplemented into the current round of session information as a key text for rewriting the current round of session information, so as to determine a rewriting position category and a rewriting operation type corresponding to each position in the current round of session information, and a candidate position category corresponding to each position in the historical session information.
Optionally, the context adaptation model may include a backbone network and a classifier, where the backbone network is a Transformer model, and may specifically be BART or T5, etc. The classifier includes the following three classifiers: location prediction classifier, reference prediction classifier, and alternative prediction classifier. Inputting the current round of dialogue information and historical dialogue information into a backbone network of a context rewriting model for processing, and inputting the processing result into three classifiers for classification processing to obtain a classification result.
The position prediction classifier is used for determining the rewriting position category corresponding to each position in the current round of dialogue information, and the reference prediction classifier is used for determining the rewriting operation type corresponding to each position in the current round of dialogue information. Based on the classification results of the two classifiers, it can be determined whether the text information at each position in the dialog information of the current round is retained, replaced, deleted, or other text information is inserted before the position.
The replacement prediction classifier is used for determining a candidate position category corresponding to each position in the historical dialogue information, and extracting key information possibly to be added into the dialogue information in the current round from the historical dialogue information as key text according to the classification result of the classifier.
Illustratively, the classifier in the context adaptation model may be implemented by using a Multilayer Perceptron (MLP).
Illustratively, as shown in fig. 5, the context-aware model may add three MLPs on the basis of the transform, each MLP serving as a classifier for determining a corresponding classification result. Based on the contents of the multiple rounds of questions and answers shown in fig. 1, as shown in fig. 5, the dialogue information of the current round of dialogue and the two rounds of historical dialogue is input into the Transformer, and the processing results of the Transformer are input into the three classifiers to output the classification results shown in fig. 5 respectively.
In this embodiment, the context rewriting model is a trained model based on a training set.
Illustratively, prior to model training, a large number of historical data samples are first obtained, including: the method comprises the steps of a current-round conversation sample, at least one round of historical conversation sample and a target conversation sample after the current-round conversation information is rewritten. By analyzing the current round of dialogue samples, at least one round of historical dialogue samples and the target dialogue samples, the rewriting position type and the rewriting operation type corresponding to each position in the current round of dialogue samples and the candidate position type corresponding to each position in the historical dialogue samples can be determined, and the labeling data can be obtained. In addition, the annotation data can also be acquired by a manual annotation mode.
The training set comprises a plurality of training data, each training data comprises a current round of dialogue sample, at least one round of historical dialogue sample, and marking data (comprising a rewriting position type and a rewriting operation type corresponding to each position in the current round of dialogue sample, and a candidate position type corresponding to each position in the historical dialogue sample).
And when the model training is carried out, inputting the current round of dialogue samples and at least one round of historical dialogue samples into a context rewriting model to obtain a classification result of the context rewriting model, calculating loss according to the classification result of the context rewriting model and the labeled data, and optimizing model parameters of the context rewriting model according to the loss. And determining the trained context rewriting model when the model converges through multiple rounds of iterative training.
Alternatively, when performing model training, the rewritten target dialogue information may be determined based on the prediction result of the context rewriting model on the test set. The confusion (or sentence probability) of the rewritten target dialogue information is used to measure the quality of the context rewriting model, and the lower the confusion (or the higher the sentence probability), the better the context rewriting model is, so that the quality of the rewritten target dialogue information determined by the trained context rewriting model can be higher and smoother.
And step S403, determining the object to be rewritten in the dialog information of the current round, the rewriting operation type corresponding to the object to be rewritten and the key text in the historical dialog information according to the classification result.
And the object to be rewritten is a position to be inserted or a text to be rewritten. The types of rewrite operations include: insert, delete, replace, and leave intact. The type of the rewriting operation corresponding to the position to be inserted is insertion.
After the classification result is obtained, determining an object to be rewritten according to each rewriting start position and the corresponding rewriting end position in the classification result.
And determining the rewriting operation type of the object to be rewritten according to the rewriting operation type of the position of each object to be rewritten.
Illustratively, the rewrite start position and rewrite end position in the classification result are present in pairs, one rewrite start position corresponding to the rewrite end position which is the first to appear thereafter. The rewrite start position and rewrite end position that appear in pairs define an object to be rewritten that includes the rewrite start position, rewrite end position, and text at all of those positions in between. The rewrite operation types of the rewrite start position and the rewrite end position which appear in pairs and the position between the two are consistent, namely the rewrite operation type of the corresponding object to be rewritten.
For example, if the rewrite start position and rewrite end position coincide, it is determined that the object to be rewritten corresponds to one position. If the rewriting operation type of the position is any one of replacement, deletion and keeping, the object to be rewritten is the text to be rewritten, and the operation type corresponding to the text to be rewritten is consistent with the rewriting operation type of the position. If the rewriting operation type of the position is insertion, the object to be rewritten is a position to be inserted, and the operation type corresponding to the position to be inserted is insertion. The key text is subsequently inserted in front of (or behind) the position to be inserted.
For example, according to the classification result as shown in fig. 5: the rewriting start position in the dialog information of the current round is 0, the rewriting end position is 1, the object to be rewritten is determined as the text 'them' on the position 0-1, and the type of the operation to be rewritten is replacement.
In this step, a key text is determined according to each candidate start position and the corresponding candidate end position in the classification result.
Illustratively, the candidate start positions and the candidate end positions in the classification result are presented in pairs, one candidate start position corresponding to the candidate end position that is presented first thereafter. The candidate start position and candidate end position that occur in pairs determine a key text that includes the candidate start position, the candidate end position, and the positions in between the text at all of these positions.
For example, according to the classification result as shown in fig. 5, it may be determined that the candidate start position in the historical session information of the round one is 6, the candidate end position is 9, and the key text is the text "poker player" at the positions [6-9 ]; and determining that the key text is the text 'height over 200 cm' at the position [6-14], wherein the candidate starting position in the historical dialogue information of the second round is 6, the candidate ending position is 14.
And S404, rewriting the current round of dialog information by using the key text according to the object to be rewritten in the current round of dialog information and the rewriting operation type corresponding to the object to be rewritten, and generating candidate dialog information.
After the objects to be rewritten and the rewriting operation types corresponding to the objects to be rewritten in the current round of dialog information are determined, and the key texts for rewriting in the historical dialog information are determined, the current round of dialog information is automatically rewritten, and rewritten candidate dialog information is generated.
Specifically, if a position to be inserted exists in the current round of dialog information, at least one key text is inserted into the position to be inserted. It should be noted that the to-be-inserted position indicates that the key text is inserted in front of (or behind) the to-be-inserted position.
And if the first text to be rewritten exists in the dialog information of the current round and the rewriting operation type of the first text to be rewritten is replacement, replacing the first text to be rewritten by using at least one key text.
And if the second text to be rewritten exists in the current round of dialog information and the rewriting operation type of the second text to be rewritten is deletion, deleting the second text to be rewritten in the current round of dialog information.
In an actual interactive system, the dialog content is usually simple, and the dialog information in the current round usually includes a text to be rewritten with a rewriting operation type of replacement, or includes a position to be inserted.
For example, if only one position to be inserted is included in the current round of dialog information, all sequences of the key texts may be arranged and combined, all possible arrangement modes are enumerated to obtain corresponding combined texts, and each combined text is inserted into the position to be inserted in the current round of dialog information to obtain corresponding candidate dialog information.
For example, if only one text to be rewritten is included in the current round of dialog information and the type of the rewrite operation of the text to be rewritten is replacement, all sequences of the key texts may be arranged and combined, all possible arrangement modes are enumerated to obtain corresponding combined texts, and each combined text is used to replace the text to be rewritten in the current round of dialog information to obtain corresponding candidate dialog information.
Exemplarily, if the dialog information of the current round includes a plurality of objects to be rewritten (including a position to be inserted and a type of rewrite operation as a replaced text to be rewritten) that need to use a key text, each object to be rewritten corresponds to at least one key text, and candidate dialog information corresponding to each rewrite mode is generated by enumerating all possible rewrite modes.
For example, taking the classification result shown in fig. 5 as an example, the text to be rewritten in the determined current round of dialog information is the text "them" at the position 0-1, and the type of operation to be rewritten is replacement; the key texts in the historical dialog information include: the text "poker player" in the first position of the turn [6-9], and the text "height over 200 cm" in the second position of the turn [6-14 ]. At least the following candidate dialog information may be generated by way of enumeration: "what the average height of the poker player is over 200 cm", "what the average height of the poker player is over 200 cm".
And step S405, according to the quality information of the candidate dialogue information, taking one of the candidate dialogue information as the target dialogue information after the current round of dialogue information is rewritten.
After rewriting the current round of session information to obtain candidate session information, if there are a plurality of candidate session information, sorting is performed according to the quality information of the candidate session information, and one candidate session information with better quality is used as the target session information after rewriting the current round of session information.
Alternatively, sentence probabilities of each candidate dialog information are acquired, and the candidate dialog information having the highest sentence probability is taken as the target dialog information.
Illustratively, the sentence probability of each candidate dialog information may be calculated based on an n-gram model, or may be implemented in any way of calculating the sentence probability, which is not specifically limited herein.
Alternatively, the confusion of each candidate dialog information is acquired, and the candidate dialog information with the lowest confusion is taken as the target dialog information.
Wherein, the confusion degree of one sentence W can be determined by the following way:
Figure 284283DEST_PATH_IMAGE001
wherein the content of the first and second substances,
Figure 692131DEST_PATH_IMAGE002
representing the confusion of the sentence W, N representing the number of tokens contained in the sentence W,
Figure 62063DEST_PATH_IMAGE003
for the N tokens contained in the sentence W,
Figure 797938DEST_PATH_IMAGE004
representing the sentence probability of sentence W.
Alternatively, the obtained target dialogue information may be subjected to correction processing such as adding a link word, so that the rewritten target dialogue information has higher quality and is smoother.
For example, it is assumed that the target session information is "what the average height of poker players with height exceeding 200cm is", wherein "height exceeds 200 cm" and "poker player" are two key texts, a connecting word "is added between the two key texts, and the corrected" what the average height of poker players with height exceeding 200cm is ".
When applied to a question-answering and/or dialogue scene based on form data, after the target dialogue information rewritten in the current round of dialogue information is obtained, the reply information corresponding to the target dialogue information is obtained through steps S406-S408, and the reply information is fed back.
Step S406, the target dialog information is input into the language conversion model for conversion processing, and the target dialog information is converted into a corresponding SQL statement.
When the method is applied to a question-answering and/or dialogue scene based on table data, target dialogue information is input into a language conversion model for conversion processing, and an SQL statement corresponding to the target dialogue information is obtained.
Referring to fig. 6, fig. 6 is a frame diagram of Text-to-SQL language conversion based on a context rewrite model according to an exemplary embodiment, and as shown in fig. 6, based on the multi-turn question and answer content shown in fig. 1, the current turn of dialog information and two rounds of historical dialog information of the first turn and the second turn are input into the context rewrite model, and the context rewrite model is used to determine the question (i.e., the target dialog information) after the current turn of dialog information is rewritten: "what the average height of poker players whose height exceeds 200cm is", the question and the mode information of the table data are input into a text-to-SQL model, and the question is converted into a corresponding SQL statement.
Step S407, the SQL sentence is operated to query the data table stored with the table data to obtain a query result, reply information is determined according to the query result, and the reply information is fed back.
And the server queries the data table stored with the table data by operating the SQL sentence corresponding to the target dialogue information to obtain a query result.
Further, the server may send the query result as reply information of the question to the terminal, so that the terminal outputs the reply information for the user to view.
Optionally, the server may further generate reply information according to a preset reply language based on the query result, and feed the generated reply information back to the terminal, so that the terminal outputs the reply information for the user to view.
Optionally, the server may also feed back the query result to the terminal, so that a reply dialog preset by the terminal generates reply information, and outputs the reply information for the user to view.
In the embodiment, the current round of dialogue information and the historical dialogue information are input into a context rewriting model, and classification processing is performed through the context rewriting model to obtain a rewriting position type and a rewriting operation type corresponding to each position in the current round of dialogue information and a candidate position type corresponding to each position in the historical dialogue information; determining an object to be rewritten according to each rewriting start position and the corresponding rewriting end position; determining the rewriting operation type of each object to be rewritten according to the rewriting operation type of the position of each object to be rewritten; determining a key text according to each candidate starting position and the corresponding candidate ending position; according to the current round of dialogue information, objects to be rewritten and rewriting operation types corresponding to the objects to be rewritten are rewritten by using the key texts, candidate dialogue information is generated, the omitted key information in the current round of dialogue can be completely supplemented, and the designated information is replaced by the designated complete content information, so that the current round of dialogue information is rewritten into high-quality expression, the problems of designation and omission in multiple rounds of question answering are solved, when the method is applied to a question answering/dialogue scene based on form data, corresponding answer information is obtained based on the rewritten target dialogue information, and the quality and the accuracy of the answer information are improved.
Fig. 7 is a schematic structural diagram of a device for multiple rounds of question answering according to an exemplary embodiment of the present application. The device for multi-turn question answering provided by the embodiment of the application can execute the processing flow provided by the method embodiment of multi-turn question answering. As shown in fig. 7, the apparatus 70 for multi-turn question answering includes: an information acquisition module 701, a rewriting prediction module 702, a rewriting module 703, a selection module 704, and a reply module 705.
Specifically, the information obtaining module 701 is configured to, in response to the dialog request, obtain dialog information of the current round and historical dialog information of at least one historical dialog if it is determined that at least one historical dialog exists before the current round of dialog.
And the rewriting prediction module 702 is used for inputting the current round of dialogue information and the historical dialogue information into a context rewriting model, and determining an object to be rewritten in the current round of dialogue information, a rewriting operation type corresponding to the object to be rewritten, and a key text for rewriting in the historical dialogue information by using the context rewriting model.
And a rewriting module 703, configured to rewrite the current round of session information by using the key text according to the object to be rewritten in the current round of session information and the rewriting operation type corresponding to the object to be rewritten, and generate candidate session information.
And a selecting module 704, configured to take one of the candidate session information as the target session information after the current session information is rewritten, according to the quality information of the candidate session information.
The reply module 705 is configured to obtain reply information corresponding to the target session information, and feed back the reply information.
Optionally, the rewrite prediction module, when applied to input the current round of dialog information and the historical dialog information into a context rewrite model, and determine, by using the context rewrite model, an object to be rewritten in the current round of dialog information, a rewrite operation type corresponding to the object to be rewritten, and a key text for rewriting in the historical dialog information, is specifically configured to: inputting the current round of dialogue information and historical dialogue information into a context rewriting model, and performing classification processing through the context rewriting model to obtain a classification result containing the following information: the method comprises the steps that a rewriting position type and a rewriting operation type corresponding to each position in the dialog information of the current round and a candidate position type corresponding to each position in the historical dialog information, wherein the rewriting position type is any one of a rewriting starting position, a rewriting ending position and a non-rewriting starting and stopping position; the candidate position category is any one of a candidate start position, a candidate end position, and a non-candidate start/end position. And determining an object to be rewritten, a rewriting operation type corresponding to the object to be rewritten and a key text in the historical dialogue information in the current round of dialogue information according to the classification result.
Optionally, the rewrite prediction module, when applied to determine, according to the classification result, an object to be rewritten in the current round of dialog information, a rewrite operation type corresponding to the object to be rewritten, and a key text in the historical dialog information, is specifically configured to:
determining an object to be rewritten according to each rewriting start position and the corresponding rewriting end position in the classification result; determining the rewriting operation type of the object to be rewritten according to the rewriting operation type of the position of each object to be rewritten; and determining a key text according to each candidate starting position and the corresponding candidate ending position in the classification result.
Optionally, the object to be rewritten is a position to be inserted or a text to be rewritten, and the rewriting operation type includes: inserting, deleting, replacing and keeping the original state, wherein the rewriting operation type corresponding to the position to be inserted is inserting. The rewriting module is applied to rewrite the current round of dialog information by using a key text according to the object to be rewritten in the current round of dialog information and the rewriting operation type corresponding to the object to be rewritten, and is specifically used for:
if the position to be inserted exists in the current round of dialogue information, inserting at least one key text into the position to be inserted; if the first text to be rewritten exists in the dialog information of the current round and the rewriting operation type of the first text to be rewritten is replacement, replacing the first text to be rewritten by at least one key text; and if the second text to be rewritten exists in the current round of dialog information and the rewriting operation type of the second text to be rewritten is deletion, deleting the second text to be rewritten in the current round of dialog information.
Optionally, the selection module is specifically configured to:
obtaining sentence probability of each candidate dialogue information, and taking the candidate dialogue information with the highest sentence probability as target dialogue information; alternatively, the confusion of each candidate dialog information is acquired, and the candidate dialog information with the lowest confusion is taken as the target dialog information.
Optionally, the reply module is specifically configured to:
inputting the target dialogue information into a language conversion model for conversion processing, and converting the target dialogue information into a corresponding SQL statement; inquiring a data table storing table data according to the SQL statement to obtain an inquiry result; and determining reply information according to the query result.
The apparatus provided in the embodiment of the present application may be specifically configured to execute the scheme provided in any one of the method embodiments, and specific functions and technical effects that can be achieved are not described herein again.
Fig. 8 is a schematic structural diagram of an electronic device according to an example embodiment of the present application. As shown in fig. 8, the electronic apparatus 80 includes: a processor 801, and a memory 802 communicatively coupled to the processor 801, the memory 802 storing computer-executable instructions.
The processor executes the computer execution instructions stored in the memory to implement the solutions provided in any of the above method embodiments, and the specific functions and technical effects that can be implemented are not described herein again. The electronic device may be the above-mentioned server.
The embodiments of the present application further provide a computer-readable storage medium, where computer-executable instructions are stored in the computer-readable storage medium, and when the computer-executable instructions are executed by a processor, the computer-executable instructions are used to implement the solutions provided in any of the above method embodiments, and specific functions and technical effects that can be implemented are not described herein again.
An embodiment of the present application further provides a computer program product, where the program product includes: the computer program is stored in a readable storage medium, at least one processor of the electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program to enable the electronic device to execute the scheme provided by any one of the above method embodiments, and specific functions and achievable technical effects are not described herein again.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (8)

1. A method of multiple rounds of question answering, comprising:
responding to a conversation request, and if determining that at least one round of historical conversation exists before the current round of conversation, acquiring current round of conversation information and historical conversation information of the at least one round of historical conversation;
inputting the current round of dialogue information and the historical dialogue information into a context rewriting model, and performing classification processing through the context rewriting model to obtain a classification result containing the following information: the method comprises the steps that a rewriting position type and a rewriting operation type corresponding to each position in the current round of dialogue information and a candidate position type corresponding to each position in the historical dialogue information are obtained, wherein the rewriting position type is any one of a rewriting starting position, a rewriting ending position and a non-rewriting starting and stopping position; the candidate position category is any one of a candidate starting position, a candidate ending position and a non-candidate starting and ending position;
determining an object to be rewritten according to each rewriting start position and a corresponding rewriting end position in the classification result to obtain the object to be rewritten included in the current round of dialog information, where the current round of dialog information includes one or more objects to be rewritten, and determining a rewriting operation type of the object to be rewritten according to the rewriting operation type of the position where each object to be rewritten is located, where each object to be rewritten is a position to be inserted or a text to be rewritten, the rewriting operation type corresponding to the position to be inserted is an insertion, and the rewriting operation type corresponding to the text to be rewritten may be any one of deletion, replacement, and original state maintenance;
determining a key text according to each candidate starting position and the corresponding candidate ending position in the classification result to obtain one or more key texts for rewriting in the historical dialogue information;
rewriting the current round of dialogue information by using the key text according to the objects to be rewritten in the current round of dialogue information and the rewriting operation type corresponding to each object to be rewritten, and generating possible candidate dialogue information by enumerating possible rewriting modes;
according to the quality information of the candidate dialogue information, taking one of the candidate dialogue information as target dialogue information after the current round of dialogue information is rewritten;
and acquiring reply information corresponding to the target conversation information, and feeding back the reply information.
2. The method according to claim 1, wherein the generating candidate dialog information by rewriting the current-round dialog information using the key text according to an object to be rewritten in the current-round dialog information and a rewriting operation type corresponding to the object to be rewritten includes:
if the position to be inserted exists in the current round of dialogue information, inserting at least one key text into the position to be inserted;
if a first text to be rewritten exists in the current round of dialogue information and the rewriting operation type of the first text to be rewritten is replacement, replacing the first text to be rewritten with at least one key text;
and if a second text to be rewritten exists in the current round of dialog information and the rewriting operation type of the second text to be rewritten is deletion, deleting the second text to be rewritten in the current round of dialog information.
3. The method according to claim 1, wherein the rewriting of one of the candidate session information as the target session information after the current round of session information according to the quality information of the candidate session information comprises:
obtaining sentence probability of each candidate dialogue information, and taking the candidate dialogue information with the highest sentence probability as target dialogue information;
alternatively, the first and second electrodes may be,
and acquiring the confusion degree of each candidate dialogue information, and taking the candidate dialogue information with the lowest confusion degree as the target dialogue information.
4. The method of claim 1, wherein the obtaining of the current session information and the historical session information of the at least one historical session comprises:
acquiring a current round of dialogue text and historical dialogue text of the at least one round of historical dialogue;
and respectively carrying out word segmentation on the current round of dialogue text and the historical dialogue text of each round of historical dialogue to obtain a token sequence of the current round of dialogue text and a token sequence of the historical dialogue text of each round of historical dialogue.
5. The method according to claim 1, wherein the obtaining reply information corresponding to the target dialog information includes:
inputting the target dialogue information into a language conversion model for conversion processing, and converting the target dialogue information into a corresponding SQL statement;
inquiring a data table storing table data according to the SQL statement to obtain an inquiry result;
and determining reply information according to the query result.
6. A device for multiple rounds of question answering, comprising:
the information acquisition module is used for responding to the conversation request, and acquiring the conversation information of the current round and the historical conversation information of at least one round of historical conversation if at least one round of historical conversation is determined to exist before the current round of conversation;
and the rewriting prediction module is used for inputting the current round of dialogue information and the historical dialogue information into a context rewriting model, and performing classification processing through the context rewriting model to obtain a classification result containing the following information: the method comprises the steps that a rewriting position type and a rewriting operation type corresponding to each position in the current round of dialogue information and a candidate position type corresponding to each position in the historical dialogue information are obtained, wherein the rewriting position type is any one of a rewriting starting position, a rewriting ending position and a non-rewriting starting and stopping position; the candidate position category is any one of a candidate starting position, a candidate ending position and a non-candidate starting and ending position; determining an object to be rewritten according to each rewriting start position and a corresponding rewriting end position in the classification result to obtain the object to be rewritten included in the current round of dialog information, where the current round of dialog information includes one or more objects to be rewritten, and determining a rewriting operation type of the object to be rewritten according to the rewriting operation type of the position where each object to be rewritten is located, where each object to be rewritten is a position to be inserted or a text to be rewritten, the rewriting operation type corresponding to the position to be inserted is an insertion, and the rewriting operation type corresponding to the text to be rewritten may be any one of deletion, replacement, and original state maintenance; determining a key text according to each candidate starting position and the corresponding candidate ending position in the classification result to obtain one or more key texts for rewriting in the historical dialogue information;
the rewriting module is used for rewriting the current round of dialogue information by using the key text according to objects to be rewritten in the current round of dialogue information and the rewriting operation type corresponding to each object to be rewritten, and generating possible candidate dialogue information by enumerating possible rewriting modes;
the selection module is used for taking one candidate dialogue information as target dialogue information after the current round of dialogue information is rewritten according to the quality information of the candidate dialogue information;
and the reply module is used for acquiring reply information corresponding to the target conversation information and feeding back the reply information.
7. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of claims 1-5.
8. A computer-readable storage medium having computer-executable instructions stored therein, which when executed by a processor, are configured to implement the method of any one of claims 1-5.
CN202210440996.2A 2022-04-26 2022-04-26 Multi-turn question and answer method, device and equipment Active CN114547274B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210440996.2A CN114547274B (en) 2022-04-26 2022-04-26 Multi-turn question and answer method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210440996.2A CN114547274B (en) 2022-04-26 2022-04-26 Multi-turn question and answer method, device and equipment

Publications (2)

Publication Number Publication Date
CN114547274A CN114547274A (en) 2022-05-27
CN114547274B true CN114547274B (en) 2022-08-05

Family

ID=81666716

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210440996.2A Active CN114547274B (en) 2022-04-26 2022-04-26 Multi-turn question and answer method, device and equipment

Country Status (1)

Country Link
CN (1) CN114547274B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114691852B (en) * 2022-06-01 2022-08-12 阿里巴巴达摩院(杭州)科技有限公司 Man-machine conversation system and method
CN115617974B (en) * 2022-12-14 2023-12-01 北京红棉小冰科技有限公司 Dialogue processing method, device, equipment and storage medium
CN116737756B (en) * 2023-08-15 2023-11-03 腾讯科技(深圳)有限公司 Data query method, device, equipment and storage medium
CN116881429B (en) * 2023-09-07 2023-12-01 四川蜀天信息技术有限公司 Multi-tenant-based dialogue model interaction method, device and storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806508A (en) * 2021-09-17 2021-12-17 平安普惠企业管理有限公司 Multi-turn dialogue method and device based on artificial intelligence and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021128044A1 (en) * 2019-12-25 2021-07-01 深圳市优必选科技股份有限公司 Multi-turn conversation method and apparatus based on context, and device and storage medium
CN111639170A (en) * 2020-05-29 2020-09-08 深圳壹账通智能科技有限公司 Answer selection method and device, computer equipment and computer readable storage medium
CN112989008A (en) * 2021-04-21 2021-06-18 上海汽车集团股份有限公司 Multi-turn dialog rewriting method and device and electronic equipment
CN113673256A (en) * 2021-07-21 2021-11-19 阿里巴巴达摩院(杭州)科技有限公司 Query statement rewriting method and device
CN113609824A (en) * 2021-08-10 2021-11-05 上海交通大学 Multi-turn dialog rewriting method and system based on text editing and grammar error correction

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806508A (en) * 2021-09-17 2021-12-17 平安普惠企业管理有限公司 Multi-turn dialogue method and device based on artificial intelligence and storage medium

Also Published As

Publication number Publication date
CN114547274A (en) 2022-05-27

Similar Documents

Publication Publication Date Title
CN114547274B (en) Multi-turn question and answer method, device and equipment
CN108491443B (en) Computer-implemented method and computer system for interacting with a user
CN111177359A (en) Multi-turn dialogue method and device
CN108829682B (en) Computer readable storage medium, intelligent question answering method and intelligent question answering device
CN107798123B (en) Knowledge base and establishing, modifying and intelligent question and answer methods, devices and equipment thereof
CN107967250B (en) Information processing method and device
CN109271524B (en) Entity linking method in knowledge base question-answering system
US11907665B2 (en) Method and system for processing user inputs using natural language processing
US20220058349A1 (en) Data processing method, device, and storage medium
CN112115252A (en) Intelligent auxiliary writing processing method and device, electronic equipment and storage medium
CN110717021A (en) Input text and related device for obtaining artificial intelligence interview
CN116821290A (en) Multitasking dialogue-oriented large language model training method and interaction method
CN111723559B (en) Real-time information extraction method and device
CN110969005A (en) Method and device for determining similarity between entity corpora
CN117743526A (en) Table question-answering method based on large language model and natural language processing
JPWO2019167281A1 (en) Response processing program, response processing method, response processing device and response processing system
CN117370190A (en) Test case generation method and device, electronic equipment and storage medium
CN111241276A (en) Topic searching method, device, equipment and storage medium
KR102562692B1 (en) System and method for providing sentence punctuation
CN111310457B (en) Word mismatching recognition method and device, electronic equipment and storage medium
KR20220099690A (en) Apparatus, method and computer program for summarizing document
CN113627722A (en) Simple answer scoring method based on keyword segmentation, terminal and readable storage medium
CN112905752A (en) Intelligent interaction method, device, equipment and storage medium
CN111259650A (en) Text automatic generation method based on class mark sequence generation type countermeasure model
CN117453895B (en) Intelligent customer service response method, device, equipment and readable 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
GR01 Patent grant
GR01 Patent grant