Response text generation method and device, storage medium and computer equipment

By dividing the user input text as the sub -problem text and processing separately, the problem of bias and low efficiency of large models in processing complex input texts was solved, and higher quality and high -efficiency response text generation was achieved.

CN119357361APending Publication Date: 2025-01-24CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411546693.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-31
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

When the current big model deals with complex input texts containing multiple problems, there are problems such as understanding deviation and low execution efficiency, especially in high load situations, which cannot return processing results in a timely manner, which seriously affects the user experience and system performance.

Method used

By dividing the user input text into smaller sub-question texts, and allocating computing resources to each sub-question text respectively, using a large model to generate sub-response texts, the final combination generates the target response text.

Benefits of technology

This method can more accurately locate and respond to each sub -problem, improve the quality of the system response, and improve the answering efficiency through parallel processing of different sub -problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357361A_ABST
    Figure CN119357361A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of internet and finance, and particularly discloses a response text generation method and device, a storage medium and computer device.The method comprises the steps that a text input by a user is obtained, the text input by the user is segmented through a preset text segmentation model, and at least one sub-question text is obtained according to the segmentation result, the preset text segmentation model comprises a text segmentation sub-model, and the text segmentation sub-model is obtained based on reinforcement learning framework training; allocating a first computing resource to each sub-question text, and generating a sub-response text corresponding to the sub-question text through a large model set in the first computing resource; and obtaining a target response text corresponding to the text input by the user according to the sub-response text of each sub-question text. According to the invention, each sub-question can be more accurately positioned and responded, and the response quality of the system can be effectively improved; in addition, the response efficiency of the system can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of Internet and financial technology, and in particular to a method and device for generating a response text, a storage medium, and a computer device. Background Art

[0002] With the rapid development of big model technology, the application scope of big models has now been widely penetrated into various fields, from natural language processing, image recognition to intelligent decision-making, and big models are promoting the progress of science and technology and society with unprecedented capabilities. However, as the application scenarios become increasingly complex, the challenges faced by big models are becoming increasingly prominent, especially in interactive answering scenarios such as widely used robot customer service and intelligent assistants. This challenge becomes particularly obvious.

[0003] For example, in the financial field, many users usually ask a large number of questions about various financial products through robot customer service, intelligent assistants, etc. because they do not understand financial products. Users input these financial product questions into the robot customer service or intelligent assistant, which can parse these questions through the big model and then give a reply. However, the current big model has a limit on the length of the input text sequence. When faced with complex input text containing multiple questions, direct processing may lead to misunderstandings and reduced execution efficiency. It may even fail to return processing results in time under high load conditions, seriously affecting user experience and system performance. Summary of the invention

[0004] In view of this, the present application provides a method and apparatus for generating a response text, a storage medium, and a computer device. By dividing the user input text into smaller sub-question texts, and then processing these sub-question texts separately, and finally generating a target response text according to the sub-response text corresponding to each sub-question text, each sub-question can be located and responded to more accurately, which can effectively improve the system's response quality; in addition, by responding to different sub-questions through different first computing resources, the system's response efficiency can be effectively improved.

[0005] According to one aspect of the present application, a method for generating a response text is provided, comprising:

[0006] Obtain user input text, and segment the user input text through a preset text segmentation model, and obtain at least one sub-question text according to the segmentation result, wherein the preset text segmentation model includes a text segmentation sub-model, and the text segmentation sub-model is trained based on a reinforcement learning framework;

[0007] Allocate a first computing resource to each sub-question text respectively, and generate a sub-answer text corresponding to the sub-question text through a large model set in the first computing resource;

[0008] According to the sub-answer texts of each of the sub-question texts, a target answer text corresponding to the user input text is obtained.

[0009] According to another aspect of the present application, a device for generating a response text is provided, comprising:

[0010] A text segmentation unit, used to obtain a user input text, and segment the user input text through a preset text segmentation model, and obtain at least one sub-question text according to the segmentation result, wherein the preset text segmentation model includes a text segmentation sub-model, and the text segmentation sub-model is obtained by training based on a reinforcement learning framework;

[0011] A sub-answer text generating unit, used to allocate a first computing resource to each sub-question text respectively, and generate a sub-answer text corresponding to the sub-question text through a large model set in the first computing resource;

[0012] The target answer text generating unit is used to obtain the target answer text corresponding to the user input text according to the sub-answer text of each sub-question text.

[0013] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned method for generating a response text is implemented.

[0014] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned method for generating a response text when executing the program.

[0015] By means of the above technical scheme, the present application provides a method and device for generating a response text, a storage medium, and a computer device. First, a user input text is obtained. After that, the user input text can be processed by a preset text segmentation model to obtain a segmentation result, and then one or more sub-question texts included in the user input text can be determined according to the segmentation result. For each sub-question text, a first computing resource can be allocated for it, and each first computing resource is pre-set with a large model. Then, a sub-response text is generated for the sub-question text sent to the first computing resource through the large model set on each first computing resource. Finally, according to all the sub-response texts, a target response text corresponding to the above user input text is generated. The embodiment of the present application divides the user input text into smaller sub-question texts, and then processes these sub-question texts separately, and finally generates a target response text according to the sub-response text corresponding to each sub-question text, which can more accurately locate and respond to each sub-question, and can effectively improve the response quality of the system; in addition, different sub-questions are answered by different first computing resources, which can effectively improve the response efficiency of the system.

