A text completion method, device and equipment based on multi-round dialogue

CN117909454BActive Publication Date: 2026-08-18HISENSE GRP HLDG CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311637792.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-30
Publication Date
2026-08-18
Estimated Expiration
2043-11-30

AI Technical Summary

Technical Problem

[0005]本申请实施例提供了一种基于多轮对话的文本补全方法、装置及设备,用以解决现有技术中文本补全准确率不高的问题

Benefits of technology

[0016] In this embodiment, semantic analysis is performed on the question-and-answer texts of the pre-set rounds before the text to be completed to determine the follow-up question type of the text to be completed. Based on the determined follow-up question type, the large model selects the target text of the pre-set round from the question-and-answer texts of the pre-set round, and merges the text to be completed with each target text to obtain a fused text. The large model then analyzes the rationality of each fused text, and selects the target fused text as the target completion text of the text to be completed based on the analysis results. The text to be completed is then combined with the question-and-answer texts of the pre-set rounds to complete the text. Based on the powerful language analysis capabilities of the large model, the most reasonable target fused text is selected as the target completion text, which improves the accuracy of text completion in multi-round dialogues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117909454B_ABST
    Figure CN117909454B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, in particular to a text completion method and device based on multi-round dialogue and equipment. The semantic analysis is performed on a to-be-completed text and a preset round of question and answer text, the follow-up question type of the to-be-completed text is determined, a large model selects a target text of the preset round from the question and answer text according to the follow-up question type, and the to-be-completed text is fused with each target text respectively to obtain a fused text. The large model analyzes the rationality of each fused text, selects a target fused text as a target completion text of the to-be-completed text according to an analysis result, and completes the to-be-completed text in combination with the question and answer text of the preset round. Based on the powerful language analysis capability of the large model, the most reasonable target fused text is selected as the target completion text, and the accuracy of text completion in multi-round dialogue is improved. The technical solution protected by the application has the characteristics of reliability, robustness and generalization, and meets the reliable characteristics.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a text completion method, apparatus and device based on multi-turn dialogue. Background Technology

[0002] With the development of technology, users often ask follow-up questions based on the previous questions or answers during the question-and-answer interaction with electronic devices. Therefore, how to complete the question text of the current round based on the content of previous question-and-answer dialogues has become a research focus in the industry.

[0003] In related technologies, one approach is to directly use slot replacement to complete the question text for the current round. Another approach is to directly input the question and answer text from the previous round and the question text for the current round into a large model, allowing the model to directly output the completed question text. Both of these methods result in question texts with low accuracy.

[0004] Therefore, improving the accuracy of text completion in multi-turn dialogues has become an urgent problem to be solved. Summary of the Invention

[0005] This application provides a text completion method, apparatus, and device based on multi-turn dialogue to solve the problem of low text completion accuracy in the prior art.

[0006] Firstly, this application provides a text completion method based on multi-turn dialogue, the method comprising:

[0007] Obtain the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed;

[0008] Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed, wherein the target follow-up question type is either a result follow-up question or a question follow-up question.

[0009] The text to be completed, the target follow-up question type, the question and answer text of the preset round, and the first prompt text are input into the large model. The large model selects the first target text of the preset round from the question and answer text of the preset round according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text.

[0010] The large model selects the target fused text as the target completion text of the text to be completed based on the analysis results of the rationality of each fused text.

[0011] Secondly, this application provides a text completion device based on multi-turn dialogue, the device comprising:

[0012] The acquisition module is used to acquire the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed;

[0013] The analysis and completion module is used to perform semantic analysis on the text to be completed and the question-and-answer text of the preset rounds, determine the target follow-up question type of the text to be completed, which is either a result follow-up question or a question follow-up question; input the text to be completed, the target follow-up question type, the question-and-answer text of the preset rounds, and the first prompt text into the large model, the large model selects the first target text of the preset rounds from the question-and-answer text of the preset rounds according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text; based on the analysis results of the rationality of each fused text, the large model selects the target fused text as the target completion text of the text to be completed.

[0014] Thirdly, this application also provides an electronic device including a processor, the processor being configured to execute a computer program stored in a memory to implement the steps of the text completion method based on multi-turn dialogue as described above.

[0015] Fourthly, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the text completion method based on multi-turn dialogue as described above.

[0016] In this embodiment, semantic analysis is performed on the question-and-answer texts of the pre-set rounds before the text to be completed to determine the follow-up question type of the text to be completed. Based on the determined follow-up question type, the large model selects the target text of the pre-set round from the question-and-answer texts of the pre-set round, and merges the text to be completed with each target text to obtain a fused text. The large model then analyzes the rationality of each fused text, and selects the target fused text as the target completion text of the text to be completed based on the analysis results. The text to be completed is then combined with the question-and-answer texts of the pre-set rounds to complete the text. Based on the powerful language analysis capabilities of the large model, the most reasonable target fused text is selected as the target completion text, which improves the accuracy of text completion in multi-round dialogues. Attached Figure Description

[0017] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1A flowchart illustrating a text completion process based on multi-turn dialogue provided in this application embodiment;

[0019] Figure 2 A flowchart illustrating a keyword matching method provided in an embodiment of this application;

[0020] Figure 3 A flowchart illustrating a special text matching method provided in an embodiment of this application;

[0021] Figure 4 A flowchart illustrating the determination of a target inquiry type provided in an embodiment of this application;

[0022] Figure 5 A text fusion diagram provided for an embodiment of this application;

[0023] Figure 6 A schematic diagram illustrating a text completion process provided in an embodiment of this application;

[0024] Figure 7 This is a schematic diagram of a question-and-answer dialogue application provided in an embodiment of this application;

[0025] Figure 8 A schematic diagram of a text completion device based on multi-turn dialogue provided in an embodiment of this application;

[0026] Figure 9 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art are within the scope of protection of this application.

[0028] This application provides a text completion method, apparatus, device, and medium based on multi-turn dialogue. The method involves acquiring the text to be completed and the question-and-answer text from a preset number of turns preceding the text; performing semantic analysis on the text to be completed and the question-and-answer text from the preset number of turns to determine the target follow-up question type of the text to be completed, which is either a result follow-up question or a question follow-up question; inputting the text to be completed, the target follow-up question type, the question-and-answer text from the preset number of turns, and a first prompt text into a large model; the large model selects the target text from the question-and-answer text from the preset number of turns based on the target follow-up question type, and obtains the fused text after fusing the text to be completed with each target text; and the large model selects the target fused text as the target completed text based on the analysis results of the rationality of each fused text.

[0029] Figure 1 A flowchart illustrating a text completion process based on multi-turn dialogue is provided for embodiments of this application, as shown below. Figure 1 As shown, the process includes the following steps:

[0030] S101: Obtain the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed.

[0031] The text completion method based on multi-turn dialogue provided in this application is applied to electronic devices, such as servers, PCs, and mobile terminals.

[0032] In intelligent question answering, each acquired question can be designated as the text to be completed. This text can be input into the electronic device by the user. The user can input the text using either text or voice. Specifically, the user can use a keyboard connected to the electronic device or speak the text aloud. The voice acquisition module of the electronic device, after acquiring the voice of the text to be completed, performs speech recognition processing, and the resulting text becomes the text to be completed. In this embodiment, the text to be completed can also be sent to the electronic device from other connected electronic devices, or it can be text obtained by the electronic device through image recognition processing. This embodiment does not limit the method of acquiring the text to be completed.

