Intelligent question answering method and device based on emotional tendency and storage medium
Through an intelligent question-and-answer method based on emotional tendency, the answer is adjusted using the emotional tendency analysis model and the number of queries to adjust the answers, the problems of mechanical and emotional needs in the interactive question-and-answer of the big model are solved, and more effective and emotionally consistent answers are achieved.
Patent Information
- Application Number
- CN202510511800.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-04-23
AI Technical Summary
When users interact with big models, it is difficult for the existing technology to give users satisfactory answers, especially in professional fields, and the answers during big models interact with big models are too mechanical and cannot meet the emotional needs of users.
Through an intelligent question-and-answer method based on emotional tendency, the preset emotional tendency analysis model is used to determine the emotional coefficient of the target problem, and generate emotionally consistent prompt words based on the emotional coefficient, adjust candidate information based on the query number and generate a second prompt word, and finally input the prompt word to search the big model to obtain feedback answers.
It realizes the integration of user questions and positive responses, and the answer adjustment is adjusted in combination with the number of inquiry times of user questions, which improves the effectiveness of feedback answers and user satisfaction.
Smart Images

Figure CN120030134A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence, and in particular to an intelligent question-answering method, device and storage medium based on emotional tendency. Background Art
[0002] When users and large models are interacting with each other to answer questions, local information sources are usually mounted for professional questions. When users’ questions are not within the scope of local information sources, it is often difficult to give users satisfactory answers simply by relying on the model.
[0003] Moreover, when the large model is used for interactive question-and-answer, the answers given are too mechanical and cannot meet the emotional needs of users. Moreover, the prompt words generated during interactive question-and-answer cannot be dynamically updated in combination with the questions, which will lead to deviations in the content of the answers.
[0004] In view of this, the present invention is proposed. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides an intelligent question-answering method, device and storage medium based on emotional tendency, which realizes the effect of integrating the emotions of user questions to make positive responses, and adjusting answers based on feedback on answers to user questions.
[0006] The embodiment of the present invention provides an intelligent question-answering method based on emotional tendency, the method comprising:
[0007] Determine the sentiment coefficient corresponding to the target question based on the target question and the preset sentiment tendency analysis model;
[0008] Generate a model based on the target question, the sentiment coefficient and the preset sentiment prompt word, and determine the first prompt word corresponding to the target question;
[0009] Determine the target information source and the number of selections corresponding to the target information source according to the number of queries corresponding to the target question, and determine candidate information based on the target question, the target information source and the number of selections;
[0010] Determine the second prompt word corresponding to the target question according to the number of selections, candidate information and a preset search prompt word template;
[0011] The first prompt word and the second prompt word are input into the preset search model to obtain the feedback answer corresponding to the target question.
[0012] An embodiment of the present invention provides an electronic device, the electronic device comprising:
[0013] Processor and memory;
[0014] The processor is used to execute the steps of the intelligent question-answering method based on emotion tendency in any embodiment by calling the program or instruction stored in the memory.
[0015] An embodiment of the present invention provides a computer-readable storage medium, which stores a program or instruction. The program or instruction enables a computer to execute the steps of the intelligent question-answering method based on emotional tendency in any embodiment.
[0016] The embodiments of the present invention have the following technical effects:
[0017] By determining the sentiment coefficient corresponding to the target question according to the target question and the preset sentiment tendency analysis model, and generating a model according to the target question, the sentiment coefficient and the preset sentiment prompt word, the first prompt word corresponding to the target question is determined to automatically analyze the target question and generate a prompt word that matches the sentiment. Then, according to the number of queries corresponding to the target question, the target information source and the number of selections corresponding to the target information source are determined, and based on the target question, the target information source and the number of selections, the candidate information is determined to adjust the candidate information in combination with the number of queries to improve the effectiveness of subsequent feedback answers. Furthermore, according to the number of selections, the candidate information and the preset search prompt word template, the second prompt word corresponding to the target question is determined to automatically analyze the usage of the candidate information and generate prompt words for reasonable search use. The first prompt word and the second prompt word are input into the preset search large model to obtain the feedback answer corresponding to the target question, thereby achieving the effect of actively responding to the target question by integrating the sentiment, and adjusting the answer in combination with the number of queries to the target question. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 is a flow chart of an intelligent question-answering method based on emotional tendency provided by an embodiment of the present invention;
[0020] Figure 2 It is a schematic diagram of the retrieval process of the intelligent question and answer and the update process of the local information source provided by the embodiment of the present invention;
[0021] Figure 3 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the scope of protection of the present invention.
[0023] The intelligent question-answering method based on emotional tendency provided by the embodiment of the present invention is mainly applicable to the situation where, when answering user questions, the emotion of the user's question is considered to be actively responded to and the answer is adjusted in combination with the number of queries of the user's question. The intelligent question-answering method based on emotional tendency provided by the embodiment of the present invention can be executed by an electronic device.
[0024] Embodiment 1
[0025] Figure 1 is a flow chart of an intelligent question-answering method based on emotional tendency provided by an embodiment of the present invention. Figure 1 , the intelligent question-answering method based on emotional tendency specifically includes:
[0026] S110: Determine the sentiment coefficient corresponding to the target question according to the target question and a preset sentiment tendency analysis model.
[0027] The target question is a question that the user needs to answer using a preset search model. The preset search model is a model that can search for questions and provide feedback based on prompt words. The preset sentiment analysis model is a pre-selected model that can analyze emotions or feelings from a sentence. The sentiment coefficient is a numerical value used to evaluate the sentiment of the target question.
[0028] Specifically, the target question is input into a preset sentiment tendency analysis model, and the tone and emotion in the target question are perceived to obtain the output result of the model. The output result is then converted according to the coefficient requirements of the sentiment coefficient, and after the conversion, the sentiment coefficient corresponding to the target question can be obtained.
[0029] Based on the above example, the preset sentiment tendency analysis model includes at least two analysis sub-models, and the sentiment coefficient corresponding to the target question can be determined according to the target question and the preset sentiment tendency analysis model in the following manner:
[0030] For each analysis sub-model, determine the analysis coefficient corresponding to the target problem according to the target problem and the preset score range;
[0031] Determine the sentiment coefficient based on the analysis coefficients corresponding to the target question.
[0032] Among them, the analysis sub-model is a different model for sentiment analysis, which can be SnowNLP (open source Chinese natural language processing), VADER (Valence Aware Dictionary and sEntiment Reasoner, a rule-based sentiment analysis model) and a generative model (such as the Qwen2.5-14b open source model, etc.). The preset score range is a pre-set coefficient range for the analysis coefficient. The analysis coefficient is the output result of the analysis sub-model within the preset score range.
[0033] Specifically, each analysis sub-model is used to analyze the emotional tendency of the target question, and is planned according to a preset score range, such as scoring in the range of 0-1. The larger the score, the more positive the emotion. The analysis coefficient output by each analysis sub-model can be obtained. According to the pre-set analysis coefficient fusion method, such as averaging, weighted averaging, substituting into a pre-built fitting function, etc., the analysis coefficients output by each analysis sub-model can be fused to obtain the emotional coefficient corresponding to the target question.
[0034] Exemplarily, the sentiment coefficient analysis part is composed of three analysis sub-models, and a preset prompt word is used. The preset prompt word can be: "Analyze the sentiment tendency of the user's question and give a sentiment score, the score range is 0 to 1, the closer the score is to 1, the more positive the user's question content is, and the closer it is to 0, the more negative the sentiment is", etc. Then, the target question is input into the three analysis sub-models at the same time for sentiment tendency scoring, and three analysis coefficients are obtained, and the analysis coefficients can be unified into a preset score range, such as the interval of 0 to 1. Finally, the average value of the three analysis coefficients can be obtained as the sentiment coefficient of the target question.
[0035] S120: Generate a model based on the target question, the sentiment coefficient, and preset sentiment prompt words to determine a first prompt word corresponding to the target question.
[0036] The preset emotional prompt word generation model is a pre-set model for generating a first prompt word related to an emotional coefficient for guiding the answer to a target question.
[0037] Specifically, by inputting the sentiment coefficient and the target question into a preset sentiment prompt word generation model, a prompt word that guides the preset search model to answer the target question according to the sentiment coefficient can be obtained, that is, the first prompt word.
[0038] Exemplarily, the target question and the sentiment coefficient are integrated into a preset sentiment prompt word generation model, which can be by inputting a question into the preset sentiment prompt word generation model: "The current user's question is {target question}, and the sentiment tendency analysis of the question is performed. The score is {sentiment coefficient}, and the scoring range is 0 to 1. The closer the score is to 1, the more positive the emotion is, and the closer to 0, the more negative the emotion is. Please generate prompt words based on the sentiment tendency of the user's question to guide the model to generate positive answers." The prompt words output by the preset sentiment prompt word generation model are the first prompt words.
[0039] S130. Determine the target information source and the number of selections corresponding to the target information source according to the number of queries corresponding to the target question, and determine candidate information based on the target question, the target information source and the number of selections.
[0040] Among them, the number of queries is the number of queries the user has made for the target question in the current round. It can be understood that when the target question is asked for the first time, the number of queries is 1. If the user is not satisfied with the feedback answer to the target question and triggers a re-analysis of the target question to answer it, the number of queries is increased by one, and the number of queries can be updated by analogy. The target information source can be a local information source or a network information source, which is used to search and analyze the target question and determine the feedback answer. The number of selections is the number of times different information sources have been used in previous queries. It can be understood that the sum of the number of selections of the local information source and the number of selections of the network information source is equal to the number of queries, and because the information stored in the local information source is limited, the number of selections of the local information source will be subject to the upper limit of the pre-set number of local information sources. Candidate information is reference auxiliary information when analyzing and answering the target question.
[0041] Specifically, analyze the number of queries corresponding to the target question and determine whether the number of queries exceeds the upper limit of the local information source. If yes, it means that only the network information source can be used as the target information source at present, and the number of selections corresponding to the target information source in the previous search can be added by one to obtain the number of selections of the target information source. If not, it can be further determined whether there is other information corresponding to the target question in the local information source, that is, information that was not used when the local information source was searched last time. If so, the local information source can be used as the target information source. Otherwise, the network information source can be used as the target information source, and the number of selections corresponding to the target information source in the previous search can be added by one to obtain the number of selections of the target information source. Determine the number of filtered information in combination with the number of selections, and search the target information source for this number of information corresponding to the target question as candidate information.
[0042] Based on the above example, the target information source and the number of selections corresponding to the target information source can be determined according to the number of queries corresponding to the target question in the following manner:
[0043] In response to the query number being 1, it is determined whether candidate information corresponding to the target question exists according to the target question and the local information source. If so, it is determined that the target information source is a local information source, and the number of selections corresponding to the local information source is 1; if not, it is determined that the target information source is a network information source, and the number of selections corresponding to the network information source is 1;
[0044] In response to the query number being greater than 1, the target information source is determined to be a network information source, and the selection number corresponding to the target information source is determined according to the first information source corresponding to the first query and the query number.
[0045] The first query is a query when the query number is 1. The first information source is a target information source when the query number is 1.
[0046] Specifically, since the information stored in the local information source is limited, all information related to the target question can be obtained in one query, and the upper limit of the number of local information sources can be set to 1. If the number of queries is 1, the target question is searched in the local information source to determine whether the candidate information corresponding to the target question exists. If it exists, it means that there is information related to the target question in the local information source. Therefore, the target information source is determined to be a local information source, and the number of selections corresponding to the local information source is determined to be 1. If it does not exist, it means that there is no content related to the target question in the local information source, and the information source needs to be replaced. Therefore, the target information source is determined to be a network information source, and the number of selections corresponding to the network information source is determined to be 1. If the number of queries is greater than 1, it means that the local information source definitely does not meet the search requirements of the target question. Therefore, the target information source can be directly determined to be a network information source, and the first information source corresponding to the first query can be obtained. If the first information source is a local information source, the number of selections corresponding to the target information source is determined to be the number of queries minus one. If the first information source is a network information source, the number of selections corresponding to the target information source is determined to be equal to the number of queries.
[0047] Based on the above example, candidate information can be determined based on the target question, target information source, and number of selections in the following ways:
[0048] In response to the target information source being a local information source, searching the local information source according to the target question to determine candidate information;
[0049] In response to the target information source being a network information source, the amount of information is determined according to the number of selections, and the network information source is searched according to the target question and the amount of information to determine candidate information.
[0050] The number of pieces of information refers to the number of pieces of information required for searching the target problem.
[0051] Specifically, if the target information source is a local information source, the target question is used to search in the local information source, and the retrieved information related to the target question is used as candidate information. If the target information source is a network information source, a lot of information may be found in the network information source, so the number of information needs to be limited, and the number of selections can be used as the number of information. Then, the information related to the target question is searched in the network information source, and the information with the highest relevance ranking is used as candidate information.
[0052] Based on the above example, the following methods can be used to search online information sources according to the target question and the amount of information to determine candidate information:
[0053] According to the target problem, determine the problem vector corresponding to the target problem;
[0054] Determine the relevance of each network text segment to the target question based on the question vector and the text segment vector corresponding to each network text segment in the network information source;
[0055] Sort each network text segment according to its relevance from large to small, determine the sorting sequence number corresponding to each network text segment, and take each network text segment whose sorting sequence number is less than or equal to the number of information as candidate information.
[0056] The question vector is the vectorized representation of the target question. The network text segment is the text information involved in the online search in the network information source. The text segment vector is the vectorized representation of the network text segment. The relevance is the distance between the question vector and the text segment vector, which can be, for example, the Euclidean distance. The sorting number is used to identify the position of the sorted information.
[0057] Specifically, the target question is vectorized to obtain the question vector corresponding to the target question. In addition, each network text segment can be vectorized in advance in the network information source to obtain the text segment vector corresponding to each network text segment. Then, the vector distance between the question vector and each text segment vector is calculated as the relevance of each network text segment to the target question. The network text segments are sorted from large to small according to the relevance, and the sorting sequence number corresponding to each network text segment can be obtained. If the sorting sequence number is less than or equal to the number of information network text segments, it means that subsequent analysis is required, so these network text segments are all used as candidate information.
[0058] S140: Determine a second prompt word corresponding to the target question according to the number of selections, candidate information, and a preset search prompt word template.
[0059] The preset search prompt word template is used to guide the generation of a template for analysis based on candidate information according to certain rules. The second prompt word is used to guide the analysis of the target question in combination with the number of selections and candidate information.
[0060] Specifically, according to the number of selections, it can be determined whether there are multiple candidate information that need to be analyzed. If the number of selections is 1, the candidate information is directly substituted into the preset search prompt word template to generate the second prompt word corresponding to the target question. If the number of selections is greater than 1, it is necessary to determine the analysis degree of each candidate information (such as key analysis, exclusion analysis, brief analysis, etc.). After substituting the candidate information and the analysis degree of each candidate information into the preset search prompt word template, the second prompt word corresponding to the target question can be generated.
[0061] Based on the above example, if the target information source is a network information source, the second prompt word corresponding to the target question can be determined according to the number of selections, candidate information, and a preset search prompt word template in the following manner:
[0062] In response to the number of selections being 1, the candidate information is used as a target reference item, and a second prompt word corresponding to the target question is determined according to the target reference item and a first preset template in the preset search prompt word template;
[0063] In response to the number of selections being greater than 1, the sorting sequence of each candidate information is determined from large to small according to the relevance of the candidate information to the target question, and at least two combined reference items are determined based on the received answer score and the sorting sequence of each candidate information, and the second prompt word corresponding to the target question is determined based on each combined reference item and the second preset template in the preset search prompt word template.
[0064] The target reference item is the only reference information item when the number of selections is 1. The first preset template is a preset search prompt word template for only one piece of information, and the second preset template is a preset search prompt word template for at least two pieces of information. The answer score is the score given by the user to the previous feedback answer to the target question. The combined reference item is an information item that analyzes the candidate information to different degrees.
[0065] Specifically, if the number of selections is 1, it means that there is only one candidate information. The candidate information is directly used as the target reference item, and the target reference item is substituted into the first preset template in the preset search prompt word template to obtain the second prompt word corresponding to the target question. If the number of selections is greater than 1, it means that there are at least two candidate information, and different analysis degrees need to be assigned to the candidate information. Therefore, the candidate information is sorted from large to small according to the relevance to the target question, and the sorting number of each candidate information can be obtained. Then, combined with the received answer score, the analysis degree is assigned to the candidate information corresponding to the different sorting numbers, and at least two combined reference items can be determined. Then, each combined reference item is substituted into the second preset template in the preset search prompt word template to obtain the second prompt word corresponding to the target question.
[0066] Based on the above example, if the combined reference items include key reference items, brief reference items, and excluded reference items, at least two combined reference items may be determined according to the received answer scores and the ranking sequence numbers of each candidate information in the following manner:
[0067] In response to the answer score being less than the first threshold and greater than or equal to the second threshold, the previously retrieved exclusion reference item is used as the current exclusion reference item, the candidate information with the last ranking number is used as the brief reference item, and the candidate information with a ranking number other than the last ranking number and not belonging to the exclusion reference item is used as the key reference item;
[0068] In response to the answer score being less than the second threshold and greater than or equal to the third threshold, the previously retrieved exclusion reference item is used as the current exclusion reference item, the candidate information with the last ranking number is used as the key reference item, and the candidate information with a ranking number other than the last ranking number and not belonging to the exclusion reference item is used as the brief reference item;
[0069] In response to the answer score being less than the third threshold, the previously retrieved exclusion reference item and the candidate information with the second-to-last sorting number are used as current exclusion reference items, and the candidate information that does not belong to the exclusion reference item is used as the key reference item.
[0070] Among them, the first threshold, the second threshold and the third threshold are thresholds used to determine whether the feedback answer retrieved for the target question last time is satisfactory. The first threshold is greater than the second threshold, and the second threshold is greater than the third threshold. For example, if the answer score is greater than or equal to the first threshold, it can be considered that the user is very satisfied with the feedback answer; if the answer score is less than the first threshold and greater than or equal to the second threshold, it can be considered that the user is satisfied with the feedback answer, but there is still room for improvement; if the answer score is less than the second threshold and greater than or equal to the third threshold, it can be considered that the user is dissatisfied with the feedback answer, and it is believed that there is still a lot of room for improvement in the feedback answer; if the answer score is less than the third threshold, it means that the user is very dissatisfied with the feedback answer and needs to be re-analyzed. The key reference item is the information item that is analyzed in focus, the brief reference item is the information item that is analyzed briefly, and the excluded reference item is the information item that does not need to be analyzed.
[0071] Specifically, if the answer score is less than the first threshold and greater than or equal to the second threshold, it means that the user is satisfied with the feedback answer of the previous search, but there is still room for improvement. Therefore, the candidate information can be expanded, and the excluded reference item of the previous search is still used as the current excluded reference item, and the candidate information with the last ranking number (that is, the newly added candidate information) is used as the brief reference item, and the candidate information with a ranking number other than the last and not belonging to the excluded reference item (that is, each candidate information of the non-excluded reference item used in the previous search) is used as the key reference item. If the answer score is less than the second threshold and greater than or equal to the third threshold, it means that the user is not satisfied with the feedback answer of the previous search, and therefore, each candidate information of the non-excluded reference item referenced in the previous search can only be used for brief reference, so the excluded reference item of the previous search can still be used as the current excluded reference item, and the candidate information with the last ranking number can be used as the key reference item, and the candidate information with a ranking number other than the last and not belonging to the excluded reference item can be used as the brief reference item. If the answer score is less than the third threshold, the excluded reference item retrieved last time and the candidate information with the second-to-last sorting number (the candidate information newly added as a reference last time) will be used as the current excluded reference items, and the candidate information that does not belong to the excluded reference items will be used as the key reference items.
[0072] S150: Input the first prompt word and the second prompt word into a preset search model to obtain a feedback answer corresponding to the target question.
[0073] The feedback answer is the output result after the preset search model processes the first prompt word and the second prompt word.
[0074] Specifically, since the first prompt word contains the sentiment coefficient and information related to the target question, and the second prompt word contains candidate information and indicative information of each reference item, the first prompt word and the second prompt word can be combined and analyzed and processed using the preset search model to obtain the feedback answer corresponding to the target question.
[0075] Based on the above example, after obtaining the feedback answer corresponding to the target question, the user is required to feedback his or her satisfaction, that is, the answer score, to facilitate re-search or storage of satisfactory feedback answers, which can be:
[0076] Receive the answer score corresponding to the feedback answer;
[0077] In response to the answer score being greater than or equal to the first threshold, updating the local information source according to the target question and the feedback answer;
[0078] In response to the answer score being greater than or equal to the first threshold and the number of queries corresponding to the feedback answer being 1, at least one analysis sub-model in the preset emotional prompt word generation model is fine-tuned according to the target question and the emotional coefficient corresponding to the target question.
[0079] Specifically, after providing a feedback answer to the target question, a scoring window can be provided to the user for receiving the answer score corresponding to the feedback answer. If the answer score is greater than or equal to the first threshold, it means that the user is very satisfied with the current feedback answer, and there is no need to continue to optimize it, and it can be updated to the local information source. That is, if the target question and the feedback answer are already stored in the local information source, there is no need to update the local information source. If the target question and the feedback answer are not yet stored in the local information source, the target question and the feedback answer are stored in the local information source accordingly. If the answer score is less than the first threshold, the method can be returned to iteratively execute, and the feedback answer is iteratively updated to improve user satisfaction. If the answer score is greater than or equal to the first threshold and the number of queries is 1, it means that the user is satisfied with the current sentiment analysis result. Therefore, the target question and the sentiment coefficient corresponding to the target question, or the analysis coefficients corresponding to the sentiment coefficient, can be used to fine-tune the analysis sub-model (such as the generative model) in the preset sentiment prompt word generation model that can adjust the tail structure parameters to improve the analysis ability of the generative model.
[0080] For example, the retrieval process of intelligent question answering and the update process of local information sources are as follows: Figure 2 As shown. After the user raises the target question, first, the target question is searched in the local information source. If there is relevant information in the local information source, first, the searched candidate information content is sorted according to the relevance, and the answer with the highest relevance is input into the preset search model. The generative model generates content based on the candidate information, and the generated content is returned to the user as the feedback answer; if there is no relevant answer information in the local information source after the search, the network information source is used to conduct an online search. After the searched content is sorted according to the relevance, the content with the highest relevance is input into the preset search model. The model generates content based on the candidate information of the online search, and the generated feedback answer is fed back to the user. On the user side, the user can evaluate the feedback answer returned in the preset search model, that is, the answer score, and use the first threshold, the second threshold and the third threshold to judge the level of the answer score, that is, the user evaluation can be divided into four levels: very satisfied, satisfied, dissatisfied, and very dissatisfied.
[0081] If the user's evaluation is very satisfactory, the user's target question and the returned feedback answer will be updated to the local information source.
[0082] If the user's evaluation is satisfactory and he chooses to regenerate the answer, the network search will be directly carried out according to the target question, and the search content will be sorted by relevance. If the feedback answer of the first evaluation is obtained from a local information source, the content ranked first in relevance after the network search using the network information source will be returned as candidate information to the preset search model. Otherwise, the content ranked first and second in relevance after the network search using the network information source will form two sections of candidate information and be input into the preset search model at the same time, and the second prompt word will be generated based on the preset search prompt word template: "User evaluation is divided into four levels: very satisfied, satisfied, dissatisfied, and very dissatisfied. Only the first paragraph of the content can generate an answer with a user evaluation of 'satisfied'. Please focus on the first paragraph and regenerate in combination with the second paragraph." The second prompt word and the first prompt word are spliced to obtain the final prompt word, and the final prompt word is input into the preset search model together with the target question, and the feedback answer generated by the model is returned to the user, and the user evaluates again. That is, when the user's evaluation is "satisfied", when the preset search prompt word template modifies the second prompt word, it emphasizes that it is necessary to "focus on" (key reference item) the content to be referenced mentioned in all previous prompt words, and "combine" (brief reference item) the content ranked next in relevance after the online search to generate the answer.
[0083] If the user's evaluation is unsatisfactory and he chooses to regenerate the answer, he will directly conduct an online search based on the target question and sort the search content by relevance. If the feedback answer of the first evaluation is obtained from a local information source, the content ranked first in relevance after the online search using the network information source will be returned as candidate information to the preset search model. Otherwise, the content ranked first and second in relevance after the online search using the network information source will form two sections of candidate information and be input into the preset search model at the same time, and the second prompt word will be generated based on the preset search prompt word template: "User evaluation is divided into four levels: very satisfied, satisfied, dissatisfied, and very dissatisfied. Only the first paragraph of the content can generate an answer with the user evaluation of 'unsatisfactory'. Please briefly refer to the first paragraph and focus on regenerating in combination with the second paragraph." The second prompt word and the first prompt word are spliced to obtain the final prompt word, and the final prompt word is input into the preset search model together with the target question, and the feedback answer generated by the model is returned to the user, and the user evaluates again. That is, when the user's evaluation is "unsatisfied", when the preset search prompt word template modifies the second prompt word, it is necessary to emphasize the need to "briefly refer to" (brief reference item) the content to be referenced mentioned in all previous prompt words, and "focus on combining" (focus on reference item) the content with the next highest relevance ranking after online search to generate the answer.
[0084] If the user's evaluation is very unsatisfactory and he chooses to regenerate the answer, the network search will be directly carried out according to the target question, and the search content will be sorted by relevance. If the feedback answer of the first evaluation is obtained from a local information source, the content ranked first in relevance after the network search using the network information source will be returned as candidate information to the preset search model. Otherwise, the content ranked first and second in relevance after the network search using the network information source will form two sections of candidate information and input them into the preset search model at the same time, and the second prompt word will be generated based on the preset search prompt word template: "User evaluation is divided into four levels: very satisfied, satisfied, dissatisfied, and very dissatisfied. Only the first paragraph of the content can generate an answer with the user evaluation of 'very dissatisfied'. Please exclude the first paragraph and regenerate only in combination with the second paragraph." The second prompt word and the first prompt word are spliced to obtain the final prompt word, and the final prompt word is input into the preset search model together with the target question, and the feedback answer generated by the model is returned to the user, and the user evaluates again. That is, when the user's evaluation is "very dissatisfied", when the preset search prompt word template modifies the second prompt word, it is necessary to emphasize "excluding" (excluding reference items) all the content mentioned in the previous instruction for reference, and "only combining" (focusing on reference items) the content ranked next in relevance after online search and the content mentioned in all previous prompt words for reference to generate the answer. It is understandable that if the feedback answer is not "very satisfied", the excluded reference items will be continued in the subsequent second prompt word and also serve as excluded reference items.
[0085] If the user evaluates the first feedback answer returned by the model as "very satisfied", the target question, each analysis coefficient (SnowNLP score, VADER score and generative model score) and the first prompt word are recorded in the prompt word library. The content of the prompt word library is used as a data set at regular intervals, and the target question and the first prompt word are vectorized as input. The analysis coefficients are used as labels to fine-tune the tail structure of the generative model to gradually improve the ability of the generative model. The generative model can include the generative model in the analysis sub-model, and can also include a usage model of a preset search prompt word template and a preset search large model.
[0086] The above method solves the problem of manually updating the content of local information sources, forms a technical route for automatically updating local information sources, solves the problem of inaccurate answers generated by large search models due to the inability to dynamically update prompt words, and forms a method for automatically updating prompt words. In addition, the generative model is allowed to participate in the entire process of prompt word generation and answer generation, and the generative model is assisted by the existing relatively mature sentiment tendency analysis algorithm, which automatically improves the ability of the generative model to dynamically update prompt words.
[0087] The present invention has the following technical effects: by determining the sentiment coefficient corresponding to the target question according to the target question and the preset sentiment tendency analysis model, and determining the first prompt word corresponding to the target question according to the target question, the sentiment coefficient and the preset sentiment prompt word generation model, so as to automatically analyze the target question and generate a prompt word that matches the sentiment, and then, according to the number of queries corresponding to the target question, determine the target information source and the number of selections corresponding to the target information source, and based on the target question, the target information source and the number of selections, determine the candidate information, so as to adjust the candidate information in combination with the number of queries, so as to improve the effectiveness of subsequent feedback answers, and further, according to the number of selections, the candidate information and the preset search prompt word template, determine the second prompt word corresponding to the target question, so as to automatically analyze the usage of the candidate information and generate reasonable prompt words for search use, and input the first prompt word and the second prompt word into the preset search large model to obtain the feedback answer corresponding to the target question, so as to achieve the effect of actively responding to the target question by integrating the sentiment, and adjusting the answer in combination with the number of queries to the target question.
[0088] Embodiment 2
[0089] Figure 3 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 3 As shown, the electronic device 200 includes one or more processors 201 and a memory 202 .
[0090] The processor 201 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 200 to perform desired functions.
[0091] The memory 202 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 201 may run the program instructions to implement the intelligent question-answering method based on emotional tendency and / or other desired functions of any embodiment of the present invention described above. Various contents such as initial external parameters, thresholds, etc. may also be stored in the computer-readable storage medium.
[0092] In one example, the electronic device 200 may further include: an input device 203 and an output device 204, which are interconnected via a bus system and / or other forms of connection mechanisms (not shown). The input device 203 may include, for example, a keyboard, a mouse, etc. The output device 204 may output various information to the outside, including early warning prompt information, braking force, etc. The output device 204 may include, for example, a display, a speaker, a printer, a communication network and a remote output device connected thereto, etc.
[0093] Of course, to simplify, Figure 3 Only some of the components related to the present invention in the electronic device 200 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application conditions, the electronic device 200 may also include any other appropriate components.
[0094] Embodiment 3
[0095] In addition to the above-mentioned methods and devices, an embodiment of the present invention may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the intelligent question-answering method based on emotional tendency provided by any embodiment of the present invention.
[0096] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the embodiments of the present invention, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0097] In addition, an embodiment of the present invention may also be a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the processor executes the steps of the intelligent question-answering method based on emotional tendency provided by any embodiment of the present invention.
[0098] The computer-readable storage medium may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0099] It should be noted that the terms used in the present invention are only for describing specific embodiments and do not limit the scope of the present application. As shown in the specification of the present invention, unless the context clearly indicates otherwise, words such as "a", "an", "one", and / or "the" do not specifically refer to the singular and may also include the plural. The term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, or apparatus comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or also includes elements inherent to such process, method, or apparatus. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, or apparatus comprising the element.
[0100] It should also be noted that the orientation or positional relationship indicated by terms such as "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be construed as a limitation on the present invention. Unless otherwise clearly specified and defined, terms such as "installed", "connected", "coupled" should be understood in a broad sense. For example, it may be a fixed connection, a detachable connection, or an integral connection; it may be a mechanical connection or an electrical connection; it may be directly connected or indirectly connected through an intermediate medium, and may be the internal communication of two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the technical solutions of the embodiments of the present invention.
Claims
1. An intelligent question-answering method based on emotional tendency, characterized in that: include: Determine the sentiment coefficient corresponding to the target question according to the target question and the preset sentiment tendency analysis model; Determine a first prompt word corresponding to the target question according to the target question, the sentiment coefficient and a preset sentiment prompt word generation model; Determine a target information source and a selection number corresponding to the target information source according to the query number corresponding to the target question, and determine candidate information based on the target question, the target information source and the selection number; Determining a second prompt word corresponding to the target question according to the number of selections, the candidate information, and a preset search prompt word template; The first prompt word and the second prompt word are input into a preset search model to obtain a feedback answer corresponding to the target question.
2. The method according to claim 1, characterized in that: The preset sentiment tendency analysis model includes at least two analysis sub-models; determining the sentiment coefficient corresponding to the target question according to the target question and the preset sentiment tendency analysis model includes: For each analysis sub-model, determining an analysis coefficient corresponding to the target problem according to the target problem and a preset score range; The sentiment coefficient is determined according to each analysis coefficient corresponding to the target question.
3. The method according to claim 1, characterized in that The determining, according to the number of queries corresponding to the target question, a target information source and a number of selections corresponding to the target information source comprises: In response to the query number being 1, judging whether candidate information corresponding to the target question exists according to the target question and the local information source; if so, determining that the target information source is a local information source, and determining that the number of selections corresponding to the local information source is 1; if not, determining that the target information source is a network information source, and determining that the number of selections corresponding to the network information source is 1; In response to the query number being greater than 1, the target information source is determined to be a network information source, and the selection number corresponding to the target information source is determined according to the first information source corresponding to the first query and the query number.
4. The method according to claim 1, characterized in that The determining of candidate information based on the target question, the target information source, and the number of selections includes: In response to the target information source being a local information source, searching the local information source according to the target question to determine candidate information; In response to the target information source being a network information source, the amount of information is determined according to the number of selections, and candidate information is determined by searching the network information source according to the target question and the amount of information.
5. The method according to claim 4, characterized in that The step of searching the network information source according to the target question and the amount of information to determine candidate information includes: According to the target problem, determining a problem vector corresponding to the target problem; Determining the relevance of each network text segment to the target question based on the question vector and the text segment vector corresponding to each network text segment in the network information source; Sort the network text segments in descending order according to their relevance, determine the sorting sequence number corresponding to each network text segment, and take each network text segment whose sorting sequence number is less than or equal to the number of information as candidate information.
6. The method according to claim 1, characterized in that If the target information source is a network information source, determining the second prompt word corresponding to the target question according to the number of selections, the candidate information, and a preset search prompt word template includes: In response to the number of selections being 1, the candidate information is used as a target reference item, and a second prompt word corresponding to the target question is determined according to the target reference item and a first preset template in the preset search prompt word templates; In response to the number of selections being greater than 1, the sorting sequence number of each candidate information is determined from large to small according to the relevance of the candidate information to the target question, and at least two combined reference items are determined based on the received answer score and the sorting sequence number of each candidate information, and the second prompt word corresponding to the target question is determined based on each combined reference item and the second preset template in the preset search prompt word template.
7. The method according to claim 6, characterized in that The combined reference items include key reference items, brief reference items and excluded reference items; The step of determining at least two combination reference items according to the received answer scores and the ranking sequence numbers of the candidate information includes: In response to the answer score being less than the first threshold and greater than or equal to the second threshold, the previously retrieved exclusion reference item is used as the current exclusion reference item, the candidate information with the last ranking number is used as the brief reference item, and the candidate information with a ranking number other than the last ranking number and not belonging to the exclusion reference item is used as the key reference item; In response to the answer score being less than the second threshold and greater than or equal to the third threshold, the previously retrieved exclusion reference item is used as the current exclusion reference item, the candidate information with the last ranking number is used as the key reference item, and the candidate information with a ranking number other than the last ranking number and not belonging to the exclusion reference item is used as the brief reference item; In response to the answer score being less than the third threshold, the previously retrieved exclusion reference item and the candidate information with the second-to-last sorting sequence number are used as current exclusion reference items, and the candidate information that does not belong to the exclusion reference item is used as the key reference item.
8. The method according to claim 1, characterized in that: After obtaining the feedback answer corresponding to the target question, the method further includes: Receive an answer score corresponding to the feedback answer; In response to the answer score being greater than or equal to a first threshold, updating a local information source according to the target question and the feedback answer; In response to the answer score being greater than or equal to a first threshold and the number of queries corresponding to the feedback answer being 1, at least one analysis sub-model in the preset emotion prompt word generation model is fine-tuned according to the target question and the emotion coefficient corresponding to the target question.
9. An electronic device, characterized in that: The electronic device comprises: Processor and memory; The processor is used to execute the steps of the intelligent question-answering method based on emotion tendency as described in any one of claims 1 to 8 by calling the program or instructions stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores programs or instructions, which enable a computer to execute the steps of the intelligent question-answering method based on emotional tendency as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Prompt word updating method, device and system based on multi-dimensional large language model
CN118132716A
Question and answer method, device and equipment based on large language model and storage medium
CN118133948A
Intelligent question answering method and device based on emotion assistance, medium and equipment
CN118394910A
Question and answer method and device based on large language model, electronic equipment and storage medium
CN118395957A
Question and answer method and device, equipment and medium
CN118585619A