Conversation processing method and device, electronic equipment, storage medium and program product

By using multiple similarity calculation models in the intelligent question and answer system to double screen the question statement and statement library, the problems of low efficiency and insufficient accuracy of traditional question and answer systems are solved, and efficient and accurate question responses are achieved.

CN119166750APending Publication Date: 2024-12-20MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411310637.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

Traditional Q&A systems are inefficient and inaccurate in large enterprises, unable to handle large number of problem responses quickly and efficiently, and simple keyword recognition leads to low accuracy in problem responses.

Method used

By determining the similarity between the problem statement and the statement library, the target setting statement is selected, and the reply statement is determined based on the second similarity calculation, and a variety of similarity calculation methods (such as Doc2vec, tfidf and simbert models) are used for double-sided Filter to ensure high-matching replies.

Benefits of technology

It improves the efficiency and accuracy of question responses, ensures that the target setting statements filtered from the statement database are most similar to the question statements, and the reply statements are the most matched, improving the system's intelligent question-and-answer capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166750A_ABST
    Figure CN119166750A_ABST
Patent Text Reader

Abstract

The invention provides a dialogue processing method and device, electronic equipment, a storage medium and a program product, through the method provided by the invention, after problem statements in all statements are identified, similarity calculation is carried out on the problem statements and set statements in a first statement library, target set statements are screened out, and a dialogue processing result is obtained. And if the target set statement meeting the preset condition exists in the first question statement, then the target reply statement is determined based on the second statement similarity between the first question statement and the target set statement, so that the reply of each question statement can be more accurately screened out through two similarity screening conditions, and the accuracy of the reply of each question statement is improved. And the accuracy and efficiency of matching the question statements with the reply statements are also improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a conversation processing method, device, electronic device, storage medium and program product. Background Art

[0002] With the development of economy, the scale of various enterprises is gradually expanding, and the interaction within enterprises is becoming more frequent. The technical support and question answering within the company are also increasing, and the intelligent question answering system has come into being. Intelligent question answering is an automatic question answering system implemented by artificial intelligence technology. It understands the user's questions through deep learning of large amounts of text data and extracts the most matching answers from the knowledge base. Summary of the invention

[0003] The present application provides a dialogue processing method, device, electronic device, storage medium and program product to improve the accuracy and efficiency of matching question statements and knowledge bases, thereby improving the accuracy of question and answering.

[0004] In a first aspect, an embodiment of the present application provides a method for processing a conversation, the method comprising:

[0005] Determine a first question statement, and determine a first statement similarity between the first question statement and N set statements in a first statement library;

[0006] Based on the first sentence similarity, determining a target setting sentence from the first sentence library;

[0007] If there is a goal setting statement that satisfies a preset condition in the goal setting statements, determining a second statement similarity between the first question statement and the goal setting statement;

[0008] Based on a second sentence similarity between the first question sentence and the target setting sentence, a target answer sentence for the first question sentence is determined.

[0009] Through the above method, N setting statements with a first similarity to the first question statement can be first located in the statement library, and then a target setting statement can be determined from the N setting statements. When the target setting statement meets the preset condition, a reply statement to the first question statement can be determined based on the second similarity between the target setting statement and the first question statement. The embodiment of the present application is based on two different similarity calculation methods, and the setting statements in the first statement library are screened twice to screen out the target setting statement that is most similar to the first question statement, and the reply statement corresponding to the target setting statement is used as the reply to the first question statement. In this way, it can be ensured that the target setting statement screened from the first statement library is the setting statement that is most similar to the first question statement, and the reply statement determined based on the setting statement is also the reply statement that best matches the first question statement, which improves the efficiency of replying to the question statement and ensures the accuracy of replying to the question statement.

[0010] In a second aspect, an embodiment of the present application provides a dialog processing device, the device comprising:

[0011] A determination module, configured to determine a first question statement, and determine a first statement similarity between the first question statement and N set statements in a first statement library;

[0012] A processing module is used to determine a target setting statement from the first statement library based on the first statement similarity; if there is a target setting statement that meets the preset conditions in the target setting statements, determine the second statement similarity between the first question statement and the target setting statement; based on the second statement similarity between the first question statement and the target setting statement, determine a target answer statement for the first question statement.

[0013] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0014] Memory, used to store computer programs;

[0015] The processor is used to implement the above-mentioned dialogue processing method steps when executing the computer program stored in the memory.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned steps of the dialogue processing method are implemented.

[0017] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed, it is used to implement the above-mentioned steps of the dialogue processing method.

[0018] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A flow chart of a conversation processing method provided for this application;

[0020] Figure 2 A schematic diagram of the statement collection interface provided for this application;