[0016] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0018] Figure 1 A schematic diagram showing a flow chart of a method for generating a response text provided in an embodiment of the present application;

[0019] Figure 2 A schematic diagram of the structure of a device for generating a response text provided in an embodiment of the present application is shown;

[0020] Figure 3 A schematic diagram of the device structure of a computer device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0021] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0022] In this embodiment, a method for generating a response text is provided, such as Figure 1As shown, the method includes:

[0023] Step 101, obtain user input text, and segment the user input text through a preset text segmentation model, and obtain at least one sub-question text according to the segmentation result, wherein the preset text segmentation model includes a text segmentation sub-model, and the text segmentation sub-model is trained based on a reinforcement learning framework.

[0024] A method for generating a response text provided by an embodiment of the present application can quickly and accurately give a corresponding response text according to a user's question. First, obtain the user input text. Here, the user input text can be a text entered by the user in the question interface to express his or her own consulting needs. Afterwards, the user input text can be processed by a preset text segmentation model. The function of this model is to segment a complex user input text that may contain multiple questions into smaller, easier-to-process texts, and then obtain a segmentation result. After that, one or more sub-question texts included in the user input text can be determined based on the segmentation result, and each sub-question text is used to describe a question raised by the user. The preset text segmentation model may include a text segmentation sub-model, which is trained based on a reinforcement learning framework. Reinforcement learning is a machine learning technology that allows the model to learn how to achieve a goal by trying different actions. The goal here is to segment the user input text most accurately.

[0025] Step 102, allocate a first computing resource to each sub-question text respectively, and generate a sub-answer text corresponding to the sub-question text through a large model set in the first computing resource.

[0026] In this embodiment, for each sub-question text, a first computing resource can be allocated thereto. Here, the first computing resource can be a data processing device including components such as a processor, memory, and storage, which is used to perform subsequent sub-answer text generation tasks. It should be noted that a large model is pre-set on each first computing resource. Then, a sub-answer text is generated for the sub-question text sent to the first computing resource through the large model set on each first computing resource. Here, a large model refers to a model that has the ability to process complex language tasks and generate high-quality text.

[0027] Step 103: Obtain a target answer text corresponding to the user input text according to the sub-answer texts of each of the sub-question texts.

[0028] In this embodiment, finally, the target response text corresponding to the above user input text is generated based on all the sub-response texts. Specifically, all the sub-response texts can be directly spliced ​​according to the segmentation order of the sub-question texts to obtain the final target response text. Alternatively, based on all the sub-response texts, further logical integration or more complex natural language processing technology is performed on these sub-response texts to ensure that the final response text is both accurate and coherent, and then the target response text is obtained based on the processing results.

[0029] For example, a user inputs a user input text containing four financial product questions through a financial product consultation interface. Then, the user input text can be segmented by a preset text segmentation model, and four sub-question texts can be obtained according to the segmentation results. Each sub-question text is used to describe a user's consultation question about a financial product. After that, the first computing resources are allocated to the four sub-question texts. After each first computing resource receives the sub-question text, the sub-question text can be input into the large model, and the consultation question can be answered through the large model to obtain a sub-answer text. Finally, the entire answer text corresponding to the user input text can be obtained based on the four sub-answer texts.

[0030] By applying the technical solution of this embodiment, first, the user input text is obtained. After that, the user input text can be processed by a preset text segmentation model to obtain a segmentation result, and then one or more sub-question texts included in the user input text can be determined according to the segmentation result. For each sub-question text, a first computing resource can be allocated for it, and a large model is pre-set on each first computing resource. Then, through the large model set on each first computing resource, a sub-answer text is generated for the sub-question text sent to the first computing resource. Finally, according to all the sub-answer texts, the target answer text corresponding to the above-mentioned user input text is generated. The embodiment of the present application divides the user input text into smaller sub-question texts, and then processes these sub-question texts separately, and finally generates the target answer text according to the sub-answer text corresponding to each sub-question text, which can more accurately locate and respond to each sub-question, and can effectively improve the quality of the system's response; in addition, by responding to different sub-questions through different first computing resources, the system's response efficiency can be effectively improved.

