CN114880451A - Retrieval type conversation generation method and device and electronic equipment - Google Patents

Retrieval type conversation generation method and device and electronic equipment Download PDF

Info

Publication number
CN114880451A
CN114880451A CN202210571485.4A CN202210571485A CN114880451A CN 114880451 A CN114880451 A CN 114880451A CN 202210571485 A CN202210571485 A CN 202210571485A CN 114880451 A CN114880451 A CN 114880451A
Authority
CN
China
Prior art keywords
statement
sentence
determining
input
retrieval
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
CN202210571485.4A
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 CN202210571485.4A priority Critical patent/CN114880451A/en
Publication of CN114880451A publication Critical patent/CN114880451A/en
Pending legal-status Critical Current

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
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/211Syntactic parsing, e.g. based on context-free grammar [CFG] or unification grammars

Landscapes

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

Abstract

The disclosure provides a method for generating a search-type dialogue, which relates to the technical field of data processing, in particular to the fields of big data, natural language processing, artificial intelligence and the like. The specific implementation scheme is as follows: after the first emotion tag and the plurality of search results corresponding to the first input statement are obtained, a first association degree between each search result and the first input statement may be determined, then, a statement to be returned may be extracted from the plurality of search results according to the plurality of first association degrees, and then, the statement to be returned may be rewritten according to the first emotion tag by using a preset rewrite rule to generate a target response statement. Therefore, a sentence to be returned with the highest accuracy is searched out through the first relevance between each search result and the first input sentence, and the sentence to be returned is rewritten according to the emotion label of the first input sentence, so that the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is enriched.

Description