[0021] Figure 3 A schematic diagram of the software architecture provided for this application;

[0022] Figure 4 A schematic diagram of the structure of a conversation processing device provided by the present application;

[0023] Figure 5 A schematic diagram of the structure of an electronic device provided in this application. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operating methods in the method embodiments can also be applied to device embodiments or system embodiments. It should be noted that in the description of the present application, "multiple" is understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent: A is directly connected to B and A is connected to B through C. In addition, in the description of the present application, words such as "first" and "second" are only used to distinguish the purpose of description, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0025] The embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0026] With the development of technology, the need for technical support and answering questions within enterprises has also increased. In traditional question-and-answer systems, users are often required to manually ask questions and wait for the system to return answers. This operation efficiency is too low, especially in some large enterprises, where there are a large number of questions that need to be answered. If these questions need to be answered manually one by one, the efficiency of answering questions will be low; if simple system keyword recognition is used to match questions and then answer them, the accuracy of the answer to the questions will be low. Therefore, a more intelligent and real-time method is needed to improve the efficiency and accuracy of problem solving.

[0027] In order to improve the efficiency and accuracy of problem solving, the present application provides a dialogue processing method, which includes: determining a first question statement, and determining the first sentence similarity between the first question statement and N setting sentences in the first sentence library, determining a target setting sentence from the first sentence library based on the first sentence similarity, and if there is a target setting sentence that meets the preset condition in the target setting sentence, then determining the second sentence similarity between the first question statement and the target setting sentence, and determining the target reply sentence of the first question statement based on the second sentence similarity between the first question statement and the target setting sentence. Based on the above method, after identifying the question statement in all sentences, the target setting sentence can be screened out by calculating the similarity with the setting sentence in the first sentence library, and if there is a target setting sentence that meets the preset condition in the first question statement, then the target reply sentence is determined based on the second sentence similarity between the first question statement and the target setting sentence, so that the system can more quickly locate the target setting sentence related to the question statement through two similarity screenings, avoiding the reply efficiency problem caused by manual reply; and the above method can also make the similarity between the quickly located target setting sentence and the question statement higher, thereby improving the accuracy of replying to the question statement.

[0028] Reference Figure 1 The figure shows a flow of a conversation processing method provided by the present application, the method comprising:

[0029] S1, determine a first question statement, and determine a first statement similarity between the first question statement and N set statements in a first statement library.

[0030] In the embodiment of the present application, the data to be processed is first collected, such as the user's statement in an interactive interface, referring to Figure 2 As shown, in Figure 2 Each user enters various question statements in a group chat interface. Some question statements are irrelevant to the company's business, while some are related to the company's business. These question statements will be collected and stored, and then text preprocessing will be performed on the collected question statements.

[0031] In an embodiment of the present application, the text preprocessing can be keyword recognition, that is, keyword recognition is performed on all collected question sentences, and regular question sentences containing keywords are identified. Regular question sentences here are question sentences that are not related to the company's business, such as "Which bus should I take to work in the morning?", "Is there any performance at noon today?", the keywords "bus" and "performance" are identified in these question sentences, and these keywords are not related to the company's business, so these question sentences are determined to be regular question sentences. Then, the question sentences in all question sentences except the regular question sentences are taken as the first question sentences. Obviously, in the keyword recognition process, regular keywords are used as recognition objects, so that regular question sentences can be determined.

[0032] Of course, in the embodiment of the present application, the first question statement may also be directly screened out through keyword recognition, so that the first question statement can be quickly located among all question statements.

[0033] For example, in Figure 2 There are various sentences in these question sentences. Some of these question sentences are related to the company's business, while some are not. Figure 2 All question statements are divided into business-related question statements and business-irrelevant question statements. Business-related question statements are used as the first question statements. This method can reduce the processing volume of question statements and accurately screen out question statements that need to be answered.

[0034] It should be noted that in the embodiment of the present application, a binary classification model can be used to perform keyword recognition on all collected question sentences, such as a BERT model, etc. In the embodiment of the present application, it is not limited to which method is used for keyword recognition.

[0035] After all the collected sentences are identified, the first question sentence is identified from all the sentences. The first question sentence here can be Figure 2 Business-related question statements in the interface shown.

[0036] Through the above method, the first business-related question statement can be accurately identified from all collected question statements, thereby ensuring that the business-related question statements can be accurately replied to later.

[0037] After determining the first problem statement, first retrieve the different types of setting statements saved in the first statement library. The type here describes the business to which each setting statement belongs, such as setting statements for network problems, setting statements for hardware problems, setting statements for software problems, etc. Therefore, by saving the setting statements by category, the business to which the setting statements belong can be quickly located.