[0031] In an embodiment of the present application, optionally, the preset text segmentation model also includes a text-vector conversion sub-model, and the text segmentation sub-model is trained based on the following method: define an environment space of an enhanced learning framework, wherein the environment in the environment space is a training sample text, and the state of the environment includes the current text position of the target action to be determined in the training sample text and a list of segmented sub-problem texts, and the initial state of the environment is the first character of the training sample text and an empty sub-problem text list; define an action space of the enhanced learning framework, wherein the action in the action space is a segmentation action or a continuation action at the current text position, and when the target action corresponding to the current text position is a segmentation action, the text from the previous segmentation point to the current text position is used as a new sub-problem text, the new sub-problem text is added to the sub-problem text list, and the state of the environment is updated to the next text position, and when the current text position When the corresponding target action is a continue action, the state of the environment is directly updated to the next text position; a state space of a reinforcement learning framework is defined, wherein the state representation in the state space is based on the vector representation corresponding to the text from the previous segmentation point to the current text position, and the vector representation is obtained by inputting the text from the previous segmentation point to the current text position into the text-vector conversion sub-model; a reward function of the reinforcement learning framework is defined, wherein if the target action is a segmentation action and the obtained sub-problem text is correct, a positive reward is given, if the target action is a segmentation action and the obtained sub-problem text is incorrect, a negative reward is given, and if the current sub-problem text is complete but the target action is determined to be a continue action, a negative reward is given; according to the environment space, the action space, the state space, the reward function and the preset training sample set, the initial segmentation sub-model is trained through the reinforcement learning framework to obtain the text segmentation sub-model.

[0032] In this embodiment, the preset text segmentation model includes not only the text segmentation submodel but also the text-vector conversion submodel, wherein the function of the text-vector conversion submodel is to convert the text into a vector representation for use in the reinforcement learning framework. Specifically, the text segmentation submodel is obtained by training based on the reinforcement learning framework. Before using the reinforcement learning framework, the environment space, action space, state space and reward function corresponding to the reinforcement learning framework can be defined first.

[0033] (1) Environment space. In reinforcement learning, the environment is the object with which the model interacts. Here, the environment is the training sample text, that is, the text data used to train the initial segmentation sub-model; the state of the environment includes the current text position of the target action to be determined in the training sample text and the list of segmented sub-problem texts; the initial state of the environment is the first character of the training sample text and an empty sub-problem text list.

[0034] (2) Action space. The actions in the action space refer to the actions that the text segmentation sub-model can perform in a given state. Here, there are two types of actions: segmentation actions and continuation actions. Among them, when the target action is a segmentation action, the text before the current text position (from the previous segmentation point to the current text position) is used as the new sub-problem text, the new sub-problem text is added to the sub-problem text list and the environment state is updated; when the target action is a continuation action, the segmentation is not performed, and the environment state is directly updated to the next text position.

[0035] (3) State space. In reinforcement learning, the state in the state space is usually converted into a numerical representation so that the model can process it. The converted numerical representation is the state representation. Here, the state representation is a vector representation based on the text from the previous segmentation point to the current text position. This vector representation is obtained by inputting the corresponding text into the text-to-vector conversion submodel.

[0036] (4) Reward function. The reward calculated by the reward function is the feedback obtained by the text segmentation sub-model after executing the action. Here, the reward function is used to evaluate the correctness of the segmentation action. Correct segmentation: If the target action is the segmentation action and the obtained sub-question text is correct, a positive reward is given; Incorrect segmentation: If the target action is the segmentation action but the obtained sub-question text is incorrect, a negative reward is given; Over-continuation: If the current sub-question text is complete but the target action is determined to be a continuation action, a negative reward is also given.

[0037] After defining the environment space, action space, state space and reward function of the reinforcement learning framework, the initial segmentation sub-model is trained through the reinforcement learning framework using a preset training sample set according to the defined environment space, action space, state space and reward function. During the training process, the model can try different action sequences and adjust its behavior according to the reward function to maximize the cumulative reward. Specifically, the reinforcement learning algorithm DQN can be used to train the initial segmentation sub-model, and the parameters of the initial segmentation sub-model can be adjusted according to the reward function so that actions that can obtain higher rewards can be selected in the future. Ultimately, the trained text segmentation sub-model can accurately generate a sub-question text list based on the user input text. The embodiment of the present application defines a complex reinforcement learning framework, uses a text-to-vector conversion sub-model to convert text into a vector representation, and guides the model to learn the correct segmentation strategy through a reward function, thereby training an efficient text segmentation sub-model, which is beneficial to the accuracy and efficiency of text segmentation.

[0038] In an embodiment of the present application, optionally, the method also includes: inputting the text from the previous segmentation point to the current text position into the text-to-vector conversion sub-model, performing word segmentation on the text through the word segmentation module of the text-to-vector conversion sub-model, and adding a text start mark and a text separation mark to the word segmentation result to obtain the marked word segmentation result, performing vector conversion on the marked word segmentation result to obtain an initial vector representation corresponding to the text; identifying a specific vector in the initial vector representation through the attention mechanism module in the text-to-vector conversion sub-model, and calculating the vector representation corresponding to the text based on the specific vector and the initial vector representation.

