Response text generation method and device, storage medium and program product
By determining reference questions and actions in the question-and-answer model, generating indicator text, and combining these texts and target question text input language models, the existing question-and-answer model has solved the problem of low accuracy in multiple rounds of question scenarios, and improved the user experience and answer personalization.
Patent Information
- Application Number
- CN202411750577.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-11-30
AI Technical Summary
The existing question-and-answer model has low accuracy in multiple rounds of question scenarios, and cannot effectively pay attention to the actual needs of users, resulting in poor user experience.
By determining the reference question text and reference actions of the target problem text, the reference action sequence is aggregated to generate indicator text, and input the language model with the indicator text, reference text and target problem text to generate the target reply text.
It improves the accuracy and personalization of the question and answer model, enhances the user experience, and ensures that the answers are more in line with the actual needs of users.
Smart Images

Figure CN119692469A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of text generation, and more specifically, to a reply text generation method and device, a storage medium, and a program product. Background Art
[0002] In the field of text information retrieval, retrieval-enhanced generative techniques can be used to enhance the model's ability to understand and answer specific questions. After a user asks a question, information related to the question can be retrieved from a pre-established knowledge base, and the retrieved information and the user's question can be used as input to the generative model to obtain a more accurate and rich answer.
[0003] In the related art, when a user makes multiple rounds of inquiries, the information retrieved from the questions input by the user each time and the pre-established knowledge base is used as context input to generate the model. Although the accuracy and richness of the answers are improved, each round of question-and-answer process is independent. In the case where multiple rounds of questions are related, the actual needs of the user may not be paid attention to. For example, after the user's answer to a certain round of questions actively triggers a negative evaluation, the subsequent answers may still output similar answers, resulting in a poor user experience and deviation from the user's actual needs. That is, the question-and-answer model in the related art has the problem of low accuracy.
[0004] Regarding the related technologies, the current question-answering model has the technical problem of low accuracy, and no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present application provide a method and device for generating a reply text, a storage medium, and a program product to at least solve the technical problem in the related art that the current question-answering model has a low accuracy rate.
[0006] According to one embodiment of the present application, a reply text generation method is provided, including: 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 a reference action corresponding to each of the at least one reference question texts, and aggregating the reference actions to obtain a reference action sequence, wherein the reference action is used to indicate the user's satisfaction with a reference reply text corresponding to the reference question; obtaining an indication text based on the reference action sequence, and inputting the indication text, the reference text and the target question into a language model to obtain a target reply text, wherein the indication text is used to indicate the characteristics of a reference reply text whose satisfaction reaches a preset threshold.
[0007] In an exemplary embodiment, the above-mentioned determination of a reference action corresponding to each of at least one reference question text and aggregating 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 trigger operation that responds to the reference question text and the reference answer text, and using the trigger operation as the reference action corresponding to the reference question text; using each reference action and the reference question text or reference answer text corresponding to each reference action as an element in the reference action sequence.
[0008] In an exemplary embodiment, the above-mentioned obtaining the instruction text based on the reference action sequence includes: determining the satisfaction level of each reference action based on a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific numerical value of the satisfaction level corresponding to the reference action; inputting the satisfaction level of each reference action and the reference question text or reference answer text corresponding to each reference action into the language model to obtain the instruction text.
[0009] In an exemplary embodiment, the above-mentioned determining at least one reference question text based on the target question text includes at least one of the following: performing feature extraction on the historical question text set and the target question text to obtain reference text vectors corresponding to each of the historical question texts and target text vectors corresponding to the target question text; determining the historical question text corresponding to the reference text vector whose similarity with the target text vector exceeds a preset similarity threshold as the reference question text; determining the historical question text that belongs to the same dialogue as the target question text as the reference question text.
[0010] In an exemplary embodiment, before the indication text, reference text and target question are input into the language model to obtain the target answer text, the process includes: retrieving a candidate text set according to the target question text, and determining the candidate texts in the candidate text set whose similarity with the target question text is greater than a preset threshold as candidate texts to be determined; sorting the candidate texts to be determined from large to small according to their similarity with the target question text, and determining the candidate text to be determined at a preset sequence number as the reference text.
[0011] In an exemplary embodiment, before searching the candidate text set according to the target question text, the process includes: parsing the candidate data set to retain the candidate data in text form in the candidate data set; segmenting the candidate data to obtain multiple text blocks of preset lengths; vectorizing the text blocks of preset lengths to obtain corresponding text vectors; matching the candidate data and the corresponding text vectors to store them as candidate texts in the candidate text set.
[0012] In an exemplary embodiment, the above-mentioned determination of candidate texts in the candidate text set whose similarity with 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 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 semantic similarity scores corresponding to each candidate text in the candidate text set; sorting each candidate text according to text relevance to obtain a text relevance ranking corresponding to each candidate text; sorting each candidate text according to the semantic similarity score to obtain a semantic similarity ranking corresponding to each candidate text. The method comprises the following steps: sorting the candidate texts by text relevance and semantic similarity; combining the text relevance sorting and semantic similarity sorting corresponding to each candidate text to obtain the mixed sorting corresponding to each candidate text; determining the candidate texts that meet the preset mixed sorting position as the candidate texts to be determined according to the mixed sorting result; sorting the candidate texts to be determined from large to small according to the similarity with the target question text, and determining the candidate text to be determined at a preset sequence number as the reference text, including: weighted summing the text relevance and semantic similarity scores corresponding to each candidate text to be determined to obtain the corresponding mixed similarity, sorting the candidate texts to be determined according to the mixed similarity, and determining the candidate text to be determined at the preset sequence number as the reference text.
[0013] According to another embodiment of the present application, a reply text generation device is provided, including: a reference question determination module, 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, used to determine a reference action corresponding to each of the at least one reference question texts, and aggregate the reference actions to obtain a reference action sequence, wherein the reference action is used to indicate the user's satisfaction with a reference reply text corresponding to the reference question; a reply text generation module, used to obtain an indication text based on the reference action sequence, and input the indication text, the reference text and the target question into a language model to obtain a target reply text, wherein the indication text is used to indicate the characteristics of a reference reply text whose satisfaction reaches a preset threshold.
[0014] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0015] According to another embodiment of the present application, an electronic device is 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 execute the steps in any one of the above method embodiments.
[0016] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps of the method in each embodiment of the present application are implemented.
[0017] Through the present application, at least one reference question text is determined according to the target question text, wherein the target question text and the reference question text are related texts; a reference action corresponding to each of the at least one reference question text is determined, and the reference actions are aggregated 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; an indication text is obtained according to the reference action sequence, and the indication text, the reference text and the target question are input into a language model to obtain a target answer text, wherein the indication text is used to indicate the features of the reference answer text whose satisfaction reaches a preset threshold. The requirements of the answer text with a higher satisfaction level (i.e., the indication text) can be determined through the user's reference action on the reference answer text of the reference question text similar to the target question text, and a target answer text that meets the indication text is generated to obtain an answer text with a higher satisfaction level, thereby solving the technical problem of low accuracy of the current question-answering model in the related art. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a hardware structure block diagram of an optional reply text generation method according to an embodiment of the present application;
[0019] Figure 2 is a flowchart of an optional reply text generation method according to an embodiment of the present application;
[0020] Figure 3 is a schematic diagram of an optional reply text generation method according to an embodiment of the present application;
[0021] Figure 4 is a schematic diagram of another optional reply text generation method according to an embodiment of the present application;
[0022] Figure 5 is a schematic diagram of another optional reply text generation method according to an embodiment of the present application;
[0023] Figure 6 It is a structural block diagram of an optional reply text generation device according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0026] Figure 1 1 is a hardware structure block diagram of an optional reply text generation method of an embodiment of the present application. Figure 1 As shown, according to one aspect of the embodiment of the present application, a reply text generation method is provided. As an optional implementation, the reply text generation method can be but is not limited to being applied to Figure 1 The reply text generation system in the hardware environment shown in FIG. The reply text generation system may include but is not limited to a terminal device 102, a network 110, a server 112, and a database 114. The terminal device 102 runs a target client (such as Figure 1 As shown, the target client is a client that can implement a question-and-answer system. The terminal device 102 includes a display 108, a processor 106 and a memory 104. The display 108 can be used to display the reply text and the question-and-answer system interface, etc., and is also used to provide a human-computer interaction interface to receive human-computer interaction operations of touching different controls. The processor is used to generate an interaction instruction in response to the human-computer interaction operation, and send the interaction instruction to the server to obtain a reference question text. The memory is used to store a reference action sequence, etc.
[0027] In addition, the server 112 includes a processing engine 116, which is used to perform storage or reading operations on the database 114. Specifically, the processing engine 116 reads the reference action sequence from the database 114.
[0028] Assumptions Figure 1 The terminal device 102 in the embodiment runs a client for unified management of the model of the construction project. The specific process of 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 according to the target question text, and then execute step S104 to determine the reference action corresponding to the reference question text, and send a reference action acquisition request to the server 112. The server 112 executes step S106 to send the reference action to the terminal device 102 through the network 110. The terminal device 102 can execute steps S108 and S110, aggregate the reference actions to obtain a reference action sequence, and obtain the instruction text according to the reference action sequence to obtain the target reply text.
[0029] Optionally, in this embodiment, the terminal device 102 may be a terminal device configured with a target client, which may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, an MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client may be a client that supports providing a reply text generation task, such as a question-and-answer system client and a browser client. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WI F l and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and this embodiment is not limited to this.
[0030] Optionally, in this embodiment, the above-mentioned reply text generation method can be applied to, but not limited to, a conversational question-answering system. After the system receives the target question text input by the user, it can combine the reference action corresponding to the reference question text in the current round of the user's conversation, use the reference action to determine the user's satisfaction with different reply texts, and give the characteristics of the reply text that the user is more satisfied with, and generate a reply text for the target question text according to the instruction text. In real-time response to user feedback behavior, the generation strategy of the language model is dynamically adjusted, thereby providing more personalized, accurate and efficient information retrieval and generation services. Improve the user experience and enhance the intelligence and adaptability of the artificial intelligence system.
[0031] The above usage scenarios are only examples, and any scenario related to reply text generation can utilize the solution of the present application. This embodiment does not impose any limitation on this.
[0032] Through the present application, at least one reference question text is determined according to the target question text, wherein the target question text and the reference question text are related texts; a reference action corresponding to each of the at least one reference question text is determined, and the reference actions are aggregated 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; an indication text is obtained according to the reference action sequence, and the indication text, the reference text and the target question are input into a language model to obtain a target answer text, wherein the indication text is used to indicate the features of the reference answer text whose satisfaction reaches a preset threshold. The requirements of the answer text with a higher satisfaction level (i.e., the indication text) can be determined through the user's reference action on the reference answer text of the reference question text similar to the target question text, and a target answer text that meets the indication text is generated to obtain an answer text with a higher satisfaction level, thereby solving the technical problem of low accuracy of the current question-answering model in the related art.
[0033] In this embodiment, a method for generating a reply text is provided. Figure 2 is a flowchart of an optional reply text generation method according to an embodiment of the present application, such as Figure 2 As shown, the reply text generation method includes:
[0034] Step S202, determining at least one reference question text according to the target question text, wherein the target question text and the reference question text are related texts;
[0035] Step S204, determining a reference action corresponding to each of at least one reference question text, and aggregating 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;
[0036] Step S206, obtaining an instruction text according to a reference action sequence, and inputting the instruction text, the reference text and the target question into a language model to obtain a target answer text, wherein the instruction text is used to indicate the characteristics of the reference answer text whose satisfaction reaches a preset threshold.
[0037] It should be noted that, when a user uses the question-answering system, he or she may input a target question text into the system in the hope that the system can generate a suitable target answer text for the target question text.
[0038] In an optional implementation, after determining the target reply text, it is necessary to determine the user's satisfaction with the reply text in order to generate a target reply text that can satisfy the user. Therefore, it is necessary to obtain a reference question text. The reference question text is a question that has semantically similar questions to the target question text. The target question text and the reference question text can be regarded as question texts in the same field.
[0039] It should be noted that the generation of reference action sequences is based on user feedback on previous reference question texts and the answers they generated. These feedback actions can be direct user actions, such as likes / dislikes, or indirect user actions, such as copying questions, clicking on links to referenced documents, and asking again. The purpose of the reference action sequence is to quantify the user's satisfaction with the reference answer text and provide guidance for the next step of generating the target answer text.
[0040] In an optional embodiment, the system continuously monitors and records all behaviors of users in the process of interacting with the system, including reactions to specific replies and subsequent operations related to the replies. The behaviors of user feedback are classified into different action types, and each type of action has its specific meaning. For example, copying a question may mean that the user has doubts about the current reply, while a thumbs-up indicates that the user is satisfied with the reply. The system sorts all collected reference actions in chronological order or importance to form a reference action sequence, which describes the user's attitude and behavior pattern towards the reference question and its reply.
[0041] In one example, taking the reference question "Why is city A an important city?" as an example, suppose the user browses a text about the historical importance of city A and copies part of the content, which can be interpreted as the user's interest in historical information. Afterwards, the user likes a reply about the economic impact of city A, indicating that the user is satisfied with the content of the reply. The system aggregates these feedback behaviors (copying, liking) into a reference action sequence for subsequent model input guidance.
[0042] It should be noted that the system uses the reference action sequences collected in the first two steps to generate the instruction text, which can be regarded as a summary that summarizes the user's preferences and preferences for the reference questions and answers. Subsequently, the instruction text is combined with the target question text and the reference text to guide the model to generate the target answer text based on the user's interests and satisfaction.
[0043] In an optional embodiment, the system analyzes the reference action sequence to identify the user's preference for a specific topic or type of information. For example, if the user shows interest in content about history and economic impact during browsing, the instruction text may 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 can fully consider the user's personalized needs and satisfaction standards when generating the target response text.
[0044] It should be noted that the reference text may be text retrieved by the system from a knowledge base. The knowledge base and the retrieval process will be described later and will not be repeated here.
[0045] Through the present application, at least one reference question text is determined according to the target question text, wherein the target question text and the reference question text are related texts; a reference action corresponding to each of the at least one reference question text is determined, and the reference actions are aggregated 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; an indication text is obtained according to the reference action sequence, and the indication text, the reference text and the target question are input into a language model to obtain a target answer text, wherein the indication text is used to indicate the features of the reference answer text whose satisfaction reaches a preset threshold. The requirements of the answer text with a higher satisfaction level (i.e., the indication text) can be determined through the user's reference action on the reference answer text of the reference question text similar to the target question text, and a target answer text that meets the indication text is generated to obtain an answer text with a higher satisfaction level, thereby solving the technical problem of low accuracy of the current question-answering model in the related art.
[0046] In an optional embodiment, the above-mentioned determination of a reference action corresponding to each of at least one reference question text and aggregating 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 trigger operation in response to the reference question text and the reference answer text, and using the trigger operation as the reference action corresponding to the reference question text; using each reference action and the reference question text or reference answer text corresponding to each reference action as an element in the reference action sequence.
[0047] It should be noted that the system will traverse each reference question text and its corresponding reference answer text, aiming to capture the feedback actions of users when interacting with these texts. Feedback actions can be expressed directly by users through interface operations, or indirectly inferred through user behavior. The system associates each feedback action with the corresponding reference question text or reference answer text to form a series of elements, which ultimately constitute a reference action sequence. The reference action sequence reflects the user's satisfaction and interest in different reference texts and answers, and provides an important basis for subsequent analysis and generation of personalized answers.
[0048] In an optional implementation, the system first traverses the reference question text list to ensure that each reference question text is included in the analysis scope. For each reference question text, the system will collect all trigger operations related to it by the user. Trigger operations include but are not limited to explicit operations (such as likes, dislikes) and implicit operations (such as copying questions, clicking on reference document links, asking again, etc.). These operations can directly or indirectly reflect the user's feedback and preferences for the current reference questions and answers. The system associates each acquired trigger operation with the corresponding reference question text or reference answer text. For example, if the user likes the answer to the reference question text about the history of city A, then this like operation will be marked as an operation of the reference answer text related to the history of city A. After collecting all trigger operations and associating them with the corresponding text, the system constructs a reference action sequence. The sequence consists of a series of elements, each of which contains a reference action and the corresponding reference question text or reference answer text. The elements are sorted in chronological order or importance to form an ordered sequence for subsequent analysis and processing.
[0049] In one example, suppose that during the user's interaction with the system, the system provides the user with several reference question texts and their corresponding answers for the target question "Why is City A an important city?", including explanations from different perspectives such as the history, economic impact, and cultural status of City A. In this process, the user likes the answer to the reference question text about the history of City A, reflecting the user's interest in historical information; while the answer to the economic impact is copied, which may mean that the user wants to further study or use this part of information. The system associates these user feedback actions (like, copy) with the corresponding reference question text or reference answer text. For example, the like action is associated with the reference answer text about the history of City A, and the copy action is associated with the reference answer text about the economic impact. Next, the system constructs a reference action sequence, which contains elements such as "like-historical information text" and "copy-economic impact text". The system can adjust the input of the large language model (LLM) according to the user's preference for historical and economic information to generate answers that are more in line with user needs.
[0050] In an optional implementation, when the system displays the model-generated results based on the question to the user, the user's subsequent actions will be monitored in real time. This includes but is not limited to direct feedback on whether the user likes / dislikes the current result, whether the user clicks on the reference document link contained in the result for in-depth reading, whether the question or result is copied to another area or asked again, and whether the user asks a new question. These user actions constitute a series of behavioral feedback, and the system records them as an action sequence. Each element in the sequence is action. i(i=1, 2, ..., N) represents a specific behavior of the user after seeing the model generation result. After the system collects the user's action sequence, it will analyze it to identify the user's implicit satisfaction with the current model generation result. Each action sequence element act i All of them are regarded as feedback on the current results, among which direct likes or dislikes provide clear satisfaction scores, while actions such as clicking on reference documents, copying questions or results, asking again or asking new questions imply the user's interest and needs for specific information or topics. For example, if a user clicks on a reference document about the history of city A, this may indicate that the user is interested in historical information, but the current generated results may not fully meet their needs, thus triggering further exploration behavior. In order to convert the user's implicit feedback behavior into a quantitative assessment of satisfaction with the model results, the system analyzes the action sequence elements act i The correlation between the generated results and the results. For example, if a user clicks on a reference document about a specific topic multiple times, this can be interpreted as the user's deep interest in the topic. The system quantifies the user's satisfaction by counting the frequency of clicks on a certain type of information. Similarly, the user's behavior of copying questions or results to other places may mean the practicality and relevance of the current information, while asking again or asking new questions may imply that the user is not satisfied with the current results and needs a more detailed or different angle of explanation. Each action sequence element of the user is i All of these are considered real-time feedback of the system-generated content, and the system will dynamically adjust the model generation strategy based on these behaviors. For example, if it is detected that a user has clicked on a reference document about the economy of city A multiple times, the system 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 content 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] Through the above implementation of the present application, it is possible to effectively collect and analyze the feedback behavior of users after seeing the results generated by the current question model, and transform these implicit feedback into analysis and quantification of satisfaction with the content generated by the system, thereby guiding the model to generate high-quality results that are more in line with user expectations and interests. This mechanism is particularly suitable for scenarios such as intelligent customer service, personalized search engines, and conversational AI that require a deep understanding of user needs and feedback, and can significantly improve user experience and system performance.
[0052] In an optional embodiment, the above-mentioned obtaining the instruction text based on the reference action sequence includes: determining the satisfaction level of each reference action based on a preset action satisfaction mapping table, wherein the action satisfaction mapping table is used to indicate the specific numerical value of the satisfaction level corresponding to the reference action; inputting the satisfaction level of each reference action and the reference question text or reference answer text corresponding to each reference action into the language model to obtain the instruction text.
[0053] It should be noted that in the early stages of system design, an action satisfaction mapping table needs to be established. The table lists various user feedback actions (such as likes, dislikes, clicks on reference documents, copying questions or results, etc.) and their corresponding satisfaction values. The satisfaction value can be a real number within a range, which is used to quantify the user's preference for a specific reference answer or question. For example, a like may correspond to a high satisfaction value, while a dislike corresponds to a low satisfaction value, and clicking on a reference document may be considered to be of medium satisfaction because it means that the user is interested in the information but may need more details. After collecting the user's feedback action sequence for the reference question text and answer, the system maps each action action to a satisfaction value. i (i = 1, 2, ..., N) is compared with the preset action satisfaction mapping table to determine its specific satisfaction value. This process converts implicit user feedback into a quantitative satisfaction index for subsequent analysis and processing. i The satisfaction value of the reference action and the related reference question text or reference answer text are input into the language model (LLM). Based on the satisfaction of each reference action and the related question or answer text, the LLM generates an indication text. This indication text integrates the user's satisfaction feedback on the reference content and the topics or information types that the user may be interested in.
[0054] In an optional embodiment, assume that the system shows the user a series of responses to the question "Why is City A an important global city?", which includes information about City A's history, economy, culture, etc. The user behaviors are as follows: (1) The user likes the reference response text about City A's history, expressing high satisfaction. (2) The user clicks on the reference document of the reference response text about economic impact, showing moderate satisfaction, indicating that the user is interested in economic information but may need a more in-depth explanation. (3) The user copies part of the response content about City A's culture, also showing moderate satisfaction, which may mean that the user is interested in cultural information.
[0055] According to the preset action satisfaction mapping table, the system considers a like as high satisfaction (e.g., a satisfaction value of 0.9), a click on a reference document as medium satisfaction (e.g., a satisfaction value of 0.6), and a copy of content as medium satisfaction (e.g., a satisfaction value of 0.7). The system then inputs these satisfaction values and the relevant reference question text or answer text into the LLM.
[0056] Based on the input information, LLM generates indicative text, which may include: "The user prefers detailed historical background information, is interested in a comprehensive explanation of economic and cultural impacts, and prefers content that is in-depth and practical." This indicative text is then used as a guide to generate the user's final answer text to the original question "Why is City A an important global city?", ensuring that the generated content covers the user's areas of interest more comprehensively and in-depth, while avoiding the appearance of repeated or irrelevant information, thereby improving user satisfaction.
[0057] Through the above implementation of the present application, by converting user feedback behavior into quantitative satisfaction values, and using these values and related texts to guide the language model to generate instruction texts, it is possible to effectively understand the user's preference for reference content and guide the system to generate high-quality content that better meets the user's needs and interests. This helps to improve the user interaction experience and the overall performance of the system.
[0058] In an optional embodiment, the above-mentioned determining at least one reference question text based on the target question text includes at least one of the following: performing feature extraction on the historical question text set and the target question text to obtain a reference text vector corresponding to each historical question text and a target text vector corresponding to the target question text; determining the historical question text corresponding to the reference text vector whose similarity with the target text vector exceeds a preset similarity threshold as the reference question text; determining the historical question text that belongs to the same dialogue as the target question text as the reference question text.
[0059] It should be noted that the historical question text set can be the historical question text of the user stored in the memory of the server or terminal device. The system can perform feature extraction on the historical question text set and the target question text, and convert the text data into a vector form. Then, the system can calculate the similarity between each reference text vector and the target text vector. The similarity calculation can adopt cosine similarity, Euclidean distance or a more complex semantic similarity algorithm. The system will screen the calculated similarity score according to a preset similarity threshold. If the similarity score between a reference text vector and the target text vector exceeds the preset threshold, the corresponding "historical question text" will be determined as the "reference question text". This screening process ensures that the reference question text and the target question text have a certain correlation in semantics, can provide the system with valuable context information, and assist in generating answers that are closer to user 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 is based on dialogue context analysis and aims to ensure that the system can fully understand the background and context of the user's query and provide coherent and in-depth answers. 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 checking the timestamp, user ID, dialogue ID and other information of the historical question text. The historical question texts that belong to the same dialogue as the target question text are determined as reference question texts. These texts provide the dynamic background and changing trends of the user's query, which helps the system understand the evolution of user needs.
[0061] Through the above implementation of the present application, the system can combine semantic similarity and conversation context to determine a series of reference question texts related to the target question text that can provide additional information and context. These reference question texts will be further used to guide the generation process of the language model to generate more comprehensive and personalized responses.
[0062] In an optional embodiment, before the instruction text, reference text and target question are input into the language model to obtain the target answer text, the process includes: searching a candidate text set according to the target question text, and determining the candidate text in the candidate text set whose similarity with the target question text is greater than a preset threshold as the candidate text to be determined; sorting the candidate text to be determined from large to small according to the similarity with the target question text, and determining the candidate text to be determined at a preset sequence number as the reference text.
[0063] It should be noted that "inputting the instruction text, reference text and target question into the language model to obtain the target answer text" is the core of generating personalized and high-quality answers. However, before this core step, effectively searching and screening the candidate text set to determine the most relevant reference text is an indispensable preliminary work to ensure the accuracy and relevance of the generated text content. The following is an implementation method that details how to determine the reference text by retrieving and sorting the candidate texts before inputting the information into the language model.
[0064] The system first establishes a set of candidate texts. During the retrieval process, the system calculates the similarity score between each candidate text and the target question text, which is usually achieved through vector distance (such as cosine similarity) or a specific text matching algorithm. If the similarity score between the candidate text and the target question text exceeds the preset similarity threshold, the candidate text will be considered to be related to the target question and thus determined as a "candidate text to be determined". The system further sorts the candidate texts to be determined, and the sorting is based on the similarity score between them and the target question text, from high to low. This sorting process helps the system to give priority to those candidate texts that are most relevant to the target question and can best supplement or enhance the context of the target question as references. After the sorting is completed, the system will select the reference text according to the preset serial number rule. Specifically, the system will select the candidate text to be determined that is located at the preset serial number position in the sorted list. This preset serial number can be set based on experience or dynamically adjusted by user needs or system policies. The selected candidate texts to be determined, that is, those texts that are located at a preset sequence number and have a high degree of similarity with the target question text, will be formally determined as "reference texts" for subsequent generation processes.
[0065] Through the above implementation of the present application, through the retrieval, similarity screening and sorting selection of candidate texts, the system can effectively identify and determine the reference text most relevant to the target question, and provide accurate context information for the subsequent generation process. This mechanism is a key step to ensure that the generated answers meet user needs and maintain high quality. It is particularly suitable for scenarios that require processing large amounts of text data and performing deep semantic analysis. The system can generate personalized replies based on more comprehensive and relevant knowledge and information, significantly improving user experience and interaction efficiency.
[0066] In an optional embodiment, before searching the candidate text set according to the target question text, the process includes: parsing the candidate data set to retain the candidate data in text form in the candidate data set; segmenting the candidate data to obtain multiple text blocks of preset lengths; vectorizing the text blocks of preset lengths to obtain corresponding text vectors; matching the candidate data and the corresponding text vectors and storing them as candidate texts in the candidate text set.
[0067] Figure 3 is a schematic diagram of an optional reply text generation method according to an embodiment of the present application; Figure 3 As shown, in an optional embodiment, the system first performs data parsing on the candidate data set, which is a process of converting various forms of data (such as PDF documents, Word files, web crawled content, etc.) into a unified text format. The purpose of data parsing is to retain information in text form, remove unnecessary formats, pictures or tables, and ensure that subsequent processing steps can focus on the text content itself rather than its presentation form. The parsed text data is further divided into multiple text blocks of preset lengths. This segmentation process helps to control the size of each text block, ensuring that they contain sufficient contextual information in subsequent vectorization processing and can be efficiently calculated and stored.
[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, and is usually between hundreds and thousands of words. In an example, the text block can be set to 1 to 1024 tokens, and is generally set to 128 tokens.
[0069] Each text block of preset length is then vectorized, a process that uses models such as BERT, TF-IDF (term frequency-inverse document frequency) or other semantic encoding models to convert the text block into a numerical vector. Numerical vectors can 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, which can convert natural language text into a digital form that is easy for computers to process. Finally, the system matches the vectorized text block with the original candidate data to form "text block-vector" pairs, which are stored as candidate text sets. During the storage process, the system ensures that the text vector is closely associated with the corresponding original text so that the original text content can be quickly located when the relevant vector is retrieved. The construction and storage of the candidate text set provides a rich, diverse, and semantically clear data resource for the subsequent retrieval and generation process.
[0070] Through the above-mentioned implementation methods of this application, preprocessing steps such as data parsing, text block segmentation, vectorization processing and candidate text set construction are implemented, and the system can build a structured, semantically clear and easy-to-search data resource library. This mechanism not only improves the processing efficiency of data, but also ensures the accuracy and relevance of subsequent retrieval and generation processes. It is particularly suitable for scenarios such as intelligent customer service and personalized search engines that need to process large amounts of text data and perform in-depth semantic analysis. Through a carefully designed preprocessing process, the system can generate personalized answers based on the highest quality and most relevant data, significantly improving user experience and interaction effects.
[0071] In an optional implementation, the above-mentioned determination of candidate texts in the candidate text set whose similarity with 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 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 semantic similarity scores corresponding to each candidate text in the candidate text set; sorting each candidate text according to text relevance to obtain a text relevance sorting corresponding to each candidate text; sorting each candidate text according to the semantic similarity score to obtain a semantic similarity score corresponding to each candidate text. The method comprises the following steps: sorting the candidate texts by text relevance and semantic similarity; combining the text relevance sorting and semantic similarity sorting corresponding to each candidate text to obtain the mixed sorting corresponding to each candidate text; determining the candidate texts that meet the preset mixed sorting position as the candidate texts to be determined according to the mixed sorting result; sorting the candidate texts to be determined from large to small according to the similarity with the target question text, and determining the candidate text to be determined at a preset sequence number as the reference text, including: weighted summing the text relevance and semantic similarity scores corresponding to each candidate text to be determined to obtain the corresponding mixed similarity, sorting the candidate texts to be determined according to the mixed similarity, and determining the candidate text to be determined at the preset sequence number as the reference text.
[0072] Figure 4 is a schematic diagram of an optional reply text generation method according to an embodiment of the present application; Figure 4 As shown, the target question text input by the user can be retrieved through keyword retrieval and semantic retrieval knowledge base (candidate text set), and the text relevance sorting and semantic similarity sorting results are obtained. The text relevance sorting and semantic similarity sorting are fused by reciprocal sorting to obtain a mixed sorting result. The above is a rough sorting process to obtain the candidate text to be determined. Subsequently, the candidate text to be determined is calculated by mixed similarity, and sorted according to the mixed similarity, and the candidate text to be determined with a preset sequence number is determined as the reference text.
[0073] In an optional embodiment, the system first performs keyword recognition on the target question text and the candidate text set, which involves extracting key information points in the text, such as entities, events, topic words, etc., to identify the commonalities of these texts in terms of subject and content. Subsequently, the system calculates the text relevance between the target question text and each candidate text, and the relevance score reflects the degree of match between the two at the keyword and subject level. Texts with higher text relevance scores are more likely to contain the information required for the target question. The system sorts each candidate text from high to low according to its text relevance to form a sorted list based on text relevance. In parallel, the system can perform a deeper level of semantic recognition 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 the candidate text. The semantic similarity score takes into account the context and context of the text, and can evaluate the closeness of the meaning of two texts, which is higher than the level of the text relevance score. The system also sorts each candidate text according to the semantic similarity score to form a sorted list based on semantic similarity.
[0074] In an optional implementation, in order to comprehensively consider keyword matching and semantic similarity, the system combines the text relevance ranking and semantic similarity ranking results to generate a mixed ranking of each candidate text. This combination process may involve weighted summation, sorting fusion algorithm or other statistical methods to ensure that the final ranking result reflects the comprehensive relevance of the candidate text at both the keyword matching and semantic understanding levels. Based on the mixed ranking results, the system sets a preset mixed ranking position as a threshold. Only candidate texts that meet or exceed this preset position will be determined as "candidate texts to be determined" and enter the next step of detailed screening.
[0075] In an optional embodiment, after determining the candidate texts to be determined, the system will perform a more detailed similarity calculation on these texts. Specifically, the system performs a weighted summation of the text relevance and semantic similarity scores of each candidate text to be determined to obtain the corresponding mixed similarity. Mixed similarity is a comprehensive indicator that takes into account the matching degree of the text at the keyword level and the similarity at the semantic level, and can more comprehensively evaluate the relevance of the text to the target question. The system will then sort the candidate texts to be determined according to the mixed similarity, arranging them from high to low to identify the text that is most relevant to the target question text. The system sets a preset serial number, and the candidate text to be determined at this serial number position will be finally determined as a "reference text" for subsequent generation processes.
[0076] Through the above implementation methods of this application, by implementing strategies such as keyword recognition, semantic recognition, mixed sorting, and preset threshold screening, the system can effectively screen out reference texts that are 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 the 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 and improving the user experience.
[0077] Figure 5 is a schematic diagram of an optional reply text generation method according to an embodiment of the present application; Figure 5 As shown, when the user enters the target question text, the following steps can be performed:
[0078] Step S502: Determine a reference question text. A reference question text similar to the target question text may be obtained.
[0079] Step S504, determine the reference action sequence. For the reference answer text corresponding to the reference question text, the user may have the next step of behavior, such as directly giving feedback by liking / disliking the reference answer text, or clicking on the reference document link of the reference answer text to read a paragraph, copying the question to the input area to ask again, copying the result to paste elsewhere for use, asking new questions, etc. These behaviors can also implicitly provide feedback on whether the current result is satisfactory, and these operations are determined as a 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's interest summary mainly describes whether the user likes the current result and what content the user likes. The user's interest summary is input into the Prompt of the model.
[0081] Step S508, search the candidate text set to obtain reference text. The determination of the candidate text set is as described above. After the candidate text set is determined, it can be searched. A preset number of reference texts can be retrieved based on the target question text. It can be divided into two stages. The rough sorting stage mainly eliminates texts that do not meet the conditions and returns the search results of the first stage, generally selecting a few hundred; in the fine sorting stage, further similarity calculations will be performed based on the results of the rough sorting to obtain text results that meet the conditions, generally a few.
[0082] Specifically, in the rough ranking stage, keyword retrieval can use the BM25 algorithm, and semantic retrieval can use the KNN retrieval (K-Nearest Neighbor, K-nearest neighbor algorithm).
[0083] The text relevance calculation formula of the BM25 algorithm is:
[0084]
[0085] Among them, Q is the target question text, d is the candidate text set, q i is the i-th word in the target question text, n is the total number of words in the target question text, IDF(qi) is the inverse document frequency of word qi, f(qi, d) is the word frequency of word qi in the candidate text set d, |d| is the length of the candidate text set d, avgdl is 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 calculation formula for inverse document frequency IDF(qi) is:
[0087]
[0088] Where N is the total number of candidate texts, n(q i ) is a string containing the word q i The number of candidate texts.
[0089] KNN retrieval uses L2_norm Euclidean distance to calculate the similarity score. The calculation formula is:
[0090]
[0091] Where Q and B are the vector representations of the target question text and the candidate text, respectively, Q = (a1, a2, ..., a n ),
[0092] B=(b1,b2,...,b n ), in this example, the bge-large-zh-v1.5 model is used and n is 1024.
[0093] After determining the text relevance ranking and semantic similarity ranking, the ranking calculation hybrid ranking of Reciprocal Rank Fusion (RRF) can be used:
[0094]
[0095] Where D represents the candidate text set, R represents the set of ranking ordinal numbers starting from 1, and K is a constant, usually 60.
[0096] According to the mixed sorting result, the candidate texts that meet the preset mixed sorting position are determined as candidate texts to be determined; then the refined sorting stage is carried out:
[0097] The text relevance and semantic similarity scores corresponding to each candidate text to be determined can be weighted and summed to obtain the corresponding mixed similarity: α text relevance score + (1-α) semantic similarity score, where 0≤α≤1. Then, the candidate texts to be determined are sorted according to the mixed similarity, and the candidate text to be determined at a preset sequence number is determined as the reference text.
[0098] Step S510, combining the instruction text, the reference text and the target question text to obtain the target answer text. The instruction text, the reference text and the target question text may be input into a language model (LLM) to obtain the target answer text. The language model may be GPT 4, ChatGLM, Qwen, Wenxinyiyan, Yuan2.0, etc.
[0099] Through the above implementation of the present application, at least one reference question text is determined according to the target question text, wherein the target question text and the reference question text are related texts; the reference action corresponding to each of the at least one reference question text is determined, and the reference action is aggregated 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 indication text is obtained according to the reference action sequence, and the indication text, the reference text and the target question are input into the language model to obtain the target answer text, wherein the indication text is used to indicate the characteristics of the reference answer text whose satisfaction reaches a preset threshold. The requirements of the answer text with higher satisfaction (i.e., the indication text) can be determined through the user's reference action on the reference answer text of the reference question text similar to the target question text, and the target answer text that meets the indication text is generated to obtain the answer text with higher satisfaction. The user's interest summary can be connected to the question-answering process in real time, the indication content can be optimized, and the language model can be better guided to generate answers that meet the user's interests. It meets the user's high requirements for personalization and accuracy.
[0100] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, or 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, disk, CD), including several instructions for enabling a terminal device (which can be a computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0101] In the present embodiment, a reply text generating device is also provided, and the device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description has been made no further. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0102] Figure 6 is a structural block diagram of an optional reply text generating device according to an embodiment of the present application, such as Figure 6 As shown, the device comprises:
[0103] A reference question determination module 62, configured to determine at least one reference question text according to a target question text, wherein the target question text and the reference question text are related texts;
[0104] A reference action determination module 64 is used to determine a 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 reply text generation module 66 is used to obtain the instruction text according to the reference action sequence, and input the instruction text, reference text and target question into the language model to obtain the target reply text, wherein the instruction text is used to indicate the characteristics of the reference reply text whose satisfaction reaches a preset threshold.
[0106] Through the present application, at least one reference question text is determined according to the target question text, wherein the target question text and the reference question text are related texts; a reference action corresponding to each of the at least one reference question text is determined, and the reference actions are aggregated 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; an indication text is obtained according to the reference action sequence, and the indication text, the reference text and the target question are input into a language model to obtain a target answer text, wherein the indication text is used to indicate the features of the reference answer text whose satisfaction reaches a preset threshold. The requirements of the answer text with a higher satisfaction level (i.e., the indication text) can be determined through the user's reference action on the reference answer text of the reference question text similar to the target question text, and a target answer text that meets the indication text is generated to obtain an answer text with a higher satisfaction level, thereby solving the technical problem of low accuracy of the current question-answering model in the related art.
[0107] Optionally, the reference action determination module 64 is also used to: traverse the reference question texts, and perform the following operations for each reference question text: obtain at least one trigger operation in response to the reference question text and the reference answer text, and use the trigger operation as the reference action corresponding to the reference question text; use each reference action and the reference question text or reference answer text corresponding to each reference action as an element in the reference action sequence.
[0108] Optionally, the above-mentioned reply text generation module 66 is also used to: determine 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 numerical value of the satisfaction level corresponding to the reference action; input the satisfaction level of each reference action and the reference question text or reference reply text corresponding to each reference action into the language model to obtain the indication text.
[0109] Optionally, the reference question determination module 62 is also used to: perform feature extraction on a set of historical question texts and a target question text to obtain reference text vectors corresponding to the historical question texts and target text vectors corresponding to the target question texts; determine the historical question text corresponding to the reference text vector whose similarity with the target text vector exceeds a preset similarity threshold as the reference question text; and determine the historical question text that belongs to the same dialogue as the target question text as the reference question text.
[0110] Optionally, the above-mentioned reply text generation device also includes: a coarse retrieval module, which is used to search the candidate text set according to the target question text, and determine the candidate text in the candidate text set whose similarity with the target question text is greater than a preset threshold as the candidate text to be determined; a fine retrieval module, which is used to sort the candidate text to be determined from large to small according to the similarity with the target question text, and determine the candidate text to be determined at a preset sequence number as the reference text.
[0111] Optionally, the above-mentioned reply text generation device also includes: a candidate text set module, which is used to perform data analysis on the candidate data set and retain the candidate data in text form in the candidate data set; segment the candidate data to obtain multiple text blocks of preset lengths; vectorize the text blocks of preset lengths to obtain corresponding text vectors; match the candidate data and the corresponding text vectors and store them as candidate texts in the candidate text set.
[0112] Optionally, the above-mentioned rough retrieval module is also used to perform 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; perform 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; sort each candidate text according to the text relevance to obtain the text relevance ranking corresponding to each candidate text; sort each candidate text according to the semantic similarity score to obtain the semantic similarity ranking corresponding to each candidate text; combine the text relevance ranking and the semantic similarity ranking corresponding to each candidate text to obtain the mixed ranking corresponding to each candidate text; according to the mixed ranking result, determine the candidate text that meets the preset mixed ranking position as the candidate text to be determined;
[0113] The above-mentioned detailed retrieval module is also used to: perform weighted summation of the text relevance and semantic similarity scores corresponding to each candidate text to be determined, obtain the corresponding mixed similarity, and sort the candidate texts to be determined according to the mixed similarity, and determine the candidate text to be determined at a preset sequence number as the reference text.
[0114] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0115] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0116] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0117] An embodiment of the present application further provides an electronic device, 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 execute the steps in any one of the above method embodiments.
[0118] In an 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] An embodiment of the present application further provides a computer program product, comprising a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program product, and when the computer program is executed by a processor, the steps of the method described in each embodiment of the present application are implemented.
[0120] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0121] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0122] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for generating a reply text, characterized in that: The method comprises: Determining at least one reference question text according to the target question text, wherein the target question text and the reference question text are related texts; Determine a reference action corresponding to each of the at least one reference question texts, 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; obtain an indication text based on the reference action sequence, and input the indication text, the reference text and the target question into a language model to obtain a target answer text, wherein the indication text is used to indicate the characteristics of the reference answer text whose satisfaction reaches a preset threshold.
2. The method according to claim 1, characterized in that The step of determining a reference action corresponding to each of the at least one reference question texts 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 trigger operation in response to the reference question text and the reference answer text, and use the trigger operation as a reference action corresponding to the reference question text; Each of the reference actions and the reference question text or reference answer text corresponding to the reference actions are used as elements in the reference action sequence.
3. The method according to claim 1, characterized in that The obtaining of the instruction text according to the reference action sequence comprises: Determine the satisfaction of each of the reference actions 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; The satisfaction degree of each of the reference actions and the reference question text or reference answer text corresponding to each of the reference actions are input into the language model to obtain the instruction text.
4. The method according to claim 1, characterized in that The step of determining at least one reference question text according to the target question text includes at least one of the following: Perform feature extraction on the historical question text set and the target question text to obtain reference text vectors corresponding to the historical question texts and target text vectors corresponding to the target question texts; determine the historical question text corresponding to the reference text vector whose similarity with the target text vector exceeds a preset similarity threshold as the reference question text; The historical question text that belongs to the same dialogue as the target question text is determined as the reference question text.
5. The method according to any one of claims 1 to 4, characterized in that: Before inputting the instruction text, the reference text and the target question into the language model to obtain the target answer text, the method includes: Retrieving a candidate text set according to the target question text, and determining candidate texts in the candidate text set whose similarity with the target question text is greater than a preset threshold as candidate texts to be determined; The candidate texts to be determined are sorted from large to small according to their similarities with the target question text, and the candidate texts to be determined at a preset sequence number are determined as the reference texts.
6. The method according to claim 5, characterized in that Before searching the candidate text set according to the target question text, the method includes: Performing data parsing on the candidate data set, and retaining the candidate data in text form in the candidate data set; Segmenting the candidate data to obtain a plurality of text blocks of preset lengths; Performing vectorization processing on the text block of the preset length to obtain a corresponding text vector; The candidate data and the corresponding text vector are matched and stored as candidate texts in the candidate text set.
7. The method according to claim 5, characterized in that The step of determining the candidate texts in the candidate text set whose similarity with the target question text is greater than a preset threshold as candidate texts to be determined includes: Perform keyword recognition and matching on the target question text and the candidate text set to obtain text relevance corresponding to each candidate text in the candidate text set; Performing semantic recognition matching on the target question text and the candidate text set to obtain a semantic similarity score corresponding to each candidate text in the candidate text set; Sorting each of the candidate texts according to the text relevance to obtain a text relevance ranking corresponding to each of the candidate texts; Sorting each of the candidate texts according to the semantic similarity score to obtain a semantic similarity ranking corresponding to each of the candidate texts; Combining the text relevance ranking and the semantic similarity ranking corresponding to each of the candidate texts to obtain a mixed ranking corresponding to each of the candidate texts; According to the mixed sorting result, the candidate texts satisfying the preset mixed sorting position are determined as the candidate texts to be determined; The step of sorting the candidate texts to be determined from large to small according to the similarity with the target question text, and determining the candidate texts to be determined at a preset sequence number as the reference texts includes: The text relevance and semantic similarity scores corresponding to each of the candidate texts to be determined are weightedly summed to obtain the corresponding mixed similarities, and the candidate texts to be determined are sorted according to the mixed similarities, and the candidate texts to be determined at a preset sequence number are determined as the reference texts.
8. A reply text generating device, characterized in that: The device comprises: A reference question determination module, used to determine at least one reference question text according to a target question text, wherein the target question text and the reference question text are related texts; A reference action determination module, used to determine the reference actions corresponding to each of the at least one reference question texts, 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 answer text corresponding to the reference question; A reply text generation module is used to obtain an instruction text based on the reference action sequence, and input the instruction text, reference text and the target question into a language model to obtain a target reply text, wherein the instruction text is used to indicate the characteristics of the reference reply text whose satisfaction reaches a preset threshold.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.
10. 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, the steps of the method according to any one of claims 1 to 7 are implemented.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
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
Intelligent language response recognition system and method based on attention mechanism
CN118551849A
Intelligent question and answer implementation method and device, equipment and storage medium
CN118626604A
Cited By
Control method and device of reply model, storage medium and electronic equipment
CN120851221A
Control method and device of reply model, storage medium and electronic equipment
CN120851221B
Financial data preprocessing method and system based on RAG processing packaging
CN121168458A