[0033] To complete the text to be completed and ensure the accuracy of the question-and-answer response, this embodiment of the application can obtain the question-and-answer text from a preset number of rounds prior to receiving the text to be completed. The preset number of rounds can be any positive integer, which can be understood as indicating which rounds of question-and-answer text the text to be completed should be used for completion. The preset number of rounds can be 2, 3, 5, etc., and those skilled in the art can configure it arbitrarily as needed. This embodiment of the application does not limit the configuration of the preset number of rounds. It should be noted that if the number of question-and-answer texts prior to the text to be completed is less than the preset number of rounds, then the existing number of question-and-answer texts is obtained, and subsequent text completion is performed based on this existing number of question-and-answer texts.

[0034] In this embodiment of the application, when performing intelligent question answering, after each question is received and the corresponding answer information is determined based on the question, the question corresponding to the answer information needs to be saved in chronological order so as to facilitate the subsequent acquisition of the question and answer text of the preset round.

[0035] In one possible implementation, an electronic device may serve users of multiple electronic devices. Therefore, when saving the response information and the corresponding question, the identity of the user of the electronic device that input the question can be obtained, and the response information and question can be saved according to the identity. Then, when obtaining the question and answer text of a preset round, the identity of the user of the electronic device that sent the text to be completed can also be obtained, and the question and answer text of the preset round corresponding to the identity can be obtained from the recorded question and answer text.

[0036] In one possible implementation, a time threshold can be pre-stored. If the user's identity cannot be obtained, after obtaining the text to be completed, it can be determined whether the time interval between receiving the text to be completed and the time of the last output reply is greater than the time threshold. If so, the currently received text to be completed can be considered a new question-and-answer dialogue. In this case, the question-and-answer text of the preset rounds before the obtained text to be completed is empty, and the reply information corresponding to the text to be completed can be directly determined. The text to be completed and the reply information are then saved as the latest question-and-answer text. If not, the currently received text to be completed and the previous question-and-answer text can be considered to be the same question-and-answer dialogue, not a new one. The question-and-answer text of the preset rounds can be obtained from the saved latest question-and-answer text, and the text to be completed and the corresponding reply information can be added to the latest question-and-answer text.

[0037] S102: Perform semantic analysis on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed, wherein the target follow-up question type is a result follow-up question or a question follow-up question.

[0038] Statistical analysis reveals that during multi-round dialogues, users of electronic devices often ask follow-up questions based on the responses from the previous rounds or previous questions. Therefore, when completing text, it is possible to pre-determine whether the text to be completed is a follow-up question based on the responses or a follow-up question based on the questions. For ease of description, this application's embodiments refer to follow-up questions based on responses as result follow-up questions and follow-up questions based on questions as question follow-up questions.

[0039] For example, suppose there are two rounds of question-and-answer dialogue. The first round question is: What was the tax revenue of Laoshan District in September? The corresponding answer is: The total tax revenue of Laoshan District in September 2023 was 2.1 billion yuan. The second round question is: How does it compare to Shinan District? This question is the text to be completed. Through analysis, we can see that the second round question is a follow-up question based on the first one. The completed second round question is: How does the tax revenue of Laoshan District in September compare to Shinan District?

[0040] For example, the first round of questions was: What was the tax revenue of Laoshan District in September? The corresponding answer was: The total tax revenue of Laoshan District in September 2023 was 2.1 billion yuan. The second round of questions was: Which districts in Qingdao City have a higher tax revenue than this figure? This second round of questions is the text to be completed. Through analysis, it can be seen that the second round of questions is a follow-up question based on the answer information. The completed second round of questions would be: Which districts in Qingdao City have a tax revenue higher than 2.1 billion yuan?

[0041] For example, the first round of questions was: "What was the tax revenue of Laoshan District in September?" The corresponding answer was: "The total tax revenue of Laoshan District in September 2023 was 2.1 billion yuan." The second round of questions was: "What about Shinan District?" This second round of questions is the text to be completed. Through analysis, it can be seen that the second round of questions is a follow-up question based on the first one. The completed second round of questions would be: "What was the tax revenue of Shinan District in September?"

[0042] When determining the target follow-up question type of the text to be completed, semantic analysis can be performed on the text to be completed and the question-and-answer text of the preset round. In this embodiment, semantic analysis can be performed on the text to be completed and the question-and-answer text of the preset round based on a pre-trained classification model or intent recognition model to determine the target follow-up question type of the text to be completed. Alternatively, the target follow-up question type of the text to be completed can also be determined by keyword matching. In related technologies, there are many ways to determine the follow-up question type of a certain text, and this embodiment does not limit the method of determining the target follow-up question type.

[0043] S103: Input the text to be completed, the target follow-up question type, the question and answer text of the preset round, and the first prompt text into the large model. The large model selects the target text of the preset round from the question and answer text of the preset round according to the target follow-up question type, and obtains the fused text after the text to be completed and each target text are fused separately.

[0044] After determining the target follow-up question type for the text to be completed, the text to be completed, the target follow-up question type, the question-and-answer text for a preset number of rounds, and the first prompt text can be input into the large model. The large model then selects the target text for a preset number of rounds from the question-and-answer text based on the target follow-up question type, and merges the text to be completed with each target text separately to obtain the merged text. The first prompt text is used to guide the large model in merging the text to be completed with the target text corresponding to the target follow-up question type.

[0045] In this embodiment, a large model can be understood as a model based on the transformer architecture; it can also be understood as a machine learning model with a large number of parameters and high complexity, such as a neural network model with millions to billions or tens of billions of parameters; or it can be understood as a deep learning model trained on large-scale training data using semi-(weakly) supervised, fully supervised, self-supervised, or unsupervised techniques. In this embodiment, the large model can handle a variety of different tasks. Training a large model is generally based on training data from a specific target task domain, and the trained large model can generally be transferred to other task domains similar to the target task domain for use.

[0046] In this embodiment of the application, when the large model selects the target text of the preset round of question and answer text based on the target follow-up question type, it can first determine whether the target follow-up question type is a result follow-up question or a question follow-up question. If it is a question follow-up question, then each question in the question and answer text of the preset round is determined as the target text; if it is a result follow-up question, then each reply information in the question and answer text of the preset round is determined as the target question.

[0047] For example, assuming a preset round number of 2, the obtained question-and-answer text for the preset round can be represented as Q1, A1, Q2, A2, where Q2 represents the question received in the previous round of the obtained text to be completed, A2 represents the response information output in the previous round of the text to be completed, Q1 represents the question received in the round two rounds prior to the text to be completed, and A1 represents the response information output in the round two rounds prior to the text to be completed. Assuming that the target follow-up question type of the text to be completed is determined to be a result follow-up question, then A1 and A2 in the question-and-answer text can be determined as target texts. Then, the text to be completed is fused with the target texts A1 and A2 respectively to obtain the fused text. It should be noted that how to fuse two texts in a large model is a prior art technique, and the fusion process will not be described in detail in this embodiment.

[0048] S104: Based on the analysis results of the rationality of each fused text, the large model selects the target fused text as the target completion text of the text to be completed.