[0039] In this embodiment, first, the text from the last segmentation point to the current text position can be input into the text-to-vector conversion sub-model. The text-to-vector conversion sub-model includes a word segmentation module, which is used to segment the input text into smaller units, usually words or sub-words. Word segmentation is a basic step in natural language processing, which helps to convert the text into a form that the model can understand. After obtaining the word segmentation result, the word segmentation module can be used to add a text start marker (e.g. <cls>) and text separators (to distinguish different text paragraphs or sentences, such as <sep>). These tags can help the text-to-vector conversion sub-model understand the structure and boundaries of the text. The tokenized word segmentation results can go through a vector conversion process to convert each word segmentation into a fixed-length vector that can capture the semantic relationship between words. In this way, the text from the last segmentation point to the current text position is converted into a sequence of multiple vectors, which can be regarded as the initial vector representation of the text.

[0040] In addition, the text-to-vector conversion sub-model also contains an attention mechanism module. The attention mechanism module is a method that allows the text-to-vector conversion sub-model to focus on certain parts of the initial vector representation of the input, so that it can capture important information more accurately when processing complex tasks. In this process, the attention mechanism module can identify specific vectors in the initial vector representation, which can be vectors corresponding to important words or phrases in the text. Based on these specific vectors and the entire initial vector representation, the attention mechanism module can calculate a new vector representation that focuses more on the key information of the text while also retaining the overall structure of the text. Finally, the text-to-vector conversion sub-model outputs a vector representation that is an efficient, compact, and easy-to-process form of the input text for machine learning models.

[0041] The embodiments of the present application effectively convert text into a format suitable for processing by machine learning models by combining word segmentation, vector conversion and attention mechanism, providing strong support for various natural language processing tasks.

[0042] It should be noted that in the embodiment of the present application, the above-mentioned attention mechanism can be adjusted according to different consulting fields. For example, when the consulting field is the financial field, the above-mentioned attention mechanism can be pre-set according to the key words in the financial field. For example, the attention mechanism module can focus on identifying specific vectors of key words such as "annualized rate of return", "risk", "liquidity", "credit enhancement", "negative interest rate" in the initial vector representation, so that when the sub-response text is generated later, these parts can be focused on to generate target response questions that are more in line with user expectations.

[0043] In an embodiment of the present application, optionally, the method also includes: inputting the text from the previous segmentation point to the current text position into a preset semantic integrity verification model, performing part-of-speech analysis on the text through the preset semantic integrity verification model to obtain a first analysis result, and performing syntactic analysis on the text to obtain a second analysis result; determining a semantic integrity verification result of the text based on the first analysis result and the second analysis result, and judging whether the target action corresponding to the text is correct based on the semantic integrity verification result.

[0044] In this embodiment, each time after determining that the target action is a continue action, the text from the last segmentation point to the current text position can be input into a preset semantic integrity verification model. The preset semantic integrity verification model can be divided into two parts, one part is used to perform part-of-speech analysis on the input, and the other part is used to perform syntactic analysis on the input. After the input text is subjected to part-of-speech analysis, a first analysis result can be obtained. Part-of-speech analysis is a basic task in natural language processing, which aims to determine the part of speech (such as noun, verb, adjective, etc.) of each word in the text. The result of the part-of-speech analysis is crucial for understanding the grammatical structure and semantic relationship of the text. Through the part-of-speech analysis result, it can be determined whether the analyzed text is correct and complete in terms of part-of-speech composition. At the same time, after the input text is subjected to syntactic analysis, a second analysis result can be obtained. Syntactic analysis is another core task of natural language processing, which aims to determine the syntactic relationship between words in the text (such as subject-predicate-object relationship, attributive-adverbial relationship, etc.). The result of the syntactic analysis provides a deep understanding of the text structure. Through the syntactic analysis result, it can be determined whether the analyzed text is used correctly in terms of syntax. Through part-of-speech analysis and syntactic analysis, it can be determined whether the text is semantically complete. For example, if the first analysis result indicates that the part-of-speech of the text from the last segmentation point to the current text position is correct and complete, and the second analysis result indicates that the syntax is correct, then the text is semantically complete, otherwise, it is semantically incomplete.

[0045] Finally, based on the result of the semantic integrity check, determine whether the target action corresponding to the text is correct. If the semantic integrity check of the text passes and the target action is a segmentation action, the target action is judged to be correct; if the semantic integrity check of the text passes, but the target action is a continuation action, the target action is judged to be wrong; if the semantic integrity check of the text fails, but the target action is a segmentation action, the target action is judged to be wrong; if the semantic integrity check of the text fails and the target action is a continuation action, the target action is judged to be correct.

[0046] The embodiment of the present application effectively verifies the semantic integrity of the text by combining part-of-speech analysis, syntactic analysis and other steps to implement semantic integrity verification, and judges the correctness of the target action corresponding to the text based on this, which helps to improve the efficiency, accuracy and reliability of the natural language processing system.

[0047] In an embodiment of the present application, optionally, the step 101 of "segmenting the user input text by a preset text segmentation model, and obtaining at least one sub-question text according to the segmentation result" includes: segmenting the user input text by a preset text segmentation model to obtain multiple segmented sub-texts; determining the target text category corresponding to each segmented sub-text based on a preset text category detection model, wherein the text category includes interrogative sentences and non-interrogative sentences; sorting the segmented sub-texts according to the segmentation order, and sequentially identifying the text categories of the sorted segmented sub-texts; when the interrogative sentence is identified, extracting the segmented sub-text corresponding to the interrogative sentence and the segmented sub-text of the previous non-interrogative sentence as a sub-question text until the sorted segmented sub-text does not contain the interrogative sentence.