[0038] These set sentences are all business-related question sentences, and then the first sentence similarity between the first question sentence and each set sentence is calculated. Optionally, the sentence similarity here represents the proportion of the same keywords in the sentence content and the sentence content. For example, sentence A is "What to eat for lunch today?" and sentence B is "What to eat for lunch today?". By calculating the proportion of the same keywords in sentence A and sentence B, the sentence similarity between sentence A and sentence B can be calculated.

[0039] Of course, in addition to the above method to calculate the similarity between the first question sentence and each setting sentence, the sentence similarity can also be calculated by the "edit distance" algorithm, which is specifically: the minimum number of editing operations required to convert one string into another, including inserting, deleting or replacing a character. The larger the edit distance, the greater the difference between the two sentences. For example, converting "string" to "setting" requires two operations: inserting the character "e" and replacing the character "r" with "t", so their edit distance is 2.

[0040] Of course, in addition to the above two methods to calculate the similarity between the first question statement and the setting statement, other methods can also be used for calculation, and the specific implementation method is not limited in this application.

[0041] In an optional embodiment, determining the first statement similarity between the first question statement and N set statements in the first statement library includes: determining the first statement similarity between the first question statement and the N set statements in the first statement library based on a first similarity calculation network model.

[0042] In an embodiment of the present application, in order to improve the accuracy of sentence similarity between the first question sentence and the set sentences in the first sentence library, the first sentence similarity between the first question sentence and the N set sentences in the first sentence library can be calculated through a first similarity calculation network model.

[0043] It should be noted here that the above-mentioned first sentence similarity can be calculated by a first similarity calculation network model. The first similarity calculation network model can be any one of the network models of the Doc2vec model and the tfidf model, and can also be other network models with the same function as the Doc2vec model, which is not specifically limited in the embodiments of the present application.

[0044] In an optional embodiment, in addition to calculating the first statement similarity between the first question statement and the N set statements in the first statement library through a network model in the embodiment of the present application, the first statement similarity between the first question statement and the N set statements can also be calculated through two different network models.

[0045] Specifically, in the embodiment of the present application, the first network model is used to calculate the first sentence similarity between the first question sentence and the N set sentences in the first sentence library, and then the second network model is used to calculate the first sentence similarity between the first question sentence and the N set sentences in the first sentence library. The target set sentence whose first sentence similarity is greater than the first threshold is selected from all the calculated similarities.

[0046] For example, in the embodiment of the present application, the trained Doc2vec model (i.e., the first network model) and the tfidf model (i.e., the second network model) can be used to respectively calculate the first sentence similarity between the first question sentence and the N set sentences in the first sentence library. First, the first sentence similarity between the first question sentence and the N set sentences in the first sentence library is calculated by the Doc2vec model, and the first sentence similarity between the first question sentence and the N set sentences in the first sentence library is also calculated by the tfidf model. The Doc2vec model and the tfidf model here constitute the above-mentioned first similarity calculation network model.

[0047] It should be noted here that the Doc2vec model generates a vector representation of a document by learning the relationship between words within a sentence, which can better capture the subject and content of the sentence and is suitable for deep learning algorithms and complex text processing tasks; while the tfidf model is based on statistical methods, calculating the frequency and rarity of words to evaluate the importance of words, and is suitable for simple text mining and information retrieval tasks. Therefore, by calculating similarity based on the Doc2vec model and the tfidf model, the first similarity between the first question sentence and the setting sentence can be calculated from different dimensions, thereby reflecting the similarity between the question sentence and the setting sentence at different dimensions.

[0048] Furthermore, after the first similarity between the first question statement and the N setting statements in the first statement library is calculated by the two network models, the first statement similarity between the first question statement and the N setting statements can be determined more accurately.

[0049] S2: Determine a target setting sentence from the first sentence library based on the first sentence similarity.

[0050] In an optional embodiment, determining the target setting statement from the first statement library based on the first statement similarity includes: determining a setting statement whose first statement similarity is greater than a first threshold as the target setting statement.

[0051] After calculating the first sentence similarity between the first question sentence and the N setting sentences in the first sentence through the first similarity calculation network model, the setting sentence whose first sentence similarity is greater than the first threshold is determined. The setting sentence whose first sentence similarity in the first sentence library is greater than the first threshold is determined as the target setting sentence.

[0052] Optionally, the first threshold here can be set to a value such as 0.8 or 0.85, which is not limited here. Through the above method, the target setting statement matching the first question statement can be accurately screened out from the first statement library, thereby ensuring the subsequent accurate response to the first question statement based on the target setting statement.

[0053] S3: If there is a goal setting statement that meets the preset condition in the goal setting statement, determine a second statement similarity between the first question statement and the goal setting statement.

