Agricultural production knowledge intelligent question answering method and device based on natural language processing
By combining a domain-adaptive semantic understanding model with a dynamic agricultural knowledge graph, the problems of insufficient natural language understanding and lagging knowledge updates in agricultural production knowledge question-answering systems are solved. This achieves highly accurate parsing of agricultural professional terms and effective fusion of multimodal information, thereby improving the practicality and credibility of the question-answering system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-04-10
AI Technical Summary
Existing agricultural production knowledge question-answering systems lack sufficient natural language understanding capabilities in the agricultural field, have outdated dynamic knowledge service systems, and are incomplete in multimodal interaction and decision support. This results in high semantic understanding bias rates, lagging knowledge updates, and insufficient multimodal interaction coverage, which limits their effective promotion in agricultural production.
A domain-adaptive semantic understanding model is used to parse user input, and a dynamic agricultural knowledge graph is combined for retrieval, matching and reasoning. Answers are generated through multimodal information recognition and matching degree scoring. The knowledge graph is dynamically updated to improve accuracy and timeliness.
It improved the accuracy of understanding agricultural terminology and the precision of answers, enhanced the credibility and practicality of the answers, and ensured the timeliness of knowledge and the effective integration of multimodal information.
Smart Images

Figure CN121835837A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of agricultural information technology, and in particular to an intelligent agricultural production knowledge question answering method and device based on natural language processing. BACKGROUND
[0002] With the deepening of smart agriculture, agricultural production knowledge question answering systems are gradually becoming an important tool for farmers to obtain agricultural technology guidance. However, there are still significant bottlenecks in the key links of the existing technical system, which seriously limits the further improvement of its large-scale application and user experience.
[0003] In the prior art, the agricultural production knowledge question answering system mainly faces the following three challenges. First, the natural language understanding ability in the agricultural field is weak, the general pre-training language model has low recognition accuracy for professional terms such as "tillering period" and "rotation fallow" and regional agricultural colloquialisms such as "late spring cold" and "rotten seedling disease", and has deficiencies in context reasoning mechanism, making it difficult to effectively handle complex problems or causal relationship reasoning. Second, the construction of dynamic knowledge service system is relatively lagging, the knowledge graph update cycle is long, and it highly depends on expert manual annotation, making it difficult to incorporate incremental knowledge such as new varieties, new technologies and sudden pest control solutions; at the same time, the multi-source data fusion capability is limited, and multi-modal data such as planting management, weather prediction and soil moisture have not been effectively associated. In addition, the multi-modal interaction and decision support system is not perfect, the system mainly uses text interaction, the feature extraction and semantic association ability of image information is weak, and it is difficult to support disease identification based on pictures; the answer presentation form is single, and there is a lack of personalized decision guidance based on regional characteristics and real-time agricultural conditions.
[0004] As a result, the agricultural knowledge question answering system has problems such as high semantic understanding deviation rate, obvious knowledge update lag, and insufficient multi-modal interaction coverage in actual application, which restricts its effective promotion and application in agricultural production. SUMMARY
[0005] The present application provides an intelligent agricultural production knowledge question answering method and device based on natural language processing to solve the above problems.
[0006] The present application provides an intelligent agricultural production knowledge question answering method based on natural language processing, comprising the following steps: Based on the domain adaptive semantic understanding model, the natural language query sequence input by the user is parsed, and the structured semantic representation and question vector are output; Based on the structured semantic representation and the question vector, retrieval matching is performed in the dynamic agricultural knowledge graph; Based on the results of retrieval matching, reasoning is performed to generate and output the final answer and the matching degree score of the final answer; The field-adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural field, and the masked language model assigns a higher weight to a masked token belonging to the term set than to a masked token not belonging to the term set during pre-training. The dynamic agricultural knowledge graph is constructed based on a multi-source heterogeneous data stream in the agricultural field and is dynamically updated.
[0007] According to the agricultural production knowledge intelligent question answering method based on natural language processing provided by the application, the final answer and the matching degree score of the final answer are generated and output based on the retrieval matching result and the multi-modal database, and the method comprises the following steps: In the case that the user inputs multi-modal information, the recognition result of the multi-modal information is obtained based on the modal information recognition model corresponding to the multi-modal information; Based on the recognition result of the multi-modal information, the retrieval matching result and the multi-modal database, the final answer and the matching degree score of the final answer are generated and output.
[0008] According to the agricultural production knowledge intelligent question answering method based on natural language processing provided by the application, the matching degree score of the final answer is obtained by comprehensively considering the semantic matching degree of field-adaptive semantic understanding, the knowledge matching degree of the dynamic knowledge graph and the fusion matching degree of multi-modal information; The semantic matching degree is used to represent the similarity between the question vector and the problem vector in the dynamic knowledge graph; the knowledge matching degree is used to represent the association closeness and knowledge timeliness of the final answer in the dynamic knowledge graph; and the fusion matching degree is used to represent the similarity between the multi-modal information input by the user and the entity in the dynamic knowledge graph.
[0009] According to the agricultural production knowledge intelligent question answering method based on natural language processing provided by the application, the loss function of the masked language model during pre-training is determined according to the following formula: In the formula, L represents the loss function of the masked language model; represents the token at the i-th position in the input sequence ; represents the input sequence after random masking processing; is a mask indicator function, is true when is masked, , is not masked; ; is an indicator function, and when is true , is false ; represents a set of terms in the field of agriculture; represents a weight hyperparameter of the term enhancement, ; represents a parameter of the masked language model, which is updated during the model training process; represents the current model parameter , the masked language model predicts the probability of the current position being a real token .
[0010] According to the agricultural production knowledge intelligent question and answer method based on natural language processing provided by the application, the dynamic agricultural knowledge graph is updated in the following way: Based on the multi-source heterogeneous data flow in the field of agriculture, the structured new knowledge represented in the form of triples is extracted; Based on the confidence of the structured new knowledge and the confidence of each structured knowledge in the current dynamic agricultural knowledge graph, the dynamic agricultural knowledge graph is updated.
[0011] According to the agricultural production knowledge intelligent question and answer method based on natural language processing provided by the application, the confidence of any structured knowledge is determined by the current confidence of the structured knowledge, the confidence of the knowledge source of the structured knowledge, the user feedback confidence of the structured knowledge, and the conflict resolution factor; In the case where the structured new knowledge and the structured knowledge exist in conflict, the conflict resolution factor is based on the weighted average value of the confidence of all the structured knowledge in conflict in the dynamic agricultural knowledge graph, and the confidence of the structured knowledge is adjusted.
[0012] The application also provides an agricultural production knowledge intelligent question and answer device based on natural language processing, comprising the following modules: The parsing module is used for parsing the natural language query sequence input by the user based on the field adaptive semantic understanding model, outputting the structured semantic representation and the question vector; The retrieval module is used for retrieving and matching in the dynamic agricultural knowledge graph based on the structured semantic representation and the question vector; The reasoning module is used for reasoning based on the result of retrieval and matching, generating and outputting the final answer and the matching degree score of the final answer; The field-adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural field, and the masked language model assigns a higher weight to a masked token belonging to the term set than to a masked token not belonging to the term set during the pre-training process. The dynamic agricultural knowledge graph is constructed based on a multi-source heterogeneous data stream in the agricultural field and is dynamically updated.
[0013] The application further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the agricultural production knowledge intelligent question answering method based on natural language processing according to any one of the above when executing the computer program.
[0014] The application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, and the computer program implements the agricultural production knowledge intelligent question answering method based on natural language processing according to any one of the above when executed by a processor.
[0015] The application further provides a computer program product, including a computer program, and the computer program implements the agricultural production knowledge intelligent question answering method based on natural language processing according to any one of the above when executed by a processor.
[0016] The agricultural production knowledge intelligent question answering method and device based on natural language processing provided by the application improve the understanding accuracy of agricultural professional terms, the timeliness of retrieval, and the accuracy of answers by using a field-adaptive semantic understanding model pre-trained based on a term set in the agricultural field to analyze user query content, output structured semantic representation and question vector, and perform retrieval matching and reasoning in a dynamically updated agricultural knowledge graph, and enhance the credibility of answers by matching degree scoring. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0018] Figure 1 is a flowchart of the agricultural production knowledge intelligent question answering method based on natural language processing provided by the application.
[0019] Figure 2 is an architecture diagram of the agricultural production knowledge intelligent question answering system provided by the application.
[0020] Figure 3This is a flowchart illustrating the domain-adaptive semantic understanding model provided by the present invention.
[0021] Figure 4 This is a schematic diagram of the process for constructing and updating a dynamic agricultural knowledge graph provided by this invention.
[0022] Figure 5 This is a flowchart illustrating the multimodal question-answering reasoning process provided by the present invention.
[0023] Figure 6 This is a schematic diagram of the structure of the intelligent question-and-answer device for agricultural production knowledge based on natural language processing provided by the present invention.
[0024] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0026] Figure 1 This is a flowchart illustrating the intelligent question-answering method for agricultural production knowledge based on natural language processing provided by the present invention. Figure 1 As shown, the method includes the following steps: Step 100: Based on the domain-adaptive semantic understanding model, parse the natural language query sequence input by the user and output a structured semantic representation and question vector.
[0027] Step 101: Based on structured semantic representation and question vectors, perform retrieval and matching in the dynamic agricultural knowledge graph.
[0028] Step 102: Based on the search and matching results, perform reasoning to generate and output the final answer and the matching score of the final answer.
[0029] The domain-adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural domain. During the pre-training process, the masked language model assigns higher weights to masked words that belong to the term set than to masked words that do not belong to the term set. The dynamic agricultural knowledge graph is built and dynamically updated based on multi-source heterogeneous data streams in the agricultural field.
[0030] Specifically, the execution subject of the embodiment of the present application can be any device with certain computing power and deployed model or an agricultural production knowledge intelligent question and answer system implemented by the device. The following takes the system as an example to illustrate the embodiment of the present application.
[0031] The embodiment of the present application first pre-trains the mask language model according to the term set in the agricultural field, and obtains the field adaptive semantic understanding model. In the process of pre-training the mask language model, the term enhancement strategy is implemented, and the learning weight of the masked word element belonging to the term set in the agricultural field is higher than that of the ordinary word element, so that the mask language model can deeply master the semantics of the professional vocabulary in the agricultural field and the context relationship thereof.
[0032] The trained field adaptive semantic understanding model can obtain a more profound semantic representation when facing the professional vocabulary in the agricultural field in the natural language query sequence input by the user, thereby effectively improving the understanding accuracy of the specific expression mode, the synonym and the context in the agricultural field.
[0033] The system can analyze the natural language query sequence input by the user according to the trained field adaptive semantic understanding model. The field adaptive semantic understanding model can analyze the sentence structure and identify the agricultural entity and the user intent therein, and output two kinds of key information: one is the structured semantic representation, and the structured semantic representation refers to the structured data containing the intent label and the entity list. For example, the structured semantic representation takes the entity, the relationship and the intent classification as the structure for example: {"intent":"disease prevention and treatment", "entities":[{"entity":"wheat", "type":"crop"}, {"entity":"rust", "type":"disease"}]}. The other is the question vector, which is a high-dimensional vector used to capture the overall semantic information of the question. This step converts the unstructured user problem into standardized information that can be accurately processed and transmitted by the machine.
[0034] The dynamic agricultural knowledge graph in the embodiment of the present application is a database constructed and continuously dynamically updated based on the multi-source heterogeneous data stream in the agricultural field, wherein the multi-source heterogeneous data stream can include structured expert databases, unstructured news, forum discussions and user feedback and various sources of data. Thus, the information retrieved is not only structurally rich and highly correlated, but also can reflect the latest agricultural knowledge and data, avoiding the problem of outdated answers due to outdated knowledge.
[0035] After obtaining the structured semantic representation and the question vector, the system can perform retrieval matching in the dynamic agricultural knowledge graph according to the structured semantic representation and the question vector. Specifically, the structured semantic representation can be used to perform efficient graph traversal and knowledge retrieval in the dynamic agricultural knowledge graph, find the corresponding entity of the structured semantic representation, and find the most relevant knowledge path to the user's question. Through the structured semantic representation and the question vector, the relevant entities and knowledge paths can be quickly located in the continuously updated knowledge network, which can ensure that the retrieved information is accurate and timely.
[0036] Finally, the system can generate and output the final answer according to the retrieval matching result, for example, the system directly obtains the final answer according to the knowledge path; or in the case that the user inputs multi-modal information such as pictures, the system can combine the multi-modal information for comprehensive reasoning to obtain the final answer.
[0037] At the same time, the system also outputs the matching degree score of the final answer. The matching degree score of the generated final answer can provide a direct reference for the user about the credibility of the answer, enhancing the practicality and transparency of the system answer. The user can determine the reliability of the answer according to the score, and then decide whether to adopt or need further ask.
[0038] The agricultural production knowledge intelligent question answering method based on natural language processing provided by the present application can improve the understanding accuracy of agricultural professional terms, the timeliness of retrieval, and the accuracy of answers by using the domain adaptive semantic understanding model pre-trained based on the term set in the agricultural field to analyze the user query content, output the structured semantic representation and the question vector, and perform retrieval matching and reasoning in the dynamically updated agricultural knowledge graph. At the same time, the credibility of the answer is enhanced through the matching degree score.
[0039] According to the agricultural production knowledge intelligent question answering method based on natural language processing provided by the present application, based on the retrieval matching result and the multi-modal database, the final answer and the matching degree score of the final answer are generated and output, which includes: In the case that the user inputs multi-modal information, the recognition result of the multi-modal information is obtained based on the modal information recognition model corresponding to the multi-modal information; Based on the recognition result of the multi-modal information, the retrieval matching result and the multi-modal database, the final answer and the matching degree score of the final answer are generated and output.
[0040] Specifically, when the user input contains multi-modal information such as images, the system first calls the corresponding modal information recognition model, for example, uses a computer vision model to analyze the crop diseased leaf picture uploaded by the user. This processing process can identify key visual features in the image, such as lesion shape, color distribution, etc., and convert these features into structured recognition results, laying the foundation for subsequent information fusion.
[0041] After obtaining the recognition results of multi-modal information, the system can perform multi-modal information fusion on the recognition results of multi-modal information and the retrieval matching results. For example, the system can associate and match the visual features recognized by the image with the text entities in the knowledge graph, for example, establish a corresponding relationship between the specific lesion features observed in the image and the "tomato downy mildew" entity in the knowledge graph.
[0042] Based on the above fusion results, the system can combine the multi-modal database to perform deep reasoning and answer synthesis. By combining the complete knowledge path (such as "tomato-downy mildew-prevention method") obtained from the knowledge graph and the empirical support provided by the multi-modal information, the system can perform logical reasoning, extract corresponding data from the multi-modal database, and then generate the final answer containing elements such as textual instructions, typical picture examples, and practical video tutorials. The final answer generated in this way not only provides theoretical knowledge, but also enhances the intuitiveness and operability of the guidance through visual materials.
[0043] During the entire answer generation process, the system synchronously calculates the matching degree score. This score can comprehensively consider factors such as the accuracy of semantic understanding, the relevance of knowledge paths, and the consistency of multi-modal information, providing a quantitative basis for evaluating the reliability of the answer for the user.
[0044] According to the agricultural production knowledge intelligent question and answer method based on natural language processing provided by the present application, the matching degree score of the final answer is obtained by comprehensively considering the semantic matching degree of the field adaptive semantic understanding, the knowledge matching degree of the dynamic knowledge graph, and the fusion matching degree of the multi-modal information; Wherein, the semantic matching degree is used to represent the similarity between the question vector and the problem vector in the dynamic knowledge graph; the knowledge matching degree is used to represent the association closeness and knowledge timeliness of the final answer in the dynamic knowledge graph; the fusion matching degree is used to represent the similarity between the multi-modal information input by the user and the entity in the dynamic knowledge graph.
[0045] Specifically, the embodiment of the present application determines the final score by weighted fusion of the matching degrees of the three dimensions, which are the semantic matching degree of the field adaptive semantic understanding, the knowledge matching degree of the dynamic knowledge graph, and the fusion matching degree of the multi-modal information. This comprehensive consideration method can avoid the limitations of single evaluation index, making the evaluation of the answer quality more comprehensive and accurate.
[0046] For example, the matching degree score of the final answer It can be calculated by the following formula: wherein, represents the semantic matching degree of field adaptive semantic understanding, used to represent the similarity between the question vector and the problem vector in the dynamic knowledge graph; represents the knowledge matching degree of the dynamic knowledge graph, used to represent the close association and knowledge timeliness of the final answer in the dynamic knowledge graph; represents the fusion matching degree of multi-modal information, used to represent the similarity between the multi-modal information input by the user and the entities in the dynamic knowledge graph. , and are weight coefficients, and + + =1; these weight coefficients can be dynamically adjusted according to actual application scenarios and user feedback, for example, when the user input involves an image, the weight of can be increased.
[0047] In some embodiments, can be obtained by calculating the cosine similarity between the user question vector and the pre-stored standard problem vector in the knowledge graph, that is: wherein, represents the question vector, represents the problem vector in the dynamic knowledge graph, is the cosine similarity function. This calculation process can reflect the semantic closeness between the user's asking manner and the standard problem expression in the knowledge base, and its basis is the field adaptive semantic understanding model trained by the agricultural field term enhancement, which can accurately understand the real intention behind the user's colloquial expression.
[0048] In some embodiments, can be determined by two key factors: one is the length of the knowledge path, that is, the average path length from the problem entity to the answer entity, and the shorter the path, the more direct the association; the second is the timeliness of knowledge, which is reflected by the dynamic update factor, and the newly added knowledge or the knowledge verified in recent period will obtain a higher weight. Its calculation formula can be: wherein, is the average path length from the problem entity to the answer entity in the dynamic knowledge graph (the shorter the path, the higher the relevance), is a dynamic updating factor of knowledge (for example, new knowledge has a higher weight). This design can ensure that the system preferentially recommends knowledge with close relevance and strong timeliness.
[0049] In some embodiments, when the user provides multi-modal information such as images, the system activates the calculation of . This is achieved by comparing the similarity of multi-modal information provided by the user with the features of related entities in the dynamic knowledge graph. The calculation formula can be: wherein, is the m-th image input by the user, is the image feature vector extracted by the convolutional neural network, is the vector representation of the related entity in the knowledge graph. The matching score formula of the final answer comprehensively considers the accuracy of semantic understanding, the comprehensiveness and timeliness of the knowledge graph, and the fusion ability of multi-modal information, thereby significantly improving the accuracy and practicality of the question and answer system.
[0050] The training process of the field-adaptive semantic understanding model is described below.
[0051] In some embodiments, a high-quality corpus collection in the agricultural field can be constructed by crawling and integrating multi-source agricultural text data, including agricultural field knowledge graph structured text, text corpus containing a large amount of agricultural professional knowledge, original question sentences covering dialect variants, and self-supervised data such as synonymous question pairs. These corpora are preprocessed, such as tokenization, denoising, and standardization, to ensure the quality and consistency of the corpora, which are used as input sample data sets for subsequent model training.
[0052] In the input processing stage of the mask language model, the input sequence is represented as a sequence of word pieces after preprocessing and tokenization. The sequence contains special classifiers [CLS] and separators [SEP], where the hidden state of [CLS] is used to converge the semantic information of the entire sequence, and [SEP] is used to distinguish sentence pairs.
[0053] In the embodiment of the application, the pre-training process of the mask language model is different from the traditional random mask strategy. The improved loss function is used to focus on learning agricultural professional terms. In the pre-training process, the mask language model preferentially masks the professional terms in the agricultural field, and assigns higher learning weights to the masked word pieces belonging to the term set in the agricultural field in the loss function.
[0054] In the embodiment of the application, the pre-training process of the mask language model is different from the traditional random mask strategy. The improved loss function is used to focus on learning agricultural professional terms. In the pre-training process, the mask language model preferentially masks the professional terms in the agricultural field, and assigns higher learning weights to the masked word pieces belonging to the term set in the agricultural field in the loss function.
[0055] In some embodiments, the loss function of the masked language model in the pre-training process is determined according to the following formula: wherein, represents the loss function of the masked language model; represents the input sequence ; represents the token at the th position in the input sequence; is a mask indicator function, is true when , is false when ; is an indicator function, which is true when , is false when ; represents a set of terms in the field of agriculture; represents a weight hyperparameter of term enhancement, ; represents the parameters of the masked language model, which are updated during the model training process; represents the probability of the masked language model predicting that the current position is a real token under the condition of the current model parameters . In some embodiments, the pre-trained masked language model can be further optimized in the fine-tuning stage, for example, through supervised learning of original questions and synonymous questions in the corpus set in the field of agriculture, so that the masked language model can accurately understand various colloquial expressions of users.
[0056] After training, the field-adaptive semantic understanding model of the embodiment of the present application is obtained.
[0057] According to the method for updating the dynamic agricultural knowledge graph, the field-adaptive semantic understanding model of the embodiment of the present application is obtained.
[0058] According to the agricultural production knowledge intelligent question answering method based on natural language processing provided by the present application, the dynamic agricultural knowledge graph is updated in the following ways: Based on the multi-source heterogeneous data stream in the field of agriculture, structured new knowledge represented in the form of triples is extracted; Based on the confidence of the structured new knowledge and the confidence of each structured knowledge in the current dynamic agricultural knowledge graph, the dynamic agricultural knowledge graph is updated.
[0059] Specifically, in the embodiments of the present application, the updating process of the dynamic agricultural knowledge graph is continuous. First, multi-source heterogeneous data streams can be collected, which can include structured agricultural expert databases, government-issued pest reports, and can also cover unstructured agricultural news articles, research papers, user forum discussions, and multimedia files, etc. Real-time feedback data from users on the results of the question and answer can also be received. These diverse data sources collectively provide a wealth of raw materials for the updating of the knowledge graph.
[0060] Then, knowledge extraction can be performed on the multi-source heterogeneous data streams. In some embodiments, named entity recognition (NER) and relationship extraction models can be used to extract structured knowledge in the form of triples from text data. In addition, for multimedia data such as pictures and videos, multi-modal knowledge extraction techniques can also be used to automatically identify and extract related entities and their attribute information, effectively converting unstructured data into structured knowledge.
[0061] After extracting structured new knowledge, knowledge merging and updating of the dynamic knowledge graph can be performed. In this process, the structured new knowledge needs to be compared with the knowledge in the current dynamic agricultural knowledge graph, and the same knowledge is merged.
[0062] The confidence score reflecting the credibility of each piece of knowledge can be calculated by a confidence calculation formula. In the case of contradictory new knowledge and existing knowledge, the conflict resolution process is triggered by the confidence score. For example, when the system finds two different methods of preventing and treating the same crop disease, it will make a decision based on the confidence scores of the two pieces of knowledge. Generally, the knowledge with a higher confidence score is considered more credible and is retained in the dynamic agricultural knowledge graph, while the knowledge with a lower confidence score may be down-weighted or removed. This mechanism can effectively maintain the consistency of the dynamic agricultural knowledge graph and avoid providing users with contradictory answers.
[0063] Finally, the structured new knowledge after the above extraction, merging and conflict resolution processing is stored in the dynamic agricultural knowledge graph, thereby completing the updating of the dynamic agricultural knowledge graph.
[0064] According to the agricultural production knowledge intelligent question and answer method based on natural language processing provided by the present application, the confidence of any structured knowledge is determined by the current confidence of any structured knowledge, the confidence of the knowledge source of any structured knowledge, the user feedback confidence of any structured knowledge, and the conflict resolution factor. In the case of conflict between structured new knowledge and arbitrary structured knowledge, the conflict resolution factor adjusts the confidence of arbitrary structured knowledge based on the weighted average of the confidence of all conflicting structured knowledge in the dynamic agricultural knowledge graph.
[0065] Specifically, the confidence of arbitrary structured knowledge is determined by a calculation formula that comprehensively considers multiple dimensions. The calculation formula can be expressed as: wherein, represents the triple updated new confidence. represents the triple current confidence, i.e. historical credibility. represents the confidence of the knowledge source, for example, knowledge from official agricultural databases scores higher, while scores from unverified forums are lower. represents the user feedback confidence. represents the conflict resolution factor, which reduces the confidence when the triple conflicts with existing high-confidence knowledge in the knowledge graph. 、 , and are adjustable weight coefficients, and + + = 1. These weight coefficients can be adjusted according to business needs, for example, if you want to rely more on user feedback, you can increase the weight of .
[0066] In some embodiments, the user feedback confidence is dynamically calculated based on positive (such as likes, adoption) and negative (such as negative reviews, corrections) feedback from users, as shown in the following formula: When structured new knowledge conflicts with existing knowledge, the system will start the conflict resolution mechanism. The determination of conflict is based on logical contradiction. If an existing triple is found in the knowledge graph, it has the same subject (head entity) and relationship as , but points to different objects (tail entities). For example, the newly extracted triple is: (Rice Blast, Recommended Pesticide, Pesticide A); the existing triple in the knowledge graph is (Rice Blast, Recommended Pesticide, Pesticide B). Since "a disease" should not be "recommended" two different "pesticides" as the preferred solution in logic, the system determines that and A conflict occurs.
[0067] After determining the existence of a conflict, the system adjusts the confidence level through a conflict resolution factor The calculation of the factor is not simply to reduce the confidence level of the new knowledge to zero, but to dynamically and reasonably implement the punishment according to the weighted average of the confidence level of the existing conflicting knowledge.
[0068] In some embodiments, The specific calculation formula can be designed as: In the formula, is a conflict penalty coefficient between 0 and 1, which controls the strength of the impact of the conflict on the confidence level; represents the weighted average of the confidence levels of all existing triples that conflict with the current triple , which can be calculated according to the following formula: wherein, represents the confidence level of a certain conflicting triple , and represents the weight of the conflicting triple.
[0069] The design of such confidence level calculation and conflict resolution mechanism ensures that when new knowledge conflicts with existing knowledge with high confidence level in the knowledge graph, it will be more severely suppressed; on the contrary, if the existing conflicting knowledge itself has a low confidence level, the punishment to the new knowledge will be relatively light. This dynamic adjustment strategy not only maintains the stability of the knowledge system, but also leaves room for the evolution of new and possibly correct knowledge, so that the dynamic knowledge graph has flexibility in continuous learning and adaptation to industry development while maintaining reliability.
[0070] The following embodiments in specific application scenarios further illustrate the agricultural production knowledge intelligent question answering based on natural language processing provided by the present application.
[0071] Figure 2 is the architecture diagram of the agricultural production knowledge intelligent question answering system provided by the present application, as Figure 2 shown, the system solves the core problems of low agricultural terminology recognition rate, knowledge update lag, and insufficient multi-modal interaction in the prior art through field self-adaptive semantic understanding, dynamic agricultural knowledge graph construction and update, and construction of multi-modal question answering reasoning mechanism.
[0072] The specific implementation steps are as follows: Step 1, field self-adaptive semantic understanding.
[0073] Figure 3The present application provides a field adaptive semantic understanding model. As shown in the flowchart of the field adaptive semantic understanding model Figure 3 , the present model aims to solve the core problems of inaccurate term recognition and semantic understanding deviation of general pre-training models in the agricultural field.
[0074] 1.1 Construction and preprocessing of agricultural field corpus (1) Data collection Collect and integrate multi-source agricultural text data, including: Agricultural field knowledge graph structured text: agricultural encyclopedias, textbooks, standard operation manuals, containing knowledge in the form of triples, such as (wheat, susceptible, rust disease), (rust disease, control method, fungicide).
[0075] Agricultural field corpus: contains a large amount of agricultural professional knowledge text data, which is used for pre-training and fine-tuning of the model.
[0076] Original question: natural language text input by the user, such as "What should I do if my wheat gets rust disease?" and "How to prevent and control rice diseases?" in agricultural technology forum Q&A, hotline transcription text, farmer consultation records (covering dialectal variants).
[0077] Synonymous question pairs (as self-supervised data): automatically or semi-automatically generated semantic similar question pairs from historical Q&A data.
[0078] (2) Processing procedure: Segmentation, denoising, and standardization are performed on the corpus, such as unifying "corn" and "bran" to "corn", to construct a high-quality agricultural field corpus set , where represents a sentence or paragraph, is the total amount of corpus.
[0079] 1.2 Model input The input of the model is a natural language query sequence from the user. After preprocessing and segmentation, the sequence is represented as a sequence of wordpieces: Input sequence , where represents the wordpiece at the th position in the sequence. is a special category added at the beginning of the sequence, and its final hidden state will be used to aggregate the semantic information of the entire sequence. is a separator used to distinguish sentences. is the total length of the sequence.
[0080] 1.3 Core improvement formula: term-enhanced mask language model (TE-MLM) The core of this embodiment is the term enhancement improvement on the mask language model (MLM) task in the pre-training stage. The traditional MLM is random masking, while this embodiment preferentially masks and learns professional terms in the agricultural field, and gives them higher learning weights. This enables the model to more deeply understand the meanings of these terms and their relationships in context.
[0081] Improved loss function - term enhanced mask language model loss function can refer to the aforementioned embodiment, which will not be repeated here.
[0082] 1.4 Model output: The model outputs two key data formats for subsequent question and answer reasoning: (1) Structured semantic representation, a structured data containing intent label and entity list. (Entity, relationship, intent classification), example: {"intent": "disease prevention", "entities": [{"entity": "wheat", "type": "crop"}, {"entity": "rust", "type": "disease"}]}.
[0083] (2) Question vector: A high-dimensional vector that captures the overall semantic information of the question, used for subsequent semantic similarity matching and knowledge graph retrieval. Example: [0.12, 0.45, -0.78,...].
[0084] The term enhanced mask language model fundamentally improves the model's deep understanding of the domain language by preferentially masking and learning agricultural professional terms and giving them higher training weights. This approach forces the model to focus on mastering the semantics of core terms such as "tillering period" and "rust" and their contextual relationships during the pre-training phase, significantly improving the accuracy of professional term recognition and effectively reducing the misjudgment of user queries. It solves the semantic understanding bias problem of general models in the agricultural field.
[0085] This precise semantic understanding serves as the cornerstone of the system, providing high-quality input for downstream tasks. The high-quality question vector and structured entity information output directly improves the accuracy of subsequent knowledge graph retrieval and the reliability of multi-modal reasoning, forming an efficiency closed loop from precise understanding to intelligent question answering, ultimately driving the overall accuracy and practicality of the entire question and answer system to jump up.
[0086] Step 2, dynamic agricultural knowledge graph construction and update.
[0087] Figure 4 is the process diagram of the dynamic agricultural knowledge graph construction and update provided by the present application, as Figure 4 shown, this embodiment constructs a dynamic system that can continuously evolve and update, ensuring the real-time, accuracy and consistency of the knowledge graph.
[0088] 2.1 Input: Multi-source heterogeneous data streams can include: (1) Structured data: agricultural expert databases, government-issued pest reports, agricultural product price databases, etc.
[0089] (2) Unstructured data: agricultural news articles, research papers, user discussions on forums and social media, multimedia files (pictures, videos), etc.
[0090] (3) User feedback data: user evaluations of question and answer results (likes, dislikes, adoption, corrections, etc.).
[0091] (4) Output of domain-adaptive semantic understanding model: structured query representation, used to extract knowledge from unstructured data.
[0092] 2.2 Processing process: (1) Knowledge extraction: use named entity recognition (NER) and relation extraction models to automatically extract triples from text. In addition, use multi-modal knowledge extraction technology to automatically extract entities and attributes from pictures and videos.
[0093] (2) Knowledge merging and updating: compare and merge the newly extracted knowledge with the existing knowledge graph. Use the improved formula to calculate and update the confidence scores of new and old knowledge according to the source, timeliness and existing confidence of the knowledge.
[0094] (3) Conflict resolution: when contradictory knowledge is found, such as two different prevention methods for the same disease, according to the confidence score, the more credible knowledge is retained.
[0095] (4) Knowledge graph storage: Store the updated triples in a graph database (such as Neo4j).
[0096] 2.3 Improved confidence formula: The improved confidence formula is used to dynamically evaluate and update the confidence of triples in the knowledge graph. This formula takes into account the source, timeliness of the knowledge, and most importantly, user feedback. The improved confidence formula can be found in the aforementioned embodiments and will not be repeated here.
[0097] (1) Determination of conflicts (how to find conflicts) When the system obtains a new triple through knowledge extraction (e.g.: (Disease A, Recommended Pesticide, Pesticide X)) will be compared with the existing knowledge in the knowledge graph. The determination of conflict is based on logical contradiction, which is specifically defined as: find an existing triple in the knowledge graph , which has the same subject (head entity) and relation but points to a different object (tail entity).
[0098] Conflict instance: Newly extracted triple :(Rice Blast, Recommended Pesticide, Pesticide A) Existing triple in knowledge graph :(Rice Blast, Recommended Pesticide, Pesticide B) Since "a disease" should not be "recommended" two different "pesticides" as the preferred solution in logic, the system determines that and have conflicts.
[0099] (2) Quantification of confidence reduction After determining the conflict, the calculation of the conflict resolution factor is not simply to reduce the confidence of new knowledge to zero, but to dynamically and reasonably punish new knowledge according to the weighted sum of the confidence of existing conflict knowledge. Its calculation formula can be designed as: : the weighted average of the confidence of all existing triples that conflict with the current triple T.
[0100] where : the confidence of a conflict triple : the weight of the conflict triple : a conflict penalty coefficient between 0 and 1. It controls the strength of the impact of conflict on confidence. : a conflict penalty coefficient between 0 and 1. It controls the strength of the impact of conflict on confidence.
[0101] When =0, =1, indicating complete disregard for conflicts and no punishment.
[0102] When =1, , indicating that the confidence of the new triple will be directly reduced by the average confidence of existing conflict knowledge. If the existing knowledge is very reliable (close to 1), the confidence of will be severely affected.
[0103] This design ensures that when new knowledge conflicts with mature knowledge with high confidence in the knowledge graph, it will be more severely suppressed; on the contrary, if the existing conflicting knowledge itself is not high in confidence, the punishment for new knowledge will be lighter, leaving room for the evolution of new and possibly correct knowledge. This enables the system to maintain stability while being flexible in updating knowledge.
[0104] The innovation of this embodiment is that it does not build a static and one-time knowledge graph, but establishes a dynamic system that can continuously evolve and update itself. This system integrates multi-source heterogeneous data and uses user feedback enhanced knowledge quality evaluation and conflict resolution mechanism to ensure the real-time, accuracy and consistency of the knowledge graph.
[0105] Traditional knowledge graph construction mainly relies on structured data and manual annotation, making it difficult to deal with massive amounts of unstructured dynamic information streams (such as news, forums, videos, etc.). This embodiment uses multi-modal knowledge extraction technology to automatically extract entities, relationships and attributes from text, images and videos. For example, extract triples (new pesticide, control, rice blast) from an agricultural news article; identify entities (tomato, downy mildew) from an image. This greatly improves the efficiency and coverage of the knowledge graph.
[0106] Automatically extracted information may be incorrect, outdated or contradictory, for example, different experts may have different opinions on the control method of the same disease. This embodiment introduces a confidence evaluation system to assign a confidence score to each piece of knowledge (triplet). This score is based not only on the authority of the knowledge source (such as expert system > forum), but also dynamically adjusted by integrating user feedback. If the majority of users give a good rating to an answer, the confidence of the knowledge supporting that answer will increase; otherwise it will decrease. At the same time, a conflict resolution mechanism is established to retain more credible knowledge when conflicting knowledge is found.
[0107] 2.4 Output: A real-time updated database with each triplet accompanied by a confidence score that accurately reflects the latest agricultural knowledge.
[0108] Step 3, multi-modal question and answer reasoning mechanism.
[0109] Figure 5 The flowchart of the multi-modal question and answer reasoning provided by the present application is shown in Figure 5 This step uses the understanding result of step 1 to search, reason and integrate multi-modal information on the knowledge graph of step 2 to generate the final answer.
[0110] 3.1 Input: (1) The question semantic vector, intent, and entity output by Step 1; (2) The dynamic agricultural knowledge graph constructed in Step 2; (3) External multi-modal database, including pest pictures, agricultural operation videos, soil moisture maps, etc.
[0111] 3.2 Processing process: (1) Knowledge retrieval and matching: using structured semantic representation, efficient graph traversal and knowledge retrieval in the dynamic agricultural knowledge graph are performed to find the most relevant knowledge path to the user's question.
[0112] (2) Multi-modal information fusion: using computer vision models to analyze user-provided images or videos, identifying pest characteristics or crop status, etc., and fusing image recognition results with text entities, such as associating "disease spots in the image" with "tomato downy mildew" entities in the knowledge graph.
[0113] (3) Reasoning and answer generation: combining knowledge paths in the knowledge graph and multi-modal information, logical reasoning is performed to generate comprehensive answers including text descriptions, picture examples, video tutorials, etc. For example, according to the "tomato-downy mildew-prevention method" knowledge path.
[0114] 3.3 Improved answer matching degree formula: This method introduces the field adaptation, dynamic update, and multi-modal fusion mechanism on the basis of the traditional question and answer system, and the core is to optimize the calculation of the answer matching degree (AMD) ), making it more comprehensive and accurate. The improved answer matching degree formula can be referred to in the aforementioned embodiments, which will not be described here.
[0115] This improved answer matching degree formula comprehensively considers the accuracy of semantic understanding, the comprehensiveness and timeliness of the knowledge graph, and the fusion ability of multi-modal information, thereby significantly improving the accuracy and practicality of the question and answer system.
[0116] 3.4 Output: (1) Multi-modal answers: comprehensive answers in the form of text, pictures, videos, etc.
[0117] (2) Answer confidence score: scoring the generated answers to help users assess the reliability of the answers.
[0118] This embodiment, through multiple innovations in semantic understanding, knowledge management, and question and answer forms, builds a more intelligent, dynamic, and practical agricultural knowledge question and answer platform, effectively solving the limitations of existing technologies in handling professional, dynamic, and multi-modal information. Specifically, the following technical effects exist: 1. Significantly improve the accuracy of question and answer Accurate understanding of professional terms: Through the Term Enhanced Masked Language Model (TE-MLM), the invention can accurately identify and understand agricultural professional terms such as "wheat rust" and "rice blast", solving the semantic deviation problem of general models in the agricultural field. This enables the system to better understand user intent and provide more accurate answers.
[0119] Disambiguation: The model can distinguish between different expressions with the same semantics (such as "tomato leaves turn yellow" and "tomato leaf yellowing"), ensuring that no matter how the user asks, the system can match the correct knowledge.
[0120] 2. Ensure the timeliness and comprehensiveness of knowledge Real-time knowledge update: Unlike traditional question and answer system knowledge bases, which are static, the invention uses a dynamic knowledge graph construction and update mechanism to capture and integrate the latest agricultural news, research reports, and expert insights in real time. This means users can get information about the latest disease outbreaks, new varieties, or new control methods, rather than outdated old knowledge.
[0121] Multi-source information integration: By integrating data from expert databases, forums, news, and other multi-source heterogeneous data, the knowledge graph constructed by the invention is more comprehensive and covers a wider range of agricultural knowledge areas, enabling it to answer more complex and diverse queries.
[0122] 3. Improve user experience and practicality Multi-modal answers: The system not only provides text answers, but also integrates multi-modal information such as pictures and videos. When users upload disease pictures, the system can identify the disease type and directly provide control solutions containing pictures and video tutorials, greatly improving the intuitiveness and practicality of answers.
[0123] Highly reliable answers: User feedback enhances the confidence evaluation mechanism, ensuring that the system can recommend verified and highly reliable answers to users. This reduces the risk of users obtaining incorrect information and improves the reliability of the system.
[0124] The following describes the agricultural production knowledge intelligent question and answer device based on natural language processing provided by the invention. The agricultural production knowledge intelligent question and answer device based on natural language processing described below can be mutually corresponding and referred to with the agricultural production knowledge intelligent question and answer method based on natural language processing described above.
[0125] Figure 6 is a structural schematic diagram of the agricultural production knowledge intelligent question and answer device based on natural language processing provided by the invention, as Figure 6 shown, the device includes the following modules: The parsing module 600 is configured to parse the natural language query sequence input by the user based on the domain adaptive semantic understanding model, and output a structured semantic representation and a question vector; The retrieval module 610 is configured to perform retrieval matching in the dynamic agricultural knowledge graph based on the structured semantic representation and the question vector; The reasoning module 620 is configured to perform reasoning based on the result of the retrieval matching, and generate and output a final answer and a matching degree score of the final answer; The domain adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural field, and the masked language model assigns a higher weight to a masked token belonging to the term set than to a masked token not belonging to the term set during pre-training. The dynamic agricultural knowledge graph is constructed based on a multi-source heterogeneous data stream in the agricultural field and is dynamically updated.
[0126] According to the agricultural production knowledge intelligent question answering device based on natural language processing provided by the application, the final answer and the matching degree score of the final answer are generated and output based on the retrieval matching result and the multi-modal database, which comprises: In the case that the user inputs multi-modal information, the recognition result of the multi-modal information is obtained based on the modal information recognition model corresponding to the multi-modal information; Based on the recognition result of the multi-modal information, the retrieval matching result and the multi-modal database, the final answer and the matching degree score of the final answer are generated and output.
[0127] According to the agricultural production knowledge intelligent question answering device based on natural language processing provided by the application, the matching degree score of the final answer is obtained by comprehensively considering the semantic matching degree of the domain adaptive semantic understanding, the knowledge matching degree of the dynamic knowledge graph and the fusion matching degree of the multi-modal information. Among them, the semantic matching degree is used to represent the similarity between the question vector and the problem vector in the dynamic knowledge graph; the knowledge matching degree is used to represent the closeness and knowledge timeliness of the final answer in the dynamic knowledge graph; and the fusion matching degree is used to represent the similarity between the multi-modal information input by the user and the entity in the dynamic knowledge graph.
[0128] According to the agricultural production knowledge intelligent question answering device based on natural language processing provided by the application, the loss function of the masked language model in the pre-training process is determined according to the following formula: In the formula, represents the loss function of the masked language model; represents the token at the i-th position in the input sequence represents an input sequence after random mask processing; is a mask indicating function, is masked , is not masked ; is an indicating function, when is true , is false ; represents a set of terms in the field of agriculture; represents a weight hyperparameter of term enhancement, ; represents the parameters of the mask language model, which are updated during the model training process; represents the current model parameters , the mask language model predicts the probability that the current position is a real word based on .
[0129] According to the agricultural production knowledge intelligent question and answer device based on natural language processing provided by the application, the dynamic agricultural knowledge graph is updated in the following way: Based on the multi-source heterogeneous data flow in the field of agriculture, the structured new knowledge represented in the form of triples is extracted; Based on the confidence of the structured new knowledge and the confidence of each structured knowledge in the current dynamic agricultural knowledge graph, the dynamic agricultural knowledge graph is updated.
[0130] According to the agricultural production knowledge intelligent question and answer device based on natural language processing provided by the application, the confidence of any structured knowledge is determined by the current confidence of any structured knowledge, the confidence of the knowledge source of any structured knowledge, the user feedback confidence of any structured knowledge and the conflict resolution factor; In the case of conflict between the structured new knowledge and any structured knowledge, the conflict resolution factor is based on the weighted average of the confidence of all conflicting structured knowledge in the dynamic agricultural knowledge graph to adjust the confidence of any structured knowledge.
[0131] Figure 7 An example of an entity structure diagram of an electronic device is shown as Figure 7As shown, the electronic device can include a processor 710, a communications interface 720, a memory 730, and a communications bus 740, wherein the processor 710, the communications interface 720, and the memory 730 complete mutual communication through the communications bus 740. The processor 710 can invoke a logical instruction in the memory 730 to execute an agricultural production knowledge intelligent question and answer method based on natural language processing, which includes the following steps: Based on the field adaptive semantic understanding model, the natural language query sequence input by the user is parsed, and a structured semantic representation and a question vector are output; Based on the structured semantic representation and the question vector, retrieval matching is performed in the dynamic agricultural knowledge graph; Based on the results of retrieval matching, reasoning is performed to generate and output a final answer and a matching degree score of the final answer; The field adaptive semantic understanding model is obtained by pre-training a mask language model based on a term set in the agricultural field, and the mask language model assigns higher weights to masked word elements belonging to the term set than to masked word elements not belonging to the term set during pre-training; The dynamic agricultural knowledge graph is constructed based on a multi-source heterogeneous data stream in the agricultural field and is dynamically updated.
[0132] In addition, the logical instructions in the memory 730 described above can be implemented in the form of a software function unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the method described in various embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0133] On the other hand, the present application also provides a computer program product, which includes a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to execute the agricultural production knowledge intelligent question and answer method based on natural language processing provided by the above-mentioned methods, which includes the following steps: The natural language query sequence input by the user is parsed based on the domain adaptive semantic understanding model, and a structured semantic representation and a question vector are output; Based on the structured semantic representation and the question vector, retrieval matching is performed in the dynamic agricultural knowledge graph; Based on the results of retrieval matching, reasoning is performed to generate and output a final answer and a matching degree score of the final answer; The domain adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural field, and the masked language model assigns a higher weight to a masked token belonging to the term set than to a masked token not belonging to the term set during pre-training. The dynamic agricultural knowledge graph is constructed and dynamically updated based on a multi-source heterogeneous data stream in the agricultural field.
[0134] In another aspect, the application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the agricultural production knowledge intelligent question and answer method based on natural language processing provided by the above method, and the method includes the following steps: The natural language query sequence input by the user is parsed based on the domain adaptive semantic understanding model, and a structured semantic representation and a question vector are output; Based on the structured semantic representation and the question vector, retrieval matching is performed in the dynamic agricultural knowledge graph; Based on the results of retrieval matching, reasoning is performed to generate and output a final answer and a matching degree score of the final answer; The domain adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural field, and the masked language model assigns a higher weight to a masked token belonging to the term set than to a masked token not belonging to the term set during pre-training. The dynamic agricultural knowledge graph is constructed and dynamically updated based on a multi-source heterogeneous data stream in the agricultural field.
[0135] The device embodiments described above are only schematic, wherein the units shown as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the embodiment scheme according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0136] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in the various embodiments or some parts of the embodiments.
[0137] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for intelligent question answering of agricultural production knowledge based on natural language processing, characterized in that, include: Based on a domain-adaptive semantic understanding model, the system parses the natural language query sequence input by the user and outputs a structured semantic representation and question vectors. Based on the structured semantic representation and the question vector, retrieval and matching are performed in the dynamic agricultural knowledge graph; Based on the search and matching results, reasoning is performed to generate and output the final answer and the matching score of the final answer; The domain-adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural domain. During the pre-training process, the masked language model assigns higher weights to masked words that belong to the term set than to masked words that do not belong to the term set. The dynamic agricultural knowledge graph is constructed and dynamically updated based on multi-source heterogeneous data streams in the agricultural field.
2. The intelligent question-and-answer method for agricultural production knowledge based on natural language processing according to claim 1, characterized in that, Based on the search matching results and the multimodal database, a final answer and a matching score for the final answer are generated and output, including: When a user inputs multimodal information, the recognition result of the multimodal information is obtained based on the modality information recognition model corresponding to the multimodal information; Based on the recognition results of the multimodal information, the retrieval matching results, and the multimodal database, a final answer and a matching score of the final answer are generated and output.
3. The intelligent question-and-answer method for agricultural production knowledge based on natural language processing according to claim 2, characterized in that, The final answer matching score is obtained by combining the semantic matching degree of domain adaptive semantic understanding, the knowledge matching degree of dynamic knowledge graph, and the matching degree of multimodal information fusion. The semantic matching degree is used to characterize the similarity between the question vector and the question vector in the dynamic knowledge graph; the knowledge matching degree is used to characterize the relevance and timeliness of the final answer in the dynamic knowledge graph; and the fusion matching degree is used to characterize the similarity between the multimodal information input by the user and the entities in the dynamic knowledge graph.
4. The intelligent question-answering method for agricultural production knowledge based on natural language processing according to any one of claims 1 to 3, characterized in that, The loss function of the masked language model during pre-training is determined according to the following formula: In the formula, The loss function representing the masked language model; Represents the input sequence The first in The word element at each position; This represents the input sequence after random masking. For mask indicator functions, In the case of being masked , Without being masked ; For indicator functions, in When true , When it is false ; This refers to a set of terms used in the agricultural field. The weight hyperparameters representing term enhancement, ; These represent the parameters of the masked language model, which are updated during model training. Indicates the current model parameters Under these conditions, the masked language model is based on Predicting the current position as a true word The probability of.
5. The intelligent question-answering method for agricultural production knowledge based on natural language processing according to any one of claims 1 to 3, characterized in that, The dynamic agricultural knowledge graph is updated in the following ways: Based on multi-source heterogeneous data streams in the agricultural field, extract new structured knowledge represented in the form of triples; The dynamic agricultural knowledge graph is updated based on the confidence level of the new structured knowledge and the confidence level of each structured knowledge in the current dynamic agricultural knowledge graph.
6. The intelligent question-and-answer method for agricultural production knowledge based on natural language processing according to claim 5, characterized in that, The confidence level of arbitrary structured knowledge is determined by the current confidence level of the arbitrary structured knowledge, the confidence level of the knowledge source of the arbitrary structured knowledge, the user feedback confidence level of the arbitrary structured knowledge, and the conflict resolution factor. In the event of a conflict between the new structured knowledge and any structured knowledge, the conflict resolution factor adjusts the confidence level of any structured knowledge based on the weighted average confidence level of all conflicting structured knowledge in the dynamic agricultural knowledge graph.
7. An intelligent question-and-answer device for agricultural production knowledge based on natural language processing, characterized in that, include: The parsing module is used to parse the natural language query sequence input by the user based on the domain-adaptive semantic understanding model, and output structured semantic representation and question vector; The retrieval module is used to perform retrieval and matching in the dynamic agricultural knowledge graph based on the structured semantic representation and the question vector; The reasoning module is used to perform reasoning based on the search and matching results, generate and output the final answer and the matching score of the final answer; The domain-adaptive semantic understanding model is obtained by pre-training a masked language model based on a term set in the agricultural domain. During the pre-training process, the masked language model assigns higher weights to masked words that belong to the term set than to masked words that do not belong to the term set. The dynamic agricultural knowledge graph is constructed and dynamically updated based on multi-source heterogeneous data streams in the agricultural field.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the intelligent question-and-answer method for agricultural production knowledge based on natural language processing as described in any one of claims 1 to 6.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the intelligent question-and-answer method for agricultural production knowledge based on natural language processing as described in any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the intelligent question-and-answer method for agricultural production knowledge based on natural language processing as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Big peach production knowledge open question and answer method and device for migrating context network
CN114021546A
Text question and answer model based on knowledge enhancement graph neural network
CN114969278A
Natural language-based domain-specific business knowledge retrieval method and retrieval device
CN116662582A
Law question answering system based on intention recognition and knowledge graph
CN117891923A
Vertical type government affair large model service method and system based on interactive learning
CN118820448A
Cited By
Crop management method, system, device and medium of multi-modal reasoning
CN122200641A
Crop management method, system, device and medium of multi-modal reasoning
CN122200641B