[0048] In this embodiment, first, the user input text is segmented using a preset text segmentation model. The function of this model is to divide the entire user input text into multiple relatively independent sub-texts, i.e., segmented sub-texts. Here, the segmented sub-text can be a sentence that expresses complete semantics, which can be a declarative sentence, a question sentence, or an exclamatory sentence, etc. For example, if the user input text is a long text, after segmentation by the preset text segmentation model, several semantically complete sentences can be obtained.

[0049] Next, the preset text category detection model is used to determine the target text category to which each segmented sub-text belongs. The text categories here include interrogative sentences and non-interrogative sentences. Interrogative sentences refer to sentences that express questions or inquiries; non-interrogative sentences are sentences that do not express questions, and may include statements, commands, exclamations, etc. The preset text category detection model determines the target text category of the segmented sub-text by analyzing the language features of the segmented sub-text. After determining the target text category of each segmented sub-text, the segmented sub-texts are sorted according to the segmentation order of the segmented sub-texts. After that, the sorted segmented sub-texts are traversed in order. When an interrogative sentence is identified, the segmented sub-texts of the current interrogative sentence and all the non-interrogative sentences before it are merged and extracted into a sub-question text. This process can be carried out until all segmented sub-texts are traversed and no interrogative sentences are included. Each extracted sub-question text contains a specific question asked by the user, and can also include background or premise information indicated by the non-interrogative sentences under the sub-question text.

[0050] For example, after segmenting the user input text, the obtained segmented sub-texts are A, D, E, B, and C, respectively, wherein the target text categories corresponding to A, D, and E are interrogative sentences, and the target text categories corresponding to B and C are non-interrogative sentences. These segmented sub-texts are sorted, and the order of the segmented sub-texts after sorting is A, B, C, D, and E. The sorted segmented sub-texts can be sequentially identified in text categories, and the recognition results of A, B, C, D, and E are interrogative sentences, non-interrogative sentences, non-interrogative sentences, interrogative sentences, and interrogative sentences. Then A can be extracted as a sub-question, B, C, and D can be extracted as a sub-question, and E can be extracted as a sub-question. The embodiment of the present application can quickly segment the user input text into multiple sub-question texts, which helps to process complex or lengthy user input and makes it easier to understand and process.

[0051] In an embodiment of the present application, optionally, after step 101, the method further includes: determining a target processing mode for the at least one sub-question text; when the target processing mode is a parallel processing mode, executing the step of respectively allocating a first computing resource to each sub-question text; when the target processing mode is a serial processing mode, allocating a second computing resource to the at least one sub-question text, and generating a sub-answer text corresponding to the first sub-question text through a large model set in the second computing resource; using the sub-answer text corresponding to the first sub-question text as a guide label for the second sub-question, generating a sub-answer text corresponding to the second sub-question text based on the second sub-question text and its corresponding guide label through the large model set in the second computing resource, continuing to use it as a guide label for the third sub-question text and answering the third sub-question text through the large model set in the second computing resource, until the sub-answer text corresponding to the last sub-question text is obtained; generating a target answer text corresponding to the user input text according to the sub-answer text corresponding to each of the at least one sub-question texts.

[0052] In this embodiment, before processing the sub-question texts, first, it is possible to determine how to process these sub-question texts. There are two processing methods: (1) Parallel processing method. The parallel processing method is to process all sub-question texts at the same time, that is, the processing of each sub-question text is independent and does not need to wait for the processing results of other sub-questions. (2) Serial processing method. The serial processing method is to process the sub-question texts one by one in sequence, that is, the processing of each sub-question depends on the processing result of the previous sub-question, or at least the processing of the previous sub-question is completed.

[0053] If parallel processing is selected, the following steps will be performed: an independent first computing resource is allocated to each sub-question text. These computing resources can be CPU cores, GPUs, TPUs or other computing units that are sufficient to support parallel processing of multiple sub-question texts. After that, each sub-question text is processed independently on its allocated first computing resource, and the corresponding sub-answer text is generated by calling the large model.

[0054] If the serial processing method is selected, the following steps will be performed: Allocate a unified second computing resource for all sub-question texts. This computing resource is sufficient to process sub-question texts one after another. In the process of generating sub-answer texts, for the first sub-question text, use the large model in the second computing resource to generate the sub-answer text corresponding to the first sub-question text. For subsequent sub-questions, the sub-answer text of the previous sub-question text is used as the "guide label" or context information of the next sub-question text. That is, when processing each sub-question in the subsequent sub-questions, the sub-answer text of the previous sub-question text is considered. In this way, the processing of each sub-question is based on the previous sub-question, forming a coherent answer process.

