A data processing method, device, medium and equipment for knowledge question answering

By grouping and prioritizing keywords and entity words in the initial questions in the knowledge question-and-answer system, the target expansion problem is generated, and the large language model is used for in-depth analysis, the existing system is solved when dealing with fuzzy or incomplete problems. The problem of insufficient accuracy and comprehensiveness has achieved higher accuracy of knowledge Q&A and matching user needs.

CN118690027BActive Publication Date: 2024-11-29HANGZHOU YSCREDIT CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411189092.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2024-11-29
Estimated Expiration
2044-08-28

AI Technical Summary

Technical Problem

Existing knowledge Q&A systems have insufficient accuracy and comprehensiveness in data processing, especially when dealing with vague or incomplete questions, it is difficult to provide accurate and complete answers.

Method used

By obtaining the keywords and entity words corresponding to the initial question, grouping and prioritizing the order, generating target augmentation questions, and using large language models for in-depth analysis to improve the accuracy and comprehensiveness of the answers.

Benefits of technology

The target keywords are selected through the correlation between the initial entity words and keywords and the importance of phrases, and the integration of initial questions and target keywords to generate and expand questions, which improves the depth of the problem and the richness of information, and significantly improves the accuracy of knowledge questions and answers and users. Matching requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118690027B_ABST
    Figure CN118690027B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of knowledge question answering, and in particular to a data processing method, device, medium and equipment for knowledge question answering, including: grouping initial entity words and initial keywords in a first knowledge answer, screening target keywords through the degree of association between the initial entity words and the initial keywords and the importance of the corresponding phrases, fusing the initial question and the target keyword to obtain a target expanded question, thereby improving the depth of the question and the richness of effective information; based on a comprehensive analysis of the initial question by a first large language model, deeply analyzing the target question based on a target large language model of a corresponding knowledge field to obtain a target knowledge answer, and expanding and deepening the initial question multiple times, continuously updating the target knowledge answer, and obtaining a more accurate target knowledge answer as a target knowledge query result, thereby improving the accuracy of the target knowledge query result, and thereby improving the matching with the user's question and answer needs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge question answering technology, and in particular to a data processing method, device, medium and equipment for knowledge question answering. Background Art

[0002] With the rapid development of information technology and the explosive growth of knowledge, users have an increasingly urgent need to acquire knowledge efficiently and accurately. As a tool that can quickly respond to user questions and provide accurate answers, knowledge question answering systems have been widely used in various fields.

[0003] However, existing knowledge question-answering systems often have some deficiencies in data processing. Traditional methods usually rely on simple keywords to represent the user's question-answering intentions, which limits the accuracy and comprehensiveness of the answers. For example, when a user asks a vague question, the big prediction model may not be able to accurately understand the intention of the question, and thus give inappropriate or incomplete answers, making it difficult to meet the user's question-answering needs.

[0004] Therefore, how to improve the accuracy of answers output by large language models to meet users' question-and-answer needs has become an urgent problem to be solved. Summary of the invention

[0005] In view of the above technical problems, the technical solution adopted by the present invention is a data processing method for knowledge question answering, and the data processing method for knowledge question answering comprises the following steps:

[0006] S100, obtain several initial keywords corresponding to the initial question, the first knowledge answer and the first knowledge field corresponding to the initial question, several initial entity words corresponding to the first knowledge answer, the first position and the first occurrence number of each initial entity word in the first knowledge answer, and the second position and the second occurrence number of each initial keyword in the first knowledge answer.

[0007] S200, grouping all initial entity words and all initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of phrases.

[0008] S300, for any initial entity word, obtain the word priority corresponding to the current initial entity word based on the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keywords in the phrase corresponding to the current initial entity word.

[0009] S400, traverse all initial entity words, and determine the initial entity word corresponding to the largest word priority as the target keyword.

[0010] S500, obtaining a target expanded question based on the initial question and the target keywords.

[0011] S600: Input the target expansion question into the target large language model corresponding to the first knowledge domain, and obtain the target knowledge answer corresponding to the target expansion question.

[0012] S700, takes the target knowledge answer as the first answer, updates the number of returns, and returns to execute step S100 until the maximum word priority or the number of returns meets the stopping condition, and determines the target knowledge answer corresponding to the maximum word priority when the stopping condition is met as the target knowledge query result corresponding to the initial question.

[0013] The present invention also provides a data processing device for knowledge question answering, the data processing device for knowledge question answering comprising:

[0014] A data acquisition module is used to acquire several initial keywords corresponding to the initial question, the first knowledge answer and the first knowledge field corresponding to the initial question, several initial entity words corresponding to the first knowledge answer, the first position and the first occurrence number of each initial entity word in the first knowledge answer, and the second position and the second occurrence number of each initial keyword in the first knowledge answer.

[0015] The entity word grouping module is used to group all the initial entity words and all the initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of word groups.

[0016] The priority acquisition module is used to obtain the word priority corresponding to any initial entity word based on the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keywords in the phrase corresponding to the current initial entity word.

[0017] The entity word screening module is used to traverse all the initial entity words and determine the initial entity word corresponding to the largest word priority as the target keyword.

[0018] The question expansion module is used to obtain the target expanded question based on the initial question and target keywords.

[0019] The answer acquisition module is used to input the target expansion question into the target large language model corresponding to the first knowledge domain, and obtain the target knowledge answer corresponding to the target expansion question.

[0020] The result acquisition module is used to take the target knowledge answer as the first answer, update the return times, and return to the execution data acquisition module until the maximum word priority or the return times meet the stopping condition. The target knowledge answer corresponding to the maximum word priority when the stopping condition is met is determined as the target knowledge query result corresponding to the initial question.

[0021] The present invention also provides a non-transitory computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or at least one program is loaded and executed by a processor to implement the above-mentioned data processing method for knowledge question and answer.

[0022] The present invention also provides an electronic device, comprising a processor and the above-mentioned non-transitory computer-readable storage medium.