[0049] After obtaining each fused text, the large model can leverage its powerful language analysis capabilities to analyze the rationality of each fused text. Based on the analysis results, it selects the most reasonable target fused text as the target completion text for the text to be completed. In this embodiment, the question-and-answer texts from a preset number of rounds and each fused text can be input into the large model, which will then autonomously analyze and select the fused text with the highest rationality as the target completion text. How the large model analyzes the rationality of the text is existing technology, and this embodiment will not elaborate on the rationality analysis process.

[0050] In a special case, if only one merged text is obtained, then that merged text can be identified as the target completion text for the text to be completed.

[0051] In this embodiment, semantic analysis is performed on the question-and-answer texts of the pre-set rounds before the text to be completed to determine the follow-up question type of the text to be completed. Based on the determined follow-up question type, the large model selects the target text of the pre-set round from the question-and-answer texts of the pre-set round, and merges the text to be completed with each target text to obtain a fused text. The large model then analyzes the rationality of each fused text, and selects the target fused text as the target completion text of the text to be completed based on the analysis results. The text to be completed is then combined with the question-and-answer texts of the pre-set rounds to complete the text. Based on the powerful language analysis capabilities of the large model, the most reasonable target fused text is selected as the target completion text, which improves the accuracy of text completion in multi-round dialogues.

[0052] To further ensure the accuracy of text completion, based on the above embodiments, in this embodiment, after obtaining the text to be completed and the question-and-answer text of a preset number of rounds preceding the text to be completed, and before performing semantic analysis on the text to be completed and the question-and-answer text of the preset number of rounds preceding the text to be completed, the method further includes:

[0053] The question-and-answer text of the preset round and the text to be completed are input into the classification model to obtain the target type of the text to be completed, wherein the target type is either the type that needs to be completed or the type that does not need to be completed.

[0054] Determine whether the target type is a type that needs to be completed;

[0055] If so, then perform semantic analysis on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed.

[0056] Since the questions input by users of electronic devices may already be complete, attempting to complete them again could lead to incorrect completion. Therefore, to further ensure the accuracy of text completion, in this embodiment, after obtaining the text to be completed and the pre-set rounds of question-and-answer text, before determining the target follow-up question type of the text to be completed, it can be further determined whether the obtained text to be completed requires fusion completion or does not. In this embodiment, the target type of text requiring fusion completion is referred to as the "completed type," and the target type of text not requiring fusion completion is referred to as the "completed-not-complete type."

[0057] In this embodiment, the obtained question-and-answer text and the text to be completed for the preset round can be input into a classification model. The classification model determines the target type of the text to be completed, that is, whether the text needs type completion or not. The classification model can be any pre-trained classification model, and those skilled in the art can configure it as needed. For example, the classification model can be a Bidirectional Encoder Representations from Transformers (BERT) model, such as BERT-Base, which is one type of pre-trained BERT model.

[0058] After obtaining the target type, it can be determined whether the target type is a type that needs completion. If so, semantic analysis of the text to be completed and the pre-defined rounds of question-and-answer text can be performed to determine the target follow-up question type of the text to be completed. In other words, after determining that the target type is a type that needs completion, the text to be completed is completed based on the multi-turn dialogue-based text completion method provided in this application. If the target type is a type that does not need completion, the text to be completed can be left uncompleted, and the corresponding response information can be directly determined.

[0059] Specifically, after obtaining the text to be completed, the previous question and answer information of the text to be completed, along with the text itself, are input into the BERT-Base model. The BERT-Base model then classifies the text to determine the target follow-up question type. Table 1 shows the correspondence between target follow-up question types provided in this embodiment. In Table 1, the text in the column containing question_1 represents the previous question of the text to be completed, the text in the column containing answer_1 represents the answer information corresponding to the previous question, the text in the column containing question_2 represents the text to be completed, and the text in the column containing label represents the target type. When label is 1, the target type is a type that needs completion; when label is 0, the target type is a type that does not need completion.

[0060] Table 1

[0061]

[0062] To further ensure the accuracy of text completion, based on the above embodiments, in this embodiment, the semantic analysis of the text to be completed and the pre-defined rounds of question-and-answer text to determine the target follow-up question type of the text to be completed includes:

[0063] Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds using each preset analysis method to obtain the target follow-up question type corresponding to each analysis method;

[0064] The step of inputting the text to be completed, the target follow-up question type, the question-and-answer text of the preset round, and the first prompt text into the large model, and the large model selecting the target text of the preset round from the question-and-answer text of the preset round according to the target follow-up question type, includes:

[0065] The second target text is obtained by concatenating the text to be completed, each target question type, the question and answer text of the preset round, and the first prompt text.

[0066] The second target text is input into the large model, which performs semantic analysis on the second target text to determine the final follow-up question type corresponding to the text to be completed.

[0067] The large model selects the target text of the preset round from the question and answer text of the preset round according to the final follow-up question type.

[0068] To further ensure the accuracy of text completion, different analysis methods can be used to determine the target follow-up question type of the text to be completed. In this embodiment, different analysis methods are pre-saved. When determining the target follow-up question type of the text to be completed, each preset analysis method can be used to perform semantic analysis on the text to be completed and the question and answer text of preset rounds, thereby obtaining the target follow-up question type corresponding to each analysis method.

[0069] Specifically, assume that two analysis methods are saved in advance. Analysis method 1 is semantic analysis based on intent recognition model 1, and analysis method 2 is semantic analysis based on classification model 1. Intent recognition model 1 and classification model 1 are different models.

[0070] When selecting target text, the large model can consider the target follow-up question type corresponding to each analysis method to determine the final follow-up question type. In this embodiment, the text to be completed, each target follow-up question type, the question-and-answer text of a preset round, and the first prompt text can be concatenated to obtain a second target text. This second target text is then input into the large model, which performs semantic segmentation on it to determine the final follow-up question type corresponding to the text to be completed. In other words, inputting the second target text into the large model allows it to consider the analysis results of other analysis methods when analyzing whether the follow-up question between the question-and-answer text of the preset round and the text to be completed is question-based or answer-based, thereby further improving the accuracy of the large model in determining the final follow-up question type corresponding to the text to be completed.

[0071] After the final follow-up question type is determined in the large model, the target text for a preset round can be selected from the question and answer texts of the preset rounds based on the final follow-up question type. The principle of selecting the target text based on the final follow-up question type is the same as the principle of selecting the first target text based on the target follow-up question type in the above embodiment, and will not be repeated in this embodiment.

[0072] Specifically, to facilitate semantic analysis of large models, when concatenating the complete text, each target follow-up question type, the question-and-answer text of a preset round, and the first prompt text to obtain the second target text, each target follow-up question type can be added to a preset template. This preset template, now containing the target follow-up question type, can then be concatenated with other text to obtain the second target text. For example, any target follow-up question type can be added to the template "Based on user input, the target follow-up question type {judgement_func} is likely to be high; please make a comprehensive judgment and provide a conclusion." Here, {judgement_func} represents any target follow-up question type.

[0073] To further ensure the accuracy of text completion, based on the above embodiments, in this embodiment, if the analysis method used is model analysis, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds to determine the target follow-up question type of the text to be completed, including:

[0074] The second prompt text, the example text, the question and answer text of the preset round, and the text to be completed are concatenated to obtain the third target text; wherein, the second prompt text is used to prompt the large model to confirm the target follow-up question type of the text to be completed;

