Agricultural knowledge intelligent question and answer processing method, system and equipment and medium
By constructing an agricultural knowledge graph and verifying query statements using preset language models, the problem of low accuracy of vector databases in complex agricultural knowledge recognition is solved, and the answer relevance and accuracy of the agricultural knowledge intelligent question-and-answer system is improved.
Patent Information
- Application Number
- CN202411221243.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-12-27
AI Technical Summary
When vector databases process complex agricultural knowledge with strong correlation, the accuracy of identification and information retrieval is low, resulting in the inconsequential answers of the agricultural knowledge intelligent question and answer system.
By obtaining basic agricultural knowledge, building agricultural knowledge graphs, identifying entity information in user questions, generating entity data, and finding matching graph partial views in the knowledge graph, using preset language models to generate query statements for verification and correction. Finally generate relevant answers.
The identification accuracy and information retrieval relevance of the intelligent question-and-answer system of agricultural knowledge in complex agricultural knowledge have been improved, irrelevant information interference has been reduced, and the accuracy and user experience of answers have been improved.
Smart Images

Figure CN119202161A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of large model recognition technology, and specifically to a method, system, device and medium for intelligent question-answering processing of agricultural knowledge. Background Art
[0002] Retrieval-augmented generation (RAG) is a technique that uses information from private or proprietary data sources to improve the quality of text generation. It combines retrieval models (specialized for finding relevant information in large datasets or knowledge bases) with generation models (such as large language models (LLMs), which can generate natural and fluent text responses based on retrieved data). With this technology, contextual information can be extracted from multiple data sources to supplement the built-in knowledge base of the LLM, thereby improving the accuracy and relevance of questions and answers and enhancing the output of large language models without retraining the model.
[0003] However, although vector databases perform well in processing unstructured data, especially when representing such data through high-dimensional vectors, they have great difficulty in recognition when it comes to processing complex knowledge with strong correlations, which leads to low accuracy in recognition and information retrieval. Summary of the invention
[0004] In view of the above-mentioned shortcomings of the prior art, the present application provides an agricultural knowledge intelligent question and answer processing method, system, device and medium to solve the above-mentioned technical problems.
[0005] The present application provides a method for intelligent question-answering of agricultural knowledge, the method comprising: acquiring basic agricultural knowledge, and constructing an agricultural knowledge graph based on the basic agricultural knowledge; collecting user questions and identifying agricultural entity information in the user questions to obtain materialized data; searching the agricultural knowledge graph for a partial view of the graph that matches the materialized data; identifying the partial view of the graph based on a preset model, obtaining corresponding content related to the user question and generating an answer to the user question; and feeding back the answer to the user.
[0006] In one embodiment of the present application, searching the agricultural knowledge graph for a local view of the graph that matches the materialized data includes: obtaining query prompt words based on key entities and structural information of the agricultural knowledge graph group, wherein the key entities are obtained based on the materialized data; calling a preset language model to generate a query statement based on the query prompt words; verifying the relationship direction of the query statement, and modifying the query statement according to the verification result until the verification passes; obtaining relevant information from the agricultural knowledge graph according to the query statement that passes the verification, and obtaining a local view of the graph that matches the materialized data based on the relevant information.
[0007] In one embodiment of the present application, the relationship direction of the query statement is verified, including: obtaining a relationship list in the agricultural knowledge base structure information, the relationship list including the types and initial directions of all defined relationships; obtaining the target relationship in the user question based on the query statement, and the inquiry direction of each target relationship in the query statement; comparing the inquiry direction of each target relationship with the initial direction in the relationship list, if the inquiry direction is inconsistent with the initial direction, determining that the verification has failed; correcting the query statement that has failed the verification until the inquiry direction of the target relationship in the query statement is consistent with the initial direction in the relationship list.
[0008] In one embodiment of the present application, agricultural entity information in the user question is identified to obtain materialized data of the user question, including: obtaining structural information in a preset agricultural graph database, wherein the structural information at least includes entity type, attributes and relationships; identifying the user question to obtain an entity list corresponding to the user question; performing type matching on each entity in the user question based on the entity list to determine the category to which each entity in the user question belongs; mapping the entities in the user question to corresponding entities in the agricultural graph database to establish a corresponding relationship between each entity; and outputting the results of the above matching and mapping as materialized data, wherein the materialized data includes the entities in the user question, the corresponding graph database entity types and the relationship between each entity.
[0009] In one embodiment of the present application, the local view of the graph is identified based on a preset model to obtain corresponding content related to the user question and generate an answer to the user question, including: extracting knowledge fragments related to the user question from the agricultural knowledge base based on the query statement; combining the extracted knowledge fragments with the user's original question input to form a comprehensive data set; performing graph information recognition on the local view of the graph to obtain corresponding content related to the user question, and the graph information recognition is implemented based on the information of the comprehensive data set; assembling the corresponding content and the knowledge fragments to form answer prompt words, so as to obtain a complete answer based on the answer prompt words and the knowledge fragments, and determining the answer as the answer to the user question.
[0010] In one embodiment of the present application, after the answer is fed back to the user, it also includes: obtaining feedback information from the user after accepting the answer, the feedback information including at least one of star ratings, positive / negative feedback, and detailed written comments; updating the agricultural knowledge graph based on the feedback information to improve the accuracy of the answer.
[0011] The present application provides an agricultural knowledge intelligent question-answering processing system, the system comprising: a question entity recognizer, used to receive a question input by a user, and recognize agricultural entity information from the user question, and obtain entity data with the agricultural entity information; a knowledge mapper, used to map entities in the entity data to corresponding nodes in a pre-constructed agricultural knowledge graph, so as to match entities in the user question with entity types in an agricultural graph database, and determine the position of entities in the user question in the agricultural knowledge graph; a prompt word assembler, used to generate entity recognition prompt words based on the user question, generate query prompt words based on agricultural entity information and the agricultural knowledge graph, and assemble the corresponding content and the knowledge fragment to form an answer prompt word; a large model caller, used to call a preset language model, retrieve information in the agricultural knowledge graph according to the query statement to obtain a partial view of the graph matching the entity data, and obtain a complete answer according to the answer prompt word and the knowledge fragment; a relationship direction verifier, used to verify whether the query direction of the target relationship in the query statement is consistent with the initial direction, and to correct the query statement when the query direction is consistent with the initial direction.
[0012] In one embodiment of the present application, the agricultural knowledge intelligent question and answer processing system also includes: a knowledge graph builder, which is used to acquire basic agricultural knowledge, and perform entity recognition and relationship extraction on the basic agricultural knowledge, so as to form an agricultural knowledge graph with the recognized entities and the extracted relationships; an answer generator, which is used to extract knowledge fragments related to the user's question from the agricultural knowledge base, combine the knowledge fragments with the user's original question input to form a comprehensive data set, perform image information recognition on the local view of the graph to obtain the corresponding content related to the user's question, assemble the corresponding content and the knowledge fragments into a complete answer and determine the complete answer as the answer to the user's question.
[0013] The present application provides an electronic device, including a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the agricultural knowledge intelligent question and answer processing method as described above.
[0014] The present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is used to enable a computer to execute the agricultural knowledge intelligent question-answering processing method as described above.
[0015] Beneficial effects of the present application: The method for processing intelligent agricultural knowledge questions and answers proposed in the present application first collects user questions and basic agricultural knowledge, and builds an agricultural knowledge graph based on this; then, by identifying the agricultural entity information in the user's question, it is converted into entity data, and the data is used to search for the corresponding local view in the knowledge graph; then, the local view is further analyzed to extract the content directly related to the user's question, and the answer is generated accordingly, and finally the answer is presented to the user. Through entity recognition, knowledge mapping, and relationship direction verification, higher-quality query statements are obtained, so that specific information fragments that are highly relevant to the user's question can be quickly located in the huge agricultural knowledge graph, which greatly reduces the interference of irrelevant information, effectively improves the correlation between the answer and the user's question, and further improves the accuracy of the answer.
[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0018] Figure 1 is a schematic diagram of an implementation environment of an agricultural knowledge intelligent question-answering processing method shown in an exemplary embodiment of the present application;
[0019] Figure 2 is a flowchart of the implementation steps of the agricultural knowledge intelligent question-answering processing method shown in an exemplary embodiment of the present application;
[0020] Figure 3 It is a schematic diagram of the structure of an intelligent question-answering processing system for agricultural knowledge shown in an exemplary embodiment of the present application;
[0021] Figure 4 is a flowchart of agricultural knowledge graph query and answer generation shown in an exemplary embodiment of the present application;
[0022] Figure 5 is a block diagram of an agricultural knowledge intelligent question-answering processing system shown in an exemplary embodiment of the present application;
[0023] Figure 6 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] The following will describe the implementation methods of the present application with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific implementation methods, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be understood that the preferred embodiments are only for illustrating the present application, not for limiting the scope of protection of the present application.
[0025] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0026] In the following description, a large number of details are discussed to provide a more thorough explanation of the embodiments of the present application. However, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present application difficult to understand.
[0027] First of all, it should be explained that RAG (Retrieval-Augmented Generation) retrieval enhancement generation technology combines the technical features of information retrieval (Retrieval) and natural language generation (Generation), and is usually used in question-answering systems, summary generation and other natural language processing tasks.
[0028] LLA (Large Language Model) is a large language model that can generate text, translate, write code, answer questions, and perform other complex language tasks.
[0029] In the knowledge graph, "entity", "relationship" and "attribute" are three basic concepts. Among them, entity refers to a specific thing or abstract concept in the real world, which can be a person, place, organization, event, product, idea, etc. Relationship refers to the connection or association between two or more entities. For example, the relationship between "Beijing" and "work" in "working in Beijing" can be described as the relationship between one entity and another entity. Attribute is information used to describe the characteristics of an entity. Attributes can be data points directly attached to an entity, such as a person's age, height, weight, etc. In the knowledge graph, attributes can also be regarded as a special "relationship" that connects an entity and a specific characteristic value of the entity. Attributes usually contain a key-value pair, where the key is the attribute name and the value is a specific description.
[0030] "LLM-Cypher-Generate" refers to a process or tool that combines Large Language Model (LLM) with Cypher query generation. Large Language Model is used to generate Cypher query statements, which can be used to perform complex data retrieval tasks in graph databases such as Neo4j.
[0031] "LLM-Answer-Generate" refers to the use of a large language model (LLM) to generate answers to questions.
[0032] Figure 1 It is a schematic diagram of the implementation environment of an exemplary embodiment of the present application showing an intelligent question-answering method for agricultural knowledge.
[0033] like Figure 1As shown in FIG. 1 , the implementation environment of the intelligent question-answering processing method for agricultural knowledge is composed of a data acquisition module 101 and a computer module 102. The data acquisition module 101 is responsible for collecting agricultural related information from multiple sources. This information not only covers text materials, expert opinions, and historical records in the fields of planting and breeding, but also includes dynamic data such as real-time meteorological data, soil moisture, and crop growth status. The data acquisition equipment can be various sensors installed in the farmland (such as temperature sensors, humidity sensors, soil nutrient detectors, etc.), or mobile devices such as smart phones and tablet computers, which are used to record and upload farmers' inquiries and observations. In addition, the module can also integrate data sources from the Internet, such as online agricultural forums, academic paper databases, etc. This method does not limit the specific implementation form of the data acquisition module, but aims to ensure that the system can comprehensively obtain knowledge information in the agricultural field through a variety of data input methods. The computer module 102 is used to process the raw data collected by the data acquisition module 101, and perform knowledge extraction, entity recognition, and intelligent question-answering processing. The module uses natural language processing technology and machine learning algorithms to parse user inquiries, automatically construct an agricultural knowledge map, and retrieve the most relevant information to the user's question and generate corresponding answers. The computer module 102 can be a server equipped with powerful processing capabilities, a cloud computing platform, a high-performance GPU workstation, or an embedded computing device, such as an intelligent control unit installed on agricultural machinery. This method also does not limit the specific configuration of the computer module to adapt to different application scenarios and technical requirements.
[0034] Figure 2 It is an exemplary embodiment of the present application, showing a flowchart of the implementation steps of the method for intelligent question-answering of agricultural knowledge.
[0035] like Figure 2 As shown, in an exemplary embodiment, the agricultural knowledge intelligent question answering processing method includes at least steps S210 to S250, which are described in detail as follows:
[0036] Step S210, acquiring basic agricultural knowledge and constructing an agricultural knowledge graph based on the basic agricultural knowledge.
[0037] In one embodiment of the present application, various questions about agriculture from users are collected through online questionnaires, social media, forum crawling, etc. These questions may cover planting techniques, pest control, crop growth cycle, etc. Basic agricultural knowledge is extracted from resources such as textbooks, agricultural research papers, and agricultural guidelines issued by the government. The agricultural knowledge includes but is not limited to botanical knowledge, agronomic principles, agricultural regulations, etc.
[0038] In addition, first, convert the basic agricultural knowledge documents into structured data, extract key concepts, attributes and relationships; then, use natural language processing techniques, such as named entity recognition and relationship extraction, extract entities (such as crop names, types of pests and diseases) and their relationships (such as the relationship between a certain crop and a specific disease) from user questions and basic agricultural knowledge; and build a knowledge graph model based on the extracted information, define nodes (entities) and edges (relationships). For example, create a graph node to represent "wheat" and another node to represent "rust", and connect them with an edge to indicate that "wheat may be infected with rust". Then, use graph database technology (such as Neo4j, JanusGraph, etc.) to store the above entities and relationships, and define the schema of the graph, including entity types, attributes and relationship types; finally, import the preprocessed data into the graph database to form a complete agricultural knowledge graph.
[0039] Step S220 , collecting user questions, and identifying agricultural entity information in the user questions to obtain entity data.
[0040] In one embodiment of the present application, agricultural entity information in a user question is identified to obtain materialized data of the user question, including: obtaining structural information in a preset agricultural graph database, the structural information including at least entity type, attributes and relationships; identifying the user question to obtain an entity list corresponding to the user question; performing type matching on each entity in the user question based on the entity list to determine the category to which each entity in the user question belongs; mapping the entities in the user question to corresponding entities in the agricultural graph database to establish a corresponding relationship between the entities; and outputting the results of the above matching and mapping as materialized data, the materialized data including the entities in the user question, the corresponding graph database entity types and the relationships between the entities.
[0041] In a specific embodiment of the present application, it is assumed that we already have a graph database in the agricultural field, which contains various agricultural-related entities (such as crops, pests and diseases, agronomic measures, etc.), entity attributes (such as crop growth cycle, symptoms of pests and diseases, etc.) and relationships between entities (such as the effectiveness of a certain pesticide against specific pests and diseases). The structural information includes entity types (such as "crops", "pests and diseases", "pesticides"), attributes (such as "name", "symptoms", "mode of action") and relationships between entities (such as "treatment" and "infection"). First, natural language processing technology, especially named entity recognition (NER) technology, is used to identify agricultural-related entities in user questions. For example, for the question "How to prevent and control wheat rust?", the system identifies two entities, "wheat" and "rust", and generates a corresponding entity list. Then, with the help of word embedding or pre-trained classifiers, according to the entity list obtained in the previous step, the entity types in the agricultural graph database are compared to determine which category each entity belongs to. For example, "wheat" belongs to the "crop" category, and "rust" belongs to the "disease" category. Then, these entities are mapped to the corresponding entities in the graph database. For example, "wheat" is mapped to the wheat node in the graph database, and "rust" is mapped to the rust node. At the same time, the relationship between the entities in the user's question is established according to the relationship type in the graph database. For example, in the question "How to prevent and control wheat rust?", "prevention and control" can be mapped to the "treatment" relationship in the graph database. The final output data should contain all the entities in the user's question, the type of each entity in the graph database, and the relationship between them.
[0042] Step S230, searching the agricultural knowledge graph for a local graph view that matches the materialized data.
[0043] In one embodiment of the present application, a local view of the graph that matches the materialized data is searched in the agricultural knowledge graph, including: obtaining query prompt words based on key entities and the agricultural knowledge graph assembly, wherein the key entities are obtained based on the materialized data; calling a preset language model to generate a query statement based on the query prompt words; verifying the relationship direction of the query statement, and modifying the query statement according to the verification result until the verification passes; obtaining relevant information from the agricultural knowledge graph according to the query statement that passes the verification, and obtaining a local view of the graph that matches the materialized data based on the relevant information.
[0044] In a specific embodiment of the present application, after obtaining the entity data of the user's question "How to prevent and control wheat scab?", considering that the entity data includes two key entities "wheat" and "scab", and the relationship "prevention and control" between them, these entities and their relationships are further combined to form a prompt word string such as "wheat scab prevention and control"; then, a pre-trained language model (such as BERT, GPT, etc.) is used to generate a query statement, which can understand natural language and can generate a suitable query statement based on a given prompt word string. In this example, based on the prompt word "wheat scab prevention and control", a query statement similar to "SELECT?treatment WHERE{<wheat><infection><scab><wheat><prevention and control>?treatment}" is generated. Then, after generating the query statement, further check whether the query statement correctly expresses the relationship direction between entities. For example, in the above example, it is necessary to confirm that "wheat" is indeed infected with "scab", and what we need to query is the method for prevention and control. If the verification finds an error, such as the direction of the relationship is reversed or the necessary relationship is missing, the query statement needs to be corrected. For example, if the direction of the relationship in the query is found to be wrong, it can be adjusted to the correct direction. Finally, when the query is verified, the query can be executed to retrieve specific methods and suggestions on how to prevent and control wheat fusarium from the agricultural knowledge graph. The query results contain a series of prevention and control measures, such as specific pesticide use, biological control methods, etc., and organize the query results into a local view that contains the key entities in the user's question and the relevant relationships and information found in the knowledge graph.
[0045] In one embodiment of the present application, the relationship direction of the query statement is verified, including: obtaining a relationship list in the agricultural knowledge base structure information, the relationship list including the types and initial directions of all defined relationships; obtaining the target relationship in the user's question based on the query statement, and the inquiry direction of each target relationship in the query statement; comparing the inquiry direction of each target relationship with the initial direction in the relationship list, if the inquiry direction is inconsistent with the initial direction, determining that the verification has failed; correcting the query statement that has failed the verification until the inquiry direction of the target relationship in the query statement is consistent with the initial direction in the relationship list.
[0046] In a specific embodiment of the present application, first, structural information is read from the agricultural knowledge base, which includes all defined relationship types and their initial directions. For example, the relationship list may include "crop-infection-disease" (indicating that the direction of crop infection disease is from crop to disease), "disease-treatment-drug" (indicating that the direction of disease treatment by drug is from disease to drug), etc. Taking the user's question sentence as: "Which drugs can treat wheat rust?" as an example, the target relationship in the question sentence, i.e., the "treatment" relationship, is identified by natural language processing technology, and its direction in the query statement is determined to be from "drug" to "wheat rust". The query statement here may be: "Find all 'drugs' that have a 'treatment' relationship with 'wheat rust'." Then, the direction of the identified "treatment" relationship (from drug to wheat rust) is compared with the initial direction of the "treatment" relationship in the agricultural knowledge base (from disease to drug). If it is found that the direction in the query statement does not match the initial direction in the knowledge base (i.e., from drug to disease instead of from disease to drug), it is determined that the verification fails. If the validation fails, the query statement is corrected to make it conform to the relationship direction defined in the agricultural knowledge base. For example, the corrected query statement may be: "Find all 'drugs' that have a 'treatment' relationship with 'wheat rust', where the direction of the 'treatment' relationship is from 'wheat rust' to 'drugs'." Finally, the corrected query statement is applied to the agricultural knowledge graph to ensure that the correct information is retrieved.
[0047] Step S240, based on the preset model, the local view of the graph is identified, the corresponding content related to the user's question is obtained, and the answer to the user's question is generated, and the answer is pushed to the user.
[0048] In one embodiment of the present application, a local view of a graph is identified based on a preset model to obtain corresponding content related to a user's question and generate an answer to the user's question, including: extracting knowledge fragments related to the user's question from an agricultural knowledge base based on a query statement; combining the extracted knowledge fragments with the user's original question input to form a comprehensive data set; performing graph information recognition on the local view of the graph to obtain corresponding content related to the user's question, wherein the graph information recognition is implemented based on information in the comprehensive data set; assembling the corresponding content and the knowledge fragments to form answer prompt words, so as to obtain a complete answer based on the answer prompt words and the knowledge fragments, and determining the answer as the answer to the user's question.
[0049] In a specific embodiment of the present application, take the user question "How to increase the yield of tomatoes?" as an example. The process of generating the answer to the user question is divided into the following steps:
[0050] Step 1: First, analyze the question and extract key concepts, such as "tomato" and "yield". Then, use these keywords as query conditions to retrieve relevant knowledge fragments from the agricultural knowledge base. The data in the knowledge base may be structured (such as relational database or graph database) or unstructured (such as text files). The corresponding query statement can be any one of SQL query or graph database query language (such as Cypher); and the search results include methods for increasing tomato yield, influencing factors and other related information.
[0051] Step 2: The extracted relevant knowledge fragments and the user's original question are integrated into a comprehensive dataset. This dataset contains not only the user's specific questions, but also the relevant background information found in the knowledge base.
[0052] Step 3: Use a preset graph model (such as a deep learning-based graph convolutional network GCN or other machine learning models suitable for graph data) to analyze the graph local views involved in the comprehensive dataset. It should be noted that the "graph local view" here refers to the subgraph of entities and their relationships related to the user's question, and the purpose of graph information recognition is to extract the most relevant entities, attributes and relationships from the comprehensive dataset in order to better understand the user's question context.
[0053] Step 4: After completing the graph information recognition, a set of answer prompt words is generated based on the recognized content and the knowledge fragments extracted from the knowledge base. For example, for the question "How to increase the yield of tomatoes?", prompt words may include "fertilization method", "irrigation strategy", "pest and disease management", etc.
[0054] Step 5: Use the generated answer prompts and related knowledge fragments to construct a complete answer. The answer might be: "To increase tomato yields, you can use a balanced fertilization method, especially regularly applying potassium-rich fertilizers during the growing season; at the same time, maintain an appropriate amount of irrigation and avoid overwatering; in addition, pay attention to the prevention and control of pests and diseases, and take timely biological or chemical means to treat them."
[0055] It should be noted that the above examples are only for illustrative purposes and are not intended to constitute any limitation on the specific content of this application.
[0056] In one embodiment of the present application, the answer is fed back to the user in a variety of forms, including but not limited to text, voice messages, and multimedia information; the answer is delivered to the user through a variety of channels, including but not limited to mobile applications, web interfaces, and email notifications; user feedback information is received, and the feedback information is used to evaluate the quality of the answer, and the agricultural knowledge graph and the preset model are adjusted based on the feedback information; finally, relevant content recommendations are provided to the user based on the user question and the answer to enhance the user's information acquisition experience.
[0057] In one embodiment of the present application, after the answer is fed back to the user, it also includes: obtaining feedback information after the user accepts the answer, the feedback information including at least one of star ratings, positive / negative feedback, and detailed written comments; updating the agricultural knowledge graph based on the feedback information to improve the accuracy of the answer.
[0058] In a specific embodiment of the present application, after the system provides the user with an answer to his question, the user interface will display a feedback option to allow the user to evaluate the answer provided by the system. The feedback information includes, but is not limited to, star ratings, positive / negative feedback, and detailed written comments, where star rating users can choose from 1 to 5 stars to express their satisfaction with the answer; positive / negative feedback users can choose "useful" or "useless" to quickly evaluate the relevance and accuracy of the answer; detailed written comments users can enter specific comments to detail the advantages or disadvantages of the answer and how they think it should be improved. Then, the user's feedback information is collected and the agricultural knowledge map is updated accordingly based on this information. If the user gives a high star rating and positive feedback, indicating that the answer is accurate and useful, the system can keep the existing knowledge map unchanged, or use the user's positive feedback as a reference to further optimize the relevant part of the map. If the user gives a low star rating or negative feedback, the system will analyze the user's comment content, identify the shortcomings in the answer, and update the information in the map according to the user's suggestions. For example, if the user mentions that an answer ignores a specific agricultural practice or the latest research results, the system will add this information to the map. For detailed written comments, natural language processing technology is used to extract key information and incorporate it into the graph. For example, if a user comments that an answer lacks information about a specific variety, the relevant information of this variety is added to the graph. Finally, by continuously collecting and analyzing user feedback information and updating the agricultural knowledge graph in a timely manner, the accuracy and relevance of the answers can be gradually improved. In addition, the updated knowledge graph can better reflect actual agricultural practices and the latest research results, so that the system can be more accurate and comprehensive when answering similar questions in the future.
[0059] Figure 3It is a structural diagram of an agricultural knowledge intelligent question-answering processing system shown as an exemplary embodiment of the present application.
[0060] like Figure 3 As shown in the figure, the agricultural knowledge intelligent question answering processing system includes a graph database, a prompt word assembler, a question entity recognizer, a knowledge mapper, a relationship direction verifier, and a large model caller. The specific process of the agricultural knowledge intelligent question answering processing is as follows:
[0061] Step 1: Build a knowledge base containing rich agricultural knowledge, including information on crop types, pest and disease information, resistance, suitable planting areas, etc., and structure it. The knowledge can be selected from credible agricultural knowledge sources such as authoritative institutions and academic publications. And use a combination of top-down and bottom-up methods to design the agricultural knowledge graph structure model (Schema). Including, using a combination of rule-based templates and deep learning to extract knowledge from the acquired unstructured agricultural knowledge data, obtain entities, relationships and attributes, and realize the instantiation of the knowledge graph ontology. By defining the above entities, relationships and attributes as triple data, the basic unit of the agricultural graph database is constructed. Each triple consists of entities, relationships and attributes, representing a specific knowledge point.
[0062] Step 2: Collect common questions in the agricultural field. In this embodiment, take "Why do pear trees get infected with pear aphids?" as an example.
[0063] Step 3: Use the UIE framework to adapt the pre-trained model so that it can handle the question entity recognition task in the agricultural field. This includes using the zero-shot learning capability of the UIE framework and the structured information in the agricultural knowledge base to guide the model to perform entity recognition. The vocabulary in the question is mapped to the entities in the knowledge base, and the contextual information and entity relationships in the knowledge base are used to assist the model in accurate entity recognition. For example, when "corn" appears in a question, the model can refer to the detailed information about "corn" in the knowledge base to further identify its related entities such as pests and diseases, prevention and control measures. In addition, the trained model is used to perform entity recognition on new questions and extract entity information in the questions. After the model outputs the entity label, it is post-processed to merge the continuous entity tags to obtain the final entity recognition result.
[0064] Step 4: Assemble user question input and instruction description to build a UIE question entity recognition prompt word assembler.
[0065] Step 5: Call LLM-UIE to extract relevant entities and relations from the question input by the user. By combining the structural information of the agricultural knowledge base, LLM-UIE can identify the key entities in the question and provide basic data for subsequent query generation and answer generation.
[0066] Step 6: Get the entity list returned by the question entity recognizer, and combine it with the structural information of the agricultural graph database to realize the mapping between the question entity and the entity type of the graph database. It also includes the construction of an agricultural graph database, which contains entities and their relationships in the agricultural field, with multiple triples as knowledge units, and is interrelated; each type of triple is properly defined to facilitate accurate understanding of the large model; independent triples are connected to form meaningful network patterns and subgraphs, which can represent complex agricultural knowledge structures and facilitate understanding and processing by the large model. Among them, the main graph is a crop variety map, and the subgraphs are crop disease maps and crop pest maps.
[0067] In addition, it also includes the use of standardized triple data formats and clear definitions of entities, relationships, and attributes to facilitate updating and maintaining the database. Support for adding new entity types, relationship types, and attribute types to facilitate the expansion of the knowledge scope of the database. Obtain the structural information of the agricultural graph database, including entity types, entity attributes, and relationships between entities. Perform entity recognition on the input agricultural field question according to the entity recognizer, extract the entity information in the question, and return an entity list based on the entity recognizer, which contains all entities in the question and their identification labels. Combined with the structural information of the agricultural graph database, perform type matching on each entity in the question. Specifically, by comparing the label of the question entity with the entity type in the graph database, determine the graph database entity type corresponding to the question entity. And, map the entity in the question to the entity in the graph database, establish the corresponding relationship between the question entity and the graph database entity, and output the mapping result as structured data (Dict can be used), including the entity in the question, the corresponding graph database entity type and its relationship. For example, when the question asks "Why do pear trees get infected with pear aphids?", the mapper needs to map "pear tree" to the "Crop_type" entity type in the graph database, and map "pear aphids" to the "Insect" entity type in the graph database, and output the mapping results as structured data, including the entities in the question, the corresponding graph database entity types and their relationships.
[0068] Step 7: Construct a Cypher to generate prompt word assembler to assemble knowledge mapping information, user question input, instruction description and agricultural knowledge base structure information. The knowledge mapping information is obtained based on the entity list returned by the question entity recognizer and the mapping information of the agricultural graph database; and the agricultural knowledge base structure information is used to provide the structural information of the agricultural knowledge base, and its structural information includes but is not limited to entity type, relationship type and attribute type to guide query generation.
[0069] Step 8: Build an optimized large model caller and call LLM-Cypher-Generate to generate Cypher query statements related to user questions. By combining knowledge mapping information and structural information of the agricultural knowledge base, LLM-Cypher-Generate can generate accurate Cypher query statements to retrieve relevant information in the agricultural graph database.
[0070] Step 9: Construct a relationship direction validator, which can obtain the relationship list in the structural information of the agricultural knowledge base and verify the relationship direction in the Cypher query generated by the system, thereby improving the generation quality of the Cypher query and optimizing the graph retrieval effect. It should be noted that the relationship direction validator can parse the Cypher query statement generated by the system and extract the relationship and its direction. Verifying the extracted relationship and its direction includes checking whether it conforms to the definition in the agricultural knowledge base. If the relationship direction is found to be incorrect, it is corrected to ensure that the generated Cypher query statement conforms to the structural information of the agricultural knowledge base.
[0071] Step 10: Execute the query statement obtained in step 8 or the query statement modified in step 9 to extract knowledge fragments related to the question from the agricultural knowledge base.
[0072] Step 11: Construct an answer generation prompt word assembler to assemble the corresponding knowledge fragments in the agricultural knowledge base, the user question input, and the instruction description. The corresponding knowledge fragments in the agricultural knowledge base come from step 10, and the user question is "Why do pear trees get infected with pear aphids?"
[0073] Step 12: Build an optimized large model caller and call LLM-Answer-Generate to generate answers to user questions based on knowledge fragments in the agricultural knowledge base. It should be noted that by combining user question input and instruction description, LLM-Answer-Generate can generate accurate answers that meet user needs.
[0074] Figure 4 It is a flowchart of agricultural knowledge graph query and answer generation shown as an exemplary embodiment of the present application.
[0075] like Figure 4As shown in the figure, in the process of querying and generating answers to the agricultural knowledge graph, the user's question is first obtained. Take the user question "Why do pear trees get infected with pear aphids?" as an example. First, the user question is disassembled to obtain separate words or symbols; then the key information is extracted from the user's question through the LLM-UIE (Language Model for Unified Information Extraction) module, and the extracted key information is mapped to the agricultural knowledge graph to identify related entities and relationships, and LLM-Cypher-Generate is used to generate Cypher query statements based on the mapped knowledge graph to query relevant information in the graph database. In addition, it is necessary to verify whether the direction of the relationship in the query statement is correct to ensure the accuracy of the query, and then execute the generated Cypher query statement to obtain relevant information from the agricultural knowledge graph. Finally, based on the queried information, an answer to the user's question is generated, such as "The reason why pear trees are infected with pear aphids is...".
[0076] It should be noted that in the method for processing intelligent question and answer of agricultural knowledge proposed in this application, by constructing an agricultural knowledge graph, identifying agricultural entity information in user questions, and verifying knowledge mapping and relationship direction, a higher quality query statement is obtained, so that the content related to the user's question can be quickly located in the huge agricultural knowledge base, and the speed and accuracy of the system's response to agricultural problems are improved. Specifically, by verifying and correcting the relationship direction of the query statement, the correctness of the query statement is guaranteed, and the deviation of the query result caused by the wrong relationship direction is avoided, thereby improving the reliability of the answer obtained based on the graph query. The structural information of the agricultural graph database is used to entity the user's question, so that the system can better understand and parse the agricultural professional terms in the user's question, and enhance the system's ability to understand specific entities in the agricultural field. In addition, by combining knowledge fragments with the user's original question to form a comprehensive data set, and using this data set to guide the recognition of graph information, the generated answers can also be made more comprehensive and more targeted, meeting the user's in-depth answer needs for specific questions. In summary, the applied method not only improves the performance of the agricultural knowledge intelligent question and answer processing system, but also greatly enhances the user experience, providing users with an efficient, accurate and easy-to-use agricultural knowledge consulting platform.
[0077] Figure 5 is a block diagram of an agricultural knowledge intelligent question-answering processing system shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The device may also be applicable to other exemplary implementation environments and specifically configured in other devices, and this embodiment does not limit the implementation environment to which the device is applicable.
[0078] like Figure 5 As shown, the exemplary agricultural knowledge intelligent question answering processing system includes:
[0079] Among them, the question entity recognizer 510 is used to receive the question input by the user, and recognize the agricultural entity information from the user question, and obtain the entity data with the agricultural entity information; the knowledge mapper 520 is used to map the entities in the entity data to the corresponding nodes in the pre-built agricultural knowledge graph, so as to match the entities in the user question with the entity types in the agricultural graph database, and determine the position of the entities in the user question in the agricultural knowledge graph; the prompt word assembler 530 is used to generate entity recognition prompt words based on the user question, generate query prompt words based on the agricultural entity information and the agricultural knowledge graph, and assemble the corresponding content and knowledge fragments to form answer prompt words; the large model caller 540 is used to call the preset language model, retrieve the information in the agricultural knowledge graph according to the query statement to obtain the partial view of the graph matching the entity data, and obtain a complete answer according to the answer prompt words and the knowledge fragments; the relationship direction verifier 550 is used to verify whether the query direction of the target relationship in the query statement is consistent with the initial direction, and correct the query statement when the query direction is consistent with the initial direction. The knowledge graph builder 560 is used to acquire basic agricultural knowledge, and perform entity recognition and relationship extraction on the basic agricultural knowledge, so as to form an agricultural knowledge graph with the recognized entities and the extracted relationships; the answer generator 570 is used to extract knowledge fragments related to the user's question from the agricultural knowledge base, combine the knowledge fragments with the user's original question input to form a comprehensive data set, perform image information recognition on the local view of the graph to obtain the corresponding content related to the user's question, assemble the corresponding content and the knowledge fragments into a complete answer and determine the complete answer as the answer to the user's question.
[0080] It should be noted that the agricultural knowledge intelligent question and answer processing system provided in the above embodiment and the agricultural knowledge intelligent question and answer processing method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment and will not be repeated here. In practical applications, the agricultural knowledge intelligent question and answer processing system provided in the above embodiment can distribute the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0081] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the electronic device implements the agricultural knowledge intelligent question and answer processing method provided in the above-mentioned embodiments.
[0082] Figure 6 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 6 The computer system 600 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0083] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage part 608 to the random access memory (RAM) 603, such as executing the method described in the above embodiment. In the RAM 603, various programs and data required for system operation are also stored. The CPU 601, ROM 602 and RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0084] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed so that a computer program read therefrom is installed into the storage section 608 as needed.
[0085] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 609, and / or installed from a removable medium 611. When the computer program is executed by a central processing unit (CPU) 601, various functions defined in the system of the present application are executed.
[0086] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0087] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0088] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0089] Another aspect of the present application further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor of a computer, causes the computer to execute the above-described intelligent question-answering method for agricultural knowledge. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0090] Another aspect of the present application further provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the agricultural knowledge intelligent question-answering processing method provided in each of the above embodiments.
[0091] The above embodiments are merely illustrative of the principles and effects of the present application, and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A method for intelligent question answering of agricultural knowledge, characterized in that: The method comprises: Acquire basic agricultural knowledge and construct an agricultural knowledge graph based on the basic agricultural knowledge; Collecting user questions and identifying agricultural entity information in the user questions to obtain entity data; Searching the agricultural knowledge graph for a partial graph view that matches the materialized data; Based on the preset model, the local view of the graph is identified to obtain the corresponding content related to the user's question and generate an answer to the user's question, and the answer is fed back to the user.
2. The agricultural knowledge intelligent question-answering processing method according to claim 1 is characterized in that: Searching the agricultural knowledge graph for a graph local view matching the materialized data includes: Assembling query prompt words based on key entities and structural information of the agricultural knowledge graph, wherein the key entities are obtained based on the entity data; Calling a preset language model to generate a query statement based on the query prompt word; Verifying the relationship direction of the query statement, and modifying the query statement according to the verification result until the verification passes; Relevant information is obtained from the agricultural knowledge graph according to the verified query statement, and a local view of the graph matching the materialized data is obtained based on the relevant information.
3. The agricultural knowledge intelligent question-answering processing method according to claim 2 is characterized in that: Verifying the relationship direction of the query statement includes: Acquire a relationship list in the agricultural knowledge base structure information, wherein the relationship list includes types and initial directions of all defined relationships; Obtaining target relations in the user's question sentence based on the query sentence, and the query direction of each target relation in the query sentence; Comparing the query direction of each target relationship with the initial direction in the relationship list, and if the query direction is inconsistent with the initial direction, determining that the verification fails; The query statement that fails the verification is modified until the query direction of the target relationship in the query statement is consistent with the initial direction in the relationship list.
4. The agricultural knowledge intelligent question-answering processing method according to claim 1, characterized in that: Identifying agricultural entity information in the user's question and obtaining entity data of the user's question includes: Acquire structural information in a preset agricultural graph database, wherein the structural information at least includes entity type, attribute and relationship; Identify the user question and obtain an entity list corresponding to the user question; Performing type matching on each entity in the user question based on the entity list to determine the category to which each entity in the user question belongs; Mapping entities in the user's question to corresponding entities in the agricultural graph database, and establishing corresponding relationships between entities; The results of the above matching and mapping are output as materialized data, wherein the materialized data includes entities in the user question, corresponding graph database entity types, and relationships between entities.
5. The agricultural knowledge intelligent question-answering processing method according to claim 1 is characterized in that: The local view of the graph is identified based on a preset model, corresponding content related to the user's question is obtained, and an answer to the user's question is generated, including: Extracting knowledge fragments related to the user's question from an agricultural knowledge base based on the query sentence; Combine the extracted knowledge fragments with the user's original question input to form a comprehensive dataset; Performing graph information recognition on the graph local view to obtain corresponding content related to the user question, wherein the graph information recognition is implemented based on information of the comprehensive data set; The corresponding content and the knowledge fragment are assembled to form an answer prompt word, so as to obtain a complete answer based on the answer prompt word and the knowledge fragment, and the answer is determined as the answer to the user question.
6. The agricultural knowledge intelligent question-answering processing method according to any one of claims 1 to 5, characterized in that: After the answer is fed back to the user, it also includes: Obtaining feedback information from the user after accepting the answer, the feedback information including at least one of a star rating, positive / negative feedback, and a detailed written review; The agricultural knowledge graph is updated based on the feedback information to improve the accuracy of the answer.
7. An intelligent question-answering processing system for agricultural knowledge, characterized in that: The system comprises: A question entity recognizer, used for receiving a question input by a user, recognizing agricultural entity information from the user's question, and obtaining entity data with the agricultural entity information; A knowledge mapper, used to map entities in the materialized data to corresponding nodes in a pre-built agricultural knowledge graph, so as to match entities in the user's question with entity types in the agricultural graph database, and to determine the location of the entity in the user's question in the agricultural knowledge graph; A prompt word assembler, used to generate entity recognition prompt words based on user questions, generate query prompt words based on agricultural entity information and agricultural knowledge graphs, and assemble the corresponding content and the knowledge fragments to form answer prompt words; A large model caller is used to call a preset language model, retrieve information in the agricultural knowledge graph according to the query statement to obtain a partial view of the graph that matches the materialized data, and obtain a complete answer according to the answer prompt word and the knowledge fragment; The relationship direction verifier is used to verify whether the query direction of the target relationship in the query statement is consistent with the initial direction, and to modify the query statement when the query direction is consistent with the initial direction.
8. The intelligent question-answering processing system for agricultural knowledge according to claim 7, characterized in that: The system further comprises: A knowledge graph builder, used to acquire basic agricultural knowledge, and perform entity recognition and relationship extraction on the basic agricultural knowledge, so as to form an agricultural knowledge graph with the recognized entities and the extracted relationships; The answer generator is used to extract knowledge fragments related to the user's question from the agricultural knowledge base, combine the knowledge fragments with the user's original question input to form a comprehensive data set, perform image information recognition on the local view of the graph to obtain the corresponding content related to the user's question, assemble the corresponding content and the knowledge fragments into a complete answer and determine the complete answer as the answer to the user's question.
9. An electronic device, characterized in that: It includes a processor, a memory and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute the computer program stored in the memory to implement the agricultural knowledge intelligent question and answer processing method as described in any one of claims 1-6.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is used to enable a computer to execute the agricultural knowledge intelligent question-answering processing method as described in any one of claims 1-6.
