Response text generation method and device, storage medium and program product
By generating reference action sequences and instruction text to guide the language model, the problem of low accuracy in multi-turn interactions of question-answering models is solved, and response text generation that better meets user needs is achieved, thereby improving user experience and system adaptability.
Patent Information
- Application Number
- CN202411750577.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2044-11-30
AI Technical Summary
Existing question-answering models fail to effectively address users' actual needs in multi-round question interactions, resulting in low answer accuracy and a poor user experience.
By determining the relevance between the target question text and the reference question text, user feedback actions on the reference question and answer are collected, a reference action sequence is generated, and the language model is guided by the instruction text and reference text to generate the target response text to meet user satisfaction requirements.
It improved the accuracy of the question-answering model, ensured that the response text better met user needs, and enhanced the user experience and the system's intelligence and adaptability.
Smart Images

Figure CN119692469B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text generation, and more specifically, to a method and apparatus for generating response text, a storage medium, and a program product. Background Technology
[0002] In the field of text information retrieval, retrieval-enhanced generative techniques can be used to improve a model's understanding and ability to answer specific questions. After a user queries a question, information related to the question can be retrieved from a pre-established knowledge base. This retrieved information, along with the user's question, is then used as input to the generative model to obtain a more accurate and comprehensive answer.
[0003] In related technologies, when users ask multiple questions, the model generates responses based on the user's input of each question and information retrieved from a pre-built knowledge base as context input. While this improves the accuracy and richness of the answers, each round of question-and-answering is independent. When the questions in multiple rounds are related, it may fail to address the user's actual needs. For example, if a user explicitly triggers a negative evaluation with an answer to a question in a particular round, subsequent responses may still produce similar answers, leading to a poor user experience and a deviation from the user's actual needs. In other words, the question-and-answer models in these technologies suffer from low accuracy.
[0004] Regarding the relevant technologies, current question-answering models suffer from low accuracy, and no effective solution has yet been proposed. Summary of the Invention
[0005] This application provides a method and apparatus for generating response text, a storage medium, and a program product, to at least solve the technical problem that current question-answering models have low accuracy in related technologies.
[0006] According to one embodiment of this application, a method for generating response text is provided, comprising: determining at least one reference question text based on a target question text, wherein the target question text and the reference question text are related texts; determining reference actions corresponding to each of the at least one reference question text, and aggregating the reference actions to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; obtaining an instruction text based on the reference action sequence, and inputting the instruction text, the reference text, and the target question into a language model to obtain a target response text, wherein the instruction text is used to indicate the features of the reference response text where the satisfaction level reaches a preset threshold.
[0007] In an exemplary embodiment, the above-mentioned determination of at least one reference action corresponding to each reference question text and aggregation of the reference actions to obtain a reference action sequence includes: traversing the reference question texts and performing the following operations for each reference question text: obtaining at least one triggering operation of the response of the reference question text and the reference reply text, and using the triggering operation as the reference action corresponding to the reference question text; and using each reference action and the reference question text or reference reply text corresponding to each reference action as elements in the reference action sequence.
[0008] In an exemplary embodiment, obtaining the instruction text based on the reference action sequence includes: determining the satisfaction level of each reference action according to a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific value of the satisfaction level corresponding to the reference action; and inputting the satisfaction level of each reference action and the reference question text or reference response text corresponding to each reference action into a language model to obtain the instruction text.
[0009] In an exemplary embodiment, determining at least one reference question text based on the target question text includes at least one of the following: performing feature extraction on a set of historical question texts and the target question text to obtain reference text vectors corresponding to each of the historical question texts and a target text vector corresponding to the target question text; determining historical question texts corresponding to reference text vectors whose similarity to the target text vector exceeds a preset similarity threshold as reference question texts; and determining historical question texts belonging to the same dialogue as the target question text as reference question texts.
[0010] In an exemplary embodiment, before inputting the instruction text, reference text, and target question into the language model to obtain the target response text, the method includes: retrieving a candidate text set based on the target question text, identifying candidate texts in the candidate text set whose similarity to the target question text is greater than a preset threshold as candidate texts to be determined; sorting the candidate texts to be determined in descending order of their similarity to the target question text, and identifying the candidate texts to be determined at a preset number as reference texts.
[0011] In an exemplary embodiment, before retrieving the candidate text set based on the target question text, the process includes: parsing the candidate data set and retaining the candidate data in text form; segmenting the candidate data to obtain multiple text blocks of preset length; vectorizing the text blocks of preset length to obtain corresponding text vectors; and matching the candidate data with the corresponding text vectors and storing them as candidate text in the candidate text set.
[0012] In an exemplary embodiment, determining candidate texts from a set of candidate texts whose similarity to the target question text is greater than a preset threshold as candidate texts to be determined includes: performing keyword recognition matching on the target question text and the set of candidate texts to obtain the text relevance corresponding to each candidate text in the set of candidate texts; performing semantic recognition matching on the target question text and the set of candidate texts to obtain the semantic similarity score corresponding to each candidate text in the set of candidate texts; sorting each candidate text according to text relevance to obtain the text relevance ranking corresponding to each candidate text; and sorting each candidate text according to semantic similarity score to obtain the semantic similarity ranking corresponding to each candidate text. The process involves: ranking the candidate texts by their respective text relevance and semantic similarity scores; combining these scores to obtain a mixed ranking for each candidate text; determining the candidate texts that meet the preset mixed ranking position as the candidate texts to be determined; ranking the candidate texts to be determined by their similarity to the target question text from highest to lowest, and determining the candidate texts to be determined at the preset sequence number as the reference texts, including: weighted summing of the text relevance and semantic similarity scores for each candidate text to be determined to obtain their respective mixed similarity scores, ranking the candidate texts to be determined by their mixed similarity scores, and determining the candidate texts to be determined at the preset sequence number as the reference texts.
[0013] According to another embodiment of this application, a response text generation apparatus is provided, comprising: a reference question determination module, configured to determine at least one reference question text based on a target question text, wherein the target question text and the reference question text are related texts; a reference action determination module, configured to determine a reference action corresponding to each of the at least one reference question text, and aggregate the reference actions to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; and a response text generation module, configured to obtain an instruction text based on the reference action sequence, and input the instruction text, the reference text, and the target question into a language model to obtain a target response text, wherein the instruction text is used to indicate the characteristics of the reference response text where the satisfaction level reaches a preset threshold.
[0014] According to yet another embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to perform the steps in any of the above method embodiments when it is run.
[0015] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0016] According to yet another embodiment of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the methods in various embodiments of this application.
[0017] This application determines at least one reference question text based on the target question text, wherein the target question text and the reference question text are related texts; it determines reference actions corresponding to each of the at least one reference question text, and aggregates the reference actions to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; it obtains an instruction text based on the reference action sequence, and inputs the instruction text, reference text, and target question into a language model to obtain the target response text, wherein the instruction text is used to indicate the features of the reference response text whose satisfaction reaches a preset threshold. By using the user's reference actions to the reference response text of reference question texts similar to the target question text, the requirements for a response text with high satisfaction (i.e., instruction text) can be determined, and a target response text that conforms to the instruction text can be generated to obtain a response text with high satisfaction, thereby solving the technical problem of low accuracy in current question-answering models in related technologies. Attached Figure Description
[0018] Figure 1 This is a hardware structure block diagram of an optional response text generation method according to an embodiment of this application;
[0019] Figure 2 This is a flowchart of an optional response text generation method according to an embodiment of this application;
[0020] Figure 3 This is a schematic diagram of an optional response text generation method according to an embodiment of this application;
[0021] Figure 4 This is a schematic diagram of another optional response text generation method according to an embodiment of this application;
[0022] Figure 5 This is a schematic diagram of another optional response text generation method according to an embodiment of this application;
[0023] Figure 6 This is a structural block diagram of an optional response text generation apparatus according to an embodiment of this application. Detailed Implementation
[0024] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0026] Figure 1 This is a hardware structure block diagram of an optional response text generation method according to an embodiment of this application. For example... Figure 1 As shown, according to one aspect of the embodiments of this application, a method for generating response text is provided. As an optional implementation, the above-described response text generation method can be applied to, but is not limited to, [examples of other methods]. Figure 1 The hardware environment shown includes a response text generation system. This response text generation system may include, but is not limited to, terminal device 102, network 110, server 112, and database 114. Terminal device 102 runs a target client (e.g., ...). Figure 1 As shown, taking a client that can implement a question-and-answer system as an example. The terminal device 102 includes a display 108, a processor 106, and a memory 104. The display 108 can be used to display reply text and the question-and-answer system interface, and also to provide a human-computer interaction interface to receive human-computer interaction operations by touching different controls. The processor is used to generate interaction instructions in response to the above human-computer interaction operations and send the interaction instructions to the server to obtain reference question text. The memory is used to store reference action sequences, etc.
[0027] In addition, server 112 includes processing engine 116, which performs store or read operations on database 114. Specifically, processing engine 116 reads reference action sequences from database 114.
[0028] Assumption Figure 1 The terminal device 102 runs a client for unified management of building project models. The specific process in this embodiment is as follows: After obtaining the target question text input by the user, the terminal device 102 can execute step S102 to determine the reference question text based on the target question text. Then, it executes step S104 to determine the reference action corresponding to the reference question text and sends a reference action retrieval request to the server 112. The server 112 executes step S106 to send the reference action to the terminal device 102 via network 110. The terminal device 102 can execute steps S108 and S110 to aggregate the reference actions to obtain a reference action sequence, and obtain the instruction text based on the reference action sequence, thus obtaining the target response text.
[0029] Optionally, in this embodiment, the terminal device 102 can be a terminal device configured with a target client, which may include, but is not limited to, at least one of the following: mobile phone (such as Android phone, iOS phone, etc.), laptop computer, tablet computer, PDA, M1D (Mobile Internet Devices), PAD, desktop computer, smart TV, etc. The target client can be a question-and-answer system client, browser client, or other client that supports providing reply text generation tasks. The network may include, but is not limited to, wired networks and wireless networks. The wired network includes: local area network (LAN), metropolitan area network (MAN), and wide area network (WAN). The wireless network includes: Bluetooth, Wi-Fi, and other networks that enable wireless communication. The server may be a single server, a server cluster consisting of multiple servers, or a cloud server. The above is merely an example, and no limitation is made in this embodiment.
[0030] Optionally, in this embodiment, the above-described response text generation method can be applied to, but is not limited to, a conversational question-and-answer system. After the system receives the target question text input by the user, it can combine the reference actions corresponding to the reference question text in the user's current dialogue, use the reference actions to determine the user's satisfaction with different response texts, provide the characteristics of the response text that the user is more satisfied with, and generate the response text to the target question text based on the instruction text. This allows for real-time response to user feedback and dynamic adjustment of the language model's generation strategy, thereby providing more personalized, accurate, and efficient information retrieval and generation services. It improves the user experience and enhances the intelligence and adaptability of the artificial intelligence system.
[0031] The above use cases are merely examples. Any scenario related to generating response text can utilize the solution of this application. This embodiment does not impose any limitations on this.
[0032] This application determines at least one reference question text based on the target question text, wherein the target question text and the reference question text are related texts; it determines reference actions corresponding to each of the at least one reference question text, and aggregates the reference actions to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; it obtains an instruction text based on the reference action sequence, and inputs the instruction text, reference text, and target question into a language model to obtain the target response text, wherein the instruction text is used to indicate the features of the reference response text whose satisfaction reaches a preset threshold. By using the user's reference actions to the reference response text of reference question texts similar to the target question text, the requirements for a response text with high satisfaction (i.e., instruction text) can be determined, and a target response text that conforms to the instruction text can be generated to obtain a response text with high satisfaction, thereby solving the technical problem of low accuracy in current question-answering models in related technologies.
[0033] This embodiment provides a method for generating response text. Figure 2 This is a flowchart of an optional response text generation method according to an embodiment of this application, such as... Figure 2 As shown, the method for generating the response text includes:
[0034] Step S202: Determine at least one reference question text based on the target question text, wherein the target question text and the reference question text are related texts;
[0035] Step S204: Determine the reference action corresponding to at least one reference question text, and aggregate the reference actions to obtain a reference action sequence, wherein the reference action is used to indicate the user's satisfaction with the reference response text corresponding to the reference question;
[0036] Step S206: Obtain instruction text based on reference action sequence, and input instruction text, reference text and target question into language model to obtain target response text, wherein instruction text is used to indicate the features of reference response text that indicate satisfaction reaches a preset threshold.
[0037] It should be noted that when users use the question-and-answer system, they can input the target question text into the system, hoping that the system can generate a suitable target answer text based on the target question text.
[0038] In an optional implementation, after determining the target response text, it is necessary to determine the user's level of satisfaction with the response text in order to generate a target response text that satisfies the user. Therefore, it is necessary to obtain a reference question text, which is a question that has semantic similarity to the target question text. The target question text and the reference question text can be regarded as question texts in the same domain.
[0039] It's important to note that the generation of the reference action sequence is based on user feedback to previous reference question texts and their generated responses. These feedback actions can be direct user behaviors, such as liking / disliking, or indirect user behaviors, such as copying the question, clicking a link in a cited document, or asking again. The purpose of the reference action sequence is to quantify user satisfaction with the reference response text and provide guidance for the next step of generating the target response text.
[0040] In an optional implementation, the system continuously monitors and records all user behaviors during interactions with the system, including reactions to specific responses and subsequent actions related to those responses. User feedback is categorized into different action types, each with its specific meaning. For example, copying a question might indicate a user's doubt about the current response, while a "like" indicates satisfaction with the response. The system sorts all collected reference actions chronologically or by importance, forming a reference action sequence that describes the user's attitudes and behavioral patterns towards reference questions and their responses.
[0041] In one example, taking the reference question "Why is city A an important city?" as an example, suppose a user browses text about the historical importance of city A and copies part of it, which can be interpreted as the user being interested in historical information. Later, the user likes an answer about the economic impact of city A, indicating that the user is satisfied with the answer. The system aggregates these feedback behaviors (copying, liking) into a reference action sequence for guiding subsequent model input.
[0042] It should be noted that the system uses the reference action sequences collected in the first two steps to generate instruction text. This instruction text can be seen as a summary, outlining the user's preferences and likes regarding the reference questions and answers. Subsequently, the instruction text, along with the target question text and the reference text, guides the model to generate the target response text based on the user's interests and satisfaction levels.
[0043] In an optional implementation, the system analyzes a reference action sequence to identify the user's preferences for specific topics or information types. For example, if a user shows interest in content related to historical and economic impacts during browsing, the instruction text might contain information such as "the user prefers a comprehensive answer that includes historical and economic details." The instruction text, reference text, and target question text are integrated into an optimized input Prompt to guide the language model's response generation. This process ensures that the model fully considers the user's personalized needs and satisfaction criteria when generating the target response text.
[0044] It should be noted that the reference text can be text retrieved by the system from the knowledge base. The knowledge base and retrieval process will be explained later and will not be repeated here.
[0045] This application determines at least one reference question text based on the target question text, wherein the target question text and the reference question text are related texts; it determines reference actions corresponding to each of the at least one reference question text, and aggregates the reference actions to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; it obtains an instruction text based on the reference action sequence, and inputs the instruction text, reference text, and target question into a language model to obtain the target response text, wherein the instruction text is used to indicate the features of the reference response text whose satisfaction reaches a preset threshold. By using the user's reference actions to the reference response text of reference question texts similar to the target question text, the requirements for a response text with high satisfaction (i.e., instruction text) can be determined, and a target response text that conforms to the instruction text can be generated to obtain a response text with high satisfaction, thereby solving the technical problem of low accuracy in current question-answering models in related technologies.
[0046] In an optional implementation, the above-mentioned determination of at least one reference action corresponding to each reference question text and aggregation of the reference actions to obtain a reference action sequence includes: traversing the reference question texts and performing the following operations for each reference question text: obtaining at least one triggering operation of the response of the reference question text and the reference reply text, and using the triggering operation as the reference action corresponding to the reference question text; and using each reference action and the reference question text or reference reply text corresponding to each reference action as elements in the reference action sequence.
[0047] It's important to note that the system iterates through each reference question text and its corresponding reference answer text to capture user feedback actions during interaction with these texts. These feedback actions can be directly expressed through interface operations or indirectly inferred from user behavior. The system associates each feedback action with the corresponding reference question or answer text, forming a series of elements that ultimately constitute a reference action sequence. This reference action sequence reflects the user's satisfaction and interests with different reference texts and answers, providing crucial information for subsequent analysis and the generation of personalized responses.
[0048] In an optional implementation, the system first iterates through the list of reference question texts to ensure that each reference question text is included in the analysis. For each reference question text, the system collects all user-related triggering actions. Triggering actions include, but are not limited to, explicit actions (such as liking or disliking) and implicit actions (such as copying the question, clicking the referenced document link, or asking again). These actions can directly or indirectly reflect the user's feedback and preferences on the current reference question and answer. The system associates each acquired triggering action with the corresponding reference question text or reference answer text. For example, if a user likes the answer to a reference question text about the history of City A, then this liking action will be marked as an action related to the reference answer text about the history of City A. After collecting all triggering actions and associating them with the corresponding texts, the system constructs a reference action sequence. This sequence consists of a series of elements, each containing a reference action and its corresponding reference question text or reference answer text. The elements are ordered by time or importance, forming an ordered sequence for easy subsequent analysis and processing.
[0049] In one example, suppose a user interacts with the system regarding the target question, "Why is City A an important city?" The system provides the user with several reference question texts and their corresponding answers, including explanations from different perspectives such as City A's history, economic impact, and cultural status. During this process, the user "likes" the answer to the reference question text about City A's history, reflecting their interest in historical information; while copying the answer regarding economic impact may indicate that the user wants to further research or use this information. The system associates these user feedback actions (likes, copies) with the corresponding reference question texts or reference answer texts. For example, a "like" action is associated with the reference answer text about City A's history, and a "copy" action is associated with the reference answer text about economic impact. Next, the system constructs a sequence of reference actions, containing elements such as "like - historical information text" and "copy - economic impact text." The system can then adjust the input of the Large Language Model (LLM) based on the user's preferences for historical and economic information, generating answers that better suit the user's needs.
[0050] In an optional implementation, when the system displays the model-generated results based on the question to the user, it monitors the user's subsequent actions in real time. This includes, but is not limited to, whether the user directly likes / dislikes the current result, clicks on links to cited documents within the result for further reading, copies the question or result to other areas or asks a follow-up question, and asks a new question. These user actions constitute a series of behavioral feedback, which the system records as an action sequence, where each element of the sequence is an `act`. i(i = 1, 2, ..., N) represents a specific action of the user after seeing the model-generated result. After collecting the user's action sequence, the system analyzes it to identify the user's implicit satisfaction with the current model-generated result. Each action sequence element (act) i All actions are considered feedback to the current result. Direct likes or dislikes provide a clear satisfaction score, while actions such as clicking on cited documents, copying questions or results, asking again, or raising new questions implicitly indicate the user's interest and need for specific information or topics. For example, if a user clicks on a cited document about the history of City A, it may indicate that the user is interested in historical information, but the currently generated result may not fully meet their needs, thus triggering further exploration. To transform the user's implicit feedback behavior into a quantitative assessment of satisfaction with the model results, the system analyzes the action sequence element `act`. i The relevance between the generated results and the user's actions. For example, if a user clicks multiple times on a referenced document about a specific topic, this can be interpreted as a deep interest in that topic. The system quantifies user satisfaction by counting the frequency of clicks on a particular type of information. Similarly, a user copying a question or result elsewhere may indicate the usefulness and relevance of the current information, while asking a new question or requesting a follow-up question may suggest dissatisfaction with the current result and a need for a more detailed or different perspective. Each action sequence element of the user... i These actions are considered real-time feedback to the system's generated content, and the system dynamically adjusts its model generation strategy based on them. For example, if the system detects that a user has repeatedly clicked on references to documents about the economy of City A, it will understand the user's interest in economic information and increase the weight of such information in subsequent model inputs to generate richer and more detailed economic-related responses. This real-time response and model guidance mechanism ensures that the system can quickly adapt to changes in user needs and provide more personalized and accurate information services.
[0051] The above-described implementation method of this application effectively collects and analyzes user feedback behavior after seeing the results generated by the current problem model, transforming this implicit feedback into an analysis and quantification of satisfaction with the system-generated content. This, in turn, guides the model to generate higher-quality results that better meet user expectations and interests. This mechanism is particularly suitable for scenarios requiring a deep understanding of user needs and feedback, such as intelligent customer service, personalized search engines, and conversational AI, and can significantly improve user experience and system performance.
[0052] In an optional implementation, obtaining the instruction text based on the reference action sequence includes: determining the satisfaction level of each reference action according to a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific value of the satisfaction level corresponding to the reference action; and inputting the satisfaction level of each reference action and the reference question text or reference response text corresponding to each reference action into a language model to obtain the instruction text.
[0053] It's important to note that an action satisfaction mapping table needs to be established in the early stages of system design. This table lists various user feedback actions (such as liking, disliking, clicking on a referenced document, copying a question or result, etc.) and their corresponding satisfaction values. The satisfaction value can be a real number within a range, used to quantify the user's level of liking for a specific referenced answer or question. For example, a liking might correspond to a high satisfaction value, while a disliking might correspond to a low satisfaction value, and clicking on a referenced document might be considered a moderate satisfaction, as this indicates that the user is interested in the information but may need more details. After collecting the user's feedback action sequence for the referenced question text and answer, the system will map each action... i (i = 1, 2, ..., N) are compared with a pre-defined action satisfaction mapping table to determine their specific satisfaction values. This process transforms implicit user feedback into quantifiable satisfaction indicators, facilitating subsequent analysis and processing. Each action in the reference action sequence is then compared... i The user's satisfaction score, along with the associated reference question or response text, is input into a Language Model (LLM). Based on the satisfaction scores for each reference action and the associated question or response text, the LLM generates an instruction text. This instruction text integrates the user's satisfaction feedback with the referenced content, as well as the types of topics or information the user might be interested in.
[0054] In an optional implementation, suppose the system presents the user with a series of answers to the question "Why is City A an important global city?", including information about City A's history, economy, culture, etc. User behavior is as follows: (1) The user likes the reference answer text about City A's history, expressing high satisfaction. (2) The user clicks on the reference answer text about economic impact, showing moderate satisfaction, indicating that the user is interested in economic information but may need more in-depth explanation. (3) The user copies part of the answer content about City A's culture, also showing moderate satisfaction, which may mean that the user is interested in cultural information.
[0055] Based on a pre-defined action satisfaction mapping table, the system considers "likes" as high satisfaction (e.g., a satisfaction score of 0.9), clicking on a cited document as medium satisfaction (e.g., a satisfaction score of 0.6), and copying content as medium satisfaction (e.g., a satisfaction score of 0.7). The system then inputs these satisfaction scores and related reference question or response text into the LLM (Local Management System).
[0056] LLM generates instruction text based on the input information. This text might include: "Users prefer content with detailed historical background information, are interested in a comprehensive explanation of economic and cultural impacts, and prefer in-depth and practical content." This instruction text is then used to guide the generation of the user's final answer to the original question, "Why is City A an important global city?" This ensures that the generated content covers the user's areas of interest more comprehensively and deeply, while avoiding duplicate or irrelevant information, thereby improving user satisfaction.
[0057] By implementing the above-described methods of this application, user feedback behavior is transformed into quantifiable satisfaction values. These values, along with relevant text, guide the language model to generate instruction text. This effectively helps to understand users' preferences for reference content and guides the system to generate higher-quality content that better meets user needs and interests. This contributes to improving the user experience and overall system performance.
[0058] In an optional implementation, determining at least one reference question text based on the target question text includes at least one of the following: extracting features from a set of historical question texts and the target question text to obtain reference text vectors corresponding to each historical question text and a target text vector corresponding to the target question text; determining historical question texts corresponding to reference text vectors whose similarity to the target text vector exceeds a preset similarity threshold as reference question texts; and determining historical question texts belonging to the same dialogue as the target question text as reference question texts.
[0059] It should be noted that the historical question text set can be the user's historical question text stored in the memory of the server or terminal device. The system can extract features from the historical question text set and the target question text, converting the text data into vector form. Then, the system can calculate the similarity between each reference text vector and the target text vector. The similarity calculation can use cosine similarity, Euclidean distance, or more complex semantic similarity algorithms. The system will filter the calculated similarity scores according to a preset similarity threshold. If the similarity score between a reference text vector and the target text vector exceeds the preset threshold, then the corresponding "historical question text" will be identified as "reference question text". This filtering process ensures that the reference question text and the target question text have a certain semantic relevance, providing the system with valuable contextual information and assisting in generating answers that are closer to the user's needs.
[0060] In another optional implementation, the system will pay special attention to historical question texts that belong to the same dialogue chain as the target question text. This strategy, based on dialogue context analysis, aims to ensure that the system fully understands the background and context of the user's query and provides a coherent and in-depth answer. The specific implementation steps are as follows: The system determines which historical question texts belong to the same dialogue or query chain as the current target question text by examining information such as the timestamp, user ID, and dialogue ID of the historical question texts. Historical question texts belonging to the same dialogue as the target question text are identified as reference question texts. These texts provide the dynamic background and trends of the user's query, helping the system understand the evolution of the user's needs.
[0061] Through the embodiments described above in this application, the system can comprehensively consider semantic similarity and dialogue context to determine a series of reference question texts that are related to the target question text and can provide additional information and context. These reference question texts will be further used to guide the language model generation process to generate more comprehensive and personalized responses.
[0062] In an optional implementation, before inputting the instruction text, reference text, and target question into the language model to obtain the target response text, the process includes: retrieving a candidate text set based on the target question text, identifying candidate texts in the candidate text set whose similarity to the target question text is greater than a preset threshold as candidate texts to be determined; sorting the candidate texts to be determined in descending order of their similarity to the target question text, and identifying the candidate texts to be determined at a preset number as reference texts.
[0063] It's important to note that "inputting the instruction text, reference text, and target question into the language model to obtain the target response text" is the core of generating personalized and high-quality answers. However, prior to this core step, effectively retrieving and filtering the candidate text set to identify the most relevant reference text is indispensable preliminary work to ensure the accuracy and relevance of the generated text content. The following is one implementation method that details how to determine reference texts through the retrieval and ranking of candidate texts before inputting information into the language model.
[0064] The system first establishes a candidate text set. During the retrieval process, the system calculates the similarity score between each candidate text and the target question text, typically using vector distance (such as cosine similarity) or a specific text matching algorithm. If the similarity score between a candidate text and the target question text exceeds a preset similarity threshold, the candidate text is considered relevant to the target question and is thus identified as a "candidate text to be determined." The system further sorts the candidate texts to be determined based on their similarity scores with the target question text, from highest to lowest. This sorting process helps the system prioritize candidate texts that are most relevant to the target question and best supplement or enhance the context of the target question. After sorting, the system selects reference texts according to a preset numbering rule. Specifically, the system selects the candidate text to be determined that is located at a preset number position in the sorted list. This preset number can be set based on experience or dynamically adjusted by user needs or system strategies. The selected candidate texts, namely those that are located at the preset sequence number and have a high degree of similarity to the target question text, will be officially designated as "reference texts" for use in the subsequent generation process.
[0065] Through the above-described implementation methods of this application, by retrieving, filtering, and sorting candidate texts, the system can effectively identify and determine the reference texts most relevant to the target question, providing accurate contextual information for the subsequent generation process. This mechanism is a key step in ensuring that the generated answers meet user needs while maintaining high quality. It is particularly suitable for scenarios that require processing large amounts of text data and conducting in-depth semantic analysis. The system can generate personalized responses based on more comprehensive and relevant knowledge and information, significantly improving user experience and interaction efficiency.
[0066] In an optional implementation, before retrieving the candidate text set based on the target question text, the process includes: parsing the candidate data set and retaining the candidate data in text form; segmenting the candidate data to obtain multiple text blocks of preset length; vectorizing the text blocks of preset length to obtain corresponding text vectors; and matching the candidate data with the corresponding text vectors to store the candidate text in the candidate text set.
[0067] Figure 3 This is a schematic diagram of an optional response text generation method according to an embodiment of this application; as shown... Figure 3 As shown, in an optional implementation, the system first performs data parsing on the candidate data set. This is the process of converting various forms of data (such as PDF documents, Word files, and content scraped from web pages) into a unified text format. The purpose of data parsing is to retain the information in the text format, remove unnecessary formatting, images, or tables, and ensure that subsequent processing steps can focus on the text content itself, rather than its presentation. The parsed text data is further divided into multiple text blocks of preset length. This segmentation process helps control the size of each text block, ensuring that they contain sufficient contextual information and can be efficiently computed and stored in subsequent vectorization processing.
[0068] It should be noted that the preset text block length can be flexibly set according to specific application scenarios, user needs, or system resource limitations, typically ranging from hundreds to thousands of words. In one example, the text block can be set to 1 to 1024 tokens, but is generally set to 128 tokens.
[0069] Each text block of a preset length is then vectorized. This process uses semantic encoding models such as BERT, TF-IDF (Term Frequency-Inverse Document Frequency), or others to convert the text block into a numerical vector. Numerical vectors capture the semantic features of the text, facilitating subsequent similarity calculations and retrieval operations. Vectorization is a common text representation method in machine learning and natural language processing, converting natural language text into a numerical form easily processed by computers. Finally, the system matches the vectorized text blocks with the original candidate data, forming "text block-vector" pairs. These pairs are stored as a candidate text set. During storage, the system ensures that the text vectors are closely associated with their corresponding original texts, so that the original text content can be quickly located when relevant vectors are retrieved. The construction and storage of the candidate text set provides rich, diverse, and semantically clear data resources for subsequent retrieval and generation processes.
[0070] Through the above-described implementation methods of this application, including preprocessing steps such as data parsing, text block segmentation, vectorization, and candidate text set construction, the system can build a structured, semantically clear, and easily searchable data resource library. This mechanism not only improves data processing efficiency but also ensures the accuracy and relevance of subsequent retrieval and generation processes, making it particularly suitable for scenarios requiring the processing of large amounts of text data and deep semantic analysis, such as intelligent customer service and personalized search engines. Through a carefully designed preprocessing workflow, the system can generate personalized answers based on the highest quality and most relevant data, significantly enhancing user experience and interaction.
[0071] In an optional implementation, determining candidate texts from the candidate text set whose similarity to the target question text is greater than a preset threshold as candidate texts to be determined includes: performing keyword recognition and matching on the target question text and the candidate text set to obtain the text relevance corresponding to each candidate text in the candidate text set; performing semantic recognition and matching on the target question text and the candidate text set to obtain the semantic similarity score corresponding to each candidate text in the candidate text set; sorting each candidate text according to text relevance to obtain the text relevance ranking corresponding to each candidate text; and sorting each candidate text according to semantic similarity score to obtain the semantic similarity ranking corresponding to each candidate text. The process involves: ranking the candidate texts by their respective text relevance and semantic similarity scores; combining these scores to obtain a mixed ranking for each candidate text; determining the candidate texts that meet the preset mixed ranking position as the candidate texts to be determined; ranking the candidate texts to be determined by their similarity to the target question text from highest to lowest, and determining the candidate texts to be determined at the preset sequence number as the reference texts, including: weighted summing of the text relevance and semantic similarity scores for each candidate text to be determined to obtain their respective mixed similarity scores, ranking the candidate texts to be determined by their mixed similarity scores, and determining the candidate texts to be determined at the preset sequence number as the reference texts.
[0072] Figure 4 This is a schematic diagram of an optional response text generation method according to an embodiment of this application; as shown... Figure 4 As shown, for the target question text input by the user, keyword retrieval and semantic retrieval knowledge base (candidate text set) can be used to obtain text relevance ranking and semantic similarity ranking results. The text relevance ranking and semantic similarity ranking are then fused using reciprocal ranking to obtain a mixed ranking result. The above is the coarse ranking process, which obtains candidate texts to be determined. Subsequently, the candidate texts to be determined are calculated using mixed similarity and ranked according to mixed similarity. The candidate texts with preset sequence numbers are determined as reference texts.
[0073] In an optional implementation, the system first performs keyword recognition on the target question text and the candidate text set. This process involves extracting key information points from the text, such as entities, events, and topic words, to identify commonalities in the themes and content of these texts. Subsequently, the system calculates the text relevance between the target question text and each candidate text. The relevance score reflects the degree of matching between the two at the keyword and topic levels. Texts with higher relevance scores are more likely to contain the information required by the target question. The system sorts each candidate text according to its text relevance from high to low, forming a sorted list based on text relevance. In parallel, the system can perform deeper semantic recognition and matching, using models such as BERT, TF-IDF, or other semantic encoding models to calculate the semantic similarity score between the target question text and candidate texts. The semantic similarity score considers the context and semantics of the text, assessing the semantic closeness of two texts, and is at a higher level than the text relevance score. The system also sorts each candidate text according to its semantic similarity score, forming a sorted list based on semantic similarity.
[0074] In an optional implementation, to comprehensively consider keyword matching and semantic similarity, the system combines the text relevance ranking and semantic similarity ranking results to generate a hybrid ranking of the candidate texts. This combination process may involve weighted summation, ranking fusion algorithms, or other statistical methods to ensure that the final ranking result reflects the comprehensive relevance of the candidate texts at both the keyword matching and semantic understanding levels. Based on the hybrid ranking result, the system sets a preset hybrid ranking position as a threshold. Only candidate texts that meet or exceed this preset position are identified as "candidate texts to be determined" and proceed to the next step of detailed screening.
[0075] In an optional implementation, after identifying the candidate texts to be determined, the system performs a more detailed similarity calculation on these texts. Specifically, the system weights and sums the text relevance and semantic similarity scores of each candidate text to obtain its corresponding mixed similarity score. The mixed similarity score is a comprehensive indicator that considers both keyword matching and semantic similarity, providing a more comprehensive evaluation of the text's relevance to the target question. The system then sorts the candidate texts to be determined according to their mixed similarity scores, from highest to lowest, to identify the text most relevant to the target question. The system assigns a preset number; candidate texts at this preset number are ultimately designated as "reference texts" for use in subsequent generation processes.
[0076] Through the above-described embodiments of this application, by implementing strategies such as keyword recognition, semantic recognition, hybrid sorting, and preset threshold filtering, the system can effectively filter out reference texts highly relevant to the target question from a large number of candidate texts, laying a solid foundation for generating high-quality, personalized answers. By comprehensively considering keyword matching and semantic similarity of the text, the system ensures the accuracy and relevance of the generated content, while reflecting user preferences and needs, thus improving the user experience.
[0077] Figure 5 This is a schematic diagram of an optional response text generation method according to an embodiment of this application; as shown... Figure 5 As shown, when the user enters the target question text, the following steps can be performed:
[0078] Step S502: Determine the reference question text. Reference question texts similar to the target question text can be obtained.
[0079] Step S504: Determine the reference action sequence. For the reference answer text corresponding to the reference question text, the user may take the following actions: directly like / dislike the reference answer text, click the reference document link in the reference answer text to read a paragraph, copy the question to the input area to ask it again, copy the result to another place to paste and use, ask a new question, etc. These actions can also implicitly provide feedback on whether the user is satisfied with the current result. These actions are determined as the reference action sequence.
[0080] Step S506: Determine the instruction text. Based on the obtained reference action sequence, the Language Model (LLM) can summarize the current user's interests (instruction text). The user interest summary mainly indicates whether the user likes the current result and what content they like. The user interest summary is then input into the model's Prompt.
[0081] Step S508 involves retrieving reference texts from the candidate text set. The candidate text set was determined as described above. After determining the candidate text set, it can be retrieved. A preset number of reference texts can be retrieved based on the target question text. This can be divided into two stages: the coarse ranking stage mainly removes texts that do not meet the criteria and returns the retrieval results from the first stage, typically selecting several hundred texts; the fine ranking stage performs further similarity calculations based on the coarse ranking results to obtain the text results that meet the criteria, typically a few.
[0082] Specifically, in the coarse-ranking stage, keyword retrieval can use the BM25 algorithm, and semantic retrieval can use KNN retrieval (K-Nearest Neighbor algorithm).
[0083] The formula for calculating text relevance using the BM25 algorithm is as follows:
[0084]
[0085] Where Q is the target question text, d is the candidate text set, and q i Let be the i-th word in the target question text, n be the total number of words in the target question text, IDF(qi) be the inverse document frequency of word qi, f(qi, d) be the word frequency of word qi in the candidate text set d, |d| be the length of the candidate text set d, avgdl be the average length of all candidate text sets, k1 and b are adjustable parameters, usually k1 is between 1.2 and 2, and b is usually set to 0.75.
[0086] The formula for calculating the inverse document frequency (IDF) (qi) is:
[0087]
[0088] Where N is the total number of candidate texts, n(q) i ) is a word containing q i The number of candidate texts.
[0089] KNN retrieval uses L2-norm Euclidean distance to calculate similarity scores, and the calculation formula is as follows:
[0090]
[0091] Where Q and B are the vector representations of the target question text and candidate text, respectively, and Q = (a1, a2, ..., a...). n ),
[0092] B = (b1, b2, ..., b) n In this example, the bge-large-zh-v1.5 model is used, with n being 1024.
[0093] After determining the text relevance ranking and semantic similarity ranking, a mixed ranking can be calculated using Reciprocal Rank Fusion (RRF):
[0094]
[0095] Where D represents the set of candidate texts, R represents the set of ranking ordinal numbers starting from 1, and K is a constant, usually 60.
[0096] Based on the mixed sorting results, candidate texts that meet the preset mixed sorting positions are identified as candidate texts to be determined; then, the fine sorting stage is carried out:
[0097] The text relevance and semantic similarity scores of each candidate text to be determined can be weighted and summed to obtain their respective mixed similarity scores: α text relevance score + (1-α) semantic similarity score, where 0≤α≤1. Then, the candidate texts to be determined are sorted according to their mixed similarity scores, and the candidate texts with the preset sequence number are determined as reference texts.
[0098] Step S510: Combine the instruction text, reference text, and target question text to obtain the target response text. The instruction text, reference text, and target question text can be input into a language model (LLM) to obtain the target response text. The language model can be GPT 4, ChatGLM, Qwen, Wenxin Yiyan, Yuan2.0, etc.
[0099] Through the above-described embodiments of this application, at least one reference question text is determined based on the target question text, wherein the target question text and the reference question text are related texts; reference actions corresponding to each of the at least one reference question text are determined, and the reference actions are aggregated to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; an instruction text is obtained based on the reference action sequence, and the instruction text, reference text, and target question are input into a language model to obtain a target response text, wherein the instruction text is used to indicate the characteristics of a reference response text whose satisfaction reaches a preset threshold. The requirements for a response text with high satisfaction (i.e., the instruction text) can be determined by the user's reference actions to the reference response text of a reference question text similar to the target question text, and a target response text that conforms to the instruction text can be generated to obtain a response text with high satisfaction. The user's interest summary can be integrated into the question-and-answer process in real time to optimize the instruction content and better guide the language model to generate answers that match the user's interests. This satisfies the user's high requirements for personalization and accuracy.
[0100] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0101] This embodiment also provides a response text generation device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0102] Figure 6 This is a structural block diagram of an optional response text generation apparatus according to an embodiment of this application, such as... Figure 6 As shown, the device includes:
[0103] The reference question determination module 62 is used to determine at least one reference question text based on the target question text, wherein the target question text and the reference question text are related texts;
[0104] The reference action determination module 64 is used to determine the reference action corresponding to at least one reference question text and aggregate the reference actions to obtain a reference action sequence, wherein the reference action is used to indicate the user's satisfaction with the reference answer text corresponding to the reference question;
[0105] The response text generation module 66 is used to obtain instruction text based on the reference action sequence, and input the instruction text, reference text and target question into the language model to obtain the target response text. The instruction text is used to indicate the characteristics of the reference response text that the satisfaction level reaches a preset threshold.
[0106] This application determines at least one reference question text based on the target question text, wherein the target question text and the reference question text are related texts; it determines reference actions corresponding to each of the at least one reference question text, and aggregates the reference actions to obtain a reference action sequence, wherein the reference actions are used to indicate the user's satisfaction with the reference response text corresponding to the reference question; it obtains an instruction text based on the reference action sequence, and inputs the instruction text, reference text, and target question into a language model to obtain the target response text, wherein the instruction text is used to indicate the features of the reference response text whose satisfaction reaches a preset threshold. By using the user's reference actions to the reference response text of reference question texts similar to the target question text, the requirements for a response text with high satisfaction (i.e., instruction text) can be determined, and a target response text that conforms to the instruction text can be generated to obtain a response text with high satisfaction, thereby solving the technical problem of low accuracy in current question-answering models in related technologies.
[0107] Optionally, the aforementioned reference action determination module 64 is further configured to: traverse the reference question texts and perform the following operations for each reference question text: obtain at least one triggering operation of the response to the reference question text and the reference reply text, and use the triggering operation as the reference action corresponding to the reference question text; and use each reference action and the reference question text or reference reply text corresponding to each reference action as elements in the reference action sequence.
[0108] Optionally, the above-mentioned response text generation module 66 is further configured to: determine the satisfaction of each reference action according to a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific value of the satisfaction corresponding to the reference action; and input the satisfaction of each reference action and the reference question text or reference response text corresponding to each reference action into the language model to obtain the instruction text.
[0109] Optionally, the aforementioned reference question determination module 62 is further configured to: extract features from the set of historical question texts and the target question text to obtain the reference text vectors corresponding to the historical question texts and the target text vectors corresponding to the target question texts; determine the historical question texts corresponding to the reference text vectors whose similarity to the target text vectors exceeds a preset similarity threshold as reference question texts; and determine the historical question texts that belong to the same dialogue as the target question texts as reference question texts.
[0110] Optionally, the above-mentioned response text generation device further includes: a coarse search module, used to search the candidate text set according to the target question text, and determine the candidate texts in the candidate text set whose similarity to the target question text is greater than a preset threshold as candidate texts to be determined; and a fine search module, used to sort the candidate texts to be determined from largest to smallest according to their similarity to the target question text, and determine the candidate texts to be determined located at a preset number as reference texts.
[0111] Optionally, the above-mentioned response text generation device further includes: a candidate text set module, used to parse the candidate data set, retain the candidate data in text form in the candidate data set; divide the candidate data into multiple text blocks of preset length; perform vectorization processing on the text blocks of preset length to obtain the corresponding text vectors; and match the candidate data and the corresponding text vectors as candidate text and store them in the candidate text set.
[0112] Optionally, the aforementioned coarse search module is further configured to perform keyword recognition and matching on the target question text and the candidate text set to obtain the text relevance of each candidate text in the candidate text set; perform semantic recognition and matching on the target question text and the candidate text set to obtain the semantic similarity score of each candidate text in the candidate text set; sort each candidate text according to text relevance to obtain the text relevance ranking of each candidate text; sort each candidate text according to semantic similarity score to obtain the semantic similarity ranking of each candidate text; combine the text relevance ranking and semantic similarity ranking of each candidate text to obtain the mixed ranking of each candidate text; and determine the candidate text that meets the preset mixed ranking position as the candidate text to be determined according to the mixed ranking result.
[0113] The aforementioned fine-search module is also used to: weight and sum the text relevance and semantic similarity scores corresponding to each candidate text to be determined to obtain their respective mixed similarity scores, sort the candidate texts to be determined according to the mixed similarity scores, and determine the candidate texts to be determined located at the preset sequence number as reference texts.
[0114] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0115] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0116] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0117] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0118] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0119] Embodiments of this application also provide a computer program product, including a non-volatile computer-readable storage medium storing the computer program product, wherein the computer program, when executed by a processor, implements the steps of the methods described in various embodiments of this application.
[0120] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0121] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0122] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for generating response text, characterized in that, The method includes: At least one reference question text is determined based on the target question text, wherein the target question text and the reference question text are related texts; Determine the reference action corresponding to each of the at least one reference question text, and aggregate the reference actions to obtain a reference action sequence, wherein the reference action is used to indicate the user's satisfaction with the reference answer text corresponding to the reference question; The instruction text is obtained based on the reference action sequence, and the instruction text, reference text, and target question are input into a language model to obtain the target response text. The instruction text is used to indicate the features of the reference response text that indicate a satisfaction level of a preset threshold. The step of determining the reference action corresponding to each of the at least one reference question text and aggregating the reference actions to obtain a reference action sequence includes: The reference question texts are traversed, and the following operations are performed for each reference question text: Obtain at least one triggering operation of the reference question text and the reference answer text response, and use the triggering operation as the reference action corresponding to the reference question text; Each of the reference actions and the corresponding reference question text or reference answer text are used as elements in the reference action sequence; The step of obtaining the instruction text based on the reference action sequence includes: The satisfaction level of each reference action is determined according to a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific value of the satisfaction level corresponding to the reference action. The satisfaction level of each of the reference actions and the reference question text or reference response text corresponding to each reference action are input into the language model to obtain the instruction text.
2. The method according to claim 1, characterized in that, The determination of at least one reference question text based on the target question text includes at least one of the following: Feature extraction is performed on the set of historical question texts and the target question text to obtain the reference text vectors corresponding to each of the historical question texts and the target text vector corresponding to the target question text; the historical question texts corresponding to the reference text vectors whose similarity to the target text vectors exceeds a preset similarity threshold are determined as the reference question texts; The historical question texts that belong to the same dialogue as the target question text are identified as the reference question texts.
3. The method according to claim 1 or 2, characterized in that, Before inputting the instruction text, reference text, and target question into the language model to obtain the target response text, the process includes: The candidate text set is retrieved based on the target question text, and the candidate texts in the candidate text set whose similarity to the target question text is greater than a preset threshold are determined as candidate texts to be determined; The candidate texts to be determined are sorted from largest to smallest according to their similarity to the target question text, and the candidate texts to be determined located at the preset sequence number are determined as the reference texts.
4. The method according to claim 3, characterized in that, Before retrieving the candidate text set based on the target question text, the following steps are included: The candidate data set is parsed, and the candidate data in text form is retained in the candidate data set; The candidate data is segmented to obtain multiple text blocks of preset length; The text block of the preset length is vectorized to obtain the corresponding text vector; The candidate data and the corresponding text vector are matched and stored as candidate text in the candidate text set.
5. The method according to claim 3, characterized in that, The step of identifying candidate texts from the candidate text set whose similarity to the target question text is greater than a preset threshold as candidate texts to be determined includes: Keyword recognition and matching are performed on the target question text and the candidate text set to obtain the text relevance for each candidate text in the candidate text set. Semantic recognition and matching are performed on the target question text and the candidate text set to obtain a semantic similarity score for each candidate text in the candidate text set. The candidate texts are sorted according to their text relevance to obtain the text relevance ranking of each candidate text. The candidate texts are sorted according to their semantic similarity scores to obtain the semantic similarity ranking of each candidate text. The text relevance ranking and semantic similarity ranking of each candidate text are combined to obtain the hybrid ranking of each candidate text. According to the mixed sorting results, candidate texts that meet the preset mixed sorting positions are determined as candidate texts to be determined; The step of sorting the candidate texts to be determined according to their similarity to the target question text from highest to lowest, and determining the candidate texts to be determined at the preset sequence number as the reference texts, includes: The text relevance and semantic similarity scores corresponding to each candidate text to be determined are weighted and summed to obtain their respective mixed similarity scores. The candidate texts to be determined are then sorted according to the mixed similarity scores, and the candidate text located at the preset sequence number is determined as the reference text.
6. A response text generation device, characterized in that, The device includes: A reference question determination module is used to determine at least one reference question text based on a target question text, wherein the target question text and the reference question text are related texts; A reference action determination module is used to determine the reference action corresponding to each of the at least one reference question text, and to aggregate the reference actions to obtain a reference action sequence, wherein the reference action is used to indicate the user's satisfaction with the reference response text corresponding to the reference question; The response text generation module is used to obtain instruction text based on the reference action sequence, and input the instruction text, reference text and target question into a language model to obtain target response text, wherein the instruction text is used to indicate the characteristics of the reference response text that the satisfaction level reaches a preset threshold; The step of determining the reference action corresponding to each of the at least one reference question text and aggregating the reference actions to obtain a reference action sequence includes: The reference question texts are traversed, and the following operations are performed for each reference question text: Obtain at least one triggering operation of the reference question text and the reference answer text response, and use the triggering operation as the reference action corresponding to the reference question text; Each of the reference actions and the corresponding reference question text or reference answer text are used as elements in the reference action sequence; The step of obtaining the instruction text based on the reference action sequence includes: The satisfaction level of each reference action is determined according to a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific value of the satisfaction level corresponding to the reference action. The satisfaction level of each of the reference actions and the reference question text or reference response text corresponding to each reference action are input into the language model to obtain the instruction text.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 5.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Question and answer method and device, electronic equipment and storage medium
CN118297162A
Intelligent question and answer method and device, storage medium and intelligent equipment
CN118349650A