[0075] The third target text is input into the large model, which performs semantic analysis on the third target text to determine the target question type of the text to be completed.

[0076] To further ensure the accuracy of text completion, the pre-saved analysis methods include: model analysis, keyword matching, and special text matching.

[0077] When the analysis method used is model analysis, the target follow-up question type of the text to be completed can be determined by combining chain-of-thought (CoT) and few-shot learning. In this embodiment, the second prompt text, example text, pre-set rounds of question-and-answer text, and the text to be completed can be concatenated to obtain the third target text. The second prompt text is used to prompt the large model to confirm the target follow-up question type of the text to be completed. The example text is an example given by the large model to determine the target follow-up question type. After the third target text is input into the large model, the large model can rely on its powerful language analysis capabilities to perform semantic analysis on the third target text, thereby determining the target follow-up question type of the text to be completed. How the large model performs semantic analysis on the received text is existing technology, and this embodiment will not elaborate on the process of determining the target follow-up question type of the text to be completed.

[0078] Specifically, the concatenated third target text may include the following:

[0079] # You are now an intent classification expert. Your task is to determine, based on user input, whether the second round is a follow-up question to the answer in the first round, and return the final result in JSON format:

[0080] The json field contains requirement and simplified answer. The json field is defined as follows:

[0081] -Answer simplified, string, judgment criteria

[0082] -requirement, enum, user intent; the enumeration value only contains: follow-up questions that are related to the result, and follow-up questions that are not related to the result.

[0083] To determine user intent, follow these steps:

[0084] 1. Users want to know which is more relevant, the questions in the second round or the questions and answers in the first round.

[0085] 2. Consider possible outcomes:

[0086] Candidate 1: Only related to the questions in Round 1, and can be combined with the questions in Round 1 to form a sentence with contextual relevance.

[0087] Candidate 2: Only related to the answers in round 2, and can be combined with the answers in round 1 to form a sentence with contextual relevance.

[0088] 3. Based on user needs, determine which candidate, 1 or 2, is more suitable.

[0089] 4. Generate the intents required by the user.

[0090] ## Example:

[0091] Input: Round 1: Question: Which of the following ranks first among residents' various income categories? Answer: In 2023, the top-ranked income category for Qingdao residents in terms of net operating income, net transfer income, net property income, and total wage income was net operating income.

[0092] Round 2: How many are there?

[0093] Output: {

[0094] Simplified answer: "Net income from household operations"

[0095] "requirement": "is a follow-up question about the result"}

[0096] Input: Round 1: Question: How many billion yuan was Qingdao's tax revenue last year? Answer: Qingdao's total tax revenue in 2022 was 9.8 billion yuan.

[0097] Round 2: Who has more, Jinan or [another city]?

[0098] Output: {

[0099] Simplified answer: 9.8 billion yuan

[0100] "requirement": "not a follow-up question about the result"}

[0101] # Input: Round 1: Question: {question_1} Answer: {answer_1}

[0102] Round 2: Question {question_2}

[0103] Output:

[0104] In the third target text mentioned above, the content before “## Example:” is the second prompt text; the text between “## Example:” and “# Input: Round 1: Question: {question_1} Answer: {answer_1}” is the example text; “Round 1: Question: {question_1} Answer: {answer_1}” is the obtained question and answer text; and “Round 2: Question {question_2}” contains “question_2”, which is the text to be completed.

[0105] To further ensure the accuracy of text completion, based on the above embodiments, in this embodiment, if the analysis method used is keyword matching, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds to determine the target follow-up question type of the text to be completed, including:

[0106] Based on the pre-saved correspondence between each keyword and the question-and-answer type, the target question-and-answer type corresponding to the question-and-answer text of the preset round is determined;

[0107] Extract relevant keywords from the text to be completed;

[0108] Based on the pre-saved correspondence between each associated keyword and question-and-answer type and each follow-up question type, the target follow-up question type of the text to be completed is determined.

[0109] To further ensure the accuracy of text completion, this embodiment of the application also pre-stores the correspondence between different keywords and question-and-answer types. If the analysis method used is keyword matching, then when determining the target follow-up question type of the text to be completed, the target question-and-answer type corresponding to the preset round of question-and-answer text can be determined according to the pre-stored correspondence between each keyword and question-and-answer type. In other words, by using the pre-stored correspondence, it is determined what direction the obtained preset round of question-and-answer text is discussing.

[0110] Those skilled in the art can configure the pre-saved correspondence between each keyword and the question-and-answer type as needed. Taking the application scenario of searching for indicators in smart cities as an example, the question-and-answer types included can be those about the three industries, those about finding typical examples of time, and those about finding typical examples of location, etc. Among these, the keywords for the question-and-answer type related to the three industries can be "three industries," for example, "Which of the three industries has the highest added value? In 2023, the primary industry had the highest added value, totaling 600 billion yuan. What is the proportion of this industry in the three industries?" This question-and-answer text is an example of the three industries question-and-answer type. The keywords for the question-and-answer type related to finding typical examples over time can be "time," which can be understood as a question-and-answer text that searches for relevant data based on time. For example, "Which month in 2023 had the highest tax revenue? In 2023, June was the month with the highest tax revenue in Qingdao." This question-and-answer text is an example of a time-based question-and-answer type. The keywords for the question-and-answer type related to finding typical examples over location can be "location," which can be understood as a question-and-answer text that searches for relevant data based on location. For example, "Which region in Qingdao has a GDP below 100 billion yuan? In the fourth quarter of 2023, Pingdu City had a GDP below 100 billion yuan in Qingdao." This question-and-answer text is an example of a location-based question-and-answer type.

[0111] To determine the target follow-up question type between the text to be completed and the pre-defined rounds of question-and-answer text, after determining the target question-and-answer type corresponding to the pre-defined rounds of question-and-answer text, related keywords can be extracted from the text to be completed. In this embodiment, the related keywords can be pronouns, comparisons with, or similar terms. Specifically, when extracting related keywords from the text to be completed, pre-saved related keywords can be extracted based on regular expressions. It should be noted that other methods can also be used to extract related keywords, and this embodiment does not impose any limitations.

[0112] In order to determine the target follow-up question type of the text to be completed, in this embodiment of the application, the correspondence between related keywords, question and answer types and follow-up question types is stored in advance. When determining the target follow-up question type of the text to be completed, it is possible to check whether there is a question and answer type corresponding to the target question and answer type and the extracted related keywords in the pre-stored correspondence between each related keyword and question and answer type and each follow-up question type. If there is, the corresponding question and answer type can be determined as the target follow-up question type.

[0113] Specifically, suppose we pre-save the correspondence between related keyword A and question-answer type A, and the corresponding follow-up question type A; related keyword A and question-answer type B, and the corresponding follow-up question type B; and related keyword C and question-answer type A, and the corresponding follow-up question type A. If we determine that the target question-answer type for the question-answer text in the preset round is question-answer type A, and the related keyword in the extracted text to be completed is related keyword C, since the correspondence between question-answer type A, related keyword C, and follow-up question types is pre-saveped, we can determine that the target follow-up question type for the text to be completed is follow-up question type A.