[0054] The preset condition may be a preset similarity threshold, and only when there is a first sentence in the target setting sentence whose similarity is greater than the similarity threshold, the second sentence similarity of each target setting sentence and the first question sentence will be further calculated. The similarity threshold may be a threshold close to or equal to the second threshold, and the purpose of this is to ensure that a target setting sentence whose second sentence similarity is greater than or equal to the second threshold can be selected from the target setting sentence as much as possible.

[0055] Optionally, the similarity may be set to 0.95, which is the same as the second threshold, or 0.98, which is a value greater than the second threshold, and no limitation is made here.

[0056] In an optional embodiment, determining the second sentence similarity between the first question sentence and the target setting sentence includes: determining the second sentence similarity between the first question sentence and the target setting sentence based on a second sentence similarity calculation network model, wherein the accuracy of the second sentence similarity calculation network model is greater than the accuracy of the first sentence similarity calculation network model.

[0057] In step S2, the target setting statements have been screened out. If there is a target setting statement among these N setting statements whose corresponding similarity is greater than the second threshold, the second similarity calculation network model is used to calculate the second statement similarity between the first question statement and each target setting statement screened out by the first similarity calculation network model. The second similarity calculation network model here can be a Simbert model, and of course it can also be other network models with the same performance as the Simbert model.

[0058] It should be noted here that compared with the Doc2vec model and the TFIDF model, the Simbert model uses a more accurate loss function to extract features from sentences, and can learn the key information in sentences more fully, thereby improving the accuracy of the Simbert model in sentence similarity evaluation.

[0059] In the embodiment of the present application, the second threshold can be a higher threshold, for example, it can be set to 0.95. If there is a sentence similarity greater than 0.95 in the sentence similarities calculated by the previous Doc2vec model and the tfidf model, the target setting sentence with a sentence similarity greater than 0.95 is screened out, and then the second sentence similarity between the first question sentence and the target setting sentence with a sentence similarity greater than 0.95 is calculated through the Simbert model.

[0060] Optionally, since the Doc2vec model and the tfidf model can quickly and preliminarily screen out the setting statements similar to the question statements in the sentence library, the accuracy of the sentence similarity calculated by the Doc2vec model and the tfidf model is relatively low, so the first threshold is set to 0.8 or 0.85, so that a part of the setting statements can be preliminarily screened out, and the sentence similarity between the first question statement and the preliminarily screened setting statements is calculated by the Simbert model on this basis. At this time, the calculated sentence similarity is a more accurate sentence similarity, so a larger threshold needs to be set for screening. In the embodiment of the present application, the second threshold is set to 0.95. Therefore, when the value of the second threshold is greater than the value of the first threshold, not only can the setting statements be quickly screened out, but also the target setting statements can be accurately screened out.

[0061] It should be noted that the accuracy of the first similarity calculation network model in calculating sentence similarity is lower than the accuracy of the second similarity calculation network model in calculating sentence similarity. In other words, the accuracy of the Simbert model in calculating sentence similarity is higher than any of the network models in the Doc2vec model and the TFIDF model.

[0062] Therefore, through the above method, after the setting statements are screened once in the first sentence library based on the first similarity calculation network model with faster similarity calculation speed, the setting statements are screened again through the second similarity calculation network model with higher similarity accuracy. In this way, it can be ensured that the target setting statement screened out from the first sentence library is the setting statement most similar to the first question statement, and the reply statement determined based on the setting statement is also the reply statement that best matches the first question statement, which improves the response efficiency of the question statement and ensures the accuracy of the response to the question statement.

[0063] S4, determining a target answer sentence for the first question sentence based on a second sentence similarity between the first question sentence and the target setting sentence.

[0064] In an optional embodiment, the first sentence library includes the N setting sentences and their corresponding reply sentences; the determining the target reply sentence of the first question sentence based on the second sentence similarity between the first question sentence and the target setting sentence includes: determining the first target setting sentence with the greatest second sentence similarity among the target setting sentences; if the second sentence similarity of the first target setting sentence is greater than or equal to a second threshold, determining the reply sentence corresponding to the first target setting sentence from the first sentence library; and determining the reply sentence corresponding to the first target setting sentence as the target reply sentence.

[0065] In an embodiment of the present application, in addition to storing N setting statements, the above-mentioned first sentence library also stores the reply statements corresponding to each of the N setting statements. Therefore, after calculating the second sentence similarity between the first question sentence and the target setting sentence through the second similarity calculation network model, the maximum value is determined among all the second sentence similarities, and then the first target setting sentence with the largest second sentence similarity in the target setting sentence library is determined. If the second sentence similarity of the first target setting sentence is greater than or equal to the second threshold, the reply statement corresponding to the first target setting sentence is determined from the first sentence library, and the reply statement corresponding to the first target setting sentence is determined as the target reply statement.