[0023] The present invention has at least the following beneficial effects: according to the first position and the second position, all initial entity words and all initial keywords in the first knowledge answer are grouped to obtain a number of phrases, and for any initial entity word, according to the first position of the current initial entity word, the second number of occurrences of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keyword in the phrase corresponding to the current initial entity word, the word priority corresponding to the current initial entity word is obtained, all initial entity words are traversed, and the initial entity word corresponding to the largest word priority is determined as the target keyword, according to the initial question and the target keyword, the target expanded question is obtained, the target expanded question is input into the target large language model corresponding to the first knowledge field, the target knowledge answer corresponding to the target expanded question is obtained, the target knowledge answer is used as the first answer, the return count is updated, and the above steps are returned to execute until The maximum word priority or the number of returns meets the stopping condition, and the target knowledge answer corresponding to the maximum word priority when the stopping condition is met is determined as the target knowledge query result corresponding to the initial question. It can be seen that the target keywords are screened through the degree of association between the initial entity words and the initial keywords and the corresponding importance of the phrases, and then the initial question and the target keywords are integrated to obtain the target expanded question, which improves the depth of the question and the richness of effective information. On the basis of the comprehensive analysis of the initial question by the first large language model, the target question is deeply analyzed based on the target large language model of the corresponding knowledge field to obtain the target knowledge answer, and the target knowledge answer is continuously updated by expanding and deepening the initial question multiple times to obtain a more accurate target knowledge answer as the target knowledge query result, thereby improving the accuracy of the target knowledge query result and thus improving the matching with the user's question and answer needs. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 A flowchart of a data processing method for knowledge question answering provided in the first embodiment of the present invention;

[0026] Figure 2 A flowchart of a knowledge question answering method based on a large language model provided in Embodiment 2 of the present invention;

[0027] Figure 3 A schematic diagram of the structure of a data processing device for knowledge question answering provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0028] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It is understood that, where appropriate, the above-mentioned terms used to distinguish similar objects can be interchanged so that the present invention can also implement other embodiments other than the above-mentioned illustrated embodiments or described embodiments. In addition, the terms "including" and "having" and any variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0030] Embodiment 1

[0031] This embodiment 1 provides a data processing method for knowledge question answering. The data processing method for knowledge question answering includes the following steps: Figure 1 As shown:

[0032] S100, obtaining a number of initial keywords corresponding to the initial question, a first knowledge answer and a first knowledge field corresponding to the initial question, a number of initial entity words corresponding to the first knowledge answer, a first position and a first occurrence number of each initial entity word in the first knowledge answer, and a second position and a second occurrence number of each initial keyword in the first knowledge answer.

[0033] The initial question refers to the question input by the user. By performing semantic analysis on the initial question and identifying the user's question-answering intention, the target knowledge query result corresponding to the initial question is obtained.

[0034] In a specific implementation, S100 further includes the following steps:

[0035] S110, obtaining the initial question and the preset first language model.

[0036] S120, inputting the initial question into the first large language model, and obtaining a first knowledge answer and a first knowledge field corresponding to the initial question.

[0037] S130, extracting a number of initial keywords in the initial question and a number of initial entity words in the first knowledge answer.

[0038] Among them, large language models are usually natural language processing models with large-scale parameters and computing power. They can be trained with a large amount of data and parameters to generate human-like text or answer questions in natural language, and have wide applications in knowledge question and answering.

[0039] The preset first language model refers to a large language model without a specified field, which can be obtained based on relevant knowledge data and parameter training in multiple fields, and is used to comprehensively analyze the input initial question and output the corresponding first knowledge answer and the first knowledge field to which it belongs. The specific knowledge field can be set by the implementer according to the actual situation.

[0040] When the initial question input by the user is vague, one-sided, or of poor quality, the user provides less effective information to the first language model, and the first knowledge answer output by the first language model is less accurate, making it difficult to meet the user's question and answer needs.

[0041] Therefore, in order to improve the information richness of the input to the large language model, this embodiment expands and deepens the initial question according to the initial question and the corresponding first knowledge answer, thereby increasing the amount of effective information in the question and further improving the accuracy of the knowledge question and answer.

[0042] Since the first knowledge answer contains non-entity words such as verbs, adjectives, adverbs, prepositions, conjunctions, auxiliary words, onomatopeia, and entity words that can reflect the core content and question and answer results, when the initial question is expanded based on the first knowledge answer, the initial entity words in the first knowledge answer are extracted as the basis for expanding the question.

[0043] Keywords can be used to locate the core content of the question and understand the user's question and answer intention. Therefore, this embodiment extracts several initial keywords in the initial question to screen the initial entity words in the first knowledge answer to improve the quality of expanding the initial question, thereby improving the accuracy of the target knowledge query results corresponding to the initial question.

[0044] S200, grouping all initial entity words and all initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of phrases.

[0045] Among them, according to the positional relationship between the initial entity words and the initial keywords in the first knowledge answer, all the initial entity words and all the initial keywords are grouped to obtain several phrases. Correspondingly, the positional correlation between the initial entity words and the initial keywords included in each phrase is relatively high, which serves as the data basis for filtering the initial entity words according to the initial keywords.

[0046] In a specific implementation, the first position includes a first sentence number, which refers to the number of the sentence corresponding to the corresponding initial entity word in the first knowledge answer, and the second position includes a second sentence number, which refers to the number of the sentence corresponding to the corresponding initial keyword in the first knowledge answer. S200 also includes the following steps:

[0047] S210, allocating an initial set to each first statement sequence number, wherein the initial set is an empty set.

[0048] S220: For any initial entity word, according to the first sentence sequence number corresponding to the current initial entity word, assign the current initial entity word to the corresponding initial set.

[0049] S230: For any initial keyword, according to the second sentence sequence number corresponding to the current initial keyword and the first sentence sequence number corresponding to each initial set, the current initial keyword is allocated to the corresponding initial set.

[0050] S240, traversing all initial entity words and all initial keywords, assigning all initial entity words and all initial keywords to corresponding initial sets, and obtaining an updated initial set;

[0051] S250, determining each updated initial set as a corresponding phrase.

