Disease knowledge question answering method and system, electronic equipment and storage medium
By matching the similarity of various entities in the disease knowledge graph and inference of knowledge graphs, target reasoning link information is generated, and a single knowledge point in the existing technology is difficult to accurately output disease reasoning answers, achieving more accurate disease knowledge questions and answers.
Patent Information
- Application Number
- CN202411602587.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-04-15
AI Technical Summary
In the prior art, relying only a single knowledge point, it is difficult to accurately output the corresponding disease reasoning answers, and it is impossible to effectively deal with complex crop disease knowledge Q&A scenarios.
By obtaining the disease query information of the target crop, matching the similarity between the entities in the disease knowledge graph, obtaining the entity set to be found, and performing entity relationship reasoning of the knowledge graph based on the entity set to be found, generating the target reasoning link information, and finally making a decision to output the disease knowledge reasoning answer.
It realizes deeper and more comprehensive reasoning to obtain disease knowledge information related to disease query information, improves the accuracy of disease knowledge answers, overcomes the limitations of relying only on a single knowledge point, and can more accurately deal with complex crop disease knowledge Q&A scenarios.
Smart Images

Figure CN119829699A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a disease knowledge question-answering method, system, electronic device and storage medium. Background Art
[0002] Crops will inevitably be affected by various diseases during their growth and maturity. Since farmers often lack the knowledge to identify relevant diseases, they are unable to take correct remedial measures or choose the right treatment drugs, which ultimately leads to large-scale crop yield reduction. Therefore, accurate questions and answers about crop diseases are particularly important for reducing crop yield reduction.
[0003] In the related art, a crop disease question-answering system based on knowledge base retrieval enhancement is usually used to implement crop disease knowledge question-answering. The knowledge base of the crop disease question-answering system is usually represented in the form of a vector knowledge base, which mainly focuses on the representation and retrieval of a single knowledge point.
[0004] However, the crop disease knowledge question-answering scenario is relatively complex, and it is difficult to accurately output the corresponding disease reasoning answers by relying only on a single knowledge point. Summary of the invention
[0005] The present invention provides a disease knowledge question-answering method, system, electronic device and storage medium, which are used to solve the defect that the prior art only relies on a single knowledge point and is difficult to accurately output the corresponding disease reasoning answer, thereby improving the accuracy of the disease reasoning answer.
[0006] The present invention provides a disease knowledge question-answering method, comprising: Obtain disease query information corresponding to target crops; According to the similarity between the disease query information and each entity in the disease knowledge graph, obtaining a set of entities to be queried associated with the disease query information; According to the entity set to be checked, entity relationship reasoning is performed on the disease knowledge graph to obtain target reasoning link information between the entity set to be checked and the target entity set; the target entity set is a set formed based on entities that have a connection relationship with each entity to be checked in the entity set to be checked; According to the target reasoning link information, a decision is made to output a disease knowledge reasoning answer corresponding to the disease query information; The disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0007] According to a disease knowledge question answering method provided by the present invention, obtaining a set of entities to be queried associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph includes: Performing word segmentation processing on the disease query information to obtain a word segmentation set corresponding to the disease query information; Calculating the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph; According to the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph, searching for the to-be-queried entity associated with each segmentation in the segmentation set in the disease knowledge graph; The entity set to be checked is generated according to the entities to be checked associated with each word in the word set.
[0008] According to a disease knowledge question-answering method provided by the present invention, the word segmentation processing is performed on the disease query information to obtain a word segmentation set corresponding to the disease query information, including: Generate data processing prompt words according to the disease query information and a pre-built agricultural field knowledge base; Determining input information according to the data processing prompt word and the disease query information, and inputting the input information into a word segmentation model to obtain a plurality of initial word segmentations; Performing a first processing operation on each of the initial word segments, wherein the first processing operation includes a stop word removal operation and / or a duplicate removal operation; Constructing the word segmentation set according to the multiple processed initial word segmentations; The word segmentation model is constructed on the basis of a large language model.
[0009] According to a disease knowledge question-answering method provided by the present invention, the step of determining input information according to the data processing prompt word and the disease query information includes: Performing a second processing operation on the disease query information, wherein the second processing operation includes at least one of a standardization processing operation, an irrelevant symbol removal operation, and a format conversion operation; The input information is determined according to the processed disease query information and the data processing prompt word.
[0010] According to a disease knowledge question answering method provided by the present invention, the calculating the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph includes: Input text information corresponding to each word in the word set and text information corresponding to each entity in the disease knowledge graph into the target embedding model respectively, and obtain the embedding vector of each word in the word set and the embedding vector of each entity in the disease knowledge graph; Calculate the similarity between each word in the word set and each entity in the disease knowledge graph according to the embedding vector of each word in the word set and the embedding vector of each entity in the disease knowledge graph; The target embedding model is obtained by performing self-knowledge distillation training on the pre-trained word embedding model based on text corpus in the agricultural field.
[0011] According to a disease knowledge question answering method provided by the present invention, the target embedding model is trained based on the following steps: Inputting the text corpus into the pre-trained word embedding model, obtaining a loss value corresponding to dense retrieval, a loss value corresponding to sparse retrieval, and a loss value corresponding to multi-vector retrieval, as well as a classification performance index of the pre-trained word embedding model; Fusing the loss value corresponding to the dense retrieval, the loss value corresponding to the sparse retrieval, and the loss value corresponding to the multi-vector retrieval to obtain a fused loss value; Determine a first loss function according to any one of the loss value corresponding to the dense retrieval, the loss value corresponding to the sparse retrieval, and the loss value corresponding to the multi-vector retrieval, and the fusion loss value; Determining a second loss function according to the classification performance indicator; The first loss function and the second loss function are combined to obtain a target loss function; According to the target loss function, the pre-trained word embedding model is iteratively trained to obtain the target embedding model.
[0012] According to a disease knowledge question answering method provided by the present invention, the step of deciding to output a disease knowledge reasoning answer corresponding to the disease query information based on the target reasoning link information includes: Generate disease knowledge reasoning prompt words according to the target reasoning link information and the disease query information; Inputting the disease knowledge reasoning prompt word and the target reasoning link information into the disease knowledge reasoning model to obtain the disease knowledge reasoning answer; The disease knowledge reasoning model is constructed on the basis of a large language model.
[0013] According to a disease knowledge question answering method provided by the present invention, the entity relationship reasoning is performed on the disease knowledge graph according to the entity set to be checked to obtain target reasoning link information between the entity set to be checked and the target entity set, including: Taking each entity to be checked in the entity set to be checked as a starting entity, chain reasoning is performed on the disease knowledge graph to obtain a first target entity connected to each entity to be checked, and first reasoning link information between each entity to be checked and the first target entity; Taking each entity to be checked in the entity set to be checked as a starting entity, performing diffusion reasoning on the disease knowledge graph to obtain a second target entity connected to each entity to be checked, and second reasoning link information between each entity to be checked and the second target entity; The target reasoning link information is generated according to the first reasoning link information and the second reasoning link information.
[0014] The present invention also provides a disease knowledge question-answering system, comprising: A first acquisition unit is used to acquire disease query information corresponding to the target crop; A second acquisition unit is used to acquire a to-be-queried entity set associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph; An inference unit, configured to perform entity relationship inference on the disease knowledge graph according to the entity set to be checked, and obtain target inference link information between the entity set to be checked and a target entity set; the target entity set is a set formed based on entities that have a connection relationship with each entity to be checked in the entity set to be checked; A decision-making unit, configured to decide and output a disease knowledge reasoning answer corresponding to the disease query information according to the target reasoning link information; The disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any one of the disease knowledge question-and-answer methods described above is implemented.
[0016] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the disease knowledge question and answer method as described above is implemented.
[0017] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned disease knowledge question-answering methods.
[0018] The disease knowledge question and answer method, system, electronic device and storage medium provided by the present invention obtain a set of entities to be queried associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph, and perform knowledge graph retrieval based on the entity set to be queried to obtain target reasoning link information; and perform comprehensive inference based on the target reasoning link information to output the disease knowledge reasoning answer corresponding to the disease query information through decision-making, thereby effectively utilizing the rich associated information and multi-level knowledge system contained in the disease knowledge graph, and more deeply and comprehensively reasoning to obtain the disease knowledge information associated with the disease query information, so as to improve the accurate reasoning of the disease knowledge answer, thereby alleviating the large model hallucination phenomenon while effectively improving the reasoning ability and logical judgment ability in complex knowledge question and answer scenarios, effectively overcoming the limitation of relying only on a single knowledge point for retrieval and reasoning, so as to be able to more accurately cope with complex crop disease knowledge question and answer scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 This is one of the flow charts of the disease knowledge question-answering method provided by the present invention.
[0021] Figure 2 It is a flowchart of the steps of obtaining the entity set to be checked provided by the present invention.
[0022] Figure 3 This is the second flow chart of the disease knowledge question-answering method provided by the present invention.
[0023] Figure 4 It is a structural schematic diagram of the disease knowledge question and answer system provided by the present invention.
[0024] Figure 5 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0026] With the continuous advancement of agricultural modernization, there is an increasing demand for using natural language processing technology to accurately infer crop disease knowledge.
[0027] Generally, automatic crop diagnosis systems using natural language processing technology can be divided into three categories: Solution 1) Crop knowledge question-answering system based on similarity matching of question and answer pairs; Solution 2) Crop disease question-answering system based on generative large language model; Solution 3) Crop disease question-answering system based on knowledge base retrieval enhancement. The performance of the crop knowledge question-answering system based on similarity matching of question-answer pairs is seriously dependent on the quantity and quality of the preset question-answer pair data. The question-answering generalization ability is insufficient, and the answer content is fixed and rigid, and the interactive friendliness is poor. Therefore, it is known that it has serious deficiencies in question-answering generalization ability and interactive friendliness. The crop disease diagnosis system based on the generative large language model has significantly improved the question-answering generalization ability and interactive friendliness with the help of the powerful text generation characteristics of the large model. However, the generative large language model is limited by the professionalism of agricultural knowledge, and it often has inherent hallucinations, that is, there is a phenomenon of content output that is inconsistent with the facts or untrue, which limits its accuracy in the actual application of crop disease diagnosis. The crop disease diagnosis system based on knowledge base retrieval enhancement combines the excellent question-answering generalization ability of the large model with the content professionalism of the knowledge base. It effectively solves the problems existing in the above-mentioned solutions 1) and 2) to a certain extent, and has therefore become the mainstream technology for crop disease diagnosis.
[0028] However, the knowledge base of existing consultation systems is usually in the form of a vector knowledge base. The disadvantage is that the vector knowledge base focuses on the representation and retrieval of a single knowledge point. This method mainly focuses on the storage and similarity measurement of single-point information. However, the crop disease knowledge question-and-answer scenario requires combinatorial reasoning between multiple knowledge points due to its complexity. The knowledge organization form that only relies on the vector knowledge base usually does not meet the crop disease reasoning scenario that requires deeper knowledge associations, and it is difficult to accurately output the corresponding disease reasoning answers.
[0029] In summary, although the existing technology can solve simple consultation scenarios that do not require multi-knowledge point reasoning, there is little research on complex scenario consultations that require deeper knowledge associations for crop disease reasoning.
[0030] In addition to storing individual knowledge points, knowledge graphs also build a complex knowledge network by establishing rich relationships and attributes. They not only depict the various associations between knowledge points (such as relationships, attributes, and hierarchical structures), but also support reasoning and query to reveal deeper knowledge associations and logical structures. Therefore, knowledge graphs can provide more comprehensive knowledge integration and semantic reasoning capabilities in crop disease diagnosis.
[0031] In this regard, the present application needs to solve the problem that the existing crop disease diagnosis system cannot effectively and correctly reply to the disease knowledge reasoning answer that requires deeper knowledge association. Therefore, the embodiment of the present application provides a disease knowledge question and answer method, which first obtains the entity set to be queried associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph, then performs knowledge graph retrieval based on the entity set to be queried to infer the target reasoning link information; then, performs comprehensive inference based on the target reasoning link information to output the disease knowledge reasoning answer corresponding to the disease query information by decision, thereby based on the rich association information and multi-level knowledge system contained in the disease knowledge graph, the disease knowledge information associated with the disease query information is inferred more deeply and comprehensively to improve the accurate reasoning of the disease knowledge answer, thereby achieving the purpose of alleviating the large model hallucination phenomenon while effectively improving the reasoning ability and logical judgment ability in complex knowledge question and answer scenarios, effectively overcoming the limitation of relying only on a single knowledge point for retrieval and reasoning, so as to be able to more accurately deal with complex crop disease knowledge question and answer scenarios.
[0032] Figure 1 This is one of the flow charts of the disease knowledge question-answering method provided by the present invention.
[0033] It should be noted that the execution subject of the method may be a disease knowledge question-and-answer system, which may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, a wearable device, a super mobile personal computer, a netbook, etc., and the non-mobile electronic device may be a server, a network attached storage, a personal computer or a self-service machine, etc., which is not specifically limited in this embodiment.
[0034] like Figure 1 As shown, the method includes step 110 , step 120 , step 130 and step 140 .
[0035] Step 110, obtaining disease query information corresponding to the target crop.
[0036] The target crops here are crops of a specific variety for which disease questions and answers need to be conducted, which may be crops such as wheat and corn, and this embodiment does not specifically limit this.
[0037] The disease query information corresponding to the target crops is the query information or question information raised by the user for the target crops and which requires disease knowledge answers.
[0038] Optionally, when it is necessary to conduct disease knowledge quizzes on target crops, it is necessary to obtain disease query information corresponding to the target crops; the disease query information may be user input entered by the user in the front-end interface of the disease knowledge quiz system. The so-called user input may be information input through a command line interface, a graphical interface, touch input, a drop-down selection input, voice input, gesture input, visual input, brain-computer input, etc. This embodiment does not specifically limit this.
[0039] Step 120, according to the similarity between the disease query information and each entity in the disease knowledge graph, obtain a set of entities to be queried associated with the disease query information; wherein the disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0040] Optionally, in order to answer the disease query information input by the user to achieve human-computer interaction, it is necessary to pre-establish a disease knowledge graph (or simply referred to as a knowledge graph). The disease knowledge graph here can be constructed based on the disease knowledge base corresponding to various sample crops. The specific construction steps include: Collect disease knowledge bases corresponding to various sample crops (such as wheat, corn, rice, etc.). The disease knowledge base contains knowledge information from various sources about various sample crops and their related diseases, such as knowledge information covering disease symptoms, pathogens, environmental factors, prevention and control methods, etc.
[0041] Knowledge information related to disease knowledge questions and answers is extracted from the collected disease knowledge base, and the extracted knowledge information is converted into structured data, that is, into entities and relationships; the entity and relationship conversion here can be implemented using a self-expert annotation method, or can be extracted using an entity relationship extraction model, which is not specifically limited in this embodiment. Entity types include but are not limited to crop names (such as wheat varieties), disease types, pathogen names, symptom descriptions, and prevention and control methods. Correspondingly, relationships include but are not limited to the correspondence between crops and disease types, the correspondence between disease types and pathogens, the correspondence between disease types and symptoms, and the correspondence between disease types and prevention and control methods.
[0042] After obtaining the entities and relationships, the extracted entities and relationships are organized in the form of a graph structure to form a network structure containing nodes and edges, thereby obtaining a disease knowledge graph. The nodes in the knowledge graph represent entities (such as crop names, disease types, pathogen names, symptom descriptions, prevention and control methods, etc.), and the edges represent the relationships between entities (such as the correspondence between crops and disease types, the correspondence between disease types and pathogens, the correspondence between disease types and symptoms, the correspondence between disease types and prevention and control methods, etc.).
[0043] After obtaining the disease knowledge graph, the similarity between the disease query information and each entity in the disease knowledge graph can be calculated. For example, the disease query information can be preprocessed, such as standardization, word segmentation, simplification, etc., and the processed disease query information and the text information corresponding to each entity in the disease knowledge graph are encoded to obtain the encoded information corresponding to the disease query information and the encoded information corresponding to each entity, and the similarity between the encoded information corresponding to the disease query information and the encoded information corresponding to each entity is calculated, so as to obtain the similarity between the disease query information and each entity in the disease knowledge graph. The text information corresponding to the entity is the text information used to describe the attribute information of the entity.
[0044] After obtaining the similarity, entity linking can be performed based on the similarity between the disease query information and the entities in the disease knowledge graph to determine the to-be-queried entities (or linked entities) associated with the disease query information from multiple entities in the disease knowledge graph, thereby forming a to-be-queried entity set.
[0045] It can be understood that the entity set to be checked is a set constructed by multiple entities to be checked that are associated with the disease query information. The entities in the disease knowledge graph that are directly or indirectly connected to each entity to be checked in the entity set to be checked may be the knowledge required to answer the disease query information. That is, by determining the entity set to be checked, the knowledge required to answer the disease query information can be further located in the knowledge graph.
[0046] Step 130, based on the entity set to be checked, entity relationship reasoning is performed on the disease knowledge graph to obtain target reasoning link information between the entity set to be checked and the target entity set; the target entity set is a set formed based on entities that have a connection relationship with each entity to be checked in the entity set to be checked.
[0047] Optionally, after obtaining the entity set to be checked, each entity to be checked in the entity set to be checked can be used as the starting entity, and all entity sets in the disease knowledge graph can be traversed to infer the set of entities that have a direct or indirect connection relationship with each entity to be checked in the entity set to be checked, thereby obtaining the target entity set, and based on the inference result, the inference link information formed by each entity to be checked and the entity with which it has a direct or indirect connection relationship is obtained to form the target inference link information between the entity set to be checked and the target entity set. The reasoning here includes chain reasoning and / or diffusion reasoning, which is not specifically limited in this embodiment.
[0048] The target reasoning link information here can be multiple, including entities connected to the entity to be queried and corresponding relationships, which are obtained through similarity matching and entity relationship reasoning, and are the knowledge required in the disease knowledge graph to answer disease query information.
[0049] Step 140: Based on the target reasoning link information, a decision is made to output a disease knowledge reasoning answer corresponding to the disease query information.
[0050] Optionally, after obtaining multiple target reasoning link information, the disease knowledge reasoning answer corresponding to the disease query information can be generated based on the multiple target reasoning link information. For example, multiple target reasoning link information and disease query information can be input into a pre-trained disease knowledge reasoning model, so that the disease knowledge reasoning model comprehensively considers the logic of multiple target reasoning link information, context adaptability and the intention of user input contained in the disease query information, makes a final reasoning decision, and obtains the disease knowledge reasoning answer corresponding to the disease query information; for another example, based on the target reasoning link information and the disease query information, disease knowledge reasoning prompt words are generated, and the generated disease knowledge reasoning prompt words and the disease query information are input into the pre-trained disease knowledge reasoning model, so that the disease knowledge reasoning model, under the guidance of the disease knowledge reasoning prompt words, comprehensively considers the logic of the target reasoning link information, context adaptability and the intention of user input contained in the disease query information, makes a final reasoning decision, and obtains the disease knowledge reasoning answer corresponding to the disease query information. This embodiment does not specifically limit this.
[0051] The answers to the disease knowledge reasoning here include but are not limited to the disease query information, the disease name, cause, recommended prevention and control measures and other relevant agronomic suggestions as the reasoning output.
[0052] The method provided in this embodiment obtains a set of entities to be queried associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph, and performs knowledge graph retrieval based on the entity set to be queried to obtain target reasoning link information; and performs comprehensive inference based on the target reasoning link information to output the disease knowledge reasoning answer corresponding to the disease query information through decision-making, thereby effectively utilizing the rich associated information and multi-level knowledge system contained in the disease knowledge graph, and more deeply and comprehensively reasoning to obtain the disease knowledge information associated with the disease query information, so as to improve the accurate reasoning of the disease knowledge answer, thereby alleviating the large model hallucination phenomenon while effectively improving the reasoning ability and logical judgment ability in complex knowledge question and answer scenarios, effectively overcoming the limitations of relying only on a single knowledge point for retrieval and reasoning, so as to be able to more accurately respond to complex crop disease knowledge question and answer scenarios.
[0053] Figure 2 is a flow chart of the steps of obtaining the entity set to be checked provided by the present invention; Figure 2 As shown, in some embodiments, step 120 specifically includes: Step 121, performing word segmentation processing on the disease query information to obtain a word segmentation set corresponding to the disease query information; Step 122, calculating the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph; Step 123, searching for entities to be checked associated with each segmentation in the segmentation set in the disease knowledge graph according to the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph; Step 124: Generate the entity set to be checked according to the entity to be checked associated with each word in the word set.
[0054] Optionally, in the process of obtaining the association of the entity set to be checked, the disease query information may be first segmented to decompose the disease query information into more and smaller semantic units, thereby obtaining a corresponding segmentation set. The segmentation set here may be obtained by directly segmenting the disease query information based on a pre-trained segmentation model and then performing a preprocessing operation; or it may be obtained by first performing a preprocessing operation on the disease query information and then segmenting the preprocessed disease query information based on the pre-trained segmentation model; or it may be obtained by first performing a first preprocessing operation on the disease query information and then segmenting the preprocessed disease query information based on the pre-trained segmentation model and then performing a second preprocessing operation. This embodiment does not specifically limit this.
[0055] After obtaining the word segmentation set, the similarity between each word segmentation in the word segmentation set and each entity in the disease knowledge graph can be calculated. For example, the text information corresponding to each word segmentation and the text information corresponding to each entity can be encoded to obtain the encoding information of each word segmentation and the encoding information of each entity, and the similarity between the encoding information of each word segmentation and the encoding information of each entity can be calculated to obtain the similarity between each word segmentation in the word segmentation set and each entity in the disease knowledge graph.
[0056] It should be noted that the similarity in the present application may be achieved by using similarity calculation methods such as cosine similarity and distance similarity, and this embodiment does not specifically limit this.
[0057] After obtaining the similarity between each participle and each entity in the disease knowledge graph, entity linking can be performed based on the similarity between each participle and each entity in the disease knowledge graph to determine the entity whose similarity with each participle is greater than a certain value, or the entity with the greatest similarity, as the linked entity corresponding to each participle, that is, the entity to be queried associated with each participle, thereby constructing a set of entities to be queried based on the entities to be queried associated with each participle.
[0058] The method provided in this embodiment first performs detailed word segmentation processing on the disease query information to form an accurate word segmentation set; then, using an efficient similarity calculation method, accurately measure the correlation between each word in the word segmentation set and each entity in the disease knowledge graph; then, based on these similarity information, accurately link each word segmentation to the disease knowledge graph entity that is most relevant to it, forming a set of to-be-queried entities that are closely related to the disease query information. Through the rich associated information and multi-level knowledge system contained therein, knowledge information used to answer the disease query information can be efficiently and accurately retrieved from the complex disease knowledge graph, thereby greatly improving the accuracy and efficiency of disease knowledge answer reasoning.
[0059] In some embodiments, step 121 specifically includes: Generate data processing prompt words according to the disease query information and a pre-built agricultural field knowledge base; Determining input information according to the data processing prompt word and the disease query information, and inputting the input information into a word segmentation model to obtain a plurality of initial word segmentations; Performing a first processing operation on each of the initial word segments, wherein the first processing operation includes a stop word removal operation and / or a duplicate removal operation; Constructing the word segmentation set according to the multiple processed initial word segmentations; The word segmentation model is constructed on the basis of a large language model.
[0060] Optionally, in the word segmentation process, in order to enhance the semantic understanding ability and ensure the accuracy and efficiency of word segmentation, the word segmentation of disease query information can be implemented based on the large model prompt project. The specific implementation steps are as follows: First, prompt words are generated based on the disease query information and the pre-built agricultural knowledge base to obtain the corresponding data processing prompt words. The agricultural knowledge base here includes a variety of professional terms related to the agricultural field, such as crop names, pesticide names, equipment names, technical descriptions, etc. By introducing this information, the word segmentation strategy can be effectively optimized to ensure the accuracy of word segmentation processing and enhance the professionalism of word segmentation.
[0061] The data processing prompt words here are used to guide the model to perform data segmentation, which may include the disease query information input by the user, the agricultural field knowledge base, and the segmentation logic (or the preset segmentation prompt template). For example, the data processing prompt words can be represented as follows: Prompt = ( “Please tokenize the input text for use in agricultural applications. Ensure accurate segmentation and tagging of agricultural-related professional terms such as crop names, pesticides, equipment, technology, etc.” "enter:{}" ).
[0062] After obtaining the data processing prompt words, the data processing prompt words and disease query information can be combined to determine the input information of the model, and the determined input information can be input into the word segmentation model. Under the guidance of the data processing prompt words, the word segmentation model can perform word segmentation processing on the disease query information input by the user to decompose the disease query information into smaller semantic units, thereby obtaining multiple initial word segmentations.
[0063] Here, the method for determining the input information may be to directly concatenate the data processing prompt word and the disease query information to form the corresponding input information; or the disease query information may be pre-processed and then concatenated with the data processing prompt word to form the corresponding input information. This embodiment does not specifically limit this.
[0064] Exemplarily, in some embodiments, determining the input information according to the data processing prompt word and the disease query information includes: Performing a second processing operation on the disease query information, wherein the second processing operation includes at least one of a standardization processing operation, an irrelevant symbol removal operation, and a format conversion operation; The input information is determined according to the processed disease query information and the data processing prompt word.
[0065] Optionally, when determining the input information of the model, in order to ensure the quality of the information input to the model and thus significantly improve the efficiency and accuracy of word segmentation processing based on the large language model, at least one of the following operations may be performed on the disease query information: Standardization operation, which is used to unify and standardize professional terms and common abbreviations in disease query information to avoid model comprehension deviations caused by terminology differences; Irrelevant symbol removal operation, which is used to remove symbols irrelevant to the disease knowledge question and answer, such as punctuation marks, to avoid interference with word segmentation and semantic understanding; Format conversion operation, which is used to unify the content contained in the disease query information into a unified format to ensure the consistency and readability of the input information.
[0066] The word segmentation model here is a model used to segment the input natural language data and decompose the natural language data into smaller semantic units; the word segmentation model can be constructed on the basis of a large language model, such as directly using the large language model as the word segmentation model, or using the agricultural field word segmentation data to perform transfer learning training on the large language model to obtain the corresponding word segmentation model.
[0067] Among them, the Large Language Model (LLM) is simply referred to as the large model, which refers to a Natural Language Processing (NLP) model with a huge number of parameters. The number of model parameters and / or the complexity of the model structure exceed a preset threshold. This model is pre-trained with a large amount of text data and has the ability of high semantic understanding and generating natural language.
[0068] Furthermore, after obtaining multiple initial word segments through the word segmentation model, stop word removal operations and / or deduplication operations for removing duplicate words can be performed on each initial word segment to obtain a more refined and meaningful set of word segments. Among them, the stop word removal operation can be to remove words such as "de" (的) and "le" (了) that are irrelevant to disease knowledge Q&A.
[0069] The method provided in this embodiment uses disease query information and an agricultural domain knowledge base to generate data processing prompt words to effectively guide the large language model for accurate word segmentation. Then, the processed disease query information is combined with the prompt words and input into a word segmentation model constructed based on the large language model to obtain multiple initial word segments. Subsequently, through stop word removal and deduplication operations, the word segmentation results are further refined to form a refined and meaningful set of word segments, thereby not only enhancing the semantic understanding ability but also significantly improving the accuracy and efficiency of word segmentation for more accurate implementation of agricultural disease knowledge Q&A in the future.
[0070] In some embodiments, step 122 specifically includes: Input the text information corresponding to each word segment in the word segment set and the text information corresponding to each entity in the disease knowledge graph into the target embedding model respectively to obtain the embedding vectors of each word segment in the word segment set and the embedding vectors of each entity in the disease knowledge graph; Calculate the similarity between each word segment in the word segment set and each entity in the disease knowledge graph according to the embedding vectors of each word segment in the word segment set and the embedding vectors of each entity in the disease knowledge graph; Among them, the target embedding model is obtained by self-knowledge distillation training of a pre-trained word embedding model based on text corpora in the agricultural domain.
[0071] Optionally, when calculating the similarity, the text information corresponding to each word segment in the word segment set can be input into the target embedding model to perform vector embedding on the text information corresponding to each word segment by the target embedding model, thereby obtaining the embedding vectors of each word segment in the word segment set; and the text information corresponding to each entity in the disease knowledge graph can be input into the target embedding model to perform vector embedding on the text information corresponding to each entity by the target embedding model, thereby obtaining the embedding vectors of each entity.
[0072] After obtaining the embedding vector of each word segment and the embedding vector of each entity, the similarity between the embedding vector of each word segment and the embedding vector of each entity can be calculated, and entity linking is performed based on the similarity to obtain the entities to be queried associated with each word segment.
[0073] The target embedding model here is obtained by fine-tuning the pre-trained word embedding model through self-knowledge distillation using text corpus in the agricultural field. By adding domain-specific text corpus, the trained target embedding model can better understand the terminology and contextual relationships in the agricultural field, thereby improving the quality of embedding vector extraction.
[0074] In summary, the method provided in this embodiment, by inputting the text information corresponding to each segmentation in the segmentation set and each entity in the disease knowledge graph into the self-knowledge distillation target embedding model fine-tuned based on the agricultural field text corpus, the model can accurately extract the embedding vectors of each segmentation and entity, and calculate the similarity between them, thereby achieving high-precision entity linking, which not only enhances the model's understanding of agricultural field terms and contextual relationships, but also significantly improves the quality of embedding vector extraction, so as to more accurately realize disease knowledge question and answer in the future.
[0075] In some embodiments, the target embedding model is trained based on the following steps: Inputting the text corpus into the pre-trained word embedding model, obtaining a loss value corresponding to dense retrieval, a loss value corresponding to sparse retrieval, and a loss value corresponding to multi-vector retrieval, as well as a classification performance index of the pre-trained word embedding model; Fusing the loss value corresponding to the dense retrieval, the loss value corresponding to the sparse retrieval, and the loss value corresponding to the multi-vector retrieval to obtain a fused loss value; Determine a first loss function according to any one of the loss value corresponding to the dense retrieval, the loss value corresponding to the sparse retrieval, and the loss value corresponding to the multi-vector retrieval, and the fusion loss value; Determining a second loss function according to the classification performance indicator; The first loss function and the second loss function are combined to obtain a target loss function; According to the target loss function, the pre-trained word embedding model is iteratively trained to obtain the target embedding model.
[0076] The pre-trained word embedding model here can be a pre-trained M3-Embedding model or other pre-trained model, which is not specifically limited in this embodiment. The following takes the pre-trained word embedding model as a pre-trained M3-Embedding model as an example to describe the training process of the target embedding model.
[0077] Assume that the text corpus collection in the agricultural field is , where each text corpus Contains content related to the agricultural field. After obtaining these text corpora, they can be preprocessed, such as format conversion and noise reduction, to ensure their consistency in format and remove noise.
[0078] Select the pre-trained M3-Embedding model as the base model (that is, the pre-trained word embedding model). The output of this model can be expressed as: ; in, Representing text corpus The embedding vector of is the embedding function of the pre-trained M3-Embedding model; are the model parameters of the pre-trained M3-Embedding model.
[0079] During the fine-tuning process, the self-knowledge distillation method is used to enhance the learning ability of the model. Specifically, multiple different retrieval functions are set, such as dense retrieval, sparse retrieval, and multi-vector retrieval, and the text corpus is input into the pre-trained word embedding model to calculate the relevance score corresponding to dense retrieval (such as obtained by calculating the similarity between the query vector and the document vector), the relevance score corresponding to sparse retrieval (such as obtained by calculating the dot product or weighted dot product between the query vector and the document vector), and the relevance score corresponding to multi-vector retrieval (such as obtained by calculating the composite similarity between the query vector set and the document vector set), that is, the loss value corresponding to dense retrieval, the loss value corresponding to sparse retrieval, and the loss value corresponding to multi-vector retrieval.
[0080] Next, the loss values corresponding to dense retrieval, sparse retrieval, and multi-vector retrieval are fused to obtain the fused loss value, that is, the comprehensive teacher signal. The specific calculation formula is as follows: ; in, , and They are the loss values corresponding to dense retrieval, sparse retrieval, and multi-vector retrieval respectively; is the fusion loss value; , , is the weight coefficient, satisfying In this way, the model can leverage knowledge from different retrieval features for joint learning.
[0081] During the training process, the target loss function can be obtained based on the following steps: According to any loss value corresponding to dense retrieval, sparse retrieval, multi-vector retrieval, and the fusion loss value, the first loss function (that is, the loss function of self-knowledge distillation) is determined. The specific calculation formula is as follows: ; in, is the first loss function; is the fusion loss value, which combines the outputs of different retrieval functions. is the softmax activation function; It is any loss value from the loss value corresponding to dense retrieval, the loss value corresponding to sparse retrieval, and the loss value corresponding to multi-vector retrieval.
[0082] The text corpus is input into the pre-trained word embedding model to obtain the classification performance index of the pre-trained word embedding model, and the second loss function (that is, the main loss function used to train the embedding model) is determined based on the classification performance index. The specific calculation formula is as follows: ; in, is the second loss function; is the query vector, is the positive sample set, is the set of negative samples. It is a function used to calculate similarity, which can be any function of dense search, sparse search or multi-vector search. is the temperature parameter that controls the smoothness of the distribution.
[0083] Finally, the first loss function and the second loss function are integrated to obtain the target loss function: ; in, is the target loss function; is the second loss function, is the first loss function, and is a hyperparameter.
[0084] After obtaining the target loss function, the pre-trained word embedding model can be iteratively trained based on the target loss function to obtain a target embedding model that can accurately extract embedding vectors for data in the agricultural field. This model not only utilizes the knowledge of multiple retrieval functions for joint learning, but also enhances the learning ability through self-knowledge distillation, thereby improving the performance and accuracy in text processing tasks in the agricultural field.
[0085] In some embodiments, step 140 specifically includes: Generate disease knowledge reasoning prompt words according to the target reasoning link information and the disease query information; Inputting the disease knowledge reasoning prompt word and the target reasoning link information into the disease knowledge reasoning model to obtain the disease knowledge reasoning answer; The disease knowledge reasoning model is constructed on the basis of a large language model.
[0086] Optionally, in the answer reasoning process, in order to enhance the semantic understanding ability and ensure the accuracy and efficiency of answer reasoning, answer reasoning can be implemented based on the large model prompt engineering. The specific implementation steps are as follows: First, the prompt words are generated based on the target reasoning link information and the disease query information to obtain the corresponding disease knowledge reasoning prompt words. The disease knowledge reasoning prompt words here are used to guide the model to perform disease knowledge reasoning, which can include the disease query information input by the user, the target reasoning link information, and the disease reasoning logic (or the preset disease reasoning prompt word template). For example, the disease knowledge reasoning prompt words can be represented as follows: Prompt = ( "Farmer description: {}" "After knowledge graph reasoning, the following are possible reasoning paths:" "1.Leaves → round → white → powder → powdery mildew" “2.xxx” “3.xxx” “Please generate a detailed diagnosis report based on these reasoning paths and your own knowledge of crop diseases, including the following:” “1. Possible diagnoses (corresponding to each reasoning path).” "2. Recommended treatment options." ).
[0087] After obtaining the disease knowledge reasoning prompt words, the disease knowledge reasoning prompt words and multiple target reasoning link information generated by knowledge graph reasoning can be input into the disease knowledge reasoning model, so as to guide the disease knowledge reasoning model through the disease knowledge reasoning prompt words, comprehensively consider the logic, context adaptability and user input intention of the multiple target reasoning link information generated by knowledge graph reasoning, make a comprehensive decision on the multiple target reasoning link information generated by knowledge graph reasoning, generate specific disease knowledge reasoning answers, and feedback the disease knowledge reasoning answers to the user in the form of natural language.
[0088] The method provided in this embodiment combines the target reasoning link information and the disease query information to generate a disease knowledge reasoning prompt word, and inputs the prompt word and multiple target reasoning link information into a disease knowledge reasoning model built based on a large language model. The model can generate detailed disease knowledge reasoning answers based on the guidance of the prompt word, comprehensively consider the logic of the reasoning link, context adaptability and user intention, and feedback to the user in the form of natural language, thereby achieving efficient and accurate disease knowledge question and answer.
[0089] In some embodiments, step 130 specifically includes: Taking each entity to be checked in the entity set to be checked as a starting entity, chain reasoning is performed on the disease knowledge graph to obtain a first target entity connected to each entity to be checked, and first reasoning link information between each entity to be checked and the first target entity; Taking each entity to be checked in the entity set to be checked as a starting entity, performing diffusion reasoning on the disease knowledge graph to obtain a second target entity connected to each entity to be checked, and second reasoning link information between each entity to be checked and the second target entity; The target reasoning link information is generated according to the first reasoning link information and the second reasoning link information.
[0090] Chain reasoning is a causal chain-based reasoning method that performs reasoning step by step along the relationship chain (from one entity to another) in the knowledge graph. Its goal is to derive the target entity or attribute related to the known entity. Assume that the knowledge graph is a directed graph. ,in is a collection of entities, is a set of relations. For any two entities , if there is an edge connect and , it means that there is a relationship between the two entities.
[0091] The basic process of chain reasoning can be expressed as: ; Here, the reasoning path consists of a series of relations , ,…, Connection, starting point of the path is a known entity, the end point is the target entity or attribute.
[0092] Diffusion reasoning is to start from the initial entity and expand multiple relationships and entities outward to form a broader reasoning network. This kind of reasoning is suitable for dealing with complex and multi-factor diagnostic scenarios.
[0093] Diffusion reasoning can be viewed as starting from a starting entity Start by traversing all entity sets directly or indirectly connected to it , and analyze the relationships between these entities: ; Each reasoning path Represents a possible disease knowledge, such as the cause or clues to disease diagnosis.
[0094] Optionally, in the process of knowledge graph reasoning, chain reasoning is performed with each entity to be checked in the set of entities to be checked as a starting point. This reasoning method starts from one entity like a chain, and gradually reasoning along the relationship chain in the graph until the first target entity directly related to the starting entity is found, and the first reasoning link information formed in this reasoning process is recorded.
[0095] In addition, each entity in the entity set to be checked is used as the starting point for diffusion reasoning. This reasoning method is more like a ripple spreading from the center to the surroundings. Starting from one entity, all possible entities directly or indirectly related to it are explored to find the second target entity, and the second reasoning link information formed in this process is recorded.
[0096] Finally, the first reasoning link information and the second reasoning link information are integrated to generate multiple target reasoning link information. This information not only includes the reasoning path between the entity to be checked and the directly related entity, but also includes the reasoning path of the entity that is widely related to the entity to be checked. By comprehensively and deeply mining the entity relationship in the disease knowledge graph, it provides comprehensive knowledge for disease query information, thereby alleviating the large model hallucination phenomenon while effectively improving the reasoning ability and logical judgment ability in complex knowledge question and answer scenarios, effectively overcoming the limitations of relying only on a single knowledge point for retrieval and reasoning, so as to be able to more accurately respond to complex crop disease knowledge question and answer scenarios.
[0097] The disease knowledge question-and-answer method provided in this embodiment is described below with specific examples.
[0098] Figure 3 FIG. 2 is a flow chart of the disease knowledge question-answering method provided by the present invention; Figure 3 As shown, the exemplary process of the disease knowledge question answering method includes: Step 310, constructing a disease knowledge graph (or simply a knowledge graph); Step 320, the disease query information input by the user and the input information of the model formed by generating prompt words based on the disease query information are input into the word segmentation model constructed on the basis of the large model to perform word segmentation processing on the disease query information input by the user, and perform operations such as deduplication, deletion, and deletion of stop words on the word segmentation results to obtain a word segmentation word set (or word segmentation set); Step 330: based on the text corpus in the agricultural field, incrementally fine-tune the pre-trained word embedding model (or general embedding model) to obtain a target embedding model, and embed vectors for each word in the word set and each entity in the entity set in the knowledge graph based on the target embedding model, and calculate the similarity between each word and each entity based on the vector embedding result, perform entity linking based on the similarity, and use the entity with the highest similarity in the knowledge graph as the entity to be checked associated with each word to form an entity set to be checked; Step 340, performing knowledge graph reasoning based on the entity set to be queried, and specifically using chain reasoning and diffusion reasoning to perform reasoning to generate multiple target reasoning link information; Step 350, input multiple target reasoning link information, prompt words generated based on the multiple target reasoning link information and the disease query information input by the user into the disease knowledge reasoning model constructed based on the large model, so that the disease knowledge reasoning model combines the generated prompt words with its own implicit knowledge and the inferred external knowledge (that is, multiple target reasoning link information) for comprehensive inference, and outputs the corresponding disease knowledge reasoning answer.
[0099] In summary, this embodiment effectively utilizes the rich associated information and multi-level knowledge system contained in the disease knowledge graph to more deeply and comprehensively infer the disease knowledge information associated with the disease query information, so as to improve the accurate reasoning of the disease knowledge answers, thereby effectively alleviating the shortage of crop disease expert resources and the large model hallucination phenomenon, while effectively improving the reasoning ability and logical judgment ability in complex knowledge question and answer scenarios, effectively overcoming the limitations of relying solely on a single knowledge point for retrieval and reasoning, so as to be able to more accurately respond to complex crop disease knowledge question and answer scenarios.
[0100] The disease knowledge question and answer system provided by the present invention is described below. The disease knowledge question and answer system described below and the disease knowledge question and answer method described above can be referenced to each other.
[0101] Figure 4 is a schematic diagram of the structure of the disease knowledge question-answering system provided by the present invention; Figure 4 As shown, the system includes a first acquisition unit 410 , a second acquisition unit 420 , a reasoning unit 430 and a decision unit 440 .
[0102] The first acquisition unit 410 is used to acquire disease query information corresponding to the target crop; The second acquisition unit 420 is used to acquire a to-be-queried entity set associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph; The reasoning unit 430 is used to perform entity relationship reasoning on the disease knowledge graph according to the entity set to be checked, and obtain target reasoning link information between the entity set to be checked and the target entity set; the target entity set is a set formed by entities that have a connection relationship with each entity to be checked in the entity set to be checked; The decision unit 440 is used to decide and output the disease knowledge reasoning answer corresponding to the disease query information according to the target reasoning link information; The disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0103] The system provided in this embodiment obtains a set of entities to be queried associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph, and performs knowledge graph retrieval based on the entity set to be queried to obtain target reasoning link information; and performs comprehensive inference based on the target reasoning link information to output the disease knowledge reasoning answer corresponding to the disease query information through decision-making, thereby effectively utilizing the rich associated information and multi-level knowledge system contained in the disease knowledge graph, and more deeply and comprehensively reasoning to obtain the disease knowledge information associated with the disease query information, so as to improve the accurate reasoning of the disease knowledge answer, thereby alleviating the large model hallucination phenomenon while effectively improving the reasoning ability and logical judgment ability in complex knowledge question and answer scenarios, effectively overcoming the limitations of relying only on a single knowledge point for retrieval and reasoning, so as to be able to more accurately respond to complex crop disease knowledge question and answer scenarios.
[0104] The system provided by the present invention is used to execute the above-mentioned method embodiments. Please refer to the above-mentioned embodiments for the specific processes and detailed contents, which will not be repeated here.
[0105] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the disease knowledge question-answering method, which includes: obtaining disease query information corresponding to the target crop; obtaining a to-be-checked entity set associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph; performing entity relationship reasoning on the disease knowledge graph according to the to-be-checked entity set to obtain target reasoning link information between the to-be-checked entity set and the target entity set; the target entity set is a set formed based on entities that have a connection relationship with each to-be-checked entity in the to-be-checked entity set; according to the target reasoning link information, a decision is made to output the disease knowledge reasoning answer corresponding to the disease query information; wherein the disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0106] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, 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, and the computer software product is stored in a storage medium, including a number of 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 invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0107] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the disease knowledge question and answer method provided by the above methods, which includes: obtaining disease query information corresponding to the target crop; obtaining a set of entities to be queried associated with the disease query information based on the similarity between the disease query information and each entity in the disease knowledge graph; performing entity relationship reasoning on the disease knowledge graph based on the entity set to be queried, and obtaining target reasoning link information between the entity set to be queried and the target entity set; the target entity set is a set formed based on entities that have a connection relationship with each entity to be queried in the entity set to be queried; based on the target reasoning link information, a decision is made to output the disease knowledge reasoning answer corresponding to the disease query information; wherein, the disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0108] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the disease knowledge question and answer method provided by the above-mentioned methods, the method comprising: obtaining disease query information corresponding to the target crop; obtaining a set of entities to be queried associated with the disease query information based on the similarity between the disease query information and each entity in the disease knowledge graph; performing entity relationship reasoning on the disease knowledge graph based on the entity set to be queried, and obtaining target reasoning link information between the entity set to be queried and the target entity set; the target entity set is a set formed based on entities that have a connection relationship with each entity to be queried in the entity set to be queried; based on the target reasoning link information, a decision is made to output the disease knowledge reasoning answer corresponding to the disease query information; wherein, the disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
[0109] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0110] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0111] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A disease knowledge question-answering method, characterized in that: include: Obtain disease query information corresponding to target crops; According to the similarity between the disease query information and each entity in the disease knowledge graph, obtaining a set of entities to be queried associated with the disease query information; According to the entity set to be checked, entity relationship reasoning is performed on the disease knowledge graph to obtain target reasoning link information between the entity set to be checked and the target entity set; The target entity set is a set formed based on entities that have a connection relationship with each entity to be checked in the entity set to be checked; According to the target reasoning link information, a decision is made to output a disease knowledge reasoning answer corresponding to the disease query information; The disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
2. The disease knowledge question-answering method according to claim 1, characterized in that: The obtaining, according to the similarity between the disease query information and each entity in the disease knowledge graph, a set of entities to be queried that are associated with the disease query information includes: Performing word segmentation processing on the disease query information to obtain a word segmentation set corresponding to the disease query information; Calculating the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph; According to the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph, searching for the to-be-queried entity associated with each segmentation in the segmentation set in the disease knowledge graph; The entity set to be checked is generated according to the entities to be checked associated with each word in the word set.
3. The disease knowledge question-answering method according to claim 2, characterized in that: The word segmentation processing is performed on the disease query information to obtain a word segmentation set corresponding to the disease query information, including: Generate data processing prompt words according to the disease query information and a pre-built agricultural field knowledge base; Determining input information according to the data processing prompt word and the disease query information, and inputting the input information into a word segmentation model to obtain a plurality of initial word segmentations; Performing a first processing operation on each of the initial word segments, wherein the first processing operation includes a stop word removal operation and / or a duplicate removal operation; Constructing the word segmentation set according to the multiple processed initial word segmentations; The word segmentation model is constructed on the basis of a large language model.
4. The disease knowledge question-answering method according to claim 3, characterized in that: The step of determining input information according to the data processing prompt word and the disease query information includes: Performing a second processing operation on the disease query information, wherein the second processing operation includes at least one of a standardization processing operation, an irrelevant symbol removal operation, and a format conversion operation; The input information is determined according to the processed disease query information and the data processing prompt word.
5. The disease knowledge question-answering method according to claim 2, characterized in that: The calculating the similarity between each segmentation in the segmentation set and each entity in the disease knowledge graph includes: Input text information corresponding to each word in the word set and text information corresponding to each entity in the disease knowledge graph into the target embedding model respectively, and obtain embedding vectors of each word in the word set and embedding vectors of each entity in the disease knowledge graph; Calculate the similarity between each word in the word set and each entity in the disease knowledge graph according to the embedding vector of each word in the word set and the embedding vector of each entity in the disease knowledge graph; The target embedding model is obtained by performing self-knowledge distillation training on the pre-trained word embedding model based on text corpus in the agricultural field.
6. The disease knowledge question-answering method according to claim 5, characterized in that: The target embedding model is trained based on the following steps: Inputting the text corpus into the pre-trained word embedding model, obtaining a loss value corresponding to dense retrieval, a loss value corresponding to sparse retrieval, and a loss value corresponding to multi-vector retrieval, as well as a classification performance index of the pre-trained word embedding model; Fusing the loss value corresponding to the dense retrieval, the loss value corresponding to the sparse retrieval, and the loss value corresponding to the multi-vector retrieval to obtain a fused loss value; Determine a first loss function according to any one of the loss value corresponding to the dense retrieval, the loss value corresponding to the sparse retrieval, and the loss value corresponding to the multi-vector retrieval, and the fusion loss value; Determining a second loss function according to the classification performance indicator; The first loss function and the second loss function are combined to obtain a target loss function; According to the target loss function, the pre-trained word embedding model is iteratively trained to obtain the target embedding model.
7. The disease knowledge question-answering method according to any one of claims 1 to 6, characterized in that: The step of deciding to output the disease knowledge reasoning answer corresponding to the disease query information according to the target reasoning link information includes: Generate disease knowledge reasoning prompt words according to the target reasoning link information and the disease query information; Inputting the disease knowledge reasoning prompt word and the target reasoning link information into the disease knowledge reasoning model to obtain the disease knowledge reasoning answer; The disease knowledge reasoning model is constructed on the basis of a large language model.
8. The disease knowledge question-answering method according to any one of claims 1 to 6, characterized in that: The step of performing entity relationship reasoning on the disease knowledge graph according to the entity set to be checked to obtain target reasoning link information between the entity set to be checked and the target entity set includes: Taking each entity to be checked in the entity set to be checked as a starting entity, chain reasoning is performed on the disease knowledge graph to obtain a first target entity connected to each entity to be checked, and first reasoning link information between each entity to be checked and the first target entity; Taking each entity to be checked in the entity set to be checked as a starting entity, performing diffusion reasoning on the disease knowledge graph to obtain a second target entity connected to each entity to be checked, and second reasoning link information between each entity to be checked and the second target entity; The target reasoning link information is generated according to the first reasoning link information and the second reasoning link information.
9. A disease knowledge question-answering system, characterized in that: include: A first acquisition unit is used to acquire disease query information corresponding to the target crop; A second acquisition unit is used to acquire a to-be-queried entity set associated with the disease query information according to the similarity between the disease query information and each entity in the disease knowledge graph; An inference unit, configured to perform entity relationship inference on the disease knowledge graph according to the entity set to be checked, and obtain target inference link information between the entity set to be checked and the target entity set; The target entity set is a set formed based on entities that have a connection relationship with each entity to be checked in the entity set to be checked; A decision-making unit, configured to decide and output a disease knowledge reasoning answer corresponding to the disease query information according to the target reasoning link information; The disease knowledge graph is constructed based on the disease knowledge base corresponding to various sample crops.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the disease knowledge question and answer method as described in any one of claims 1 to 8 is implemented.
11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the disease knowledge question and answer method as described in any one of claims 1 to 8 is implemented.
Citation Information
Cited By
Model cooperative processing method and device, electronic equipment and computer storage medium
CN120671795A
Model cooperative processing method and device, electronic equipment and computer storage medium
CN120671795B
Data query method and system
CN121255828A