[0066] In an embodiment of the present application, the second threshold can be specifically set to 0.95. If the sentence similarity between the first question sentence and a certain target setting sentence is greater than or equal to 0.95, it means that the target setting sentence is basically consistent with the first question sentence. At this time, the answer sentence corresponding to the target setting sentence is determined in the first sentence library, and the answer sentence can be used as the target answer sentence for the first question sentence.

[0067] In this way, a goal setting statement that is substantially consistent with the first question statement can be more accurately calculated based on the Simbert model, thereby ensuring that the reply statement to the goal setting statement can accurately answer the question in the first question statement.

[0068] In an optional embodiment, the method further includes: if the second statement similarity of the first target setting statement is less than the second threshold, the first question statement is imported into a target network model to obtain a second target setting statement, wherein the target network model is trained by a sample consisting of question statements and setting statements in the first statement library; and the reply statement of the second target setting statement is used as the target reply statement of the first question statement.

[0069] If the second sentence similarity of the first target setting sentence is less than the second threshold, that is, the sentence similarity is less than 0.95, the first question sentence is imported into the target network model to obtain the second target setting sentence, and the answer sentence of the second setting sentence is used as the target answer sentence of the first question sentence. The target network model here is obtained by sample training based on the question sentence and the setting sentence in the first sentence library.

[0070] Specifically, in the embodiment of the present application, the specific training process of the target network model is as follows:

[0071] The first step is to identify the problematic sentences in the collected sentences. The interface for collecting sentences can be Figure 2 The interface shown in the figure contains different statements entered by the user. Figure 2 The interface shown identifies a first question statement, which is a business-related statement.

[0072] After identifying the first question statement, M setting statements whose semantic similarity with the first question statement is greater than a set value are determined in the first statement library. The semantic similarity here can be calculated by a semantic similarity calculation model. A high semantic similarity indicates that it is the same question but the syntax is different. For example: the first question statement is "Where to eat at noon today", and the setting statement is "Where to eat at noon today". Obviously, the setting statement and the first question statement have the same semantics, but the sentence structure is different.

[0073] Specifically, semantic similarity is a parameter that measures the degree of closeness in meaning between two sentences. Semantic similarity can be calculated using the vector space model or the deep semantic matching model.

[0074] The vector space model treats sentences as vectors composed of independent words. Each word is assigned a weight to form a vector identifier of the sentence. The semantic similarity between two sentences is determined by calculating the angle between the two sentence vectors. The smaller the angle, the higher the semantic similarity.

[0075] The deep semantic matching model maps two sentences into a vector space to achieve overall matching at the sentence level. The deep semantic matching model can better extract similarities at the semantic level.

[0076] Therefore, the semantic similarity calculation model can accurately screen out setting sentences with higher semantic similarity in the first sentence library.

[0077] Of course, in addition to using the above two models to calculate semantic similarity in the embodiment of the present application, sentence similarity can also be calculated by other methods, which are not limited in the embodiment of the present application.

[0078] Of course, in the embodiment of the present application, different ways of asking the first question statement can also be stored in the first sentence library. For example, the first question statement A has sentences A1 to A10 whose semantic similarity is greater than a set value, and these different ways of asking actually represent the same question.

[0079] The first question statement and all M set statements whose semantic similarity is greater than a set value are combined in pairs to form positive samples for training the target network model. For example, A+A2, A+A3, A+A4..., A+A10 corresponding to the first question statement A are used as positive samples.

[0080] After obtaining the positive sample, it is also necessary to generate a negative sample for training the target network model. The negative sample is obtained by calculating the sentence similarity between the first question sentence and each setting sentence in the first sentence library, and screening out L setting sentences. The L setting sentences here include setting sentences whose sentence similarity is greater than a third threshold and whose semantic similarity is less than a set value, and setting sentences whose sentence similarity is less than the third threshold. Then, the first question sentence and the L setting sentences are respectively combined in pairs to obtain a negative sample.

[0081] Among them, sentence similarity is a parameter that measures the similarity between two sentences. The sentence similarity can be calculated by Doc2vec model, tfidf model, edit distance algorithm, Euclidean distance algorithm, cosine similarity algorithm, etc.

[0082] For example, the first question statement is "How to solve the problem of office computer delay?", and the set statements in the first sentence library are "How to solve the office network jam?", "How to solve the office computer running jam?", "When was the network delay problem solved?". Then, feature extraction is performed on the word vectors of each word in the first question statement and the set statement to form the embedding vector corresponding to each statement. The distance value between the embedding vector corresponding to the first question statement and the embedding vector corresponding to the set statement is calculated respectively, and the distance value represents the sentence similarity between the first question statement and each set statement.