[0052] Among them, the first sentence sequence number refers to the sequence number of the sentence corresponding to the initial entity word in the first knowledge answer, which is used to represent the position information of the corresponding initial entity word in the first knowledge answer. The second sentence sequence number refers to the sequence number of the sentence corresponding to the initial keyword in the first knowledge answer, which is used to represent the position information of the corresponding initial keyword in the first knowledge answer. According to the first sentence sequence number and the second sentence sequence number, all initial entity words and all initial keywords can be assigned to the corresponding initial set to obtain a number of phrases.

[0053] In the above, based on the first sentence number representation, the position information of the initial entity word corresponding to the first knowledge answer is represented, and based on the second sentence number representation, the position information of the initial keyword corresponding to the first knowledge answer is represented, and then the initial entity word and the initial keyword are allocated according to the first sentence number and the second sentence number, so as to represent the correlation between the initial entity word and the initial keyword according to the phrase, thereby improving the measurement accuracy of the word priority corresponding to the initial entity word.

[0054] S300, for any initial entity word, obtain the word priority corresponding to the current initial entity word based on the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keywords in the phrase corresponding to the current initial entity word.

[0055] In a specific implementation, the first position further includes a first character serial number, the second position further includes a second character serial number, and S300 further includes the following steps:

[0056] S310: For any initial entity word, the sum of the second occurrence times of all initial keywords in the phrase corresponding to the current initial entity word is determined as the importance corresponding to the phrase corresponding to the current initial entity word.

[0057] S320, according to the first knowledge answer, obtain the total number of characters of the corresponding sentence of the phrase corresponding to the current initial entity word in the first knowledge answer.

[0058] S330, for any initial keyword in the phrase corresponding to the current initial entity word, obtain the sequence number difference between the first character sequence number corresponding to the current initial entity word and the second character sequence number corresponding to the current initial keyword.

[0059] S340: Determine the ratio of the total number of characters to the sequence number difference as the degree of association between the current initial entity word and the current initial keyword.

[0060] S350, obtaining the word priority corresponding to the current initial entity word according to the importance of the phrase corresponding to the current initial entity word and the association between each initial keyword in the phrase corresponding to the current initial entity word and the current initial entity word.

[0061] Among them, the initial keywords can be used to locate the core content of the initial question and understand the user's question and answer intention. The more times the initial keywords appear in the phrase, the higher the importance of the corresponding phrase in locating the core content of the initial question and understanding the user's question and answer intention. Therefore, this embodiment characterizes the importance of the corresponding phrase by the sum of the second occurrence times of all the initial keywords in the phrase.

[0062] The closer the positions of the initial entity word and the initial keyword are, the higher the correlation between the initial entity word and the initial keyword. Therefore, this embodiment characterizes the degree of correlation between the initial entity word and the initial keyword by the difference between the first character number corresponding to the initial entity word and the second character number corresponding to the initial keyword, combined with the total number of characters in the corresponding sentence.

[0063] Furthermore, the word priority corresponding to each initial entity word is obtained according to the importance of the phrase and the sum of the associations between the initial entity word and all the initial keywords in the same phrase, that is, the priority used to expand the initial question. Specifically, the sum of the associations between all the initial keywords in the phrase corresponding to the current initial entity word and the current initial entity word is determined as the first priority corresponding to the current entity word, and the product of the importance of the phrase corresponding to the current initial entity word and the first priority is determined as the word priority corresponding to the current initial entity word.

[0064] In the above, the importance of the corresponding phrase is characterized based on the sum of the second occurrence times of all the initial keywords in the phrase, and the correlation between the initial entity word and the initial keyword is characterized based on the proportion of the difference between the first character number of the initial entity word and the second character number of the initial keyword in the total number of characters of the corresponding sentence. Then, combined with the importance of the phrase corresponding to the current initial entity word and the correlation between each initial keyword in the phrase corresponding to the current initial entity word and the current initial entity word, the word priority corresponding to the current initial entity word is obtained, thereby improving the accuracy of the characterization of the word priority.

[0065] S400, traverse all initial entity words, and determine the initial entity word corresponding to the largest word priority as the target keyword.

[0066] S500, obtaining a target expanded question based on the initial question and the target keywords.

[0067] Among them, the target keywords are combined with the initial question to obtain the target expanded question. Compared with the initial question, the target expanded question corresponds to a higher level of question depth and richer effective information, and the target expanded question has a higher accuracy in identifying the user's question and answer intention.

[0068] In a specific implementation, S500 further includes the following steps:

[0069] S510: Obtain a preset question expansion template.

[0070] S520, filling the initial question and the target keywords into the question expansion template to obtain the target expanded question.

[0071] The preset question expansion template can be set by the implementer according to the actual situation. For example, the preset question expansion template can be "Based on X, what does Y specifically include?", where the initial question is recorded as w and the target keyword is recorded as g, then w can be filled in the position corresponding to X and g can be filled in the position corresponding to Y, and the corresponding target expansion question is "Based on w, what does g specifically include?".

[0072] As described above, the target keywords are combined with the initial question to obtain the target expanded question, so as to enhance the depth of the question and the richness of effective information, thereby improving the accuracy of identifying the user's question and answer intention.

[0073] S600: Input the target expansion question into the target large language model corresponding to the first knowledge domain, and obtain the target knowledge answer corresponding to the target expansion question.

[0074] In a specific implementation, S600 further includes the following steps:

[0075] S610: Obtain a preset second largest language model library, wherein the second largest language model library includes a plurality of second largest language models, and each second largest language model corresponds to a preset knowledge domain.

[0076] S620, matching the first knowledge domain corresponding to the initial question with the preset knowledge domain corresponding to each second largest language model, and acquiring a target large language model corresponding to the target expanded question.

[0077] S630, input the target expansion question into the target large language model to obtain the target knowledge answer corresponding to the target expansion question.

[0078] Among them, the preset second largest language model library includes several second largest language models, each second largest language model corresponds to a preset knowledge field, and can be obtained based on the relevant knowledge data and parameter training of the corresponding preset knowledge field, and is used to focus on analyzing the input target expansion questions and output the target knowledge answers of the corresponding knowledge field.

[0079] As described above, the target expansion question is input into the target large language model corresponding to the first knowledge domain, so as to focus on analyzing the target expansion question within the corresponding preset knowledge domain, obtain the target knowledge answer corresponding to the target expansion question, and improve the accuracy of the target knowledge answer.