Search-type conversation generation method and device and electronic equipment
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to the fields of big data, natural language processing, artificial intelligence, and the like, and in particular, to a method and an apparatus for generating a search-based dialog, and an electronic device.
Background
In order to make human-computer interaction more harmonious and enhance user experience, it is desirable that dialog systems be able to generate dialog responses with emotions. However, the retrieval-based dialog is controllable and convenient to generate and widely applied to intelligent customer service scenes, so how to enrich the emotion of the generated retrieval-based dialog is a problem which needs to be solved continuously at present.
Disclosure of Invention
The present disclosure provides a method and an apparatus for generating a search dialog.
According to an aspect of the present disclosure, there is provided a method for generating a retrievable dialog, including:
acquiring a first emotion label and a plurality of retrieval results corresponding to a first input statement;
determining a first association degree between each retrieval result and the first input statement;
extracting statements to be returned from a plurality of retrieval results according to a plurality of first relevance degrees;
and rewriting the to-be-returned statement according to the first emotion label by using a preset rewriting rule so as to generate a target response statement.
According to another aspect of the present disclosure, there is provided a retrieval dialog generation apparatus including:
the obtaining module is used for obtaining a first emotion label and a plurality of retrieval results corresponding to the first input statement;
the determining module is used for determining a first association degree between each retrieval result and the first input statement;
the extraction module is used for extracting the statements to be returned from the plurality of retrieval results according to the plurality of first relevance degrees;
and the rewriting module is used for rewriting the to-be-returned statement according to the first emotion label by using a preset rewriting rule so as to generate a target response statement.
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 first and the second end of the pipe are connected with each other,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of the above embodiments.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method according to the above-described embodiments.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method of the above embodiment.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a schematic flowchart of a method for generating a search dialogue according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of another method for generating a search dialogue according to an embodiment of the present disclosure;
fig. 3 is a schematic flow chart of another method for generating a search dialogue according to an embodiment of the present disclosure;
fig. 4 is a schematic flow chart of another method for generating a search dialogue according to an embodiment of the present disclosure;
fig. 5 is a schematic flowchart of another apparatus for generating a search dialogue according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device for implementing a method of generating a retrievable dialog according to an embodiment of the disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those 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.
Big data, or mass data, refers to the data that is too large to be captured, managed, processed and organized into information that can help enterprise business decision more actively within a reasonable time through the current mainstream software tools.
NLP (Natural Language Processing) is an important direction in the fields of computer science and artificial intelligence, and the content of NLP research includes but is not limited to the following branch fields: text classification, information extraction, automatic summarization, intelligent question answering, topic recommendation, machine translation, subject word recognition, knowledge base construction, deep text representation, named entity recognition, text generation, text analysis (lexical, syntactic, grammatical, etc.), speech recognition and synthesis, and the like.
Artificial intelligence is the subject of research on the use of computers to simulate certain mental processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.) of humans, both in the hardware and software domain. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing, and the like; the artificial intelligence software technology comprises a computer vision technology, a voice recognition technology, a natural language processing technology, a deep learning technology, a big data processing technology, a knowledge map technology and the like.
According to the method and the device, the sentence to be returned with the highest accuracy is retrieved through the obtained association degree between each retrieval result corresponding to the input sentence and the input sentence, and the sentence to be returned is rewritten according to the emotion label of the input sentence, so that the accuracy of the answer sentence is guaranteed, and meanwhile, the emotion of the answer sentence is enriched.
A method, an apparatus, an electronic device, and a storage medium for generating a retrieval dialog according to an embodiment of the present disclosure are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a method for generating a search dialog according to an embodiment of the present disclosure.
As shown in fig. 1, the method includes:
step 101, a first emotion tag and a plurality of retrieval results corresponding to a first input statement are obtained.
In this disclosure, the currently acquired input sentence may be determined as a first input sentence, and then, an emotion tag of the first input sentence may be recognized by using a preset emotion recognition model, and the emotion tag may be used as the first emotion tag of the first input sentence.
In addition, the topic, intention, entity, slot and the like of the first input sentence can be determined through analysis, and then the preset database can be searched based on the topic, intention, entity, slot and the like of the first input sentence to determine a plurality of search results corresponding to the first input sentence. The preset database may include an input statement, a possible response statement corresponding to the input statement, and the like, which is not limited in this disclosure.
Optionally, the first input sentence may be input into a preset search model such as an MSN (Multi-hop Selector network) to search for a plurality of search results corresponding to the first input sentence in a preset database.
Optionally, a vector corresponding to the first input statement may be determined through vector mapping, then vector matching may be performed on the vector corresponding to the first input statement and a vector corresponding to each input statement in a preset database, so as to determine similarity between the first input statement and each input statement in the preset database, and when the similarity between a certain statement input in the preset database and the first input statement is greater than a threshold, a response statement corresponding to the statement may be input to determine as multiple search results corresponding to the first input statement.
Step 102, determining a first degree of association between each retrieval result and the first input statement.
In the present disclosure, in order to ensure the accuracy of the answer sentence (i.e., ensure that the answer sentence is the answer expected by the user) and make the answer sentence have a certain emotion, the answer sentence with the highest accuracy and similar emotion to the first input sentence in the plurality of search results may be guided to be selected as the to-be-returned sentence corresponding to the first input sentence according to the first emotion tag of the first input sentence.
It should be noted that when the semantic similarity between a certain search result and the first input sentence is high, the search result is most likely to be the answer sentence corresponding to the first input sentence, and therefore, the accuracy of the search result can be evaluated according to the semantic similarity between the search result and the first input sentence.
In the disclosure, the emotion tag corresponding to each search result may be determined by querying a preset database, and then, the first input sentence, the first emotion tag, and each search result may be input into a preset model for determining semantic similarity, so as to determine a first association degree between each search result and the first input sentence. Thus, the emotion tag is used as a feature of the model to influence semantic similarity evaluation, so that the response sentence with high semantic similarity to the first input sentence has the emotion matching with the first input sentence.
Optionally, the emotion tag of each search result may be determined, and the first association degree between each search result and the first input sentence is determined according to the emotion similarity between the emotion tag of each search result and the first emotion tag and the semantic similarity between each search result and the first input sentence.
And 103, extracting the statements to be returned from the plurality of retrieval results according to the plurality of first relevance degrees.
In the present disclosure, when the first relevance between the search result and the first input sentence is high, it is described that the search result is semantically and emotionally closest to the first input sentence, and therefore, the search result with the highest first relevance to the first input sentence may be determined as the sentence to be returned.
Optionally, when the first degree of association between at least two search results and the input sentence is the highest in the plurality of search results, the search frequency and/or the number of rewriting times corresponding to each search result in the at least two search results may be determined. And when the retrieval frequency of the retrieval result is higher, the retrieval result has higher reliability, so that the retrieval result with the highest retrieval frequency is determined as the to-be-returned statement. Alternatively, since the search result is more reliable when the number of times the search result history is rewritten is smaller, the search result with the smallest number of rewriting times is determined as the term to be returned. Thereby improving the accuracy of the statements to be returned.
And 104, rewriting the to-be-returned statement according to the first emotion label by using a preset rewriting rule to generate a target response statement.
The preset rewrite rule can be used for enriching the emotion of the sentence to be rewritten, and rewrite models such as a pre-training model PLATO can be generated for the dialogue, which is not limited by the disclosure.
In this disclosure, the emotion tag of the answer sentence corresponding to the first emotion tag may be determined according to a mapping relationship between the emotion tag of the preset input sentence and the emotion tag of the corresponding answer sentence. Then, the preset rewrite model can be used, and the emotion label of the answer sentence corresponding to the first emotion label is used as a feature of the rewrite model to control and generate the target answer sentence emotion. Therefore, the to-be-returned sentence is rewritten according to the emotion label of the response sentence corresponding to the first input sentence, so that the modified to-be-returned sentence has the response emotion conforming to the first input sentence under the condition of not changing the quality of the to-be-returned sentence.
In the disclosure, after a first emotion tag and a plurality of search results corresponding to a first input sentence are obtained, a first association degree between each search result and the first input sentence may be determined, then a sentence to be returned may be extracted from the plurality of search results according to the plurality of first association degrees, and then the sentence to be returned may be rewritten according to the first emotion tag by using a preset rewrite rule to generate a target response sentence. Therefore, a sentence to be returned with the highest accuracy is searched out through the first relevance between each search result and the first input sentence, and the sentence to be returned is rewritten according to the emotion label of the first input sentence, so that the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is enriched.
Fig. 2 is a schematic flowchart of a method for generating a search dialog according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes:
step 201, a first emotion tag and a plurality of search results corresponding to a first input statement are obtained.
In this disclosure, the specific implementation process of step 201 may refer to the detailed description of any embodiment of the disclosure, and is not described herein again.
Step 202, determining a second emotion label corresponding to each retrieval result.
In the disclosure, the emotion tag of each search result can be identified by using a preset emotion identification model, and the emotion tag is used as a second emotion tag of each search result.
Step 203, determining a first correlation value according to the matching degree of each second emotion tag and the first emotion tag.
In the disclosure, the distance between the vector corresponding to each second emotion tag and the vector corresponding to the first emotion tag may be calculated, the matching degree between each second emotion tag and the first emotion tag may be determined according to the distance, and then, the first association value between each second emotion tag and the first emotion tag may be determined according to the matching degree between each second emotion tag and the first emotion tag.
It is understood that the first correlation value may be used to evaluate whether the search result is close to the emotion of the first input sentence, and when the first correlation value is larger, the corresponding search result is close to the emotion of the first input sentence.
And 204, determining a second correlation value according to the semantic similarity between each retrieval result and the first input statement.
In the present disclosure, a semantic similarity between each search result and the first input sentence may be calculated through a preset semantic model, and then, a second association value between each search result and the first input sentence may be determined according to each semantic similarity.
It is understood that the second relevance value may be used to evaluate whether the search result is semantically related to the first input sentence, and when the second relevance value is larger, it indicates that the corresponding search result is semantically related to the first input sentence, and therefore, the search result is most likely to be the answer sentence corresponding to the first input sentence.
Step 205, determining a first association degree between each search result and the first input sentence according to the first association value and the second association value.
In this disclosure, the first relevance value and the second relevance value corresponding to the search result may be subjected to weighted summation processing, and the weighted sum may be determined as the first relevance between the search result and the first input sentence. Therefore, the first relevance degree corresponding to each retrieval result is determined jointly according to the first relevance value related to the emotion and the second relevance value related to the semanteme, so that the first relevance degree guarantees the semanteme correlation and simultaneously considers the emotion correlation, namely, the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is richer.
And step 206, extracting the statements to be returned from the plurality of retrieval results according to the plurality of first association degrees.
And step 207, rewriting the to-be-returned statement according to the first emotion tag by using a preset rewriting rule to generate a target response statement.
In the present disclosure, the specific implementation process of step 206 to step 207 may refer to the detailed description of any embodiment of the present disclosure, and is not described herein again.
According to the method, after a first emotion tag corresponding to a first input statement and a plurality of search results are obtained, a second emotion tag corresponding to each search result can be determined, then a first correlation value can be determined according to the matching degree of each second emotion tag and the first emotion tag, a second correlation value is determined according to the semantic similarity between each search result and the first input statement, therefore, the first correlation degree between each search result and the first input statement can be determined according to the first correlation value and the second correlation value, then, a statement to be returned is extracted from the search results according to the first correlation degrees, and the statement to be returned is rewritten according to the first emotion tag by using a preset rewriting rule to generate a target response statement. Therefore, a sentence to be returned with the highest accuracy is searched out through the first relevance between each search result and the first input sentence, and the sentence to be returned is rewritten according to the emotion label of the first input sentence, so that the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is enriched.
Fig. 3 is a schematic flowchart of a method for generating a search dialog according to an embodiment of the present disclosure.
As shown in fig. 3, the method includes:
step 301, a first emotion tag and a plurality of search results corresponding to a first input sentence are obtained.
Step 302, determining a first degree of association between each retrieval result and the first input statement.
Step 303, extracting the to-be-returned statement from the plurality of retrieval results according to the plurality of first association degrees.
And 304, rewriting the to-be-returned statement according to the first emotion label by using a preset rewriting rule to generate a target response statement.
In the present disclosure, the detailed implementation process of steps 301 to 304 may refer to the detailed description of any embodiment of the present disclosure, and is not repeated herein.
And 305, determining a second emotion label corresponding to the target answer sentence.
In the disclosure, the target answer sentence may be input into a preset emotion recognition model to determine a second emotion tag corresponding to the target answer sentence.
And step 306, storing the first input statement, the first emotion label, the target response statement and the second emotion label in a database in a correlated manner.
In the disclosure, the first input sentence, the first emotion tag, the target answer sentence and the second emotion tag may be stored in the database in an associated manner, so that when the input sentence is subsequently acquired, and it is determined that the emotion tag of the input sentence is the same as the first emotion tag and semantic similarity with the first input sentence is greater than a threshold, the target answer sentence associated with the first input sentence may be directly determined as the target answer sentence corresponding to the input sentence. Thus, the efficiency of determining the answer sentence corresponding to the input sentence can be improved.
Optionally, after determining the second emotion tag corresponding to the target answer sentence, the second emotion tag, the target answer sentence, and the to-be-returned sentence may be stored in an associated manner. Therefore, when the input statement is acquired subsequently and the target answer statement stored in association with the statement to be returned of the input statement is determined, the target answer statement can be directly determined as the target answer statement corresponding to the input statement. Thus, the efficiency of determining the answer sentence corresponding to the input sentence can be improved.
According to the method, after a first emotion label and a plurality of retrieval results corresponding to a first input statement are obtained, a first association degree between each retrieval result and the first input statement can be determined, a statement to be returned is extracted from the plurality of retrieval results according to the plurality of first association degrees, then the statement to be returned can be rewritten according to the first emotion label by using a preset rewriting rule to generate a target response statement, then a second emotion label corresponding to the target response statement can be determined, and the first input statement, the first emotion label, the target response statement and the second emotion label are stored in a database in an associated mode. Therefore, a sentence to be returned with the highest accuracy is searched out through the first relevance between each search result and the first input sentence, and the sentence to be returned is rewritten according to the emotion label of the first input sentence, so that the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is enriched.
Fig. 4 is a schematic flowchart of a method for generating a retrieval dialog according to an embodiment of the present disclosure.
As shown in fig. 4, the method includes:
step 401, a first emotion tag and a plurality of search results corresponding to a first input sentence are obtained.
Step 402, determining a first degree of association between each retrieval result and the first input statement.
Step 403, extracting the to-be-returned statement from the plurality of search results according to the plurality of first association degrees.
And step 404, rewriting the to-be-returned statement according to the first emotion tag by using a preset rewriting rule to generate a target response statement.
In the present disclosure, the specific implementation process of steps 401 to 404 may refer to the detailed description of any embodiment of the present disclosure, and is not described herein again.
Step 405, outputting the target answer sentence.
In the present disclosure, a target answer sentence may be output to answer a user input sentence.
In response to receiving the second input sentence, a second degree of association between the second input sentence and the first input sentence is determined, step 406.
In the present disclosure, when the user is not satisfied with the output target response sentence, the sentence may be input again by changing the expression form. Therefore, the input sentence acquired again after the target answer sentence is output may be determined as the second input sentence, and the second association degree between the second input sentence and the first input sentence may be determined, so as to determine whether the second input sentence is a phase-change expression of the user for the first input sentence.
Step 407, storing the target answer sentence and the first emotion label into a preset training database under the condition that the second relevance is greater than the first threshold.
In the present disclosure, when the second relevance is greater than the first threshold, it may be determined that the second input sentence is a phase-change expression of the user for the first input sentence, and the emotion or semantic of the output target response sentence is not accurate. At this time, the target answer sentence and the first emotion tag may be stored in a preset training database.
And step 408, in response to the data amount in the preset training database being larger than the second threshold, updating the preset rewriting rule based on the data in the preset training database.
In this disclosure, when the data amount in the preset training database is greater than the second threshold, the rewrite model may be instructed to be retrained based on the data in the preset training database to update the preset rewrite rule. Thereby improving the quality of the answer sentence.
In the present disclosure, after the first emotion tag corresponding to the first input sentence and the plurality of search results are obtained, a first degree of association between each search result and the first input sentence may be determined, and the sentence to be returned may be extracted from the plurality of search results according to the plurality of first degrees of association, and then, according to the first emotion tag, using a preset rewrite rule, rewrites the to-be-returned sentence to generate a target answer sentence, and then, the target answer sentence may be output, when a second input sentence is received, a second degree of association between the second input sentence and the first input sentence may be determined, in case that the second degree of association is greater than the first threshold, the target answer sentence and the first emotion label may be stored in a preset training database, and in the case that the amount of data in the preset training database is greater than the second threshold, the preset rewrite rule may be updated based on the data in the preset training database. Therefore, a sentence to be returned with the highest accuracy is searched out through the first relevance between each search result and the first input sentence, and the sentence to be returned is rewritten according to the emotion label of the first input sentence, so that the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is enriched.
In order to implement the foregoing embodiment, the present disclosure further provides a device for generating a search dialog. Fig. 5 is a schematic structural diagram of an apparatus for generating a search dialog according to an embodiment of the present disclosure.
As shown in fig. 5, the apparatus 500 for generating a search dialogue includes: an acquisition module 510, a determination module 520, an extraction module 530, and a rewriting module 540.
An obtaining module 510, configured to obtain a first emotion tag and multiple search results corresponding to a first input sentence;
a determining module 520, configured to determine a first association degree between each search result and the first input sentence;
an extracting module 530, configured to extract a to-be-returned statement from the multiple search results according to the multiple first association degrees;
and the rewriting module 540 is configured to rewrite the to-be-returned statement according to the first emotion tag by using a preset rewriting rule, so as to generate a target response statement.
In a possible implementation manner of the embodiment of the present disclosure, the determining module 520 is configured to:
determining a second emotion label corresponding to each retrieval result;
determining a first correlation value according to the matching degree of each second emotion label and the first emotion label;
determining a second correlation value according to the semantic similarity between each retrieval result and the first input statement;
and determining a first association degree between each retrieval result and the first input statement according to the first association value and the second association value.
In a possible implementation manner of the embodiment of the present disclosure, the extracting module 530 is configured to:
determining the retrieval frequency and/or the rewriting times corresponding to each retrieval result in the at least two retrieval results in response to the highest first degree of association between the at least two retrieval results in the plurality of retrieval results and the input statement;
and determining the retrieval result with the highest retrieval frequency and/or the retrieval result with the least rewriting times as the statement to be returned.
In a possible implementation manner of the embodiment of the present disclosure, the determining module 520 is further configured to:
determining a second emotion label corresponding to the target answer sentence;
the device still includes:
and the storage module is used for storing the first input statement, the first emotion label, the target response statement and the second emotion label in a database in a correlated manner.
In a possible implementation manner of the embodiment of the present disclosure, the determining module 520 is further configured to:
determining a second emotion label corresponding to the target response sentence;
and the storage module is also used for storing the second emotion tag, the target response statement and the statement to be returned in a correlation manner.
In a possible implementation manner of the embodiment of the present disclosure, the method further includes:
the output module is used for outputting the target answer sentence;
the determining module 520 is further configured to determine, in response to receiving the second input sentence, a second association degree between the second input sentence and the first input sentence;
the storage module is further configured to store the target answer sentence and the first emotion tag into a preset training database under the condition that the second relevance is greater than the first threshold;
and the updating module is used for responding to the fact that the data quantity in the preset training database is larger than a second threshold value, and updating the preset rewriting rule based on the data in the preset training database.
It should be noted that the explanation of the embodiment of the search dialog generation method is also applicable to the apparatus of the embodiment, and therefore, the explanation is not repeated here.
In the disclosure, after a first emotion tag and a plurality of search results corresponding to a first input sentence are obtained, a first association degree between each search result and the first input sentence may be determined, then a sentence to be returned may be extracted from the plurality of search results according to the plurality of first association degrees, and then the sentence to be returned may be rewritten according to the first emotion tag by using a preset rewrite rule to generate a target response sentence. Therefore, a sentence to be returned with the highest accuracy is searched out through the first relevance between each search result and the first input sentence, and the sentence to be returned is rewritten according to the emotion label of the first input sentence, so that the accuracy of the answer sentence is guaranteed, and the emotion of the answer sentence is enriched.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 6 illustrates a schematic block diagram of an example electronic device 600 that can 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 phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the device 600 includes a computing unit 601 which can perform various appropriate actions and processes in accordance with a computer program stored in a ROM (Read-Only Memory) 602 or a computer program loaded from a storage unit 608 into a RAM (Random Access Memory) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The calculation unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An I/O (Input/Output) interface 605 is also connected to the bus 604.
A number of components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, a mouse, or the like; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of the computing Unit 601 include, but are not limited to, a CPU (Central Processing Unit), a GPU (graphics Processing Unit), various dedicated AI (Artificial Intelligence) computing chips, various computing Units running machine learning model algorithms, a DSP (Digital Signal Processor), and any suitable Processor, controller, microcontroller, and the like. The calculation unit 601 executes the respective methods and processes described above, such as the generation method of the retrieval dialog. For example, in some embodiments, the method of generating a searchable dialog may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the generation method of a retrievable dialog described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured by any other suitable means (e.g. by means of firmware) to perform the generation method of the retrievable dialog.
Various implementations of the systems and techniques described here above may be realized in digital electronic circuitry, Integrated circuitry, FPGAs (Field Programmable Gate arrays), ASICs (Application-Specific Integrated circuits), ASSPs (Application Specific Standard products), SOCs (System On Chip, System On a Chip), CPLDs (Complex Programmable Logic devices), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes 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 codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. 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. A 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 RAM, a ROM, an EPROM (Electrically Programmable Read-Only-Memory) or flash Memory, an optical fiber, a CD-ROM (Compact Disc Read-Only-Memory), 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 a pointing device (e.g., a mouse or a 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 can 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, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end 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 back-end, 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: LAN (Local Area Network), WAN (Wide Area Network), internet, and blockchain Network.
The computer system may include clients and servers. A client and server are generally 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, which is also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in a conventional physical host and a VPS (Virtual Private Server). The server may also be a server of a distributed system, or a server incorporating a blockchain.
According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, which when executed by an instruction processor in the computer program product, performs the generation method of the retrieval dialog proposed by the above-mentioned embodiment of the present disclosure.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel or sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (15)

1. A method of generating a searchable dialog, comprising:
acquiring a first emotion label and a plurality of retrieval results corresponding to a first input statement;
determining a first degree of association between each retrieval result and the first input statement;
extracting statements to be returned from the plurality of retrieval results according to the plurality of first relevance degrees;
and rewriting the statement to be returned according to the first emotion label by using a preset rewriting rule to generate a target response statement.
2. The method of claim 1, wherein said determining a first degree of association between each of said retrieved results and said first input statement comprises:
determining a second emotion label corresponding to each retrieval result;
determining a first correlation value according to the matching degree of each second emotion label and the first emotion label;
determining a second correlation value according to semantic similarity between each retrieval result and the first input statement;
and determining a first association degree between each retrieval result and the first input statement according to the first association value and the second association value.
3. The method as claimed in claim 1, wherein said extracting the to-be-returned sentence from the plurality of search results according to the plurality of first relevance degrees comprises:
determining the retrieval frequency and/or the rewriting times corresponding to each retrieval result in the at least two retrieval results in response to the highest first degree of association between the at least two retrieval results in the plurality of retrieval results and the input statement;
and determining the retrieval result with the highest retrieval frequency and/or the retrieval result with the least rewriting times as the statement to be returned.
4. The method of claim 1, wherein after the generating the target answer sentence, further comprising:
determining a second emotion label corresponding to the target response sentence;
and storing the first input statement, the first emotion label, the target response statement and the second emotion label in a database in a correlated manner.
5. The method of any of claims 1-4, wherein after the generating the target answer sentence, further comprising:
determining a second emotion label corresponding to the target response sentence;
and storing the second emotion label, the target response statement and the statement to be returned in a correlation manner.
6. The method of any of claims 1-4, wherein after the generating the target answer sentence, further comprising:
outputting the target answer sentence;
in response to receiving a second input sentence, determining a second degree of association between the second input sentence and the first input sentence;
under the condition that the second relevance is larger than a first threshold value, storing the target response sentence and the first emotion label into a preset training database;
and updating the preset rewriting rule based on the data in the preset training database in response to the data quantity in the preset training database being larger than a second threshold.
7. An apparatus for generating a retrievable dialog, comprising:
the obtaining module is used for obtaining a first emotion label and a plurality of retrieval results corresponding to the first input statement;
the determining module is used for determining a first association degree between each retrieval result and the first input statement;
the extraction module is used for extracting the statements to be returned from the plurality of retrieval results according to the plurality of first relevance degrees;
and the rewriting module is used for rewriting the statement to be returned according to the first emotion label by using a preset rewriting rule so as to generate a target response statement.
8. The apparatus of claim 7, wherein the means for determining is configured to:
determining a second emotion label corresponding to each retrieval result;
determining a first correlation value according to the matching degree of each second emotion label and the first emotion label;
determining a second correlation value according to semantic similarity between each retrieval result and the first input statement;
and determining a first association degree between each retrieval result and the first input statement according to the first association value and the second association value.
9. The apparatus of claim 7, wherein the extraction module is to:
determining the retrieval frequency and/or the rewriting times corresponding to each retrieval result in the at least two retrieval results in response to the highest first degree of association between the at least two retrieval results in the plurality of retrieval results and the input statement;
and determining the retrieval result with the highest retrieval frequency and/or the retrieval result with the least rewriting times as the statement to be returned.
10. The apparatus of claim 7, wherein the means for determining is further configured to:
determining a second emotion label corresponding to the target response sentence;
the device further comprises:
and the storage module is used for storing the first input statement, the first emotion label, the target response statement and the second emotion label in a database in a correlated manner.
11. The apparatus of any of claims 7-10, wherein the means for determining is further configured to:
determining a second emotion label corresponding to the target response sentence;
the storage module is further configured to store the second emotion tag, the target response statement and the to-be-returned statement in an associated manner.
12. The apparatus of any of claims 7-10, further comprising:
the output module is used for outputting the target answer sentence;
the determining module is further configured to determine, in response to receiving a second input sentence, a second degree of association between the second input sentence and the first input sentence;
the storage module is further configured to store the target answer sentence and the first emotion tag into a preset training database under the condition that the second relevance is greater than a first threshold;
and the updating module is used for responding to the fact that the data quantity in the preset training database is larger than a second threshold value, and updating the preset rewriting rule based on the data in the preset training database.
13. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
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-6.
14. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-6.
15. A computer program product comprising a computer program which, when executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
CN202210571485.4A 2022-05-24 2022-05-24 Retrieval type conversation generation method and device and electronic equipment Pending CN114880451A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210571485.4A CN114880451A (en) 2022-05-24 2022-05-24 Retrieval type conversation generation method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210571485.4A CN114880451A (en) 2022-05-24 2022-05-24 Retrieval type conversation generation method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN114880451A true CN114880451A (en) 2022-08-09

Family

ID=82676804

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210571485.4A Pending CN114880451A (en) 2022-05-24 2022-05-24 Retrieval type conversation generation method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN114880451A (en)

Similar Documents

Publication Publication Date Title
CN107679039B (en) Method and device for determining statement intention
CN112560912B (en) Classification model training method and device, electronic equipment and storage medium
TW202020691A (en) Feature word determination method and device and server
CN113590776A (en) Text processing method and device based on knowledge graph, electronic equipment and medium
CN112926308B (en) Method, device, equipment, storage medium and program product for matching text
CN114548110A (en) Semantic understanding method and device, electronic equipment and storage medium
CN112148881A (en) Method and apparatus for outputting information
CN114579104A (en) Data analysis scene generation method, device, equipment and storage medium
CN112466289A (en) Voice instruction recognition method and device, voice equipment and storage medium
CN112560461A (en) News clue generation method and device, electronic equipment and storage medium
JP7369228B2 (en) Method, device, electronic device, and storage medium for generating images of user interest
CN112528658A (en) Hierarchical classification method and device, electronic equipment and storage medium
CN113553412A (en) Question and answer processing method and device, electronic equipment and storage medium
CN112541070A (en) Method and device for excavating slot position updating corpus, electronic equipment and storage medium
CN114037059A (en) Pre-training model, model generation method, data processing method and data processing device
US20230206007A1 (en) Method for mining conversation content and method for generating conversation content evaluation model
CN116049370A (en) Information query method and training method and device of information generation model
CN114461749B (en) Data processing method and device for conversation content, electronic equipment and medium
CN116467461A (en) Data processing method, device, equipment and medium applied to power distribution network
CN114490986B (en) Computer-implemented data mining method, device, electronic equipment and storage medium
CN114239583B (en) Method, device, equipment and medium for training entity chain finger model and entity chain finger
CN113641724B (en) Knowledge tag mining method and device, electronic equipment and storage medium
CN114416941A (en) Generation method and device of dialogue knowledge point determination model fusing knowledge graph
CN114647727A (en) Model training method, device and equipment applied to entity information recognition
CN114880451A (en) Retrieval type conversation generation method and device and electronic equipment

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