[0083] In an embodiment of the present application, the sentence similarity is calculated between the first question sentence A and each setting sentence in the first sentence library, and 10 setting sentences with a sentence similarity greater than 0.8 are screened out. Then, among the 10 setting sentences with a sentence similarity greater than 0.8, 5 setting statements with a semantic similarity less than 0.5 are screened out, and 3 setting statements are randomly selected from the setting sentences with a sentence similarity less than 0.8. Finally, the 8 setting statements selected in total are combined with the first question sentence in pairs as negative samples.

[0084] Optionally, the pairwise combination may be sentence combination of two sentences. Here, the sentence combination is to concatenate two sentences. The specific concatenation method may be: [CLS]sentence1[SEP]sentence2[SEP], where sentence1 represents the first question sentence, and sentence2 represents one of the eight setting sentences. Similarly, the pairwise combination in the positive sample may be sentence combination of two sentences.

[0085] After obtaining positive samples and negative samples, the initial network model is trained based on the positive samples and negative samples to obtain the target network model. The target network model obtained through the above training can combine multiple features in the sentence, such as the word form, word order, structure, length, etc. in the sentence. These features reflect the sentence similarity of the sentence from different angles. Therefore, the trained target network model integrates these features, which can more comprehensively describe the sentence information and improve the accuracy of sentence similarity calculation.

[0086] The specific training process of the initial network model is the same as the current neural network training process, and the training process will not be repeated here. However, in the embodiment of the present application, the loss function can also be optimized during the training of the initial network model, such as by contrastive learning to improve the computational ability of the sentence similarity of the network model.

[0087] In an optional implementation, interference can be added to positive samples and negative samples to perform adversarial training on the initial network model, thereby improving the robustness and generalization ability of the trained target network model. Specifically, both positive samples and negative samples will be converted into embedding vectors during training, that is, one sentence combination is converted into one embedding vector.

[0088] It should be noted here that an embedding vector is to identify an entity as a vector, that is, to convert an entity into a set of numbers, which can be a word or a sentence. In the embodiment of the present application, the sentence is converted into a set of numbers, and then a noise number is added to each set of numbers. For example, the embedding vector is (x1, x2, x3, x4, x5, x6), and the value range of the noise number is (1, 6). At this time, the number 5 can be randomly selected from 1-6 and added to the embedding vector to obtain training data (x1, x2, x3, x4, x5, x6, 5). Here, whether it is a positive sample or a negative sample, noise data can be added in this way. And the specific position of the noise data in the embedding vector can also be randomly set. By adding noise data to positive samples and negative samples, the model can be exposed to more "similar" samples during the training process, thereby enhancing the generalization ability of the model, reducing overfitting, and thus improving the performance of the model.

[0089] After adding noise data to the embedding vector to obtain training data, the training data with added noise sentences is imported into the initial network for training, thereby finally obtaining the target network model.

[0090] After obtaining the target network model, the supervised network model is used to calculate the sentence similarity. The specific process is as follows:

[0091] First, the first sentence similarity between the first question sentence and the N setting sentences in the first sentence library is calculated, and the target setting sentences with a first sentence similarity greater than a first threshold are screened out. For example, the target setting sentences with a first sentence similarity greater than 0.85 are selected, and then the first question sentence is combined with these selected target setting sentences to obtain multiple candidate sentence groups, where the format of the candidate sentence groups is consistent with the above-mentioned sentence splicing method.

[0092] The obtained multiple candidate sentence groups are imported into the target network model to calculate sentence similarity, thereby obtaining sentence similarity corresponding to each candidate sentence group, determining the maximum sentence similarity, and determining whether the maximum sentence similarity is greater than a fourth threshold. The fourth threshold can be set to 0.98.

[0093] If the maximum sentence similarity calculated by the target network model is greater than the fourth threshold, the candidate sentence corresponding to the maximum sentence similarity is used as the second set sentence, and the answer sentence corresponding to the second set sentence is determined as the target answer sentence of the first question sentence. If the sentence similarity corresponding to the second set sentence is less than the fourth threshold, return to the end, that is, end the process.

[0094] It should be noted here that the target network model is obtained by training with a large number of samples. Therefore, compared with the untrained first similarity calculation network model and the second similarity calculation network model, it can more accurately calculate the sentence similarity between the first question sentence and the set sentence in the first sentence library.