[0080] S700, takes the target knowledge answer as the first answer, updates the number of returns, and returns to execute step S100 until the maximum word priority or the number of returns meets the stopping condition, and determines the target knowledge answer corresponding to the maximum word priority when the stopping condition is met as the target knowledge query result corresponding to the initial question.

[0081] Among them, the target knowledge answer is taken as the first answer, the return number is updated, and the execution returns to step S100, and the target expansion question is expanded and deepened until the maximum word priority or the return number meets the stopping condition, completing multiple expansions and deepenings of the initial question, thereby completing multiple improvements in the question depth and the richness of effective information of the initial question, effectively improving the question depth and the richness of effective information of the target expansion question.

[0082] In a specific implementation, S700 further includes the following steps:

[0083] S710, taking the target knowledge answer as the first answer and increasing the number of returns by one.

[0084] S720, returning to step S100 to obtain the updated maximum word priority.

[0085] S730: If the updated maximum word priority is greater than the preset second priority threshold, or the updated return times are equal to the preset return times, it is determined that the maximum word priority or the return times meets the stop condition.

[0086] S740, determining the target knowledge answer corresponding to the maximum word priority when the stop condition is met as the target knowledge query result corresponding to the initial question.

[0087] Among them, before executing step S100 for the first time, the return number can be initialized to 0, and the return number can be updated by adding one to the return number. Then, when the updated maximum word priority is greater than the preset second priority threshold, or the updated return number is equal to the preset return number, it is determined that the maximum word priority or the return number meets the termination condition, and the target knowledge query result is obtained.

[0088] The specific values ​​of the preset second priority threshold and the preset number of returns can be set by the implementer according to actual conditions.

[0089] As described above, the initial question is expanded and deepened multiple times, thereby improving the question depth and the richness of effective information of the initial question multiple times, effectively improving the question depth and the richness of effective information of the target expanded question, thereby improving the accuracy of the corresponding target knowledge query results.

[0090] In the above, according to the first position and the second position, all the initial entity words and all the initial keywords in the first knowledge answer are grouped to obtain a number of phrases. For any initial entity word, according to the first position of the current initial entity word, the second occurrence number of all the initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keyword in the phrase corresponding to the current initial entity word, the word priority corresponding to the current initial entity word is obtained, all the initial entity words are traversed, and the initial entity word corresponding to the largest word priority is determined as the target keyword. According to the initial question and the target keyword, the target expanded question is obtained, and the target expanded question is input into the target large language model corresponding to the first knowledge field, and the target knowledge answer corresponding to the target expanded question is obtained. The target knowledge answer is used as the first answer, the return number is updated, and the execution of step S100 is returned until the largest word is reached. When the word priority or the number of returns meets the stopping condition, the target knowledge answer corresponding to the largest word priority when the stopping condition is met is determined as the target knowledge query result corresponding to the initial question. It can be seen that the target keywords are screened through the degree of association between the initial entity words and the initial keywords and the corresponding importance of the phrases, and then the initial question and the target keywords are integrated to obtain the target expanded question, which improves the depth of the question and the richness of effective information. On the basis of the comprehensive analysis of the initial question by the first large language model, the target question is deeply analyzed based on the target large language model of the corresponding knowledge field to obtain the target knowledge answer, and the target knowledge answer is continuously updated by expanding and deepening the initial question multiple times to obtain a more accurate target knowledge answer as the target knowledge query result, thereby improving the accuracy of the target knowledge query result and thus improving the matching with the user's question and answer needs.

[0091] Embodiment 2

[0092] This embodiment 2 provides a knowledge question answering method based on a large language model. The knowledge question answering method based on a large language model includes the following steps: Figure 2 As shown:

[0093] S1, obtain the initial question, the preset first language model and the preset second language model library.

[0094] S2: Input the initial question into the first language model to obtain the first knowledge answer and the first knowledge field corresponding to the initial question.

[0095] S3. Obtain N first expanded questions according to the initial question and the first knowledge answer, where N is an integer greater than 1.

[0096] In a specific implementation, S3 further includes the following steps:

[0097] S31, extracting several initial keywords in the initial question and several initial entity words in the first knowledge answer.

[0098] S32, based on all the initial keywords and all the initial entity words, N key entity words are screened out from all the initial entity words.

[0099] S33: For any key entity word, the initial question and the current key entity word are combined to obtain a first expanded question corresponding to the current key entity word.

[0100] S34, traverse N key entity words and obtain N first expansion questions.

[0101] Among them, compared with the initial question, the first expanded question integrates the effective information in the first knowledge answer, improves the question depth and the richness of effective information of the initial question, so that when the target knowledge answer corresponding to the initial question is obtained based on the first expanded question, the accuracy of the target knowledge answer can be improved.

[0102] In a specific implementation, S32 further includes the following steps:

[0103] S321, obtaining the first position and the first occurrence number of each initial entity word in the first knowledge answer, and the second position and the second occurrence number of each initial keyword in the first knowledge answer.

[0104] S322, grouping all initial entity words and all initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of phrases.

[0105] S323, for any initial entity word, obtain the word priority corresponding to the current initial entity word based on the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keywords in the phrase corresponding to the current initial entity word.

[0106] S324, determining the first N initial entity words with the highest word priority as key entity words.

[0107] In a specific implementation, the first position includes a first statement serial number, the second position includes a second statement serial number, and S322 further includes the following steps:

[0108] S3221, assign an initial set to each first statement sequence number, where the initial set is an empty set.

[0109] S3222: For any initial entity word, assign the current initial entity word to the corresponding initial set according to the first sentence sequence number corresponding to the current initial entity word.

[0110] S3223, for any initial keyword, according to the second sentence sequence number corresponding to the current initial keyword and the first sentence sequence number corresponding to each initial set, assign the current initial keyword to the corresponding initial set;

[0111] S3224, traverse all initial entity words and all initial keywords, assign all initial entity words and all initial keywords to corresponding initial sets, and obtain an updated initial set;

[0112] S3225, determining each updated initial set as a corresponding phrase.

[0113] In a specific implementation, the first position further includes a first character serial number, the second position further includes a second character serial number, and S323 further includes the following steps:

[0114] S3231: For any initial entity word, the sum of the second occurrence times of all initial keywords in the phrase corresponding to the current initial entity word is determined as the importance corresponding to the phrase corresponding to the current initial entity word.

[0115] S3232, according to the first knowledge answer, obtain the total number of characters of the corresponding sentence of the phrase corresponding to the current initial entity word in the first knowledge answer.

[0116] S3233, for any initial keyword in the phrase corresponding to the current initial entity word, obtain the sequence number difference between the first character sequence number corresponding to the current initial entity word and the second character sequence number corresponding to the current initial keyword.

[0117] S3234, determining the ratio of the sequence number difference to the total number of characters as the degree of association between the current initial entity word and the current initial keyword.

[0118] S3235, obtaining the word priority corresponding to the current initial entity word according to the importance of the phrase corresponding to the current initial entity word and the association between each initial keyword in the phrase corresponding to the current initial entity word and the current initial entity word.

[0119] In the above, the initial question is expanded according to the first knowledge answer to obtain N first expanded questions. Compared with the initial question, the first expanded question integrates the effective information in the first knowledge answer, improves the question depth and the richness of effective information of the initial question, thereby improving the accuracy of the target knowledge answer when the target knowledge answer corresponding to the initial question is obtained based on the first expanded question.

[0120] S4, inputting the N first expanded questions into the first large language model respectively, and obtaining the second knowledge answer and the second knowledge field corresponding to each first expanded question.

[0121] Herein, each first expanded question is comprehensively analyzed based on the first language model, and the second knowledge answer and the second knowledge field corresponding to each first expanded question are obtained.

[0122] S5. Obtain the answer priority corresponding to each second knowledge answer according to the initial question, the first knowledge domain, the first expanded question corresponding to each second knowledge answer, and the second knowledge domain corresponding to each first expanded question.

[0123] In a specific implementation, S5 further includes the following steps:

[0124] S51, for any second knowledge answer, calculating a first similarity between the initial question and the first expanded question corresponding to the current second knowledge answer.

[0125] S52, obtaining a second similarity between the first knowledge field and the second knowledge field corresponding to the current second knowledge answer.

[0126] S53: Obtain the answer priority corresponding to the current second knowledge answer according to the first similarity and the second similarity.

[0127] Among them, the higher the first similarity between the initial question and the first expanded question, and the higher the second similarity between the first knowledge field corresponding to the initial question and the second knowledge field corresponding to the current second knowledge answer, the less the first expanded question deviates from the core content and question-answering intention of the initial question while improving the question depth and richness of effective information of the initial question, and the higher the reliability of the second knowledge answer corresponding to the first expanded question as the target knowledge answer to the initial question.

[0128] Therefore, this embodiment obtains the answer priority corresponding to each second knowledge answer based on the first similarity and the second similarity, which is used to characterize the priority of using the second knowledge answer as the target knowledge answer of the initial question, thereby improving the accuracy of the answer priority.

[0129] In a specific implementation, S52 further includes the following steps:

[0130] S521, obtaining a preset similarity question and answer template.

[0131] S522, fill the first knowledge field and the second knowledge field corresponding to the current second knowledge answer into the similarity question and answer template to obtain a similarity question.

[0132] S523, inputting the similarity question into the first large language model, and obtaining a second similarity between the first knowledge field and the second knowledge field corresponding to the current second knowledge answer.

[0133] The specific similarity question-answering template can be set by the implementer according to the actual situation. For example, the similarity question-answering template can be set as "How high is the similarity between A and B as two fields?", with a representing the first knowledge field and b representing the second knowledge field, then a can be filled in the A position and b can be filled in the B position, and the corresponding similarity question is "How high is the similarity between the first knowledge field a and the second knowledge field b as two fields?". The similarity question is input into the first large language model, and the first large language model is used to perform semantic analysis on the relevant knowledge in the first knowledge field and the second knowledge field, so as to obtain the second similarity between the first knowledge field and the second knowledge field corresponding to the current second knowledge answer.

[0134] In the above, semantic analysis is performed on relevant knowledge in the first knowledge field and the second knowledge field based on the first language model to obtain the second similarity between the first knowledge field and the second knowledge field, thereby improving the accuracy of the second similarity.

[0135] In a specific implementation, S53 further includes the following steps:

[0136] S531: Obtain a first preset weight corresponding to the first similarity and a second preset weight corresponding to the second similarity.

[0137] S532: Determine the sum of the product of the first similarity and the first preset weight and the product of the second similarity and the second preset weight as the answer priority corresponding to the current second knowledge answer.

[0138] The specific values ​​of the first preset weight and the second preset weight can be set by the implementer according to actual conditions.

[0139] In the above, the answer priority of the second knowledge answer as the target knowledge answer to the initial question is measured based on the similarity between the initial question and the first expanded question, and the similarity between the first knowledge field and the second knowledge field, thereby improving the answer priority and the accuracy of the target knowledge answer.

[0140] S6, taking the first expanded question corresponding to the largest answer priority as the initial question, updating the number of executions, and returning to execute step S2 until the largest answer priority or the number of executions meets the termination condition, and determining the first expanded question corresponding to the largest answer priority when the termination condition is met as the target question.

[0141] Among them, the first expanded question corresponding to the largest answer priority is used as the initial question, the execution times are updated, and the execution step S2 is returned to expand the first expanded question until the largest answer priority or the execution times meet the termination condition, and multiple expansions of the initial question are completed, thereby completing multiple improvements in the problem depth and the richness of effective information of the initial question, effectively improving the problem depth and the richness of effective information of the target question.

[0142] In a specific implementation, S6 further includes the following steps:

[0143] S61, taking the first expanded question corresponding to the largest answer priority as the initial question, adding one to the number of executions, and obtaining an updated number of executions.

[0144] S62, return to step S2 to obtain the updated maximum answer priority.

[0145] S63, if the updated maximum answer priority is greater than the preset first priority threshold, or the updated execution times are equal to the preset execution times, it is determined that the maximum answer priority or the execution times meet the termination condition.

[0146] S64, determining the first expanded question corresponding to the maximum answer priority when the termination condition is satisfied as the target question.