[0114] The keyword matching method will be explained below with a specific example. Figure 2 This is a flowchart illustrating a keyword matching method provided in an embodiment of this application. Figure 2 As shown, after obtaining the text to be completed and the question-and-answer text for a preset round, the target question-and-answer type corresponding to the question-and-answer text for the preset round is determined based on the pre-saved correspondence between each keyword and the question-and-answer type. If the question-and-answer text does not contain pre-saved keywords, the target question-and-answer type corresponding to that text is determined to be empty. Pre-saved related keywords are extracted from the text to be completed, such as pronouns, comparisons with, etc. If the text to be completed does not contain related keywords, the related keywords are determined to be empty. When both the target question-and-answer type and related keywords are not empty, the target follow-up question type of the text to be completed can be determined based on the pre-saved correspondence between each related keyword and the question-and-answer type and each follow-up question type. If there is no pre-saved correspondence between the target question-and-answer type and related keywords, the target follow-up question type determined by the keyword matching method is determined to be empty.

[0115] To further ensure the accuracy of text completion, based on the above embodiments, in this embodiment, if the analysis method used is a special text matching method, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds for a preset threshold number of times to obtain the target follow-up question types of the preset threshold, including:

[0116] If the text to be completed exists in a pre-saved special text set, then the target question type of the text to be completed is determined according to the correspondence between the special texts and question types stored in the special text set.

[0117] Analysis and statistics of a large number of texts to be completed show that for some special texts, neither model analysis nor keyword matching methods have a high accuracy rate in determining the corresponding target question type. Therefore, in order to further ensure the accuracy of text completion, a special text set is pre-configured in this embodiment, which stores the relationship between each special text and the question type.

[0118] If the analysis method used is special text matching, when determining the question type of the text pair to be completed, it can be determined whether the text to be completed exists in the special text set. If it exists, it means that the text to be completed is special text, and the question type corresponding to the text to be completed stored in the special text set can be determined as the target question type.

[0119] Specifically, suppose the special text set stores the follow-up question type corresponding to the special text "What about the top two?" as a question, and the follow-up question type corresponding to the special text "What about next?" as a result. If the text to be completed is "What about the top two?", then the target follow-up question type of the text to be completed can be determined to be a question.

[0120] It should be noted that as long as the text to be completed includes special text recorded in a special text set, it can be determined that the text to be completed exists in a pre-saved special text set. In other words, as long as a part of the text to be completed is special text recorded in a special text set, it can be determined that the text to be completed exists in a special text set.

[0121] In addition, when determining whether the text to be completed exists in a pre-saved special text set, the similarity between the text to be completed and each special text recorded in the special text set can be determined. The follow-up question type corresponding to the special text with the highest similarity and a similarity greater than a preset similarity threshold is determined as the target follow-up question type of the text to be completed.

[0122] The special text matching method will be explained below with reference to a specific embodiment. Figure 3 This is a flowchart illustrating a special text matching method provided in an embodiment of this application. After obtaining the text to be completed, it is determined whether the text exists in a special text set. If it exists, the follow-up question type corresponding to the text to be completed in the special text set is obtained, and the corresponding follow-up question type is determined as the target follow-up question type. If it does not exist, the follow-up question type of the text to be completed is determined to be empty. The target follow-up question type can be determined based on other analysis methods.

[0123] The process of determining the type of follow-up question is explained below with reference to another specific embodiment. Figure 4 This application provides a flowchart illustrating the process of determining the type of follow-up inquiry. Figure 4 The method is illustrated using two rounds of dialogue. First, a special text matching method is used to analyze the previous round's question, the previous round's answer, and the current round's question. The skill-related question is the text to be completed. If the text to be completed is determined to be special text, the follow-up question type corresponding to that text within the special text set can be identified as the target follow-up question type. If the text to be completed is not special text, other analysis methods can be used to determine the target follow-up question type.

[0124] To further ensure the accuracy of text completion, based on the above embodiments, in this embodiment, if there are multiple fused texts, the large model selects a target fused text as the target completion text for the text to be completed based on the analysis results of the rationality of each fused text, including:

[0125] The large model concatenates the third prompt text and each fused text to obtain the fourth target text. The third prompt text is used to prompt the large model to delete unreasonable fused text from all fused texts.

[0126] The large model analyzes the rationality of each fused text in the fourth target text, and based on the analysis results corresponding to each fused text, deletes unreasonable fused texts to obtain candidate fused texts;

[0127] If the number of candidate fusion texts is 1, then the candidate fusion text is determined as the target completion text of the text to be completed.

[0128] To further ensure the accuracy of text completion, the large model can progressively determine the target completion text. The large model can concatenate the third prompt text and each merged text to obtain the fourth target text. The third prompt text is used to guide the large model to delete unreasonable merged text from all merged texts. For example, the third prompt text could be "Compare each merged text and eliminate the least likely merged text."

[0129] After obtaining the fourth target text, the large model can analyze the rationality of each fused text within the fourth target text, and based on the analysis results corresponding to each fused text, delete unreasonable fused texts to obtain candidate fused texts. It should be noted that how the large model analyzes the rationality of the text is existing technology, and will not be elaborated on in the embodiments of this application.

[0130] After the large model removes unreasonable fused texts, it can determine whether the number of remaining candidate fused texts is 1. If so, it can be considered that the optimal and most reasonable fused text remains, and this candidate fused text can be determined as the target fused text for the text to be completed.

[0131] To further ensure the accuracy of text completion, based on the above embodiments, the method in this application embodiment further includes:

[0132] If the number of candidate fused texts is not 1, delete the first target text corresponding to the deleted fused text, and continue to execute the step of obtaining the fused text after fusing the text to be completed with each first target text.

[0133] When the number of remaining candidate fusion texts is not 1, in order to determine the optimal target completion text, in this embodiment of the application, the large model can delete the first target text corresponding to the deleted fusion text, and continue to execute the step of fusing the text to be completed with each first target text separately. That is, through repeated fusion and elimination, the final target completion text is determined.

[0134] In this embodiment of the application, in order to further ensure the accuracy of text completion, other large models can be used to determine the fusion text with the best fusion effect, and the fusion text with the best fusion effect and the target question type are input into the large model together. When the large model selects the target fusion text as the target completion text of the text to be completed based on the analysis results of the rationality of each fusion text, it considers the fusion results of other large models, so as to further improve its own text completion accuracy.

[0135] In this embodiment, when determining the best-performing fused text, other large models can input both the text to be completed and the question-and-answer text from a preset round into the other large model. Upon receiving the text to be completed and the question-and-answer text from the preset round, the other large model merges the text to be completed with each text included in the question-and-answer text from the preset round to obtain each corresponding fused text. After obtaining each fused text, the rationality of each fused text is analyzed, and based on the analysis results of each rationality, the fused text with the best fusion effect is selected. In this embodiment, the fused text with the best fusion effect can be filled into the template "According to verification, {llm_evaluation_result} has a better fusion effect; please conduct a comprehensive analysis," where {llm_evaluation_result} represents the determined fused text with the best fusion effect. After obtaining the filled template, it can be input into the large model along with the text to be completed, the target follow-up question type, the question and answer text of the preset round, and the first prompt text. This allows the large model to consider the fusion results determined by the other large models when determining the target text to be completed.

[0136] In this embodiment of the application, when any large model fuses text, the text can be input into that large model as follows: Specifically:

[0137] # You are now a language expert. Your task is to use the user's first round of questions and answers to complete the second round of input into a simple interrogative sentence querying a metric. The types of completion are as follows:

[0138] - During the second round of follow-up questions, please rewrite the timeline from the first round of questions.

[0139] - In the second round, when asking follow-up questions about location, please rewrite the location questions from the first round.

[0140] - In the second round, when asking follow-up questions about the indicators, please rewrite the indicators from the questions in the first round.

[0141] # Example:

[0142] Input: Round 1: Question: How does Qingdao's GDP compare to that of the second quarter? Answer: Qingdao's GDP in the first quarter of 2023 was 10 trillion yuan, and in the second quarter it was 15 trillion yuan.

[0143] Round 2: What percentage does that represent in Shandong Province?

[0144] Output: What percentage of Qingdao's GDP in Shandong Province was in the first quarter?

[0145] # Input: Round 1: Question: {question1}. Answer: {answer1}

[0146] Round 2: {question2}

[0147] Output:

[0148] It should be noted that the above text is only an example given in this application, and those skilled in the art can configure specific text as needed. The embodiments of this application are not limited.

[0149] Figure 5 A text fusion illustration provided for an embodiment of this application, such as... Figure 5 As shown, the question and answer text includes: Q1, A1, Q2, and A2. Q1 is: Which city has a higher GDP, Qingdao or Yantai? A1 is: Qingdao's GDP is higher, totaling 2 trillion. Q2 is: Where does Shinan District rank in tax revenue? A2 is: Shinan District ranks first. The input text to be completed is: What is his quantity?

[0150] The large model can merge the input and Q1 texts into a single query based on the pre-saved prompt text "You now need to merge the input and Q1 texts into a single query for an indicator." This allows it to merge "What is its quantity?" with "Which city has a higher GDP, Qingdao or Yantai?", resulting in merged text M1 "What is the GDP of Qingdao and Yantai?". Similarly, it merges with other texts to obtain merged texts such as M2 "Qingdao's GDP is 2 trillion," M3 "How much tax revenue does Shinan District have?", and M4 "How much does Shinan District have?". After obtaining each merged text, the large model can further refine the results based on the pre-saved prompt text "Compare the merged results and remove the least likely result." This allows it to remove the least reasonable merged text M2 and its corresponding question-and-answer text A1. The model then performs the merging and removal process on the remaining Q1, Q2, and A2 to obtain the best-performing merged text M1.

[0151] The following example illustrates the process of text completion based on multi-turn dialogue. Figure 6 This application provides a schematic diagram of a text completion process, which includes the following steps:

[0152] S601: Obtain the text to be completed, and the question and answer text of the preset rounds before the text to be completed.

[0153] S602: Determine whether the target type of the text to be completed is the type that needs to be completed. If yes, execute S604, S605, and S606; otherwise, execute S603.

[0154] S603: Query the corresponding data based on the text to be completed, and determine the response information.

[0155] S604: Determine the target follow-up question type 1 of the text to be completed based on model analysis method.

[0156] S605: Determine the target follow-up question type 2 of the text to be completed based on keyword matching.

[0157] S606: Determine the target follow-up question type of the text to be completed based on a special text matching method 3.

[0158] S607: Concatenate the text to be completed, each target follow-up question type, the question and answer text of the preset rounds, and the first prompt text to obtain the second target text. Input the second target text into the large model to obtain the target completed text output by the large model.

[0159] The text completion method based on multi-turn dialogue provided in this application can be applied to intelligent voice assistants in smartphones. Figure 7 This is a schematic diagram of a question-and-answer dialogue application provided in an embodiment of this application. Through experimental statistics, it is found that the text completion method provided in this application can effectively ensure that the overall accuracy of text completion is above 90%, thereby improving the accuracy of question-and-answer dialogue.

[0160] The technical solution protected in this application has the characteristics of reliability, robustness, and generalizability, and meets the requirements of trustworthiness.

[0161] Based on the above embodiments, Figure 8 A schematic diagram of a text completion device based on multi-turn dialogue provided in this application embodiment, the device comprising:

[0162] The acquisition module 801 is used to acquire the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed;

[0163] The analysis and completion module 802 is used to perform semantic analysis on the text to be completed and the question-and-answer text of the preset rounds, determine the target follow-up question type of the text to be completed, wherein the target follow-up question type is either a result follow-up question or a question follow-up question; input the text to be completed, the target follow-up question type, the question-and-answer text of the preset rounds, and the first prompt text into the large model; the large model selects the first target text of the preset rounds from the question-and-answer text of the preset rounds according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text; based on the analysis results of the rationality of each fused text, the large model selects the target fused text as the target completion text of the text to be completed.

[0164] In one possible implementation, the analysis and completion module 802 is further configured to input the question-and-answer text of the preset round and the text to be completed into a classification model to obtain the target type of the text to be completed, wherein the target type is a type that needs completion or a type that does not need completion; determine whether the target type is a type that needs completion; if so, perform semantic analysis on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed.

[0165] In one possible implementation, the analysis and completion module 802 is specifically used to perform semantic analysis on the text to be completed and the question-and-answer text of the preset rounds using each preset analysis method to obtain the target follow-up question type corresponding to each analysis method; the step of inputting the text to be completed, the target follow-up question type, the question-and-answer text of the preset rounds and the first prompt text into the large model, and the large model selecting the target text of the preset rounds from the question-and-answer text of the preset rounds according to the target follow-up question type includes: concatenating the text to be completed, each target follow-up question type, the question-and-answer text of the preset rounds and the first prompt text to obtain a second target text; inputting the second target text into the large model, the large model performing semantic analysis on the second target text to determine the final follow-up question type corresponding to the text to be completed; and the large model selecting the target text of the preset rounds from the question-and-answer text of the preset rounds according to the final follow-up question type.

[0166] In one possible implementation, if the analysis method used is model analysis, the analysis completion module 802 is specifically used to concatenate the second prompt text, the example text, the question-and-answer text of the preset round, and the text to be completed to obtain the third target text; wherein, the second prompt text is used to prompt the large model to confirm the target follow-up question type of the text to be completed; the third target text is input into the large model, and the large model performs semantic analysis on the third target text to determine the target follow-up question type of the text to be completed.

[0167] In one possible implementation, if the analysis method used is keyword matching, the analysis completion module 802 is specifically used to determine the target question-answer type corresponding to the question-answer text of the preset round based on the pre-saved correspondence between each keyword and the question-answer type; extract related keywords from the text to be completed; and determine the target follow-up question type of the text to be completed based on the pre-saved correspondence between each related keyword and the question-answer type and each follow-up question type.

[0168] In one possible implementation, if the analysis method used is a special text matching method, the analysis completion module 802 is specifically used to determine the target question type of the text to be completed based on the correspondence between the special texts and question types stored in the special text set if the text to be completed exists in a pre-saved special text set.

[0169] In one possible implementation, if there are multiple fused texts, the analysis and completion module 802 is specifically used to concatenate the third prompt text and each fused text in the large model to obtain a fourth target text. The third prompt text is used to prompt the large model to delete any unreasonable fused texts. The large model analyzes the rationality of each fused text in the fourth target text and, based on the analysis results corresponding to each fused text, deletes unreasonable fused texts to obtain candidate fused texts. If the number of candidate fused texts is 1, then the candidate fused text is determined as the target completion text of the text to be completed.