[0055] Regardless of the processing method used, all sub-answer texts corresponding to all sub-question texts are ultimately combined or integrated into a complete target answer text for the user input text. The embodiment of the present application selects a parallel or serial processing method and allocates appropriate computing resources according to the selected method, so that the system can efficiently generate a sub-answer text for each sub-question and finally integrate it into a complete target answer text, which can improve the flexibility of sub-question text processing and enable the selection of an appropriate target processing method according to actual needs.

[0056] In an embodiment of the present application, optionally, step 103 includes: splicing each sub-answer text according to the segmentation order of the sub-question text corresponding to each sub-answer text to obtain a spliced ​​answer text; verifying the spliced ​​answer text to obtain a target answer text corresponding to the user input text, wherein the verification processing includes at least one of connection processing, language style processing, logic processing and deduplication processing.

[0057] In this embodiment, after obtaining the sub-answer texts corresponding to each sub-question text, these sub-answer texts can be spliced ​​together according to the segmentation order of the sub-question texts corresponding to each sub-answer text to form a coherent, integrated answer text. During the splicing process, ensure that each sub-answer text is arranged according to the segmentation order of its corresponding sub-question text. In this way, the spliced ​​answer text can maintain a logical structure and information flow similar to the user input text. In addition, the goal of the splicing process is to generate a coherent, easy-to-understand answer text. Therefore, during the splicing process, the transition and connection between the sub-answer texts can be considered to ensure the fluency of the entire answer text.

[0058] Next, the spliced ​​response text is verified to further ensure the quality of the response text and generate the target response text corresponding to the final user input text. The verification process may include at least one of connection processing, language style processing, logic processing and deduplication processing. Among them, the connection processing mainly focuses on whether the connection between the sub-response texts is natural and smooth. Appropriate transition sentences or connectors can be added to enhance the overall coherence of the response text. Language style processing involves adjusting the language style of the response text to ensure that it meets the user's expectations or specific contextual requirements. For example, if the user expects a formal and professional answer, then the language style of the response text needs to be adjusted accordingly. It should be noted that user expectations can be directly extracted from the user input text. For example, the language style of the user input text can be directly analyzed, and the response text can be adjusted according to the semantic style obtained by the analysis; for another example, it can also be directly identified from the user input text whether the user has entered the language style requirements for the response text. If it is identified, the response text can be adjusted according to the identified language style, otherwise the default language style is directly used. Logical processing mainly checks and corrects the logical structure of the response text. It is necessary to ensure that the information in the response text is arranged in a reasonable logical order without logical jumps or contradictions. Deduplication mainly checks whether there is repeated information or sentences in the response text. If there is repeated content, it needs to be deleted or merged to avoid confusion or redundancy for readers.

[0059] Finally, the response text after splicing and verification will become the target response text corresponding to the user input text. This target response text should be a coherent, accurate answer that meets the user's expectations. The embodiment of the present application generates a final target response text through verification processing based on the sub-response texts corresponding to each sub-question text, which can improve the quality of the target response text and improve the user experience.

[0060] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a device for generating a response text, such as Figure 2 As shown, the device comprises:

[0061] A text segmentation unit, used to obtain a user input text, and segment the user input text through a preset text segmentation model, and obtain at least one sub-question text according to the segmentation result, wherein the preset text segmentation model includes a text segmentation sub-model, and the text segmentation sub-model is obtained by training based on a reinforcement learning framework;

[0062] A sub-answer text generating unit, used to allocate a first computing resource to each sub-question text respectively, and generate a sub-answer text corresponding to the sub-question text through a large model set in the first computing resource;

[0063] The target answer text generating unit is used to obtain the target answer text corresponding to the user input text according to the sub-answer text of each sub-question text.

[0064] Optionally, the preset text segmentation model further includes a text-vector conversion sub-model, and the text segmentation sub-model is trained based on the following method:

[0065] An environment space of a reinforcement learning framework is defined, wherein the environment in the environment space is a training sample text, the state of the environment includes the current text position of the target action to be determined in the training sample text and a list of segmented sub-problem texts, and the initial state of the environment is the first character of the training sample text and an empty sub-problem text list;

[0066] An action space of a reinforcement learning framework is defined, wherein the action in the action space is a segmentation action or a continuation action at the current text position, when the target action corresponding to the current text position is a segmentation action, the text from the last segmentation point to the current text position is used as a new sub-problem text, the new sub-problem text is added to the sub-problem text list, and the state of the environment is updated to the next text position, and when the target action corresponding to the current text position is a continuation action, the state of the environment is directly updated to the next text position;

[0067] Defining a state space of a reinforcement learning framework, wherein the state representation in the state space is based on a vector representation corresponding to the text from the last segmentation point to the current text position, and the vector representation is obtained by inputting the text from the last segmentation point to the current text position into the text-to-vector conversion submodel;

[0068] Define the reward function of the reinforcement learning framework, where a positive reward is given if the target action is a segmentation action and the obtained sub-question text is correct, a negative reward is given if the target action is a segmentation action and the obtained sub-question text is incorrect, and a negative reward is given if the current sub-question text is complete but the target action is determined to be a continuation action;