[0147] Among them, before executing step S2 for the first time, the execution times can be initialized to 0, and the execution times can be updated by adding one to the execution times. Then, when the updated maximum answer priority is greater than the preset first priority threshold, or the updated execution times are equal to the preset execution times, it is determined that the maximum answer priority or the execution times meet the termination condition, and the target question is obtained.

[0148] The specific values ​​of the preset first priority threshold and the preset execution times may be set by the implementer according to actual conditions.

[0149] As described above, the initial question is expanded and deepened multiple times, thereby improving the problem depth and the richness of effective information of the initial question multiple times, effectively improving the problem depth and the richness of effective information of the target question, thereby improving the accuracy of the target knowledge answer when the target knowledge answer corresponding to the initial question is obtained based on the target question.

[0150] S7, in the preset second largest language model library, determine the second largest language model corresponding to the second knowledge field corresponding to the target question as the target large language model.

[0151] S8: Input the target question into the target large language model to obtain the target knowledge answer corresponding to the initial question.

[0152] Among them, based on the comprehensive analysis of the input question by the first large language model, the initial question is expanded and deepened multiple times to obtain the target question, so that the target question has higher question depth and richness of effective information than the initial question. Furthermore, this embodiment performs a deep analysis of the target question based on the target large language model of the specified field, obtains the target knowledge answer corresponding to the initial question, improves the accuracy of the target knowledge answer, meets the user's question and answer needs, and improves the matching with the user's question and answer needs.

[0153] In the above, the initial question is input into the first large language model, the first knowledge answer and the first knowledge field corresponding to the initial question are obtained, and according to the initial question and the first knowledge answer, N first expanded questions are obtained, and the N first expanded questions are respectively input into the first large language model to obtain the second knowledge answer and the second knowledge field corresponding to each first expanded question, and according to the initial question, the first knowledge field, the first expanded question corresponding to each second knowledge answer and the second knowledge field corresponding to each first expanded question, the answer priority corresponding to each second knowledge answer is obtained, and the first expanded question corresponding to the largest answer priority is used as the initial question, the execution count is updated, and the execution count is returned. Perform step S2 until the maximum answer priority or the number of executions meets the termination condition, and determine the first expanded question corresponding to the maximum answer priority when the termination condition is met as the target question. Compared with the initial question, the first expanded question integrates the effective information in the first knowledge answer, and improves the question depth and the richness of effective information of the initial question. On the basis of the comprehensive analysis of the input question by the first large language model, the initial question is expanded and deepened for many times, and the target question is deeply analyzed based on the target large language model of the specified field to obtain the target knowledge answer corresponding to the initial question, thereby improving the accuracy of the target knowledge answer and the matching with the user's question and answer needs.

[0154] Embodiment 3

[0155] This embodiment 3 provides a data processing device for knowledge question answering, and the data processing device for knowledge question answering includes: Figure 3 As shown:

[0156] The data acquisition module 31 is used to obtain several initial keywords corresponding to the initial question, the first knowledge answer and the first knowledge field corresponding to the initial question, several initial entity words corresponding to the first knowledge answer, the first position and the first occurrence number of each initial entity word in the first knowledge answer, and the second position and the second occurrence number of each initial keyword in the first knowledge answer.

[0157] The entity word grouping module 32 is used to group all the initial entity words and all the initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of word groups.

[0158] The priority acquisition module 33 is used to obtain the word priority corresponding to any initial entity word based on the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keywords in the phrase corresponding to the current initial entity word.

[0159] The entity word screening module 34 is used to traverse all the initial entity words and determine the initial entity word corresponding to the largest word priority as the target keyword.

[0160] The question expansion module 35 is used to obtain a target expanded question based on the initial question and the target keyword.

[0161] The answer acquisition module 36 is used to input the target expansion question into the target large language model corresponding to the first knowledge domain, and obtain the target knowledge answer corresponding to the target expansion question.

[0162] The result acquisition module 37 is used to take the target knowledge answer as the first answer, update the number of returns, and return to the execution data acquisition module 31 until the maximum word priority or the number of returns meets the stopping condition. The target knowledge answer corresponding to the maximum word priority when the stopping condition is met is determined as the target knowledge query result corresponding to the initial question.

[0163] In a specific implementation, the data acquisition module 31 further includes:

[0164] The first data acquisition submodule is used to obtain the initial question and the preset first language model.

[0165] The first model application submodule is used to input the initial question into the first large language model to obtain the first knowledge answer and the first knowledge field corresponding to the initial question.

[0166] The keyword extraction submodule is used to extract several initial keywords in the initial question and several initial entity words in the first knowledge answer.

[0167] In a specific implementation, the first position includes a first sentence number, which refers to the number of the sentence corresponding to the corresponding initial entity word in the first knowledge answer, and the second position includes a second sentence number, which refers to the number of the sentence corresponding to the corresponding initial keyword in the first knowledge answer. The entity word grouping module 32 also includes:

[0168] The initial set allocation submodule is used to allocate an initial set to each first statement sequence number, wherein the initial set is an empty set.

[0169] The first set matching submodule is used to allocate the current initial entity word to the corresponding initial set according to the first sentence sequence number corresponding to the current initial entity word for any initial entity word.

[0170] The second set matching submodule is used to allocate the current initial keyword to the corresponding initial set according to the second sentence sequence number corresponding to the current initial keyword and the first sentence sequence number corresponding to each initial set for any initial keyword.

[0171] The initial set update submodule is used to traverse all initial entity words and all initial keywords, assign all initial entity words and all initial keywords to corresponding initial sets, and obtain the updated initial sets;

[0172] The phrase acquisition submodule is used to determine each updated initial set as a corresponding phrase.

[0173] In a specific implementation, the first position further includes a first character serial number, the second position further includes a second character serial number, and the priority acquisition module 33 further includes:

[0174] The importance acquisition submodule is used to determine, for any initial entity word, the sum of the second occurrence times of all initial keywords in the phrase corresponding to the current initial entity word as the importance corresponding to the phrase corresponding to the current initial entity word.

[0175] The total character number acquisition submodule is used to acquire the total character number of the corresponding sentence of the phrase corresponding to the current initial entity word in the first knowledge answer according to the first knowledge answer.