[0095] In summary, the above-mentioned first similarity calculation network model can quickly screen out setting sentences with high similarity to the first question sentence from the first sentence library, and then further screen out the target setting sentences with the highest similarity through the second similarity calculation model with higher sentence similarity calculation accuracy. In this way, it can be ensured that the target setting sentence screened out from the first sentence library is the setting sentence most similar to the first question sentence, and the reply sentence determined based on the setting sentence is also the reply sentence that best matches the first question sentence, which improves the efficiency of replying to the question sentence and ensures the accuracy of replying to the question sentence.

[0096] Furthermore, in the embodiment of the present application, when the sentence similarities calculated by the first similarity calculation network model and the second similarity calculation network model are not greater than the threshold, the trained target network model is used to further improve the accuracy of calculating sentence similarities. Therefore, using the combination of the above network models to calculate sentence similarities can quickly and accurately screen the set sentences in the sentence library, thereby improving the accuracy and efficiency of the system's reply to the first question sentence.

[0097] The technical solution of this application is described in detail below in conjunction with a specific software architecture.

[0098] Reference Figure 3 The software structure shown in Figure 3 It includes text processing module, unsupervised network model and supervised network model. First, the text processing module collects data in real time, that is, collects all sentences, and then performs text preprocessing to further determine whether it is related to the business. If it is related to the business, it is input into the unsupervised network model. If it is not related to the business, the process ends directly.

[0099] The unsupervised network model includes the Doc2vec model and the tfidf model. The two models are used to calculate the first sentence similarity between the target sentence and each setting sentence in the first sentence library, and the setting sentence with the first sentence similarity greater than 0.85 is determined as the target setting sentence.

[0100] Then, the maximum sentence similarity is determined among the first sentence similarities calculated by the two models, that is, the target setting sentence with the maximum first sentence similarity. If the similarity value of the target setting sentence with the maximum first sentence similarity is greater than 0.95, all the target setting sentences and the first question sentence are imported into the Simbert model to calculate the second sentence similarity. If the maximum sentence similarity of the calculated second sentence similarity is greater than 0.95, the first question sentence is directly replied based on the reply sentence corresponding to the target setting sentence.

[0101] If the maximum sentence similarity in the second sentence similarity is less than 0.95, all target setting sentences and the first question sentence are combined into a sentence group, and the sentence group is imported into the supervised network model for sentence similarity calculation, and it is determined whether the maximum sentence similarity is greater than 0.985. If the maximum sentence similarity is greater than 0.985, the reply sentence corresponding to the setting sentence in the sentence group is used as the reply sentence of the first question sentence. If the maximum sentence similarity is not greater than 0.985, the process ends directly.

[0102] Through the embodiment of the present application, N setting statements with a first similarity to the first question statement can be first located in the sentence library, and then a target setting statement can be determined from the N setting statements. When the target setting statement meets the preset condition, a reply statement to the first question statement can be determined based on the second similarity between the target setting statement and the first question statement. The embodiment of the present application is based on two different similarity calculation methods, and the setting statements in the first sentence library are screened twice to screen out the target setting statement that is most similar to the first question statement, and the reply statement corresponding to the target setting statement is used as the reply to the first question statement. In this way, it can be ensured that the target setting statement screened from the first sentence library is the setting statement that is most similar to the first question statement, and the reply statement determined based on the setting statement is also the reply statement that best matches the first question statement, which improves the efficiency of replying to the question statement and ensures the accuracy of replying to the question statement.

[0103] Corresponding to the method provided in the embodiment of the present application, the embodiment of the present application also provides a dialogue processing device, referring to Figure 4 As shown, a conversation processing device provided by the present application includes:

[0104] A determination module 401 is used to determine a first question statement, and determine a first statement similarity between the first question statement and N set statements in a first statement library;

[0105] Processing module 402 is used to determine a target setting statement from the first statement library based on the first sentence similarity; if there is a target setting statement that meets the preset conditions in the target setting statements, determine the second sentence similarity between the first question statement and the target setting statement; based on the second sentence similarity between the first question statement and the target setting statement, determine the target answer statement of the first question statement.

[0106] Based on the same inventive concept, an electronic device is also provided in the embodiment of the present application, and the electronic device can realize the functions of the aforementioned dialogue processing device, referring to Figure 5 , the electronic device comprises:

[0107] At least one processor 501, and a memory 502 connected to the at least one processor 501. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 In the example, the processor 501 and the memory 502 are connected via a bus 500. The bus 500 is Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 500 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller, and there is no limitation on the name.

[0108] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 can execute the dialog processing method discussed above by executing the instructions stored in the memory 502. The processor 501 can implement Figure 4 The functions of each module in the device shown.

[0109] Among them, the processor 501 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 502 and calling data stored in the memory 502, the various functions of the device and processing data, the device can be monitored as a whole.

[0110] In one possible design, the processor 501 may include one or more processing units, and the processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 501. In some embodiments, the processor 501 and the memory 502 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on separate chips.

