Knowledge question response method and device, electronic equipment and storage medium
By identifying and matching problem model types, efficiently searching knowledge documents and generating responses, the problem that existing intelligent question-and-answer system is difficult to deeply understand and transfer hierarchical knowledge in the fields of knowledge problem learning and education is solved, and more accurate and efficient response is achieved.
Patent Information
- Application Number
- CN202411928678.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing intelligent question-and-answer system is difficult to meet the needs of in-depth understanding and hierarchical knowledge transmission in the fields of knowledge problem learning and education, especially in terms of the precise classification of complex problem types and the targeted and profoundness of the response content.
By identifying the content of the target problem, matching the appropriate problem model type, efficiently retrieving associated knowledge documents, and generating high-quality problem responses based on preset response strategies, improving the accuracy and efficiency of the response.
The structured learning needs for complex knowledge problems are achieved, the accuracy and efficiency of responses are improved, and the deep understanding needs in the field of education and knowledge problems can be better met.
Smart Images

Figure CN119848224A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device and storage medium for answering knowledge questions. Background Art
[0002] With the rapid development of artificial intelligence technology, intelligent question-answering systems have been widely used in many fields such as education, customer service, and medical care. These systems provide users with automated question answers based on semantic understanding through natural language processing technology. However, existing intelligent question-answering systems mainly rely on generative language models or rule-based answering methods, lack a deep understanding of the essence of the problem, and are difficult to meet application scenarios that require in-depth understanding and hierarchical knowledge transfer, especially in the field of knowledge problem learning and education.
[0003] In the field of education, learners often need systematic and structured knowledge transfer, not just simple answers. For example, in the process of learning knowledge problems, learners need to understand not only the operation methods of knowledge problems, but also the composition, causal relationship and application background of knowledge problems. Cognitive science research shows that human declarative memory is divided into two parts: semantic memory and episodic memory. Semantic memory stores facts and concepts, while episodic memory involves specific events and experiences. In the learning of knowledge problems, both types of memory play an important role. Semantic memory helps learners understand the basic concepts and rules of knowledge problems, while episodic memory helps them apply knowledge problems to specific situations. However, existing educational question-and-answer systems usually exist in a single question-and-answer form, which is difficult to meet the structured learning needs of complex knowledge problems. In addition, the types of questions raised by learners are often complex and diverse, and the existing system lacks an accurate classification mechanism for question types, resulting in a lack of pertinence and depth in the answer content. Summary of the invention
[0004] The embodiments of the present disclosure at least provide a method, device, electronic device and storage medium for answering knowledge questions. In this way, the question content is obtained by identifying the target question, and the question model type is matched accordingly, so that the related knowledge documents can be efficiently retrieved, and high-quality question responses can be generated according to the response strategy, which can improve the accuracy and efficiency of the answer.
[0005] The present disclosure provides a method for answering knowledge questions, including:
[0006] Obtaining a target question and identifying question content corresponding to the target question;
[0007] By analyzing the question content, determining the question model type that is suitable for the question content;
[0008] Retrieving the target knowledge document with the highest relevance according to the question content;
[0009] A preset response strategy corresponding to the question model type is determined, and the target knowledge document is converted into a target question response using the preset response strategy.
[0010] In an optional implementation manner, after obtaining the target question and identifying the question content corresponding to the target question, the method further includes:
[0011] Extracting question keywords corresponding to the question content, and determining question format features corresponding to the target question according to the question keywords;
[0012] The question type corresponding to the target question is determined according to the question format feature, and the target question whose question type is a semantic knowledge question is screened.
[0013] In an optional implementation manner, determining the type of question model adapted to the question content by analyzing the question content specifically includes:
[0014] Constructing a knowledge representation framework including a task module, a knowledge module and a problem module matching each problem type, wherein the problem module includes: a method module matching a problem type of a knowledge model and a method module matching a problem type of a method task model;
[0015] The task module is used to define the task attribute information of the problem task corresponding to the target problem; the method module is used to describe the implementation step information of solving the problem task; the knowledge module is used to represent the knowledge entity information corresponding to the problem task;
[0016] Input the problem content into the knowledge representation framework, parse the task attribute information and the implementation step information through the task module and the method module, and parse the knowledge entity information through the knowledge model;
[0017] Determining whether the problem content belongs to the method task model problem according to the analysis results of the task attribute information and the implementation step information;
[0018] According to the parsing result of the knowledge entity information, it is determined whether the question content belongs to the knowledge model question.
[0019] In an optional implementation manner, searching for a target knowledge document with the highest relevance according to the question content specifically includes:
[0020] Determine multiple K-nearest neighbor algorithm performance index values corresponding to the target problem according to the preset response detail requirement;
[0021] Determine the relevance between the knowledge document pre-stored in the preset knowledge base and the question content according to the K-nearest neighbor algorithm performance index value;
[0022] Filtering the plurality of knowledge documents whose relevance is greater than a preset relevance threshold as candidate knowledge documents;
[0023] The target knowledge document having the highest degree of association among the candidate knowledge documents is determined.
[0024] In an optional implementation, determining a preset response strategy corresponding to the question model type, and converting the target knowledge document into a target question response using the preset response strategy specifically includes:
[0025] For the target question corresponding to the knowledge model question, or corresponding to both the knowledge model question and the method task model question, generating a preliminary question response according to the document content corresponding to the target knowledge document;
[0026] Iteratively integrate document contents corresponding to the candidate knowledge documents except the target knowledge document into the preliminary question response to generate the target question response.
[0027] In an optional implementation, determining a preset response strategy corresponding to the question model type, and converting the target knowledge document into a target question response using the preset response strategy, specifically includes:
[0028] For the target problem of the corresponding method task model problem, extract the task execution conversion information corresponding to the target knowledge document, each of the task execution conversion information represents an execution step in the task completion process;
[0029] According to the task execution conversion information and the corresponding metadata, a natural language description corresponding to the task execution process is generated through chain thinking, and the natural language description is used as the target question response.
[0030] The present disclosure also provides a device for answering knowledge questions, including:
[0031] A question classification module, used to obtain a target question and identify the question content corresponding to the target question;
[0032] A model category matching module, used to determine the type of question model that is suitable for the question content by analyzing the question content;
[0033] A document retrieval module is used to retrieve the target knowledge document with the highest relevance according to the question content;
[0034] The response generation module is used to determine a preset response strategy corresponding to the question model type, and convert the target knowledge document into a target question response using the preset response strategy.
[0035] An embodiment of the present disclosure also provides an electronic device, including: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the method for answering the knowledge questions mentioned above, or steps in any possible implementation of the method for answering the knowledge questions mentioned above are executed.
[0036] The embodiments of the present disclosure also provide a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for answering the knowledge question described above or the steps in any possible implementation of the method for answering the knowledge question described above are executed.
[0037] The present disclosure also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the method for answering the above-mentioned knowledge question, or the steps in any possible implementation of the method for answering the above-mentioned knowledge question.
[0038] The disclosed embodiments provide a method, device, electronic device, and storage medium for answering knowledge questions, which obtain a target question and identify the question content corresponding to the target question; determine the question model type that is adapted to the question content by analyzing the question content; retrieve the target knowledge document with the highest relevance according to the question content; determine the preset response strategy corresponding to the question model type, and convert the target knowledge document into a target question response using the preset response strategy. In this way, the question content is obtained by identifying the target question, and the question model type is matched accordingly, so that the related knowledge documents can be efficiently retrieved, and high-quality question responses can be generated according to the response strategy, which can improve the accuracy and efficiency of the answer.
[0039] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can also be obtained based on these drawings without creative work.
[0041] Figure 1 A flow chart showing a method for answering knowledge questions provided by an embodiment of the present disclosure is shown;
[0042] Figure 2 A flowchart showing another method for answering knowledge questions provided by an embodiment of the present disclosure is shown;
[0043] Figure 3 A schematic diagram showing a device for answering knowledge questions provided by an embodiment of the present disclosure is shown;
[0044] Figure 4 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present disclosure.
[0046] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0047] The term "and / or" herein only describes an association relationship, indicating that three relationships may exist. For example, A and / or B may represent the following three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.
[0048] Research has found that existing intelligent question-answering systems mainly rely on generative language models or rule-based answering methods, lack a deep understanding of the essence of the problem, and are difficult to meet application scenarios that require in-depth understanding and hierarchical knowledge transfer, especially in the fields of knowledge problem learning and education. In the field of education, learners often need systematic and structured knowledge transfer, not just simple answers. For example, in the process of learning knowledge problems, learners not only need to understand the operation methods of knowledge problems, but also need to understand the composition, causal relationship, and application background of knowledge problems. However, existing educational question-answering systems usually exist in a single question-answering form, which is difficult to meet the structured learning needs of complex knowledge problems. In addition, the types of questions raised by learners are often complex and diverse, and the existing system lacks an accurate classification mechanism for question types, resulting in a lack of pertinence and depth in the answer content.
[0049] Based on the above research, the present disclosure provides a method, device, electronic device and storage medium for answering knowledge questions, which obtains a target question and identifies the question content corresponding to the target question; determines the question model type adapted to the question content by analyzing the question content; retrieves the target knowledge document with the highest relevance according to the question content; determines the preset response strategy corresponding to the question model type, and converts the target knowledge document into a target question response using the preset response strategy. In this way, the question content is obtained by identifying the target question, and the question model type is matched accordingly, so that the related knowledge documents can be efficiently retrieved, and high-quality question responses can be generated according to the response strategy, which can improve the accuracy and efficiency of the answer.
[0050] To facilitate understanding of this embodiment, a method for answering a knowledge question disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the method for answering a knowledge question provided in the embodiment of the present disclosure is generally a computer device with certain computing capabilities, and the computer device includes, for example: a terminal device or a server or other processing device, and the terminal device can be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. In some possible implementations, the method for answering a knowledge question can be implemented by a processor calling a computer-readable instruction stored in a memory.
[0051] See also Figure 1 FIG. 1 is a flowchart of a method for answering knowledge questions provided by an embodiment of the present disclosure, the method comprising steps S101 to S104, wherein:
[0052] S101: Acquire a target question and identify the question content corresponding to the target question.
[0053] In a specific implementation, a target question raised by a user is first received, and the question can be any form of natural language text. For example, the question input by the user can be: "What is gravity?" or "How to use the quick sort algorithm?" and other related questions for a specific knowledge or knowledge problem.
[0054] Here, a preset large language model may be used to identify the question content corresponding to the target question, that is, obtaining the target question and identifying the question content corresponding to the target question in S101 includes: inputting the target question into the preset large language model, and determining the question content corresponding to the target question.
[0055] Here, the large language model has a strong natural language understanding ability, which can analyze the semantics and context of the question and identify the core content and intent of the question. For example, for the question "What is supervised learning in machine learning?", the large language model can identify the topic ("machine learning") and the detailed content ("supervised learning"), thereby determining that the user wants to know the definition of supervised learning. After being processed by the large language model, the main content of the question is extracted, that is, the content of the question, including the topic and possible intent.
[0056] S102: Determine a question model type that is suitable for the question content by analyzing the question content.
[0057] It should be noted that after identifying the content of the target question, it is also necessary to determine whether the target question is a semantic knowledge question or a situational knowledge question, that is, to determine the question type of the target question. In specific implementations, semantic knowledge questions usually involve the explanation of conceptual knowledge or methodological guidance, but the content of specific questions may be different. In order to answer semantic knowledge questions more accurately, semantic knowledge questions need to be further divided into different question model types.
[0058] Here, semantic knowledge questions refer to knowledge questions involving facts, concepts or definitions. Such questions require the corresponding response to provide a direct explanation or definition of a certain knowledge point. For example, "What is gravity?" is a semantic knowledge question, and the user expects to get the definition and basic concept of gravity. It should be noted that semantic knowledge questions mainly focus on the basic content of knowledge, rather than its application in specific situations.
[0059] In addition, situational knowledge questions refer to questions involving specific events, situations or application processes. Such questions require the corresponding responses to provide application steps or specific operation examples of knowledge. For example, "How to apply the quick sort algorithm in an actual project?" is a situational knowledge question, and the user expects to obtain the specific application method or steps of the quick sort algorithm. It should be noted that situational knowledge questions focus on the application and operation process of knowledge in specific situations, and can include practice or execution content.
[0060] Here, the present application mainly focuses on generating responses to semantic knowledge questions, while all existing conventional response methods can be used to respond to situational knowledge questions, such as simulation and introspective analysis of the simulation process. This process is not within the scope of the present application, so it will not be described in detail.
[0061] As a possible implementation, after obtaining the target question and identifying the question content corresponding to the target question in S101, a process of determining the question type of the target question is further included, which is specifically implemented through the following steps:
[0062] Step 1: extract question keywords corresponding to the question content, and determine the question format features corresponding to the target question based on the question keywords.
[0063] Step 2: Determine the question type corresponding to the target question according to the question format feature, and select the target question whose question type is a semantic knowledge question.
[0064] In specific implementations, generative AI technology can be used to analyze the target question through the zero-sample classification capability of a large language model (such as GPT-4o), and use information such as context and question keywords to determine the type of question. Input the target question into the large language model to parse the topic and core content of the question. Extract the question keywords, such as "what is it" and "how to do it", to identify the user's question intention. Then, based on the question format characteristics of these question keywords, determine whether the target question is seeking knowledge explanation or operational guidance, and then determine whether its type is semantic knowledge or situational knowledge.
[0065] Among them, the question keywords can indicate the user's need for a certain type of knowledge and are the key basis for judging the question type. In the question content, the question keywords directly related to the question intention are extracted through the language model or preset keyword rules.
[0066] Furthermore, the question format characteristics of the question are determined based on the question keywords. The question format characteristics are used to help determine the demand level and type of the question, thereby providing a basis for question classification. The question format characteristics of the question can be determined by analyzing the specific type of the question keywords and the question sentence pattern.
[0067] For example, if the question keyword is "what is", the question format feature indicates that the question is definition-type, usually related to semantic knowledge. If the question keyword is "how to use" or "how to proceed", the question format feature indicates that the question is step-type, usually related to situational knowledge.
[0068] Here, the question format features can summarize the basic requirement types of the question (such as definition, operation, purpose, etc.), enabling the system to more accurately infer the user's intentions, and then the question format features are ultimately used to help determine the question type.
[0069] Among them, if the question format features point to "definition" or "conceptual", the question is classified as a semantic knowledge question. Such questions only require explanation or definition of the concept. If the question format features point to "operational" or "step-by-step", the question is classified as a situational knowledge question, which requires specific steps at the application or operation level.
[0070] For example, for the question “What is machine learning?”, the keyword “what is” points to the “definitional” question format feature, and the question type is determined to be a semantic knowledge question. For the question “How to apply the quick sort algorithm in a project?”, the keyword “how to apply” points to the “operational” question format feature, and the question type is determined to be a situational knowledge question.
[0071] It should be noted that question keywords can be divided into definitional keywords, operational keywords, and purpose keywords, so that the system can more easily identify the intent of the question. Among them, definitional keywords, such as "what is", "definition", "what does it mean", etc., indicate that the user wants to obtain a conceptual explanation. Operational keywords, such as "how to do it", "how to proceed", "steps", etc., indicate that the user wants to know the specific operating steps or methods. Purposeful keywords, such as "why", "what is the reason", etc., indicate that the user wants to understand the reason or background knowledge.
[0072] In this way, keyword questions are extracted from user questions, and question types are accurately judged based on the question format characteristics of the keyword questions, laying the foundation for selecting appropriate answer generation strategies. This enables the system to provide conceptual answers while meeting specific operational needs, thereby improving the accuracy and practicality of answers.
[0073] It should be noted that the purpose of determining the question type is to select an appropriate answer generation strategy for the subsequent steps. For semantic knowledge questions, we tend to directly explain, define or describe; for situational knowledge questions, we provide more detailed step-by-step instructions or cases to help users understand the application of this knowledge in actual situations.
[0074] Furthermore, the question model types include two categories: knowledge model question types and method task model question types; among them, knowledge model questions mainly focus on the explanation of concepts, definitions and basic knowledge, while method task model questions mainly focus on the methods and operation steps to complete a certain knowledge question or task.
[0075] Among them, knowledge model problems mainly involve objects, concepts, attributes and relationships, and usually do not involve specific operations or steps, but rather provide basic explanations around a knowledge point.
[0076] For example, the question "What is machine learning?" is a knowledge model question where the user wants to get a definition or overview of machine learning. The answer to this type of question can directly provide knowledge related to concepts, features, components, etc. without requiring detailed operational steps.
[0077] Here, although the method-task model problem belongs to the semantic knowledge problem, it is more inclined to understand the basic method or steps to complete a task, which involves describing the execution logic of the task but not the specific application steps.
[0078] For example, the question "What is the basic working principle of a machine learning algorithm?" is a method-task model question because the user wants to understand how the algorithm works rather than the specific application steps. The answer can describe the implementation process, logical sequence or steps of the task rather than the contextual application process.
[0079] As a possible implementation method, the process of analyzing the question content and determining the type of question model adapted to the question content can be seen in Figure 2 FIG. 1 is a flowchart of another method for answering knowledge questions provided by an embodiment of the present disclosure, wherein the method includes steps S1021 to S1024, wherein:
[0080] S1021, constructing a knowledge representation framework including a task module, a knowledge module and a problem module matching each problem type, wherein the problem module includes: a method module for matching problem types of knowledge models and a method module for matching problem types of method task models;
[0081] S1022: Input the problem content into the knowledge representation framework, parse the task attribute information and the implementation step information through the task module and the method module, and parse the knowledge entity information through the knowledge model.
[0082] S1023. Determine whether the problem content belongs to the method task model problem based on the analysis results of the task attribute information and the implementation step information.
[0083] S1024. Determine whether the question content belongs to the knowledge model question based on the parsing result of the knowledge entity information.
[0084] In the specific implementation, a knowledge representation framework including a task module, a method module and a knowledge module is first constructed. The knowledge representation framework can adopt the Task-Method-Knowledge (TMK) model to analyze and represent the three core components of the problem-solving knowledge problem. Among them, the task module is used to define the task attribute information of the problem task corresponding to the target problem; the method module is used to describe the implementation step information of the problem-solving task; and the knowledge module is used to represent the knowledge entity information corresponding to the problem task.
[0085] Here, the task module is used to identify the task attributes of the problem, that is, whether the problem involves a specific knowledge problem or task; the method module is used to identify the implementation steps of the problem, that is, whether the problem involves the operational logic of a task; the knowledge module is used to identify the knowledge entity of the problem, that is, whether the problem mainly involves the definition or description of a certain knowledge point.
[0086] Among them, the task module determines the goal or purpose of a given task, including specifying the allowed inputs (i.e. known conditions) and the expected outputs (i.e. results). For example, in a sorting algorithm, the goal may be to sort a list of numbers in ascending order. The method module describes the method of completing the task, using a deterministic finite state machine (FSM) called an organizer. Each organizer contains a set of states, transitions, and actions, which together guide the system to complete the task. In addition, each state may contain sub-goals in its own mechanism, thereby achieving hierarchical modeling. Taking the sorting algorithm as an example, the method may include comparing pairs of numbers and swapping them if they are out of order. The knowledge module defines objects, concepts, and relationships in the environment, including the attributes of objects and logical expressions that connect user-provided values. Going back to the sorting algorithm example, the knowledge representation may include numbers, lists, and the relationships between them.
[0087] Furthermore, after receiving a user question, the question content is input into the knowledge representation framework, and the question content is parsed according to the functions of different modules to identify various information elements involved in the question.
[0088] Specifically, during the parsing process of the task module, the question content is analyzed to extract information related to the task goal, that is, the task that the question wants to complete. For example, the "quick sort algorithm" in "How to use the quick sort algorithm?" is identified as the core of the task module. During the parsing process of the method module, the step information required to implement the task is further identified on the basis of the task module parsing. For example, for the question of "quick sort", the specific steps for performing the sorting are parsed, including "selecting a reference point", "recursive splitting", etc. During the parsing process of the knowledge module, the knowledge entity information involved in the question is extracted, including definitions, characteristics, and attributes. For example, for the question "What is the quick sort algorithm?", "quick sort" is identified as a knowledge entity, and its definition, purpose, etc. are associated.
[0089] Here, first determine whether there is a clear task goal (such as "quick sort algorithm") in the task module. Then parse the implementation step information of the task in the method module. If the method module can extract specific operation step information, it means that the problem not only involves the task goal, but also involves the process of how to complete the task. When both the task module and the method module have confirmed the task and step information, it is determined that the problem belongs to the method task model problem because the problem requires understanding the implementation method of a certain task.
[0090] Here, for the judgment of knowledge model problems, the knowledge entity information in the problem will be parsed through the knowledge module. If the knowledge module can directly parse out the basic definition or concept information, and the task module or method module does not detect clear task goals or specific steps, the system will judge that the problem mainly focuses on the definition and attributes of the knowledge point. When the knowledge module confirms the information of the knowledge entity, it is judged that the problem belongs to a knowledge model problem because the problem is mainly a conceptual description rather than an operational process.
[0091] For example, the knowledge model question is: "What is machine learning?" The task module identifies "machine learning" as the task goal, but there are no operations or steps required. The knowledge module extracts the definition information of "machine learning", indicating that the user wants to understand the basic concepts of machine learning, and determines that the question belongs to a knowledge model problem.
[0092] For example, the method-task model question is: "How to use machine learning for classification?" The task module identifies "machine learning classification" as the task goal, and the method module extracts the information of the steps involved in the "classification process" (such as data preprocessing, feature selection, model training, etc.), and determines that the question belongs to the method-task model problem because the user wants to understand how to perform the classification task.
[0093] It should be noted that tasks and methods are interrelated. Tasks define the goals of a knowledge problem, while methods outline the mechanisms for achieving those goals. Therefore, during the classification process, tasks and methods are combined into one category. If a question is not related to the specific task or concept being discussed, it will be classified as "irrelevant".
[0094] Furthermore, the problem model type corresponding to the target problem can be a multi-model problem, which combines the elements of a knowledge model problem and a method task model problem. This type explores the interaction between objects, concepts, and relationships in the environment and the mechanisms for completing tasks. For example, in a sorting algorithm, a multi-model problem may ask how numerical attributes affect the process of comparing and sorting them.
[0095] S103: Retrieve the target knowledge document with the highest relevance according to the question content.
[0096] In a specific implementation, multiple K-nearest neighbor algorithm performance index values corresponding to the target problem are determined according to the preset response detail requirement; the correlation between the knowledge documents pre-stored in the preset knowledge base and the problem content is determined according to the K-nearest neighbor algorithm performance index values; multiple knowledge documents with correlations greater than a preset correlation threshold are screened as candidate knowledge documents; and the target knowledge document with the highest correlation among the candidate documents is determined.
[0097] Here, we first obtain and parse the content of the question raised by the user to determine the key topics and core concepts it contains. We extract key subject words or phrases from the question content so that we can find documents in the knowledge base that have a high degree of match with these keywords. For example, for the question "What are the basic principles of supervised learning?", "supervised learning" and "basic principles" will be extracted as keywords.
[0098] Furthermore, a K-Score ranging from 1 to 4 is calculated for each question, depending on the complexity of the question and the detail of the expected response. This k-score helps determine the detail and complexity of the response. For example, a K-Score of 1 indicates a very brief response (3-5 words), while a K-Score of 2 indicates a short response of a few sentences. A K-Score of 3 corresponds to a more detailed paragraph-length response, while a K-Score of 4 indicates a comprehensive response of multiple paragraphs. The K-Score is used to guide the system to select appropriate documents in the knowledge base. For example, when the K-Score is 1, the system will give priority to documents that provide concise definitions; when the K-Score is 4, the system will look for more detailed documents, even containing multiple perspectives and detailed explanations.
[0099] Specifically, the FAISS (Facebook AI Similarity Search) library can be used to perform document similarity search. FAISS is an efficient vector retrieval tool that can quickly calculate the similarity of documents in a large knowledge base. During the retrieval process, the documents and question content in the knowledge base are first converted into embedded vectors to capture the semantic information of the text, so that the system can judge the similarity based on the distance between the vectors. The FAISS library calculates the similarity score between the question content vector and the document vector in the knowledge base. The higher the similarity, the stronger the correlation between its content and the question content.
[0100] Here, according to the preset relevance threshold, documents with relevance scores higher than the preset relevance threshold are screened out. These documents are regarded as candidate knowledge documents. Among the candidate knowledge documents, one or more documents with the highest relevance are further screened out as the final target knowledge documents.
[0101] It should be noted that for questions classified as knowledge models, only the most relevant knowledge documents are retrieved. Similarly, for questions classified as multi-models, the most relevant documents in the combination of knowledge, task, and method documents are retrieved. Conversely, for questions classified as method-task models, the search focuses on the most relevant task documents and their related method documents.
[0102] For example, for the question "What is the working mechanism of deep learning?", the system will first generate a vector based on the question content and calculate the similarity. If the document "Basic Principles of Deep Learning" has the highest similarity score, then the document is selected as the target knowledge document.
[0103] Optionally, you can not only rely on the similarity score of the FAISS library, but also combine other indicators to further judge the relevance of the document. These indicators may include: topic coverage, document length, and context matching. Among them, topic coverage refers to whether the document covers all the keywords and topics of the question; document length means that for questions with high K-Scores, you may tend to choose longer and more content-rich documents; context matching refers to whether the context of the question is consistent with the context of the document content. For example, when some questions involve specific application fields, documents in the same field are preferred.
[0104] It should be noted that the selected target knowledge document will serve as the main basis for generating answers. The content of the target knowledge document is highly relevant to the content of the question, ensuring that the answer generated by the system can hit the point. In some cases, multiple relevant documents may be selected and the contents of these documents may be merged or cross-referenced to generate a more comprehensive answer.
[0105] For example, the question is: "What is the difference between supervised learning and unsupervised learning?", extract the keywords "supervised learning" and "unsupervised learning", and set the K-Score to 3 (indicating that detailed explanation is required). The documents matching these two keywords are calculated through the FAISS library, and the documents with higher relevance are selected. Among the candidate documents with relevance higher than the threshold, the two most relevant documents are found - "Supervised Learning Principles" and "Unsupervised Learning Overview", and these two documents are used as target knowledge documents.
[0106] S104: Determine a preset response strategy corresponding to the question model type, and convert the target knowledge document into a target question response by using the preset response strategy.
[0107] In the specific implementation, a preset response strategy is used to determine how to convert the retrieved target knowledge documents into answers to user questions. Different response generation methods are selected according to the question model type of the target question (such as knowledge model questions or method task model questions), thereby improving the accuracy, relevance and orderliness of the answers.
[0108] Here, we first select the appropriate response strategy based on the problem model type of the target problem (knowledge model problem or method task model problem). The purpose of the preset response strategy is to provide the best response generation method for different types of questions to ensure that the structure and depth of the response meet the requirements of the question.
[0109] As a possible implementation method, for a target question corresponding to a knowledge model problem, or corresponding to both a knowledge model problem and a method task model problem, a preliminary question response is generated based on the document content corresponding to the target knowledge document; the document content corresponding to the alternative knowledge documents other than the target knowledge document is iteratively integrated into the preliminary question response to generate a target question response.
[0110] Here, the preset response strategy for knowledge model questions or multi-model questions mainly focuses on the definition, attributes or conceptual description of knowledge points, and it is suitable to use iterative refinement strategy to generate answers. Iterative refinement strategy can deepen the definition and concepts layer by layer by gradually integrating the contents of multiple documents, making the answer more comprehensive.
[0111] Specifically, when a question is judged to be a knowledge model question (mainly involving conceptual knowledge) or a combination of a knowledge model and a method task model (requiring both conceptual explanation and a brief description of the method flow), a preliminary question response will be generated first. Extract basic concepts, definitions, or descriptions from the target knowledge document to generate a preliminary response to the user's question. For example, for the question "What is machine learning?", find the definition, core concepts, and basic knowledge of "machine learning" in the target knowledge document to generate a preliminary response. This preliminary response contains core information and can provide a basic answer, but it may not be detailed or comprehensive enough.
[0112] Here, the contents of the alternative knowledge documents with high relevance retrieved in addition to the target knowledge document are gradually integrated into the preliminary response, and additional information and context are continuously incorporated to deepen the preliminary response to enrich the response content. This process is gradually refined, and the response will be further improved after each round of integration. Through multiple rounds of iteration, more dimensional explanations are gradually added to the response, so that the response not only contains basic concepts, but also relevant background information, detailed descriptions, etc. The response after iterative integration is the final response to the target question, ensuring the coverage completeness and orderliness of the response.
[0113] For example, for the question: "What are the basic principles of deep learning?", the target knowledge document contains the basic definition of deep learning, such as "deep learning is a machine learning method based on artificial neural networks". The candidate knowledge documents may contain information such as the characteristics, application fields, and training methods of deep learning. After generating the initial response, the "characteristics", "application fields", and "common training methods" of deep learning are gradually added from the candidate documents. After iterative integration, the final response is more detailed and complete.
[0114] Here, for the target problem of the corresponding method task model problem, the task execution conversion information corresponding to the target knowledge document is extracted, and each task execution conversion information represents an execution step in the task completion process; based on the task execution conversion information and the corresponding metadata, the natural language description corresponding to the task execution process is generated through chain thinking, and the natural language description is used as the target problem response.
[0115] Specifically, when it is identified that the question raised by the user is a method task model question, a chain thinking generation strategy will be used to generate an answer. The core of this strategy is to ensure the logical coherence of the answer content by gradually parsing the execution steps of the task, so that the user can clearly understand the complete execution process of the task. Extract the task execution conversion information from the target knowledge document. The task execution conversion information refers to each step or state transition involved in the task completion process. Each task execution conversion information represents a specific step, state or action in the task process. Extract the execution steps or state conversion information related to the task from the target knowledge document, and gradually decompose the key steps of the task.
[0116] For example, for the question "How to perform a quick sort algorithm?", the system will extract task steps related to quick sort from the target knowledge document, including "selecting a reference point", "dividing sublists", "recursively sorting sublists", etc.
[0117] In this way, by breaking down the task into multiple execution steps, the system can answer questions in a step-by-step manner, making the response structure clear and well-organized, making it easier for users to understand the overall process of the task.
[0118] Among them, the chain thinking generation strategy is a generation method that connects task steps in series through a logical sequence. According to the order of steps in the task execution conversion information, a natural language description of the task process is gradually constructed to make the response logically coherent. Each task execution conversion information is converted into a natural language description to describe the content and purpose of each step. At the same time, the logical relationship between the steps is clearly presented, such as conditions, cause and effect, etc., so that users can not only understand the operation of each step, but also understand the connection and dependency between each step.
[0119] For example, the question "How to perform a quick sort algorithm?" parses out the steps of quick sort, and generates a natural language description based on these steps in sequence, including the following three steps. Specifically, step 1: select a reference point and divide the array into two parts that are greater than and less than the reference point. Step 2: recursively sort the two parts separately. Step 3: after the sorting is completed, merge the two parts.
[0120] The above solution will be described below in conjunction with specific implementation methods.
[0121] Take the river crossing problem as an example. This problem describes a situation where three guards and three prisoners must cross a river using a boat that can only carry two people. If the number of prisoners on either side of the river exceeds the number of guards, the prisoners will overpower the guards and escape. Therefore, the goal is to transport all individuals across the river safely without violating this rule. When the user asks the question "Who is the guard?", the following steps are followed to generate the response:
[0122] Step 1. Construct TMK model: First, establish a simplified TMK model for the river crossing problem.
[0123] In this model, the main task is set as "transporting all individuals across the river safely". Specific method steps may include: rowing the boat to the other side, selectively loading the people on the boat, unloading the people on the boat, and checking whether any constraints are violated. Knowledge representation may involve concepts such as guards, prisoners, boats, and the relationships between them, as well as rules guiding the movement of individuals.
[0124] Step 2: Question Classification: To classify the question “Who is the guard?”, a query containing a description of the TMK model components and classification hints is submitted to the large language model, which classifies this question as a knowledge model question because it involves understanding entities in the environment.
[0125] Step 3: After completing the problem classification, select relevant knowledge documents from the TMK knowledge base.
[0126] First, the K-Score is calculated based on the level of detail of the expected response. For example, for questions like "Who is the guard?", the K-Score may be set to 2, meaning a concise answer is required. Then, with the help of the FAISS library, a similarity search is performed between the user query and all knowledge documents in the TMK knowledge base, and the two documents most similar to the user query are selected for generating a response.
[0127] For example, Document 1 Guard Definition: elaborates on the role and responsibilities of the guard in the river crossing problem, with a similarity score of 0.60. Document 2 Relationship Interpretation: deeply analyzes the interactive relationship between the guard and the prisoner in the river crossing problem, with a similarity score of 0.45.
[0128] Step 4: For the question "Who is the guard?" which is classified as a knowledge model, a progressive refinement method is used to construct an answer. First, a preliminary request is submitted to the large language model, which integrates the user's query and the closest relevant document (i.e., document 1) in order to form a basic response. Then, the large language model generates a preliminary answer based on the user's query and the content of document 1. The preliminary answer may be: "In the river crossing problem, the guard is one of the individuals who needs to be transported across the river." Further, this answer is further refined by incorporating additional information from document 2. The large language model fine-tunes the preliminary answer by integrating the information in document 2, thereby forming a more detailed answer.
[0129] An exemplary, condensed response is as follows: "In the river crossing problem, the guards are the key people who must be transported across the river. Their duties are crucial and they are responsible for ensuring that the prisoners cannot escape during the crossing.".
[0130] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.
[0131] The embodiment of the present disclosure provides a method for answering knowledge questions, which obtains a target question and identifies the question content corresponding to the target question; determines the question model type adapted to the question content by analyzing the question content; retrieves the target knowledge document with the highest relevance according to the question content; determines the preset response strategy corresponding to the question model type, and converts the target knowledge document into a target question response using the preset response strategy. In this way, the question content is obtained by identifying the target question, and the question model type is matched accordingly, so that the related knowledge documents can be efficiently retrieved, and a high-quality question response can be generated according to the response strategy, which can improve the accuracy and efficiency of the answer.
[0132] Based on the same inventive concept, a device for answering knowledge questions corresponding to the method for answering knowledge questions is also provided in the embodiments of the present disclosure. Since the principle of solving problems by the device in the embodiments of the present disclosure is similar to the method for answering knowledge questions mentioned above in the embodiments of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0133] See also Figure 3 , Figure 3 A schematic diagram of a knowledge question answering device provided by an embodiment of the present disclosure, such as Figure 3 As shown in , the knowledge question answering device 300 provided by the embodiment of the present disclosure includes:
[0134] The question classification module 310 is used to obtain a target question and identify the question content corresponding to the target question.
[0135] The model category matching module 320 is used to determine the question model type that is suitable for the question content by analyzing the question content.
[0136] The document retrieval module 330 is used to retrieve the target knowledge document with the highest relevance according to the question content.
[0137] The response generation module 340 is used to determine a preset response strategy corresponding to the question model type, and convert the target knowledge document into a target question response using the preset response strategy.
[0138] For descriptions of the processing flow of each module in the device and the interaction flow between each module, reference may be made to the relevant descriptions in the above method embodiment, which will not be described in detail here.
[0139] The embodiment of the present disclosure provides a device for answering knowledge questions, which obtains a target question and identifies the question content corresponding to the target question; determines the question model type adapted to the question content by analyzing the question content; retrieves the target knowledge document with the highest relevance according to the question content; determines the preset response strategy corresponding to the question model type, and converts the target knowledge document into a target question response using the preset response strategy. In this way, the question content is obtained by identifying the target question, and the question model type is matched accordingly, so that the related knowledge documents can be efficiently retrieved, and a high-quality question response can be generated according to the response strategy, which can improve the accuracy and efficiency of the answer.
[0140] Corresponds to Figure 1 and Figure 2 The present disclosure also provides an electronic device 400, such as Figure 4 FIG. 4 is a schematic diagram of the structure of an electronic device 400 provided in an embodiment of the present disclosure, including:
[0141] Processor 41, memory 42, and bus 43; memory 42 is used to store execution instructions, including memory 421 and external memory 422; memory 421 here is also called internal memory, which is used to temporarily store operation data in processor 41 and data exchanged with external memory 422 such as hard disk. Processor 41 exchanges data with external memory 422 through memory 421. When the electronic device 400 is running, the processor 41 communicates with the memory 42 through bus 43, so that the processor 41 executes Figure 1 and Figure 2 The steps of the method for answering knowledge questions.
[0142] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method for answering knowledge questions described in the above method embodiment are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.
[0143] The present disclosure also provides a computer program product, which includes computer instructions. When the computer instructions are executed by a processor, the steps of the method for answering knowledge questions described in the above method embodiment can be executed. For details, please refer to the above method embodiment, which will not be repeated here.
[0144] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).
[0145] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. In the several embodiments provided in the present disclosure, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.
[0146] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0148] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0149] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for answering knowledge questions, characterized in that: include: Obtaining a target question and identifying question content corresponding to the target question; By analyzing the question content, determining the question model type that is suitable for the question content; Retrieving the target knowledge document with the highest relevance according to the question content; A preset response strategy corresponding to the question model type is determined, and the target knowledge document is converted into a target question response using the preset response strategy.
2. The method according to claim 1, characterized in that After obtaining the target question and identifying the question content corresponding to the target question, the method further includes: Extracting question keywords corresponding to the question content, and determining question format features corresponding to the target question according to the question keywords; The question type corresponding to the target question is determined according to the question format feature, and the target question whose question type is a semantic knowledge question is screened.
3. The method according to claim 1, characterized in that By analyzing the question content, determining the question model type that is suitable for the question content, specifically including: Construct a knowledge representation framework including a task module, a knowledge module and a problem module matching each problem type, wherein the problem module includes: a method module matching the problem type of the knowledge model and a method module matching the problem type of the method task model; wherein the task module is used to define the task attribute information of the problem task corresponding to the target problem; the method module is used to describe the implementation step information of solving the problem task; and the knowledge module is used to represent the knowledge entity information corresponding to the problem task; Input the problem content into the knowledge representation framework, parse the task attribute information and the implementation step information through the task module and the method module, and parse the knowledge entity information through the knowledge model; Determining whether the problem content belongs to the method task model problem according to the analysis results of the task attribute information and the implementation step information; According to the parsing result of the knowledge entity information, it is determined whether the question content belongs to the knowledge model question.
4. The method according to claim 1, characterized in that Retrieving the target knowledge document with the highest relevance according to the question content specifically includes: Determine multiple K-nearest neighbor algorithm performance index values corresponding to the target problem according to the preset response detail requirement; Determine the relevance between the knowledge document pre-stored in the preset knowledge base and the question content according to the K-nearest neighbor algorithm performance index value; Filtering the plurality of knowledge documents whose relevance is greater than a preset relevance threshold as candidate knowledge documents; The target knowledge document having the highest degree of association among the candidate knowledge documents is determined.
5. The method according to claim 4, characterized in that Determining a preset response strategy corresponding to the question model type, and converting the target knowledge document into a target question response using the preset response strategy, specifically includes: For the target question corresponding to the knowledge model question, or corresponding to both the knowledge model question and the method task model question, generating a preliminary question response according to the document content corresponding to the target knowledge document; Iteratively integrate document contents corresponding to the candidate knowledge documents except the target knowledge document into the preliminary question response to generate the target question response.
6. The method according to claim 1, characterized in that Determining a preset response strategy corresponding to the question model type, and converting the target knowledge document into a target question response using the preset response strategy, specifically including: For the target problem of the corresponding method task model problem, extract the task execution conversion information corresponding to the target knowledge document, each of the task execution conversion information represents an execution step in the task completion process; According to the task execution conversion information and the corresponding metadata, a natural language description corresponding to the task execution process is generated through chain thinking, and the natural language description is used as the target question response.
7. A device for answering knowledge questions, characterized in that: include: A question classification module, used to obtain a target question and identify the question content corresponding to the target question; A model category matching module, used to determine the type of question model that is suitable for the question content by analyzing the question content; A document retrieval module is used to retrieve the target knowledge document with the highest relevance according to the question content; The response generation module is used to determine a preset response strategy corresponding to the question model type, and convert the target knowledge document into a target question response using the preset response strategy.
8. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the steps of the method for answering knowledge questions as described in any one of claims 1 to 6 are performed.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the method for answering knowledge questions as claimed in any one of claims 1 to 6.
10. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the method for answering a knowledge question according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Question answering method and device based on knowledge graph
CN114647719A
Answer generation methods, devices, electronic equipment, and storage media
CN114936276A
Information retrieval method and device, storage medium and computer program product
CN118939763A
Cited By
Intelligent question and answer method and system, electronic equipment and storage medium
CN121434348A