[0176] The sequence number difference acquisition submodule is used to obtain the sequence number difference between the first character sequence number corresponding to the current initial entity word and the second character sequence number corresponding to the current initial keyword for any initial keyword in the phrase corresponding to the current initial entity word.

[0177] The association degree acquisition submodule is used to determine the ratio of the total number of characters to the sequence number difference as the association degree between the current initial entity word and the current initial keyword.

[0178] The word priority acquisition submodule is used to obtain the word priority corresponding to the current initial entity word according to the importance of the phrase corresponding to the current initial entity word and the degree of association between each initial keyword in the phrase corresponding to the current initial entity word and the current initial entity word.

[0179] In a specific implementation, the question expansion module 35 further includes:

[0180] The second data acquisition submodule is used to acquire a preset question expansion template.

[0181] The question expansion submodule is used to fill the initial question and target keywords into the question expansion template to obtain the target expanded question.

[0182] In a specific implementation, the answer acquisition module 36 further includes:

[0183] The third data acquisition submodule is used to acquire a preset second largest language model library, wherein the second largest language model library includes a plurality of second largest language models, and each second largest language model corresponds to a preset knowledge field.

[0184] The model matching submodule is used to match the first knowledge domain corresponding to the initial question with the preset knowledge domain corresponding to each second largest language model, and obtain the target large language model corresponding to the target expanded question.

[0185] The target knowledge answer acquisition submodule is used to input the target expansion question into the target large language model to obtain the target knowledge answer corresponding to the target expansion question.

[0186] In a specific implementation, the result acquisition module 37 further includes:

[0187] The return count update submodule is used to take the target knowledge answer as the first answer and increase the return count by one.

[0188] The return execution submodule is used to return to the execution data acquisition module 31 to obtain the updated maximum word priority.

[0189] The return stop submodule is used to determine that the maximum word priority or the return number meets the stop condition if the updated maximum word priority is greater than the preset second priority threshold, or the updated return number is equal to the preset return number.

[0190] The result acquisition submodule is used to determine the target knowledge answer corresponding to the maximum word priority when the stop condition is met as the target knowledge query result corresponding to the initial question.

[0191] It should be noted that the information interaction, execution process and other contents between the above modules are based on the same concept as the embodiment of the method of the present invention. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0192] Embodiment 4

[0193] Embodiment 4 of the present invention provides a non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the non-transitory computer-readable storage medium, and the at least one instruction or at least one program is loaded and executed by a processor to implement the steps:

[0194] S100, obtain several initial keywords corresponding to the initial question, the first knowledge answer and the first knowledge field corresponding to the initial question, several initial entity words corresponding to the first knowledge answer, the first position and the first occurrence number of each initial entity word in the first knowledge answer, and the second position and the second occurrence number of each initial keyword in the first knowledge answer.

[0195] S200, grouping all initial entity words and all initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of phrases.

[0196] S300, for any initial entity word, obtain the word priority corresponding to the current initial entity word based on the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keywords in the phrase corresponding to the current initial entity word.

[0197] S400, traverse all initial entity words, and determine the initial entity word corresponding to the largest word priority as the target keyword.

[0198] S500, obtaining a target expanded question based on the initial question and the target keywords.

[0199] S600: Input the target expansion question into the target large language model corresponding to the first knowledge domain, and obtain the target knowledge answer corresponding to the target expansion question.

[0200] S700, takes the target knowledge answer as the first answer, updates the number of returns, and returns to execute step S100 until the maximum word priority or the number of returns meets the stopping condition, and determines the target knowledge answer corresponding to the maximum word priority when the stopping condition is met as the target knowledge query result corresponding to the initial question.

[0201] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchronization Link) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0202] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0203] Embodiment 5

[0204] A fifth embodiment of the present invention provides an electronic device, which includes a processor and the non-transitory computer-readable storage medium in the fourth embodiment of the present invention.

[0205] The above are only preferred embodiments of the present invention, and are not intended to limit the present invention in any form. Although the present invention has been disclosed as a preferred embodiment as above, it is not intended to limit the present invention. Any technician familiar with the profession can make some changes or modifications to equivalent embodiments of equivalent changes using the technical contents disclosed above without departing from the scope of the technical solution of the present invention. However, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solution of the present invention are still within the scope of the technical solution of the present invention.

Claims

1. A data processing method for knowledge question answering, characterized in that: The data processing method for knowledge question answering comprises the following steps: S100, obtaining a number of initial keywords corresponding to an initial question, a first knowledge answer and a first knowledge field corresponding to the initial question, a number of initial entity words corresponding to the first knowledge answer, a first position and a first occurrence number of each initial entity word in the first knowledge answer, and a second position and a second occurrence number of each initial keyword in the first knowledge answer; S200, according to the first position and the second position, grouping all initial entity words and all initial keywords in the first knowledge answer to obtain a plurality of phrases, wherein the first position includes a first sentence sequence number, the first sentence sequence number refers to the sequence number of the sentence corresponding to the corresponding initial entity word in the first knowledge answer, and the second position includes a second sentence sequence number, the second sentence sequence number refers to the sequence number of the sentence corresponding to the corresponding initial keyword in the first knowledge answer, S200 also includes the following steps: S210, allocating an initial set to each first statement sequence number, wherein the initial set is an empty set; S220, for any initial entity word, according to the first sentence sequence number corresponding to the current initial entity word, assign the current initial entity word to the corresponding initial set; S230, for any initial keyword, according to the second sentence sequence number corresponding to the current initial keyword and the first sentence sequence number corresponding to each initial set, assign the current initial keyword to the corresponding initial set; S240, traversing all initial entity words and all initial keywords, assigning all initial entity words and all initial keywords to corresponding initial sets, and obtaining an updated initial set; S250, determining each updated initial set as a corresponding phrase; S300, for any initial entity word, according to the first position of the current initial entity word, the second occurrence number of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keyword in the phrase corresponding to the current initial entity word, obtain the word priority corresponding to the current initial entity word; S400, traversing all initial entity words, and determining the initial entity word corresponding to the largest word priority as the target keyword; S500, obtaining a target expanded question according to the initial question and the target keyword; S600, inputting the target expansion question into the target large language model corresponding to the first knowledge domain, and obtaining the target knowledge answer corresponding to the target expansion question; S700, taking the target knowledge answer as the first answer, updating the number of returns, and returning to execute step S100 until the maximum word priority or the number of returns meets the stopping condition, and determining the target knowledge answer corresponding to the maximum word priority when the stopping condition is met as the target knowledge query result corresponding to the initial question.