[0111] The processor 501 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the dialog processing method disclosed in the embodiments of the present application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0112] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0113] By programming the processor 501, the code corresponding to the dialog processing method described in the above embodiment can be fixed into the chip, so that the chip can execute the dialog processing method when it is running. Figure 1The steps of the dialogue processing method of the embodiment shown are as follows: How to design and program the processor 501 is a technique well known to those skilled in the art and will not be described in detail here.

[0114] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the dialogue processing method discussed above.

[0115] In some possible implementations, various aspects of the dialogue processing method provided by the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on an apparatus, the program code is used to enable the control device to execute the steps of the dialogue processing method according to various exemplary implementations of the present application described above in this specification.

[0116] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0117] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0118] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0119] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0120] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for processing a conversation, characterized in that: The method comprises: Determine a first question statement, and determine a first statement similarity between the first question statement and N setting statements in a first statement library, wherein the first statement library includes the N setting statements and answer statements corresponding to the N setting statements; Based on the first sentence similarity, determining a target setting sentence from the first sentence library; If there is a goal setting statement that satisfies a preset condition in the goal setting statements, determining a second statement similarity between the first question statement and the goal setting statement; Based on a second sentence similarity between the first question sentence and the target setting sentence, a target answer sentence for the first question sentence is determined.

2. The method according to claim 1, characterized in that The determining of the first sentence similarity between the first question sentence and the N set sentences in the first sentence library includes: Determine, based on the first similarity calculation network model, a first sentence similarity between the first question sentence and N set sentences in the first sentence library; The step of determining the target setting statement from the first statement library based on the first statement similarity includes: The setting sentence whose first sentence similarity is greater than a first threshold is determined as the target setting sentence.

3. The method according to claim 2, characterized in that The determining a second sentence similarity between the first question sentence and the goal setting sentence includes: Based on a second sentence similarity calculation network model, a second sentence similarity between the first question sentence and the target setting sentence is determined, wherein an accuracy of the second sentence similarity calculation network model is greater than an accuracy of the first sentence similarity calculation network model.

4. The method according to claim 1, characterized in that The step of determining a target answering statement for the first question statement based on a second statement similarity between the first question statement and the target setting statement comprises: Determine a first goal setting statement that has the greatest similarity to the second statement among the goal setting statements; If the second sentence similarity of the first goal setting sentence is greater than or equal to a second threshold, determining a reply sentence corresponding to the first goal setting sentence from the first sentence library; The reply statement corresponding to the first target setting statement is determined as the target reply statement.

5. The method according to claim 4, characterized in that The method further comprises: If the second sentence similarity of the first target setting sentence is less than the second threshold, the first question sentence is introduced into the target network model to obtain a second target setting sentence, wherein the target network model is trained by a sample consisting of the question sentence and the setting sentence in the first sentence library; The reply statement of the second target setting statement is used as the target reply statement of the first question statement.

6. The method according to claim 5, characterized in that Before importing the first question statement into the target network model, the method further includes: In the first sentence library, M setting sentences whose semantic similarity with the first question sentence is greater than a set value are determined, and the first question sentence is combined with the M setting sentences in pairs to obtain positive samples, wherein one of the positive samples is a combination sentence of the first question sentence and a setting sentence, and M is an integer greater than or equal to 1; Calculating the sentence similarity between the first question sentence and each setting sentence in the first sentence library, and selecting L setting sentences, wherein the L setting sentences include setting sentences whose sentence similarity is greater than a third threshold and whose semantic similarity is less than the set value, and setting sentences whose sentence similarity is less than the third threshold, and Y is an integer greater than or equal to 1 and less than X; Combine the first question statement with the L setting statements in pairs to obtain negative samples; The initial network model is trained based on the positive samples and the negative samples to obtain the target network model.

7. The method according to claim 2, characterized in that The initial network model is trained based on the positive sample and the negative sample to obtain a target network model, including: Convert the positive sample and the negative sample into an embedding vector; Add noise data to each embedding vector to obtain training data; The initial network model is trained using the training data to obtain the target network model.

8. The method according to claim 5, characterized in that The step of importing the first question statement into the target network model to obtain a second setting statement includes: Combining the first question statements with the target setting statements in pairs to obtain a plurality of statement groups to be selected; Importing the candidate sentence group into the target network model to calculate sentence similarity, and determining whether the maximum sentence similarity among all sentence similarities calculated by the target network model is greater than a fourth threshold; If so, the target setting sentence corresponding to the maximum sentence similarity is used as the second target setting sentence.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 8 when executing a computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 8 are implemented.

11. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed, the computer program is used to implement the dialog processing method according to any one of claims 1 to 8.