[0069] According to the environment space, the action space, the state space, the reward function and the preset training sample set, the initial segmentation sub-model is trained through a reinforcement learning framework to obtain the text segmentation sub-model.

[0070] Optionally, the device further comprises:

[0071] A word segmentation unit is used to input the text from the last segmentation point to the current text position into the text-to-vector conversion sub-model, perform word segmentation processing on the text through the word segmentation module of the text-to-vector conversion sub-model, and add a text start mark and a text separation mark to the word segmentation result to obtain the marked word segmentation result, and perform vector conversion on the marked word segmentation result to obtain the initial vector representation corresponding to the text;

[0072] The specific vector recognition unit is used to recognize the specific vector in the initial vector representation through the attention mechanism module in the text-vector conversion sub-model, and calculate the vector representation corresponding to the text based on the specific vector and the initial vector representation.

[0073] Optionally, the device further comprises a semantic integrity verification unit, wherein the semantic integrity verification unit is configured to:

[0074] A semantic integrity verification unit, configured to input the text from the last segmentation point to the current text position into a preset semantic integrity verification model, perform part-of-speech analysis on the text through the preset semantic integrity verification model to obtain a first analysis result, and perform syntactic analysis on the text to obtain a second analysis result;

[0075] A semantic integrity check result of the text is determined based on the first analysis result and the second analysis result, and whether a target action corresponding to the text is correct is judged based on the semantic integrity check result.

[0076] Optionally, the text segmentation unit is used to:

[0077] Segmenting the user input text using a preset text segmentation model to obtain a plurality of segmented sub-texts;

[0078] Based on a preset text category detection model, determine the target text category corresponding to each segmented sub-text, wherein the text category includes interrogative sentences and non-interrogative sentences;

[0079] The segmented sub-texts are sorted in the order of segmentation, and the sorted segmented sub-texts are sequentially identified with respect to text categories. When the interrogative sentence is identified, the segmented sub-text corresponding to the interrogative sentence and the segmented sub-text of the previous non-interrogative sentence are extracted as a sub-question text until the sorted segmented sub-text does not contain the interrogative sentence.

[0080] Optionally, the device further comprises:

[0081] A processing method determining unit, configured to segment the user input text, obtain at least one sub-question text according to the segmentation result, and then determine a target processing method for the at least one sub-question text;

[0082] A first execution unit, configured to execute the step of respectively allocating a first computing resource to each sub-question text when the target processing mode is a parallel processing mode;

[0083] A second execution unit is used to allocate a second computing resource to the at least one sub-question text when the target processing mode is a serial processing mode, and generate a sub-answer text corresponding to the first sub-question text through the large model set in the second computing resource; use the sub-answer text corresponding to the first sub-question text as a guide label for the second sub-question, and generate a sub-answer text corresponding to the second sub-question text based on the second sub-question text and its corresponding guide label through the large model set in the second computing resource, continue to use it as a guide label for the third sub-question text and answer the third sub-question text through the large model set in the second computing resource, until the sub-answer text corresponding to the last sub-question text is obtained; generate a target answer text corresponding to the user input text according to the sub-answer text corresponding to each of the at least one sub-question texts.

[0084] Optionally, the target response text generating unit is used to:

[0085] According to the segmentation order of the sub-question texts corresponding to the sub-answer texts, the sub-answer texts are concatenated to obtain a concatenated answer text;

[0086] The concatenated response text is verified to obtain a target response text corresponding to the user input text, wherein the verification process includes at least one of connection processing, language style processing, logic processing and deduplication processing.

[0087] It should be noted that for other corresponding descriptions of the functional units involved in the device for generating a response text provided in the embodiment of the present application, reference can be made to Figure 1 The corresponding description in the method will not be repeated here.

[0088] The present application also provides a computer device, which may be a personal computer, a server, a network device, etc. Figure 3 As shown, the computer device includes a bus, a processor, a memory and a communication interface, and may also include an input and output interface and a display device. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store location information. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.

[0089] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0090] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0091] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0092] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0093] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0094] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0095] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.< / sep> < / cls>

Claims

1. A method for generating a response text, characterized in that: include: Obtain user input text, and segment the user input text through a preset text segmentation model, and obtain at least one sub-question text according to the segmentation result, wherein the preset text segmentation model includes a text segmentation sub-model, and the text segmentation sub-model is trained based on a reinforcement learning framework; Allocate a first computing resource to each sub-question text respectively, and generate a sub-answer text corresponding to the sub-question text by using a large model set in the first computing resource; According to the sub-answer texts of each of the sub-question texts, a target answer text corresponding to the user input text is obtained.