2. The data processing method for knowledge question answering according to claim 1, characterized in that: S100 also includes the following steps: S110, obtaining an initial question and a preset first language model; S120, inputting the initial question into the first large language model to obtain a first knowledge answer and a first knowledge field corresponding to the initial question; S130, extracting a number of initial keywords in the initial question and a number of initial entity words in the first knowledge answer.

3. The data processing method for knowledge question answering according to claim 1, characterized in that: The first position further includes a first character serial number, the second position further includes a second character serial number, and S300 further includes the following steps: S310, for any initial entity word, determining the sum of the second occurrence times of all initial keywords in the phrase corresponding to the current initial entity word as the importance of the phrase corresponding to the current initial entity word; S320, according to the first knowledge answer, obtaining the total number of characters of the corresponding sentence of the phrase corresponding to the current initial entity word in the first knowledge answer; S330, for any initial keyword in the phrase corresponding to the current initial entity word, obtaining a sequence number difference between a first character sequence number corresponding to the current initial entity word and a second character sequence number corresponding to the current initial keyword; S340, determining the ratio of the total number of characters to the sequence number difference as the degree of association between the current initial entity word and the current initial keyword; S350, obtaining the word priority corresponding to the current initial entity word according to the importance of the phrase corresponding to the current initial entity word and the association between each initial keyword in the phrase corresponding to the current initial entity word and the current initial entity word.

4. The data processing method for knowledge question answering according to claim 1, characterized in that: S500 also includes the following steps: S510, obtaining a preset question expansion template; S520: Fill the initial question and the target keyword into the question expansion template to obtain a target expanded question.

5. The data processing method for knowledge question answering according to claim 1, characterized in that: S600 also includes the following steps: S610, obtaining a preset second largest language model library, wherein the second largest language model library includes a plurality of second largest language models, each of which corresponds to a preset knowledge domain; S620, matching the first knowledge domain corresponding to the initial question with the preset knowledge domain corresponding to each second large language model, and acquiring a target large language model corresponding to the target expanded question; S630: Input the target expansion question into the target large language model to obtain a target knowledge answer corresponding to the target expansion question.

6. The data processing method for knowledge question answering according to claim 1, characterized in that: S700 also includes the following steps: S710, taking the target knowledge answer as the first answer and increasing the number of returns by one; S720, returning to step S100 to obtain the updated maximum word priority; S730, if the updated maximum word priority is greater than the preset second priority threshold, or the updated return number is equal to the preset return number, then determining that the maximum word priority or the return number meets the stop condition; S740, determining the target knowledge answer corresponding to the maximum word priority when the stop condition is met as the target knowledge query result corresponding to the initial question.

7. A data processing device for knowledge question answering, characterized in that: The data processing device for knowledge question answering comprises: A data acquisition module, used to acquire a number of initial keywords corresponding to an initial question, a first knowledge answer and a first knowledge field corresponding to the initial question, a number of initial entity words corresponding to the first knowledge answer, a first position and a first occurrence number of each initial entity word in the first knowledge answer, and a second position and a second occurrence number of each initial keyword in the first knowledge answer; An entity word grouping module is used to group all initial entity words and all initial keywords in the first knowledge answer according to the first position and the second position to obtain a plurality of phrases, wherein the first position includes a first sentence sequence number, the first sentence sequence number refers to the sequence number of the sentence corresponding to the corresponding initial entity word in the first knowledge answer, the second position includes a second sentence sequence number, the second sentence sequence number refers to the sequence number of the sentence corresponding to the corresponding initial keyword in the first knowledge answer, and the entity word grouping module also includes: An initial set allocation submodule, used to allocate an initial set to each first statement sequence number, wherein the initial set is an empty set; The first set matching submodule is used to assign the current initial entity word to the corresponding initial set according to the first sentence sequence number corresponding to the current initial entity word for any initial entity word; The second set matching submodule is used to allocate the current initial keyword to the corresponding initial set according to the second sentence sequence number corresponding to the current initial keyword and the first sentence sequence number corresponding to each initial set for any initial keyword; The initial set update submodule is used to traverse all initial entity words and all initial keywords, assign all initial entity words and all initial keywords to corresponding initial sets, and obtain the updated initial sets; A phrase acquisition submodule, used for determining each updated initial set as a corresponding phrase; A priority acquisition module is used to acquire, for any initial entity word, the word priority corresponding to the current initial entity word according to the first position of the current initial entity word, the second number of occurrences of all initial keywords in the phrase corresponding to the current initial entity word, and the second position of the initial keyword in the phrase corresponding to the current initial entity word; An entity word screening module is used to traverse all initial entity words and determine the initial entity word corresponding to the largest word priority as the target keyword; A question expansion module, used to obtain a target expanded question according to the initial question and the target keyword; An answer acquisition module, used for inputting the target expansion question into the target large language model corresponding to the first knowledge domain, and acquiring the target knowledge answer corresponding to the target expansion question; A result acquisition module is used to take the target knowledge answer as the first answer, update the number of returns, and return to the execution data acquisition module until the maximum word priority or the number of returns meets the stopping condition, and the target knowledge answer corresponding to the maximum word priority when the stopping condition is met is determined as the target knowledge query result corresponding to the initial question.

8. A non-transitory computer-readable storage medium, wherein at least one instruction or at least one program is stored in the non-transitory computer-readable storage medium, characterized in that: The at least one instruction or the at least one program is loaded and executed by the processor to implement the data processing method for knowledge question answering as described in any one of claims 1-6.

9. An electronic device, characterized in that: The invention comprises a processor and the non-transitory computer-readable storage medium as claimed in claim 8.

Citation Information

Patent Citations

  • Knowledge question-answering method and device based on large language model, medium and equipment

    CN118690003A