Method, device and electronic equipment for generating a retrieval pattern dialogue
By acquiring the sentiment tags and relevance assessments of the input statements and using rewriting rules to generate target response statements, the problem of insufficient emotional expression in retrieval-based dialogue generation is solved, achieving emotionally rich and accurate responses.
Patent Information
- Application Number
- CN202210571485.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-24
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-05-24
AI Technical Summary
Existing retrieval-based dialogue generation methods struggle to enrich emotional expression while ensuring the accuracy of response statements, and their application is particularly insufficient in intelligent customer service scenarios.
By obtaining the sentiment tags of the input statement and multiple search results, and using relevance evaluation and rewriting rules, the target response statement is generated to ensure semantic similarity and sentiment consistency.
While maintaining the accuracy of the response statements, it enriches the emotional expression and enhances the user experience.
Smart Images

Figure CN114880451B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of data processing, in particular to the fields of big data, natural language processing, artificial intelligence, and the like, and specifically relates to a generation method and device of a retrieval dialogue and an electronic device. BACKGROUND
[0002] In order to make human-computer interaction more harmonious and enhance user experience, people hope that a dialogue system can generate a dialogue response with emotion. Since the generation of a retrieval dialogue is controllable and convenient, it is widely used in intelligent customer service scenarios. Therefore, how to enrich the emotion of the generated retrieval dialogue is a problem that needs to be solved at present. SUMMARY
[0003] The present disclosure provides a generation method and device of a retrieval dialogue.
[0004] According to an aspect of the present disclosure, a generation method of a retrieval dialogue is provided, comprising:
[0005] obtaining a first emotion label corresponding to a first input sentence and a plurality of retrieval results;
[0006] determining a first correlation degree between each retrieval result and the first input sentence;
[0007] extracting a to-be-returned sentence from the plurality of retrieval results according to the plurality of first correlation degrees;
[0008] using a preset rewriting rule to rewrite the to-be-returned sentence according to the first emotion label to generate a target response sentence.
[0009] According to another aspect of the present disclosure, a generation device of a retrieval dialogue is provided, comprising:
[0010] an obtaining module configured to obtain a first emotion label corresponding to a first input sentence and a plurality of retrieval results;
[0011] a determining module configured to determine a first correlation degree between each retrieval result and the first input sentence;
[0012] an extracting module configured to extract a to-be-returned sentence from the plurality of retrieval results according to the plurality of first correlation degrees;
[0013] a rewriting module configured to use a preset rewriting rule to rewrite the to-be-returned sentence according to the first emotion label to generate a target response sentence.
[0014] According to another aspect of the present disclosure, an electronic device is provided, comprising:
[0015] at least one processor; and
[0016] a memory communicatively connected with the at least one processor; wherein
[0017] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the above embodiments.
[0018] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method according to the above embodiments.
[0019] 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 according to the above embodiments.
[0020] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0021] The accompanying drawings are used to better understand the present scheme and do not limit the present disclosure. Among them:
[0022] Figure 1 A flowchart of a retrieval type dialogue generation method provided by an embodiment of the present disclosure is shown;
[0023] Figure 2 A flowchart of another retrieval type dialogue generation method provided by an embodiment of the present disclosure is shown;
[0024] Figure 3 A flowchart of another retrieval type dialogue generation method provided by an embodiment of the present disclosure is shown;
[0025] Figure 4 A flowchart of another retrieval type dialogue generation method provided by an embodiment of the present disclosure is shown;
[0026] Figure 5 A flowchart of another retrieval type dialogue generation device provided by an embodiment of the present disclosure is shown;
[0027] Figure 6 A block diagram of an electronic device for implementing the retrieval type dialogue generation method of the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0028] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0029] Big data, or massive data, refers to information that is so large that it cannot be captured, managed, processed, and organized into a more proactive business decision-making process using current mainstream software tools within a reasonable timeframe.
[0030] Natural Language Processing (NLP) is an important field in computer science and artificial intelligence. NLP research includes, but is not limited to, the following subfields: text classification, information extraction, automatic summarization, intelligent question answering, topic recommendation, machine translation, topic word recognition, knowledge base construction, deep text representation, named entity recognition, text generation, text analysis (lexical, syntactic, and grammatical functions), speech recognition and synthesis, etc.
[0031] Artificial intelligence (AI) is the study of using computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies include computer vision, speech recognition, natural language processing, deep learning, big data processing, and knowledge graph technologies.
[0032] In this disclosure, by obtaining the correlation between each search result corresponding to the input statement and the input statement, the statement to be returned with the highest accuracy is retrieved, and the statement to be returned is rewritten according to the sentiment tag of the input statement, thereby enriching the sentiment of the response statement while ensuring the accuracy of the response statement.
[0033] The following detailed description of the method, apparatus, electronic device, and storage medium for generating search-based dialogs according to embodiments of the present disclosure is provided with reference to the accompanying drawings.
[0034] Figure 1 This is a flowchart illustrating a method for generating a retrieval-based dialogue, as provided in an embodiment of this disclosure.
[0035] like Figure 1 As shown, the method includes:
[0036] Step 101, obtaining a first emotion label corresponding to the first input sentence and a plurality of retrieval results.
[0037] In the present disclosure, the current input sentence can be determined as the first input sentence, and then a preset emotion recognition model can be used to identify the emotion label of the first input sentence, and the emotion label can be used as the first emotion label of the first input sentence.
[0038] In addition, the topic, intent, entity, slot, etc. of the first input sentence can be determined by analysis, and then the topic, intent, entity, slot, etc. of the first input sentence can be used to search the preset database to determine the plurality of retrieval results corresponding to the first input sentence. The preset database can include input sentences, possible response sentences corresponding to the input sentences, etc., which are not limited by the present disclosure.
[0039] Optionally, the first input sentence can be input into a preset MSN (Multi-hop Selector Networker, multi-hop selector network) retrieval model to retrieve the plurality of retrieval results corresponding to the first input sentence in the preset database.
[0040] Optionally, the vector corresponding to the first input sentence can be determined by vector mapping, and then the vector corresponding to the first input sentence and the vector corresponding to each input sentence in the preset database can be matched to determine the similarity between the first input sentence and each input sentence in the preset database. When the similarity between a certain input sentence in the preset database and the first input sentence is greater than a threshold, the response sentence corresponding to the certain input sentence can be input to determine the plurality of retrieval results corresponding to the first input sentence.
[0041] Step 102, determining a first correlation degree between each retrieval result and the first input sentence.
[0042] In the present disclosure, in order to ensure the accuracy of the response sentence (i.e. to ensure that the response sentence is the expected response of the user), the response sentence has a certain emotion, which can be guided according to the first emotion label of the first input sentence to select the response sentence with the highest accuracy and similar emotion to the first input sentence from the plurality of retrieval results as the to-be-returned sentence corresponding to the first input sentence.
[0043] It should be noted that when the semantic similarity between a certain retrieval result and the first input sentence is high, the retrieval result is most likely to be the response sentence corresponding to the first input sentence, and therefore the accuracy of the retrieval result can be evaluated according to the semantic similarity between the retrieval result and the first input sentence.
[0044] In the present disclosure, the sentiment label corresponding to each search result can be determined by querying a preset database, and then the first input sentence, the first sentiment label and each search result can be input into a preset model for determining semantic similarity to determine the first correlation degree between each search result and the first input sentence. Thus, the sentiment label is used as a feature of the model to affect the evaluation of semantic similarity, so that the response sentence with high semantic similarity to the first input sentence also has consistent sentiment with the first input sentence.
[0045] Optionally, the sentiment label of each search result can also be determined, and the first correlation degree between each search result and the first input sentence can be determined according to the sentiment similarity between the sentiment label of each search result and the first sentiment label and the semantic similarity between each search result and the first input sentence.
[0046] In step 103, the to-be-returned sentence is extracted from the plurality of search results according to the plurality of first correlation degrees.
[0047] In the present disclosure, when the first correlation degree between the search result and the first input sentence is high, it means that the search result is most close to the semantic and sentiment of the first input sentence, and therefore the search result with the highest first correlation degree to the first input sentence can be determined as the to-be-returned sentence.
[0048] Optionally, when there are at least two search results with the highest first correlation degree between the search results and the input sentence, the search frequency and / or the number of rewrites corresponding to each search result in the at least two search results can be determined. The higher the search frequency of a search result, the higher the reliability of the search result, and therefore the search result with the highest search frequency can be determined as the to-be-returned sentence. Alternatively, the less the number of rewrites in the history of a search result, the higher the reliability of the search result, and therefore the search result with the least number of rewrites can be determined as the to-be-returned sentence. Thus, the accuracy of the to-be-returned sentence can be improved.
[0049] In step 104, the to-be-returned sentence is rewritten according to the first sentiment label by using a preset rewriting rule to generate a target response sentence.
[0050] The preset rewriting rule can be used to enrich the sentiment of the to-be-rewritten sentence, and a rewriting model such as a pre-training model PLATO for dialogue generation can be used, which is not limited in the present disclosure.
[0051] In the present disclosure, the sentiment label of the response sentence corresponding to the first sentiment label can be determined according to a preset mapping relationship between the sentiment label of the input sentence and the sentiment label of the corresponding response sentence. Then, the sentiment label of the response sentence corresponding to the first sentiment label can be used as a feature of the preset rewriting model to control the generation of the target response sentence emotion. In this way, the to-be-returned sentence is rewritten according to the sentiment label of the response sentence corresponding to the first input sentence, so that the modified to-be-returned sentence has the response emotion that meets the first input sentence without changing the quality of the to-be-returned sentence.
[0052] In the present disclosure, after obtaining the first sentiment label corresponding to the first input sentence and the plurality of search results, the first correlation degree between each search result and the first input sentence can be determined. Then, according to the plurality of first correlation degrees, the to-be-returned sentence can be extracted from the plurality of search results. Then, the to-be-returned sentence can be rewritten according to the first sentiment label by using the preset rewriting rule to generate the target response sentence. In this way, the to-be-returned sentence with the highest accuracy is searched according to the first correlation degree between each search result and the first input sentence, and the to-be-returned sentence is rewritten according to the sentiment label of the first input sentence, so as to ensure the accuracy of the response sentence while enriching the emotion of the response sentence.
[0053] Figure 2 A flowchart of a method for generating a search type dialogue according to an embodiment of the present disclosure is provided.
[0054] As shown in Figure 2 , the method comprises:
[0055] In step 201, the first sentiment label corresponding to the first input sentence and the plurality of search results are obtained.
[0056] In the present disclosure, the specific implementation process of step 201 can be referred to the detailed description of any embodiment of the present disclosure, which will not be repeated here.
[0057] In step 202, the second sentiment label corresponding to each search result is determined.
[0058] In the present disclosure, the sentiment recognition model can be used to identify the sentiment label of each search result, and the sentiment label is used as the second sentiment label of each search result.
[0059] In step 203, the first correlation value is determined according to the matching degree between each second sentiment label and the first sentiment label.
[0060] In the present disclosure, the distance between the vector corresponding to each second emotional label and the vector corresponding to the first emotional label can be calculated, and the matching degree of each second emotional label and the first emotional label can be determined according to the distance. Then, the first association value of each second emotional label and the first emotional label can be determined according to the matching degree of each second emotional label and the first emotional label.
[0061] It can be understood that the first association value can be used to evaluate whether the emotion of the retrieval result is similar to that of the first input sentence. When the first association value is large, it indicates that the corresponding retrieval result is more similar in emotion to the first input sentence.
[0062] In step 204, the second association value is determined according to the semantic similarity between each retrieval result and the first input sentence.
[0063] In the present disclosure, the semantic similarity between each retrieval result and the first input sentence can be calculated through a preset semantic model. Then, the second association value between each retrieval result and the first input sentence can be determined according to the semantic similarity.
[0064] It can be understood that the second association value can be used to evaluate whether the semantic of the retrieval result is related to that of the first input sentence. When the second association value is large, it indicates that the corresponding retrieval result is semantically related to the first input sentence, and therefore, the retrieval result is most likely to be the response sentence corresponding to the first input sentence.
[0065] In step 205, the first association degree between each retrieval result and the first input sentence is determined according to the first association value and the second association value.
[0066] In the present disclosure, the first association value and the second association value corresponding to the retrieval result can be weighted and summed, and the weighted sum is determined as the first association degree between the retrieval result and the first input sentence. Thus, the first association degree corresponding to each retrieval result is determined by combining the first association value related to emotion and the second association value related to semantics, so that the first association degree guarantees semantic relevance while taking into account emotional relevance, that is, the accuracy of the response sentence is guaranteed while the emotion of the response sentence is more abundant.
[0067] In step 206, the to-be-returned sentence is extracted from the plurality of retrieval results according to the plurality of first association degrees.
[0068] In step 207, the to-be-returned sentence is rewritten according to the first emotional label using a preset rewriting rule to generate a target response sentence.
[0069] In the present disclosure, the specific implementation process of steps 206-207 can be referred to the detailed description of any embodiment of the present disclosure, which will not be repeated here.
[0070] In the present disclosure, after obtaining the first sentiment label corresponding to the first input sentence and the plurality of retrieval results, the second sentiment label corresponding to each retrieval result can be determined, then the first correlation value can be determined according to the matching degree between each second sentiment label and the first sentiment label, and the second correlation value can be determined according to the semantic similarity between each retrieval result and the first input sentence, so that the first correlation degree between each retrieval result and the first input sentence can be determined according to the first correlation value and the second correlation value, then the to-be-returned sentence can be extracted from the plurality of retrieval results according to the plurality of first correlation degrees, and the to-be-returned sentence can be rewritten according to the first sentiment label by using the preset rewriting rule, so as to generate the target response sentence. Therefore, the to-be-returned sentence with the highest accuracy can be retrieved from each retrieval result and the first input sentence according to the first correlation degree between the retrieval result and the first input sentence, and the to-be-returned sentence can be rewritten according to the sentiment label of the first input sentence, so as to ensure the accuracy of the response sentence while enriching the emotion of the response sentence.
[0071] Figure 3 A flowchart of a method for generating a retrieval type dialogue provided by an embodiment of the present disclosure is shown.
[0072] As shown in Figure 3 , the method comprises:
[0073] Step 301: obtaining a first sentiment label corresponding to a first input sentence and a plurality of retrieval results.
[0074] Step 302: determining a first correlation degree between each retrieval result and the first input sentence.
[0075] Step 303: extracting a to-be-returned sentence from the plurality of retrieval results according to the plurality of first correlation degrees.
[0076] Step 304: rewriting the to-be-returned sentence according to the first sentiment label by using a preset rewriting rule, so as to generate a target response sentence.
[0077] In the present disclosure, the specific implementation process of steps 301-304 can be referred to the detailed description of any embodiment of the present disclosure, which will not be repeated here.
[0078] Step 305: determining a second sentiment label corresponding to the target response sentence.
[0079] In the present disclosure, the target response sentence can be input into a preset sentiment recognition model to determine the second sentiment label corresponding to the target response sentence.
[0080] Step 306: associating and storing the first input sentence, the first sentiment label, the target response sentence and the second sentiment label in a database.
[0081] In the present disclosure, the first input sentence, the first sentiment label, the target response sentence and the second sentiment label can be associated and stored in a database. Thus, when a subsequent input sentence is obtained and it is determined that the sentiment label of the input sentence is the same as the first sentiment label and the semantic similarity between the first input sentence and the input sentence is greater than a threshold, the target response sentence associated with the first input sentence can be directly determined as the target response sentence corresponding to the input sentence. Thus, the efficiency of determining the response sentence corresponding to the input sentence can be improved.
[0082] Optionally, after the second sentiment label corresponding to the target response sentence is determined, the second sentiment label, the target response sentence and the to-be-returned sentence can be associated and stored. Thus, when a subsequent input sentence is obtained and it is determined that the to-be-returned sentence of the input sentence exists in the associated and stored target response sentence, the target response sentence can be directly determined as the target response sentence corresponding to the input sentence. Thus, the efficiency of determining the response sentence corresponding to the input sentence can be improved.
[0083] In the present disclosure, after the first sentiment label corresponding to the first input sentence and the plurality of retrieval results are obtained, the first association degree between each retrieval result and the first input sentence can be determined, and the to-be-returned sentence can be extracted from the plurality of retrieval results according to the plurality of first association degrees. Then, the to-be-returned sentence can be rewritten according to the first sentiment label by using a preset rewriting rule to generate a target response sentence. Then, the second sentiment label corresponding to the target response sentence can be determined, and the first input sentence, the first sentiment label, the target response sentence and the second sentiment label can be associated and stored in a database. Thus, the to-be-returned sentence with the highest accuracy can be retrieved from each retrieval result and the first input sentence according to the first association degree, and the to-be-returned sentence can be rewritten according to the sentiment label of the first input sentence. Thus, the accuracy of the response sentence can be ensured while the sentiment of the response sentence is enriched.
[0084] Figure 4 A flowchart of a method for generating a retrieval type dialogue provided by an embodiment of the present disclosure is shown.
[0085] As shown in Figure 4 , the method comprises:
[0086] In step 401, the first sentiment label corresponding to the first input sentence and the plurality of retrieval results are obtained.
[0087] In step 402, the first association degree between each retrieval result and the first input sentence is determined.
[0088] In step 403, the to-be-returned sentence is extracted from the plurality of retrieval results according to the plurality of first association degrees.
[0089] At step 404, the first input sentence is rewritten according to the preset rewriting rule to generate a target response sentence according to the first emotional label.
[0090] In the present disclosure, the specific implementation process of steps 401-404 can be referred to the detailed description of any embodiment of the present disclosure, which will not be repeated here.
[0091] At step 405, the target response sentence is output.
[0092] In the present disclosure, the target response sentence can be output to respond to the user input sentence.
[0093] At step 406, a second correlation degree between the second input sentence and the first input sentence is determined in response to receiving the second input sentence.
[0094] In the present disclosure, when the user is not satisfied with the output target response sentence, the user may input the sentence again in a different way. Therefore, the input sentence obtained again after outputting the target response sentence can be determined as the second input sentence, and the second correlation degree between the second input sentence and the first input sentence is determined to determine whether the second input sentence is a disguised expression of the first input sentence.
[0095] At step 407, the target response sentence and the first emotional label are stored in the preset training database when the second correlation degree is greater than the first threshold.
[0096] In the present disclosure, when the second correlation degree is greater than the first threshold, it can be determined that the second input sentence is a disguised expression of the first input sentence, indicating that the emotion or semantics of the output target response sentence is inaccurate. At this time, the target response sentence and the first emotional label can be stored in the preset training database.
[0097] At step 408, the preset rewriting rule is updated based on the data in the preset training database in response to the amount of data in the preset training database being greater than a second threshold.
[0098] In the present disclosure, when the amount of data in the preset training database is greater than the second threshold, the rewriting model can be guided to retrain based on the data in the preset training database to update the preset rewriting rule. Thus, the quality of the response sentence is improved.
[0099] In the present disclosure, after obtaining the first sentiment label corresponding to the first input sentence and the plurality of retrieval results, the first correlation degree between each retrieval result and the first input sentence can be determined, and the to-be-returned sentence can be extracted from the plurality of retrieval results according to the plurality of first correlation degrees. Then, the to-be-returned sentence can be rewritten according to the first sentiment label by using the preset rewriting rule to generate a target response sentence. Then, the target response sentence can be output. When the second input sentence is received, the second correlation degree between the second input sentence and the first input sentence can be determined. In the case where the second correlation degree is greater than a first threshold, the target response sentence and the first sentiment label can be stored in a preset training database. In the case where the amount of data in the preset training database is greater than a second threshold, the preset rewriting rule can be updated based on the data in the preset training database. Thus, by the first correlation degree between each retrieval result and the first input sentence, the to-be-returned sentence with the highest accuracy can be retrieved, and the to-be-returned sentence can be rewritten according to the sentiment label of the first input sentence, so as to ensure the accuracy of the response sentence while enriching the emotion of the response sentence.
[0100] To implement the above-mentioned embodiments, the present disclosure further provides a retrieval dialogue generation device. Figure 5 A structure diagram of a retrieval dialogue generation device provided by the present disclosure is shown.
[0101] As shown in the figure, the retrieval dialogue generation device 500 includes an acquisition module 510, a determination module 520, an extraction module 530, and a rewriting module 540. Figure 5 The acquisition module 510 is configured to acquire a first sentiment label corresponding to a first input sentence and a plurality of retrieval results.
[0102] The determination module 520 is configured to determine a first correlation degree between each retrieval result and the first input sentence.
[0103] The extraction module 530 is configured to extract a to-be-returned sentence from the plurality of retrieval results according to the plurality of first correlation degrees.
[0104] The rewriting module 540 is configured to rewrite the to-be-returned sentence according to the first sentiment label by using a preset rewriting rule to generate a target response sentence.
[0105] In a possible implementation manner of the present disclosure, the determination module 520 is configured to:
[0106] determine a second sentiment label corresponding to each retrieval result;
[0107] determine a first correlation value according to a matching degree between each second sentiment label and the first sentiment label; and
[0108] determine a second correlation value according to a matching degree between the second input sentence and the first input sentence.
[0109] determine a second association value according to a semantic similarity between each search result and the first input sentence;
[0110] determine a first association degree between each search result and the first input sentence according to the first association value and the second association value.
[0111] In a possible implementation of the present disclosure, the extraction module 530 is configured to:
[0112] determine a search frequency and / or a number of rewrites corresponding to each of the at least two search results in response to the first association degree between the at least two search results and the input sentence being the highest;
[0113] determine the search result with the highest search frequency and / or the search result with the least number of rewrites as the to-be-returned sentence.
[0114] In a possible implementation of the present disclosure, the determination module 520 is further configured to:
[0115] determine a second sentiment label corresponding to the target response sentence;
[0116] The apparatus further includes:
[0117] The storage module is configured to store the first input sentence, the first sentiment label, the target response sentence, and the second sentiment label in a database.
[0118] In a possible implementation of the present disclosure, the determination module 520 is further configured to:
[0119] determine a second sentiment label corresponding to the target response sentence;
[0120] The storage module is further configured to store the second sentiment label, the target response sentence, and the to-be-returned sentence in association.
[0121] In a possible implementation of the present disclosure, the apparatus further includes:
[0122] The output module is configured to output the target response sentence.
[0123] The determination module 520 is further configured to determine a second association degree between the second input sentence and the first input sentence in response to receiving the second input sentence;
[0124] The storage module is further configured to store the target response sentence and the first sentiment label in a preset training database in a case where the second association degree is greater than a first threshold value.
[0125] The updating module is configured to update the preset rewriting rule based on data in the preset training database in response to an amount of data in the preset training database being greater than a second threshold.
[0126] It should be noted that the above-mentioned explanation of the embodiment of the method for generating a retrieval formula dialogue is also applicable to the device of the embodiment, and thus will not be described here again.
[0127] In the present disclosure, after the first sentiment label corresponding to the first input sentence and the plurality of retrieval results are obtained, the first correlation degree between each retrieval result and the first input sentence can be determined, then the to-be-returned sentence can be extracted from the plurality of retrieval results according to the plurality of first correlation degrees, and then the to-be-returned sentence can be rewritten according to the first sentiment label by using the preset rewriting rule, so as to generate the target response sentence. Therefore, by the first correlation degree between each retrieval result and the first input sentence, the to-be-returned sentence with the highest accuracy is retrieved, and the to-be-returned sentence is rewritten according to the sentiment label of the first input sentence, so as to ensure the accuracy of the response sentence while enriching the emotion of the response sentence.
[0128] According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0129] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit implementations of the present disclosure described and / or claimed in this document.
[0130] As shown in FIG. 6, the device 600 includes a computing unit 601 that can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 602 or a computer program loaded into a RAM (Random Access Memory) 603 from a storage unit 608. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604. Figure 6 As shown in FIG. 6, the device 600 includes a computing unit 601 that can perform various appropriate actions and processes according to a computer program stored in a ROM (Read-Only Memory) 602 or a computer program loaded into a RAM (Random Access Memory) 603 from a storage unit 608. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An I / O (Input / Output) interface 605 is also connected to the bus 604.
[0131] 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, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through computer networks, such as the Internet, and / or various telecommunication networks.
[0132] The computing unit 601 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a CPU (Central Processing Unit), a GPU (Graphic Processing Unit), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, a DSP (Digital Signal Processor), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 performs various methods and processes described above, such as the generation method of the retrieval dialogue. For example, in some embodiments, the generation method of the retrieval dialogue can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded to the RAM 603 and executed by the computing unit 601, one or more steps of the generation method of the retrieval dialogue described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the generation method of the retrieval dialogue by any other appropriate means, such as by means of firmware.
[0133] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application-Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a System on a Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0134] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general or special purpose computer, such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can execute entirely on a 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.
[0135] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can 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 the machine-readable storage medium would include a linearly-programmed electronic storage, a portable computer diskette, a hard disk, RAM, ROM, 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.
[0136] 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 the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; 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 can be received in any form, including acoustic, speech, or tactile input.
[0137] 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 a LAN (Local Area Network), a WAN (Wide Area Network), the Internet, and a blockchain network.
[0138] The computer system can include clients and servers. This relationship can be between a client and a server that are typically remote from each other and typically interact through a communication network. The relationship between client and server exists by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service (Virtual Private Server, virtual private server).
[0139] According to the embodiments of the present disclosure, the present disclosure also provides a computer program product, when the instruction processor in the computer program product executes, executes the generation method of the search formula dialogue proposed in the above embodiments of the present disclosure.
[0140] It should be understood that the steps shown above can be reordered, added or deleted. For example, the steps described in the present disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, which is not limited herein.
[0141] The above specific embodiments do not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements within the spirit and principles of the present disclosure should be included in the protection scope of the present disclosure.
Claims
1. A method for generating a retrieval dialogue, comprising: obtaining a first sentiment label corresponding to a first input sentence and a plurality of retrieval results; determining a first correlation degree between each of the retrieval results and the first input sentence; in response to the first correlation degree between at least two of the retrieval results and the input sentence being the highest, determining a retrieval frequency and / or a rewriting times corresponding to each of the at least two retrieval results; determining a retrieval result with the highest retrieval frequency and / or a retrieval result with the least rewriting times as a to-be-returned sentence; rewriting the to-be-returned sentence according to the first sentiment label by using a preset rewriting rule to generate a target response sentence; outputting the target response sentence; in response to receiving a second input sentence, determining a second correlation degree between the second input sentence and the first input sentence; in a case where the second correlation degree is greater than a first threshold, storing the target response sentence and the first sentiment label in a preset training database; in response to a data amount in the preset training database being greater than a second threshold, updating the preset rewriting rule based on data in the preset training database.
2. The method of claim 1, wherein, The determining of the first correlation degree between each of the retrieval results and the first input sentence comprises: determining a second sentiment label corresponding to each of the retrieval results; determining a first correlation value according to a matching degree between each of the second sentiment labels and the first sentiment label; determining a second correlation value according to a semantic similarity between each of the retrieval results and the first input sentence; determining the first correlation degree between each of the retrieval results and the first input sentence according to the first correlation value and the second correlation value.
3. The method of claim 1, wherein, After the generating of the target response sentence, the method further comprises: determining a second sentiment label corresponding to the target response sentence; storing the first input sentence, the first sentiment label, the target response sentence and the second sentiment label in a database in association.
4. The method of any one of claims 1-3, wherein, After the generating of the target response sentence, the method further comprises: determining a second sentiment label corresponding to the target response sentence; storing the second sentiment label, the target response sentence and the to-be-returned sentence in association. 5.An apparatus for generating a retrieval dialogue, comprising: an obtaining module configured to obtain a first sentiment label corresponding to a first input sentence and a plurality of retrieval results; a determining module configured to determine a first correlation degree between each of the retrieval results and the first input sentence; an extracting module configured to extract a to-be-returned sentence from the plurality of retrieval results according to a plurality of the first correlation degrees; a rewriting module configured to rewrite the to-be-returned sentence according to the first sentiment label by using a preset rewriting rule to generate a target response sentence. The extracting module is specifically configured to: in response to the first correlation degree between at least two of the retrieval results and the input sentence being the highest, determine a retrieval frequency and / or a rewriting times corresponding to each of the at least two retrieval results; determine a retrieval result with the highest retrieval frequency and / or a retrieval result with the least rewriting times as the to-be-returned sentence. The apparatus further comprises: an output module, configured to output the target response statement; the determination module is further configured to determine a second correlation degree between the second input statement and the first input statement in response to receiving the second input statement; a storage module, configured to store the target response statement and the first sentiment label in a preset training database if the second correlation degree is greater than a first threshold value; an update module, configured to update the preset rewriting rule based on data in the preset training database in response to an amount of data in the preset training database being greater than a second threshold value.
6. The apparatus of claim 5, wherein, the determination module is configured to: determine a second sentiment label corresponding to each of the search results; determine a first correlation value according to a matching degree between each of the second sentiment labels and the first sentiment label; determine a second correlation value according to a semantic similarity between each of the search results and the first input statement; determine a first correlation degree between each of the search results and the first input statement according to the first correlation value and the second correlation value.
7. The apparatus of claim 5, wherein, the determination module is further configured to: determine a second sentiment label corresponding to the target response statement; the storage module is further configured to store the first input statement, the first sentiment label, the target response statement and the second sentiment label in the database in association.
8. The apparatus of any of claims 5-7, wherein, the determination module is further configured to: determine a second sentiment label corresponding to the target response statement; the storage module is further configured to store the second sentiment label, the target response statement and the to-be-returned statement in association. 9.An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to make the computer execute the method according to any one of claims 1-4. 11.A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-4.
Citation Information
Patent Citations
Dialogue generation method and device
CN110188177A
Method and device for correcting natural language generation result
CN111737417A
Emotion reply automatic generation method for open domain dialogue system
CN111782788A