[0170] In one possible implementation, the analysis and completion module 802 is further configured to delete the first target text corresponding to the deleted fusion text if the number of candidate fusion texts is not 1, and continue to execute the step of obtaining the fusion text after fusing the text to be completed with each first target text.

[0171] Based on the above embodiments, this application also provides an electronic device. Figure 9 This application provides a schematic diagram of an electronic device structure, such as... Figure 9 As shown, it includes: processor 901, communication interface 902, memory 903 and communication bus 904, wherein processor 901, communication interface 902 and memory 903 communicate with each other through communication bus 904.

[0172] The memory 903 stores a computer program. When the program is executed by the processor 901, the processor 901 performs the following steps:

[0173] Obtain the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed;

[0174] Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed, wherein the target follow-up question type is either a result follow-up question or a question follow-up question.

[0175] The text to be completed, the target follow-up question type, the question and answer text of the preset round, and the first prompt text are input into the large model. The large model selects the first target text of the preset round from the question and answer text of the preset round according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text.

[0176] The large model selects the target fused text as the target completion text of the text to be completed based on the analysis results of the rationality of each fused text.

[0177] In one possible implementation, the processor 901 is further configured to: input the question-and-answer text of the preset round and the text to be completed into a classification model to obtain the target type of the text to be completed, wherein the target type is a type that needs to be completed or a type that does not need to be completed;

[0178] Determine whether the target type is a type that needs to be completed;

[0179] If so, then perform semantic analysis on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed.

[0180] In one possible implementation, the processor 901 is further configured to: perform semantic analysis on the text to be completed and the question-and-answer text of the preset rounds using each preset analysis method, and obtain the target follow-up question type corresponding to each analysis method;

[0181] The step of inputting the text to be completed, the target follow-up question type, the question-and-answer text of the preset round, and the first prompt text into the large model, and the large model selecting the target text of the preset round from the question-and-answer text of the preset round according to the target follow-up question type, includes:

[0182] The second target text is obtained by concatenating the text to be completed, each target question type, the question and answer text of the preset round, and the first prompt text.

[0183] The second target text is input into the large model, which performs semantic analysis on the second target text to determine the final follow-up question type corresponding to the text to be completed.

[0184] The large model selects the target text of the preset round from the question and answer text of the preset round according to the final follow-up question type.

[0185] In one possible implementation, if the analysis method used is model analysis, the processor 901 is further configured to: concatenate the second prompt text, the example text, the question and answer text of the preset round, and the text to be completed to obtain a third target text; wherein, the second prompt text is used to prompt the large model to confirm the target follow-up question type of the text to be completed;

[0186] The third target text is input into the large model, which performs semantic analysis on the third target text to determine the target question type of the text to be completed.

[0187] In one possible implementation, if the analysis method used is keyword matching, the processor 901 is further configured to: determine the target question-and-answer type corresponding to the question-and-answer text of the preset round based on the pre-saved correspondence between each keyword and the question-and-answer type;

[0188] Extract relevant keywords from the text to be completed;

[0189] Based on the pre-saved correspondence between each associated keyword and question-and-answer type and each follow-up question type, the target follow-up question type of the text to be completed is determined.

[0190] In one possible implementation, if the analysis method used is a special text matching method, the processor 901 is further configured to: if the text to be completed exists in a pre-saved special text set, determine the target question type of the text to be completed based on the correspondence between the special texts and question types stored in the special text set.

[0191] In one possible implementation, if there are multiple fused texts, the processor 901 is further configured to: concatenate the third prompt text and each fused text into a fourth target text, wherein the third prompt text is used to prompt the large model to delete unreasonable fused texts from all fused texts;

[0192] The large model analyzes the rationality of each fused text in the fourth target text, and based on the analysis results corresponding to each fused text, deletes unreasonable fused texts to obtain candidate fused texts;

[0193] If the number of candidate fusion texts is 1, then the candidate fusion text is determined as the target completion text of the text to be completed.

[0194] In one possible implementation, the processor 901 is further configured to: if the number of candidate fused texts is not 1, delete the first target text corresponding to the deleted fused text, and continue to execute the step of obtaining the fused text after fusing the text to be completed with each first target text respectively.

[0195] Since the text completion methods based on multi-turn dialogues that solve the problem described above are similar, the implementation of the above electronic devices can be found in the embodiments of the method, and repeated details will not be repeated.

[0196] The communication bus mentioned in the aforementioned electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not indicate that there is only one bus or one type of bus. The communication interface 902 is used for communication between the aforementioned electronic device and other devices. The memory can include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory can also be at least one storage device located remotely from the aforementioned processor.

[0197] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0198] Based on the above embodiments, this invention also provides a computer-readable storage medium storing a computer program executable by a processor. When the program runs on the processor, it causes the processor to perform the following steps:

[0199] Obtain the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed;

[0200] Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed, wherein the target follow-up question type is either a result follow-up question or a question follow-up question.

[0201] The text to be completed, the target follow-up question type, the question and answer text of the preset round, and the first prompt text are input into the large model. The large model selects the first target text of the preset round from the question and answer text of the preset round according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text.

[0202] The large model selects the target fused text as the target completion text of the text to be completed based on the analysis results of the rationality of each fused text.

[0203] In one possible implementation, the question-and-answer text of the preset round and the text to be completed are input into a classification model to obtain the target type of the text to be completed, wherein the target type is a type that needs to be completed or a type that does not need to be completed.

[0204] Determine whether the target type is a type that needs to be completed;

[0205] If so, then perform semantic analysis on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed.

[0206] In one possible implementation, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds using each preset analysis method to obtain the target follow-up question type corresponding to each analysis method;

[0207] The step of inputting the text to be completed, the target follow-up question type, the question-and-answer text of the preset round, and the first prompt text into the large model, and the large model selecting the target text of the preset round from the question-and-answer text of the preset round according to the target follow-up question type, includes:

[0208] The second target text is obtained by concatenating the text to be completed, each target question type, the question and answer text of the preset round, and the first prompt text.

[0209] The second target text is input into the large model, which performs semantic analysis on the second target text to determine the final follow-up question type corresponding to the text to be completed.

[0210] The large model selects the target text of the preset round from the question and answer text of the preset round according to the final follow-up question type.

[0211] In one possible implementation, if the analysis method used is model analysis, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds to determine the target follow-up question type of the text to be completed, including:

[0212] The second prompt text, the example text, the question and answer text of the preset round, and the text to be completed are concatenated to obtain the third target text; wherein, the second prompt text is used to prompt the large model to confirm the target follow-up question type of the text to be completed;

[0213] The third target text is input into the large model, which performs semantic analysis on the third target text to determine the target question type of the text to be completed.

[0214] In one possible implementation, if the analysis method used is keyword matching, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds to determine the target follow-up question type of the text to be completed, including:

[0215] Based on the pre-saved correspondence between each keyword and the question-and-answer type, the target question-and-answer type corresponding to the question-and-answer text of the preset round is determined;

[0216] Extract relevant keywords from the text to be completed;

[0217] Based on the pre-saved correspondence between each associated keyword and question-and-answer type and each follow-up question type, the target follow-up question type of the text to be completed is determined.