2. The method according to claim 1, characterized in that The preset text segmentation model also includes a text-vector conversion sub-model, and the text segmentation sub-model is trained based on the following method: An environment space of a reinforcement learning framework is defined, wherein the environment in the environment space is a training sample text, the state of the environment includes the current text position of the target action to be determined in the training sample text and a list of segmented sub-problem texts, and the initial state of the environment is the first character of the training sample text and an empty sub-problem text list; An action space of a reinforcement learning framework is defined, wherein the action in the action space is a segmentation action or a continuation action at the current text position, when the target action corresponding to the current text position is a segmentation action, the text from the last segmentation point to the current text position is used as a new sub-problem text, the new sub-problem text is added to the sub-problem text list, and the state of the environment is updated to the next text position, and when the target action corresponding to the current text position is a continuation action, the state of the environment is directly updated to the next text position; Defining a state space of a reinforcement learning framework, wherein the state representation in the state space is based on a vector representation corresponding to the text from the last segmentation point to the current text position, and the vector representation is obtained by inputting the text from the last segmentation point to the current text position into the text-to-vector conversion submodel; Define the reward function of the reinforcement learning framework, where a positive reward is given if the target action is a segmentation action and the obtained sub-question text is correct, a negative reward is given if the target action is a segmentation action and the obtained sub-question text is incorrect, and a negative reward is given if the current sub-question text is complete but the target action is determined to be a continuation action; According to the environment space, the action space, the state space, the reward function and the preset training sample set, the initial segmentation sub-model is trained through a reinforcement learning framework to obtain the text segmentation sub-model.

3. The method according to claim 2, characterized in that The method further comprises: Input the text from the last segmentation point to the current text position into the text-to-vector conversion sub-model, perform word segmentation processing on the text through the word segmentation module of the text-to-vector conversion sub-model, add a text start mark and a text separation mark to the word segmentation result, obtain the marked word segmentation result, perform vector conversion on the marked word segmentation result, and obtain the initial vector representation corresponding to the text; The specific vector in the initial vector representation is identified through the attention mechanism module in the text-to-vector conversion sub-model, and the vector representation corresponding to the text is calculated based on the specific vector and the initial vector representation.

4. The method according to claim 2 or 3, characterized in that: The method further comprises: Inputting the text from the last segmentation point to the current text position into a preset semantic integrity verification model, performing part-of-speech analysis on the text through the preset semantic integrity verification model to obtain a first analysis result, and performing syntactic analysis on the text to obtain a second analysis result; A semantic integrity check result of the text is determined based on the first analysis result and the second analysis result, and whether a target action corresponding to the text is correct is judged based on the semantic integrity check result.

5. The method according to claim 1, characterized in that The method of segmenting the user input text by using a preset text segmentation model and obtaining at least one sub-question text according to the segmentation result includes: Segmenting the user input text using a preset text segmentation model to obtain a plurality of segmented sub-texts; Based on a preset text category detection model, determine the target text category corresponding to each segmented sub-text, wherein the text category includes interrogative sentences and non-interrogative sentences; The segmented sub-texts are sorted in the order of segmentation, and the sorted segmented sub-texts are sequentially identified with respect to text categories. When the interrogative sentence is identified, the segmented sub-text corresponding to the interrogative sentence and the segmented sub-text of the previous non-interrogative sentence are extracted as a sub-question text until the sorted segmented sub-text does not contain the interrogative sentence.

6. The method according to claim 1, characterized in that After segmenting the user input text and obtaining at least one sub-question text according to the segmentation result, the method further includes: Determining a target processing method for the at least one sub-question text; When the target processing mode is a parallel processing mode, executing the step of respectively allocating the first computing resource to each sub-question text; When the target processing mode is a serial processing mode, a second computing resource is allocated to the at least one sub-question text, and a sub-answer text corresponding to the first sub-question text is generated through the large model set in the second computing resource; the sub-answer text corresponding to the first sub-question text is used as a guide label for the second sub-question, and a sub-answer text corresponding to the second sub-question text is generated based on the second sub-question text and its corresponding guide label through the large model set in the second computing resource, and continues to be used as a guide label for the third sub-question text and the third sub-question text is answered through the large model set in the second computing resource, until the sub-answer text corresponding to the last sub-question text is obtained; according to the sub-answer text corresponding to each of the at least one sub-question text, a target answer text corresponding to the user input text is generated.

7. The method according to any one of claims 1 to 6, characterized in that The step of obtaining a target answer text corresponding to the user input text according to the sub-answer texts of each of the sub-question texts includes: According to the segmentation order of the sub-question texts corresponding to the sub-answer texts, the sub-answer texts are concatenated to obtain a concatenated answer text; The concatenated response text is verified to obtain a target response text corresponding to the user input text, wherein the verification process includes at least one of connection processing, language style processing, logic processing and deduplication processing.

8. A device for generating a response text, characterized in that: include: A text segmentation unit, used to obtain a user input text, and segment the user input text through a preset text segmentation model, and obtain at least one sub-question text according to the segmentation result, wherein the preset text segmentation model includes a text segmentation sub-model, and the text segmentation sub-model is obtained by training based on a reinforcement learning framework; A sub-answer text generating unit, used to allocate a first computing resource to each sub-question text respectively, and generate a sub-answer text corresponding to the sub-question text through a large model set in the first computing resource; The target answer text generating unit is used to obtain the target answer text corresponding to the user input text according to the sub-answer text of each sub-question text.

9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

10. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.