[0218] In one possible implementation, if the analysis method used is a special text matching method, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset number of rounds for a preset threshold number of times to obtain the target follow-up question types of the preset threshold, including:

[0219] If the text to be completed exists in a pre-saved special text set, then the target question type of the text to be completed is determined according to the correspondence between the special texts and question types stored in the special text set.

[0220] In one possible implementation, if there are multiple fused texts, the large model selects a target fused text as the target completion text for the text to be completed based on the analysis results of the reasonableness of each fused text, including:

[0221] The large model concatenates the third prompt text and each fused text to obtain the fourth target text. The third prompt text is used to prompt the large model to delete unreasonable fused text from all fused texts.

[0222] The large model analyzes the rationality of each fused text in the fourth target text, and based on the analysis results corresponding to each fused text, deletes unreasonable fused texts to obtain candidate fused texts;

[0223] If the number of candidate fusion texts is 1, then the candidate fusion text is determined as the target completion text of the text to be completed.

[0224] In one possible implementation, the method further includes:

[0225] If the number of candidate fused texts is not 1, delete the first target text corresponding to the deleted fused text, and continue to execute the step of obtaining the fused text after fusing the text to be completed with each first target text.

[0226] Since the principle of the computer-readable storage medium in solving the problem is similar to that of the text completion method based on multi-turn dialogue, the implementation of the computer-readable storage medium can be found in the embodiments of the method, and repeated details will not be described again.

[0227] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0228] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0229] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0230] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0231] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A text completion method based on multi-turn dialogue, characterized in that, The method includes: Obtain the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed; Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed, wherein the target follow-up question type is either a result follow-up question or a question follow-up question. The text to be completed, the target follow-up question type, the question and answer text of the preset round, and the first prompt text are input into the large model. The large model selects the first target text of the preset round from the question and answer text of the preset round according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text. The large model selects the target fused text as the target completion text of the text to be completed based on the analysis results of the rationality of each fused text. The semantic analysis of the text to be completed and the question-and-answer text of the preset rounds, to determine the target follow-up question type of the text to be completed, includes: Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds using each preset analysis method to obtain the target follow-up question type corresponding to each analysis method; The step of inputting the text to be completed, the target follow-up question type, the question-and-answer text of the preset round, and the first prompt text into the large model, and the large model selecting the target text of the preset round from the question-and-answer text of the preset round according to the target follow-up question type, includes: The second target text is obtained by concatenating the text to be completed, each target question type, the question and answer text of the preset round, and the first prompt text. The second target text is input into the large model, which performs semantic analysis on the second target text to determine the final follow-up question type corresponding to the text to be completed. The large model selects the target text of the preset round from the question and answer text of the preset round according to the final follow-up question type.

2. The method according to claim 1, characterized in that, After obtaining the text to be completed and the question-and-answer text from a preset number of rounds prior to the text to be completed, and before performing semantic analysis on the text to be completed and the question-and-answer text from the preset number of rounds prior to the text to be completed, the method further includes: The question-and-answer text of the preset round and the text to be completed are input into the classification model to obtain the target type of the text to be completed, wherein the target type is either the type that needs to be completed or the type that does not need to be completed. Determine whether the target type is a type that needs to be completed; If so, then perform semantic analysis on the text to be completed and the question-and-answer text of the preset round to determine the target follow-up question type of the text to be completed.

3. The method according to claim 1, characterized in that, If the analysis method used is model analysis, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds to determine the target follow-up question types of the text to be completed, including: The second prompt text, the example text, the question and answer text of the preset round, and the text to be completed are concatenated to obtain the third target text; wherein, the second prompt text is used to prompt the large model to confirm the target follow-up question type of the text to be completed; The third target text is input into the large model, which performs semantic analysis on the third target text to determine the target question type of the text to be completed.

4. The method according to claim 1, characterized in that, If the analysis method used is keyword matching, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds to determine the target follow-up question types of the text to be completed, including: Based on the pre-saved correspondence between each keyword and the question-and-answer type, the target question-and-answer type corresponding to the question-and-answer text of the preset round is determined; Extract relevant keywords from the text to be completed; Based on the pre-saved correspondence between each associated keyword and question-and-answer type and each follow-up question type, the target follow-up question type of the text to be completed is determined.

5. The method according to claim 1, characterized in that, If the analysis method used is a special text matching method, semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds for a preset threshold number of times to obtain the target follow-up question types of the preset threshold, including: If the text to be completed exists in a pre-saved special text set, then the target question type of the text to be completed is determined according to the correspondence between the special texts and question types stored in the special text set.

6. The method according to claim 1, characterized in that, If there are multiple fused texts, the large model selects target fused texts as target completion texts for the text to be completed based on the analysis results of the rationality of each fused text, including: The large model concatenates the third prompt text and each fused text to obtain the fourth target text. The third prompt text is used to prompt the large model to delete unreasonable fused text from all fused texts. The large model analyzes the rationality of each fused text in the fourth target text, and based on the analysis results corresponding to each fused text, deletes unreasonable fused texts to obtain candidate fused texts; If the number of candidate fusion texts is 1, then the candidate fusion text is determined as the target completion text of the text to be completed.

7. The method according to claim 6, characterized in that, The method further includes: If the number of candidate fused texts is not 1, delete the first target text corresponding to the deleted fused text, and continue to execute the step of obtaining the fused text after fusing the text to be completed with each first target text.

8. A text completion device based on multi-turn dialogue, characterized in that, The device includes: The acquisition module is used to acquire the text to be completed, and the question and answer text of the preset rounds preceding the text to be completed; The analysis and completion module is used to perform semantic analysis on the text to be completed and the question-and-answer text of the preset rounds, determine the target follow-up question type of the text to be completed, which is either a result follow-up question or a question follow-up question; input the text to be completed, the target follow-up question type, the question-and-answer text of the preset rounds, and the first prompt text into the large model, the large model selects the first target text of the preset rounds from the question-and-answer text of the preset rounds according to the target follow-up question type, and obtains the fused text after fusing the text to be completed with each first target text; based on the analysis results of the rationality of each fused text, the large model selects the target fused text as the target completion text of the text to be completed; The semantic analysis of the text to be completed and the question-and-answer text of the preset rounds, to determine the target follow-up question type of the text to be completed, includes: Semantic analysis is performed on the text to be completed and the question-and-answer text of the preset rounds using each preset analysis method to obtain the target follow-up question type corresponding to each analysis method; The step of inputting the text to be completed, the target follow-up question type, the question-and-answer text of the preset round, and the first prompt text into the large model, and the large model selecting the target text of the preset round from the question-and-answer text of the preset round according to the target follow-up question type, includes: The second target text is obtained by concatenating the text to be completed, each target question type, the question and answer text of the preset round, and the first prompt text. The second target text is input into the large model, which performs semantic analysis on the second target text to determine the final follow-up question type corresponding to the text to be completed. The large model selects the target text of the preset round from the question and answer text of the preset round according to the final follow-up question type.

9. An electronic device, characterized in that, The electronic device includes a processor that executes a computer program stored in a memory to implement the steps of the text completion method based on multi-turn dialogue as described in any one of claims 1-7.

Citation Information

Patent Citations

  • Task processing method and device, electronic equipment and computer readable storage medium

    CN116384360A