A knowledge graph construction method and system for crop diseases and insect pests

CN123012176APending Publication Date: 2026-10-30HENAN MECHANICAL & ELECTRICAL ENG COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611413650.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-11
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

[0004]为了解决在农作物病虫害知识图谱的构建过程中,实体边界识别的准确率较低以及正确的(实体,关系,实体)三元组容易被遗漏的技术问题,本发明的目的在于提供一种面向农作物病虫害的知识图谱构建方法及系统,所采用的技术方案具体如下:

Benefits of technology

[0014]本发明相较于现有技术,具有如下有益效果:本发明在不改变实体识别模型的底层结构的情况下,在流水线解码端引入反馈机制,利用关系层面的语义约束逆向修正实体边界,以此提高实体边界识别的准确率,减少或避免正确的(实体,关系,实体)三元组被遗漏并纳入到农作物病虫害知识图谱。具体而言,针对传统知识图谱流水线架构中实体边界识别与关系抽取缺乏交互、实体边界识别错误无法修正的技术缺陷,本发明采用集束搜索保留多候选实体边界,通过冲突组枚举互不重叠方案,并利用关系类型相容性约束驱动边界方案的迭代修正,使关系约束能够反向校正实体边界。本发明在不改变现有模型结构、不进行联合训练的前提下,有效抑制了知识实体的错误传播,提高了实体边界识别与(实体,关系,实体)三元组抽取的准确性,同时保持了流水线架构的简洁性与模块化优势,可低成本适配已部署系统,具备显著的工程实用价值。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123012176A_ABST
    Figure CN123012176A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of electric digital data processing, in particular to a knowledge graph construction method and system for crop diseases and insect pests, which comprises the following steps: decoding the sentences in the plant protection text through cluster search to obtain a label sequence, extracting entities in the label sequence to obtain a candidate entity pool; determining the initial weight of the candidate entities in the candidate entity pool, and dividing the candidate entity pool into conflict groups according to the character index of the candidate entities; taking the entity subset obtained by combining the entities that do not overlap in the conflict groups as a boundary scheme, and determining an optimal boundary scheme; iteratively modifying the optimal boundary scheme by using a relationship type compatibility constraint, outputting adjacent entity pairs in the modified optimal boundary scheme as target relationship triplets; and writing each target relationship triplet into a graph database to construct a knowledge graph for crop diseases and insect pests. Through the technical scheme, the accuracy of entity boundary recognition and triplet extraction is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of electronic digital data processing technology, specifically to a method and system for constructing a knowledge graph for crop diseases and pests. Background Technology

[0002] In the construction of crop disease and pest knowledge graphs, entity recognition and relation extraction are two core steps. Existing systems mostly adopt a pipeline architecture: first, a sequence labeling model (such as a bidirectional long short-term memory network-conditional random field model or a Transformer-based bidirectional encoder representation) is used to extract entities such as diseases, pests, crops, and parts from plant protection texts. Then, entities appearing in the same sentence are paired and fed into a relation classification model to determine whether there is a semantic relationship between them (such as infection, transmission vector, control, etc.). This step-by-step processing method is simple to implement, highly modular, and can be optimized by selecting appropriate neural network structures for different steps. Therefore, it is adopted by most current knowledge graph construction tools.

[0003] In the above pipeline architecture, the output of the entity recognition module is the only input of the relation classification module, and there is no interaction mechanism between the two. Once the entity recognition has a boundary deviation or type error, the relation classification model can neither detect it nor correct it. It can only continue to perform the prediction task based on the incorrect entity pair, resulting in the incorrect entity being written into the graph. At the same time, the correct (entity, relation, entity) triple is easily missed due to the entity misalignment. Summary of the Invention

[0004] To address the technical problems of low accuracy in entity boundary identification and the easy omission of correct (entity, relation, entity) triples during the construction of crop disease and pest knowledge graphs, this invention aims to provide a method and system for constructing knowledge graphs for crop diseases and pests. The specific technical solution adopted is as follows: This invention provides a method for constructing a knowledge graph for crop diseases and pests, the method comprising: The sentences in the plant protection text are decoded by bundle search to obtain multiple label sequences, and the entities in each label sequence are extracted to obtain a candidate entity pool; Determine the initial weights of candidate entities in the candidate entity pool, and divide the candidate entity pool into conflict groups based on the character index of the candidate entities; The entity subset obtained by combining non-overlapping entities in the conflict group is used as the boundary scheme, and the optimal boundary scheme is determined by using the initial weights of each entity in the entity subset. The optimal boundary scheme is iteratively corrected using preset relation type compatibility constraints, and the adjacent entity pairs in the corrected optimal boundary scheme are output as target relation triples. Each target relation triple is written into a graph database to construct a knowledge graph for crop diseases and pests.

[0005] Furthermore, the process of decoding sentences in the plant protection text using bundle search to obtain multiple label sequences includes: Based on the character length of the target sentence in the plant protection text, determine the preset number of label sequences to retain by sorting them according to label probabilities; The target sentence is decoded using a bundle search to obtain multiple label sequences of a preset number. Each label sequence corresponds to a set of entity boundary and entity type annotation schemes.

[0006] Further, determining the initial weights of candidate entities in the candidate entity pool includes: Determine the number of times the target candidate entity appears in all label sequences in the candidate entity pool, and determine the total number of sequences in all label sequences; The ratio of the number of target occurrences to the total number of sequences is calculated and used as the initial weight of the target candidate entity, where the initial weight represents the statistical confidence of the entity boundary and entity type of the target candidate entity.

[0007] Furthermore, the step of dividing the candidate entity pool into conflict groups based on the character index of the candidate entities includes: The character range of the candidate entity is determined based on the starting character index and the ending character index of the candidate entity, and it is determined whether the character ranges of any two candidate entities overlap. If the character ranges of any two candidate entities overlap, then the two candidate entities are included in the same conflict group to divide the candidate entity pool into conflict groups.

[0008] Furthermore, the step of determining the optimal boundary scheme using the initial weights of each entity in the entity subset includes: The internal consistency score of the boundary scheme is determined by using the initial weights of each entity in the entity subset, and the boundary scheme with the highest internal consistency score is determined as the optimal boundary scheme.

[0009] Furthermore, the iterative correction of the optimal boundary scheme using preset relation type compatibility constraints includes: A type compatibility matrix is ​​constructed based on various entity types in the field of crop diseases and pests. The entities in the optimal boundary scheme are sorted according to the starting character index to obtain a sorted entity list. Iterate through each pair of adjacent entities in the entity list and use the type compatibility matrix to determine whether the entity types of adjacent entity pairs are compatible. If the entity types of any adjacent entity pair are incompatible, the adjacent entity pairs in the optimal boundary scheme are iteratively corrected according to the preset iterative correction rules.

[0010] Further, the iterative correction of adjacent entity pairs in the optimal boundary scheme according to the preset iterative correction rule includes: The adjacent entity pairs are merged to obtain the merged entity. It is then determined whether the merged entity has a matching entity type in the preset pest and disease dictionary. If the merged entity has a matching entity type in the preset pest and disease dictionary, then delete the adjacent entity pair from the entity list and insert the merged entity to update the entity list. Based on the updated entity list, re-traverse each adjacent entity pair in the entity list and iteratively correct the adjacent entity pairs in the optimal boundary scheme.

[0011] Furthermore, the step of determining whether the merged entity has a matching entity type in a preset pest and disease dictionary further includes: If the merged entity does not have a matching entity type in the preset pest and disease dictionary, the merged entity will be restored to an adjacent entity pair. Perform a boundary sliding operation on adjacent entity pairs to update them. Based on the updated adjacent entity pairs, use the type compatibility matrix to determine whether the entity types of the adjacent entity pairs are compatible. If the entity types of each adjacent entity pair are compatible or the iterative correction reaches the preset maximum number of iterations, then the iterative correction of the optimal boundary scheme is terminated.

[0012] Furthermore, the step of outputting adjacent entity pairs in the corrected optimal boundary scheme as target relation triples includes: The relation type of adjacent entity pairs in the revised optimal boundary scheme is labeled as the related type to obtain the initial relation triplet; Based on the mapping table between relation types and entity type pairs in the field of crop diseases and pests, determine the actual relation types of adjacent entity pairs and adjust the initial relation triplets to output the target relation triplets.

[0013] This invention also provides a knowledge graph construction system for crop diseases and pests, the system being used to implement the knowledge graph construction method for crop diseases and pests as described in any of the preceding claims; the system includes: The conflict partitioning module is used to decode sentences in plant protection texts through bundle search to obtain multiple label sequences, extract entities from each label sequence to obtain a candidate entity pool, determine the initial weights of candidate entities in the candidate entity pool, and divide the candidate entity pool into conflict groups according to the character index of the candidate entities. The boundary iteration module is used to combine non-overlapping entities in the conflict group to form a subset of entities as the boundary scheme. It uses the initial weights of each entity in the entity subset to determine the optimal boundary scheme. It iteratively corrects the optimal boundary scheme using preset relation type compatibility constraints, and outputs the adjacent entity pairs in the corrected optimal boundary scheme as target relation triples. Each target relation triple is written into the graph database to construct a knowledge graph for crop diseases and pests.

[0014] Compared to existing technologies, this invention offers the following advantages: Without altering the underlying structure of the entity recognition model, it introduces a feedback mechanism at the pipeline decoding end. This mechanism uses semantic constraints at the relation level to inversely correct entity boundaries, thereby improving the accuracy of entity boundary recognition and reducing or preventing the omission of correct (entity, relation, entity) triples in the crop pest and disease knowledge graph. Specifically, addressing the technical shortcomings of traditional knowledge graph pipeline architectures—lack of interaction between entity boundary recognition and relation extraction, and the inability to correct entity boundary recognition errors—this invention employs bundle search to retain multiple candidate entity boundaries, enumerates non-overlapping schemes through conflict groups, and uses relation type compatibility constraints to drive iterative correction of boundary schemes, enabling relation constraints to inversely correct entity boundaries. Without changing the existing model structure or performing joint training, this invention effectively suppresses the propagation of knowledge entity errors, improves the accuracy of entity boundary recognition and (entity, relation, entity) triple extraction, while maintaining the simplicity and modularity of the pipeline architecture. It can be adapted to deployed systems at low cost and possesses significant engineering practical value. Attached Figure Description

[0015] Figure 1 A flowchart illustrating the steps of a knowledge graph construction method for crop diseases and pests provided by this invention; Figure 2 This is a flowchart of step S1 in a knowledge graph construction method for crop diseases and pests provided by the present invention; Figure 3 This is a flowchart of step S2 in a knowledge graph construction method for crop diseases and pests provided by the present invention; Figure 4 This is a flowchart of step S4 in a knowledge graph construction method for crop diseases and pests provided by the present invention; Figure 5 The flowchart of step S43 in the knowledge graph construction method for crop diseases and pests provided by the present invention. Detailed Implementation

[0016] In order to maintain the simplicity of the original pipeline, this invention establishes a lightweight feedback path that enables relation extraction to assist in correcting entity boundaries, thereby making entity boundary recognition more accurate and ensuring that (entity, relation, entity) triples can be extracted correctly and completely.

[0017] In traditional pipelines, entity boundary recognition only outputs one optimal boundary, and relationship classification cannot provide feedback. This invention addresses this by: ① retaining multiple possible boundaries (through bundle search); ② generating all candidate entities and dividing them into conflict groups; ③ enumerating all non-overlapping entity combinations as boundary schemes; ④ iteratively refining the optimal boundary scheme using relationship type compatibility constraints (type compatibility matrix) (merging, sliding); ⑤ marking the relationships of the refined entity pairs as "related," then mapping them to specific relationship types and writing them into the graph.

[0018] The specific scheme of the knowledge graph construction method for crop diseases and pests provided by the present invention will be described in detail with reference to the accompanying drawings.

[0019] Example 1: For a knowledge graph construction method for crop diseases and pests provided by this invention, please refer to [link / reference]. Figure 1 The diagram illustrates a flowchart of the steps involved in constructing a knowledge graph for crop diseases and pests, according to an embodiment of the present invention.

[0020] The method for constructing a knowledge graph for crop diseases and pests includes: Step S1: Decode the sentences in the plant protection text using bundle search to obtain multiple label sequences, and extract the entities in each label sequence to obtain a candidate entity pool; In the field of knowledge about crop diseases and pests, the plant protection texts here include, but are not limited to: disease and pest forecasting reports, control technology plans, scientific research paper abstracts, pesticide instructions, plant protection Q&A records, etc. The common technical characteristics of these plant protection texts are: the length of a single sentence is usually between 20 and 200 characters; each sentence contains at least one pest / disease entity and one crop entity or part entity; and there is at least one predefined relationship type between the entities (infection, spread, control, etc.); the plant protection text data is submitted in plain text or JSON line format, and each data entry contains a unique identifier and a raw text string; the raw text string is, for example: The pest and disease monitoring report states: Large leaf spot disease is occurring severely on spring corn, and timely prevention and control measures are recommended. The pesticide instructions state: This product controls wheat scab, powdery mildew, and rust. The abstract of the paper states that corn leaf blight, caused by the corn leaf blight pathogen, can infect leaves; Based on the original plant protection text data, further preprocessing is performed. To avoid pre-determining entity boundaries at the data entry point, only three basic lossless processing steps are needed: (1) Sentence segmentation: Using periods, question marks, exclamation marks, and semicolons as boundaries, the original text of the plant protection text is split into independent sentences; sentences with a length of less than 9 characters (to avoid sentences that do not contain complete semantics) and sentences with a length of more than 300 characters (the density of such general relations is too low and the computational burden is too large), or sentences with a length of more than 300 characters are further segmented by commas or clause conjunctions; (2) Character standardization: convert full-width numbers / letters to half-width; convert traditional Chinese to simplified Chinese; compress consecutive whitespace characters into a single space; remove invisible control characters; do not change the length and character order of the original text string; (3) Filtering: retain sentences that contain at least one disease and pest domain trigger word (such as disease, insect, mold, fungus, rust, aphid, moth, mite, lice), and filter out other sentences; this filtering is only used to exclude irrelevant text and does not involve any entity category judgment; Through the above data preprocessing, each sentence obtained is a valid sentence; each valid sentence is output as a sentence triple: (sentence number, source identifier, cleaned text); the source identifier is only used for subsequent error tracing and does not participate in model calculation; the cleaned text retains the original character order and is not subjected to word segmentation, part-of-speech tagging or entity pre-labeling. The set of triples formed by each sentence serves as the sole data entry point, directly fed into the entity recognition module for boundary probability calculation.

[0021] Therefore, it should be noted that the sentences in the plant protection text here refer to the effective sentences after the above preprocessing and the sentence triples they form.

[0022] Specifically, please refer to Figure 2 In step S1, the sentences in the plant protection text are decoded using a bundle search to obtain multiple tag sequences, including: Step S11: Based on the character length of the target sentence in the plant protection text, determine the preset number of tag sequences to be retained by sorting the tag sequences according to the tag probabilities; Step S12: Decode the target sentence using bundle search to obtain multiple label sequences of a preset number of sequences. Each label sequence corresponds to a set of entity boundary and entity type annotation schemes.

[0023] In crop disease and pest texts, entity boundaries (referred to as "boundaries") are often ambiguous. For example, "maize leaf spot" can be considered as a whole as a disease entity, or it can be split into two entities: "maize" and "leaf spot". Entity recognition models typically use a BiLSTM-CRF (Bidirectional Long Short-Term Memory–Conditional Random Field) architecture. The CRF (Conditional Random Field) layer is responsible for decoding the globally optimal label sequence given the character label probabilities. The decoding process of CRF is essentially searching all possible label sequences and calculating the joint probability of each label sequence. Two different label sequences will yield two different probability values. When both boundary partitioning methods are reasonable, their probabilities may differ by only a few percentage points. In traditional pipelines, entity recognition modules use the Viterbi algorithm for decoding. Viterbi is a dynamic programming algorithm that retains only the label sequence with the highest global probability and discards all other label sequences with similar probabilities. These discarded label sequences may contain more reasonable boundary schemes at the relation level. However, since the output of the entity recognition module is unique and unchangeable, the relation classification module cannot reverse-correct even if it finds that the final decision contradicts the relation semantics. Therefore, this embodiment abandons the traditional Viterbi algorithm and uses Beam Search for decoding. Each step of Beam Search retains the K label sequences with the highest label probabilities (i.e., the preset number of sequences). That is, the label sequences are sorted from largest to smallest according to their label probabilities, and the top K label sequences are retained. Finally, K complete label sequences are output, thus preserving a variety of possible boundary schemes. The value of K is determined based on the character length of the target sentence (referring to any sentence) in the plant protection text. K=5 when the sentence length does not exceed 50 characters, otherwise K=10. If there are identical label sequences in the output, deduplication is performed, resulting in K' label sequences, with the actual number K' being used as the standard. Each label sequence corresponds to a complete set of entity boundary and entity type annotation schemes. For example: For the sentence "Maize leaf spot disease infects leaves" (approximately 9 characters long), cluster search with K=5 outputs the following 5 label sequences (simplified illustration of the BIOES system): In the BIOES annotation system: B = Begin, the starting character of the entity; I = Inside, the internal character of the entity; E = End, the end character of an entity; S = Single, an entity consisting of a single character; O = Outside, non-entity character (i.e., ordinary character that does not belong to any entity); Therefore, we can conclude that: Tag sequence 1: B-disease, I-disease, I-disease, I-disease, E-disease, O, O, B-part, E-part; →Entity: Corn leaf spot (disease), leaf (part); Tag sequence 2: B-crop, E-crop, B-disease, I-disease, E-disease, O, O, B-part, E-part; →Entity: Corn (crop), large leaf spot (disease), leaf (part); Tag sequence 3: B-crop, I-crop, E-crop, B-disease, I-disease, E-disease, O, O, B-part, E-part; →Entity: Corn (crop, but there is an extra character on the boundary, which is actually incorrect), Large Leaf Spot (disease), Leaf (part). Tag sequence 4: B-disease, I-disease, E-disease, O, O, O, B-location, E-location; →Entity: Corn (error boundary, no such entity exists), Leaf (part); Tag sequence 5: B-crop, E-crop, O, B-disease, E-disease, O, O, B-part, E-part; →Entity: Corn (crop), large spot (incorrect boundary, should be large leaf spot disease), leaf (part); In the above 5 label sequences, assuming that label sequence 1 and label sequence 2 are two reasonable boundary partitions with similar label probabilities, the traditional Viterbi will only retain the label sequence 1 with the highest probability, while the bundle search in this embodiment will retain all 5, providing a candidate basis for subsequent relation constraint correction; Next, entities are extracted from each of the above tag sequences; this embodiment adopts the start-inner-outer-end-word (i.e., BIOES) tagging system, where: B represents the start character of the entity, I represents the inner character of the entity, E represents the end character of the entity, S represents an entity composed of a single character, and O represents a non-entity character; Each entity record has three elements: starting character index, ending character index, and entity type (including one of disease, pest, crop, and part); entities extracted from all tag sequences are merged to obtain a candidate entity pool.

[0024] Step S2: Determine the initial weights of candidate entities in the candidate entity pool, and divide the candidate entity pool into conflict groups based on the character index of the candidate entities; Specifically, please refer to Figure 3 Step S2, determining the initial weights of candidate entities in the candidate entity pool, includes: Step S21: Determine the number of times the target candidate entity appears in all label sequences in the candidate entity pool, and determine the total number of sequences in all label sequences; Step S22: Calculate the ratio of the number of target occurrences to the total number of sequences and use it as the initial weight of the target candidate entity, where the initial weight represents the statistical confidence of the entity boundary and entity type of the target candidate entity.

[0025] In this embodiment, for any two candidate entities in the candidate entity pool, they are considered to be the same unique entity only if their start character index, end character index, and entity type are exactly the same; if the start character index and end character index are the same but the entity types are different, they are considered to be two different candidate entities. Count the number of times each unique candidate entity appears in all K' label sequences, and denote the number of times the target candidate entity (referring to any unique candidate entity) appears in all label sequences as the target count; If the target candidate entity appears multiple times within the same label sequence (i.e., entities with the same entity boundary and entity type appear repeatedly in the same label sequence), it is counted only once. Calculate the initial weight: The initial weight is equal to the ratio of the number of times the target appears to the total number of sequences K'. The initial weight is a real number between 0 and 1, representing the statistical confidence of the entity recognition model in the entity boundary and entity type of the target candidate entity. The more times the target is encountered, the larger the initial weight is, indicating that the entity recognition model is more inclined to choose this boundary for partitioning. If the total number of sequences is 0, the initial weight is set to 0 directly.

[0026] For example (continuing from the previous example): Calculate the initial weights of candidate entities: Corn (crop, character index 0-1): appears in label sequence 2 and label sequence 5 → target number of times = 2 → initial weight = 0.4; Large corn disease (character index 0-2): appears in label sequence 4 → target count = 1 → initial weight = 0.2.

[0027] Specifically, step S2, which divides the candidate entity pool into conflict groups based on the character index of the candidate entities, includes: The character range of the candidate entity is determined based on the starting character index and the ending character index of the candidate entity, and it is determined whether the character ranges of any two candidate entities overlap. If the character ranges of any two candidate entities overlap, then the two candidate entities are included in the same conflict group to divide the candidate entity pool into conflict groups.

[0028] In this embodiment, to determine which candidate entities in the candidate entity pool cannot coexist, a conflict relationship is defined: for any two candidate entities A and B, let the character range of A be [A...]. start A end A start Let A be the starting character index of entity A. end The character index of entity A is the ending character index; the character range of entity B is [B start B end ], B start Let B be the starting character index of entity B. end The index for the end character of entity B; If these two character intervals have an intersection and the intersection length is greater than or equal to 1, it means that they overlap, and A and B are said to conflict, and can be included in the same conflict group; if they do not overlap, then A and B do not conflict. Using candidate entities as nodes and conflict relationships between entities as edges, construct an undirected graph and compute each connected component of the undirected graph. Each connected component is called a conflict group. Entities within different conflict groups do not conflict with each other and can therefore be selected independently; entities within the same conflict group are connected by direct or indirect conflict relationships and a subset of non-overlapping entities needs to be selected. Example (continuing from the previous example): The character index of the candidate entity in the sentence "corn leaf blight infects leaves" (assuming "corn leaf blight" occupies 0-4, "infects" occupies 5-6, and "leaves" occupies 7-8; the actual character index needs to be consistent, this is a simplified demonstration): Entity A: Maize leaf spot [0,4] Entity B: Corn [0,1] Solid C: Large leaf spot [2,4] Entity D: Corn (Error Boundary) [0,2] Entity E: Corn [0,2] Entity F: Large spot [2,3] Entity G: Blade [7,8] (has no intersection with any of the above entity intervals, thus forming a separate conflict group) Conflict group 1 includes A, B, C, D, E, and F (where B and C are indirectly in conflict through A), and conflict group 2 only includes G.

[0029] Step S3: Take the entity subset obtained by combining non-overlapping entities in the conflict group as the boundary scheme, and use the initial weights of each entity in the entity subset to determine the optimal boundary scheme. Specifically, step S3, which determines the optimal boundary scheme using the initial weights of each entity in the entity subset, includes: The internal consistency score of the boundary scheme is determined by using the initial weights of each entity in the entity subset, and the boundary scheme with the highest internal consistency score is determined as the optimal boundary scheme.

[0030] In this embodiment, for any conflict group, enumerate all entity subsets formed by combinations of non-overlapping entities within the conflict group; The enumeration method is as follows: traverse all candidate entities in the conflict group, generate all possible entity subsets, and ensure that no two entities in the entity subsets overlap (their corresponding character ranges do not overlap). In practical applications, the number of candidate entities in a single conflict group does not exceed 8, and the number of entity subsets obtained by enumeration is at most 2. 8 =256 types, the computational load is acceptable; If the number of candidate entities in the conflict group exceeds 12 (which occurs in very few long sentences; 12 is an empirical threshold set based on the balance between computational complexity 2^12=4096 and system response time), then a greedy strategy is adopted: sort each entity in descending order of its initial weight, select entities that do not conflict with the currently selected entities, and generate only one subset of entities. Each subset of entities is called a boundary scheme, and the empty set is also a valid boundary scheme. The internal consistency score of each boundary scheme is defined as the sum of the initial weights of all entities in that boundary scheme; the score for the empty set is 0; the boundary scheme with the highest internal consistency score is determined as the optimal boundary scheme for the corresponding conflict group.

[0031] For each sentence, output all its conflict groups; for each conflict group, output all its boundary solutions and the internal consistency score of each boundary solution, and select the boundary solution with the highest internal consistency score for each conflict group as its optimal boundary solution. Example (continuing from the previous example): For candidate entities in conflict group 1, enumerate its entity subset, that is, enumerate the boundary schemes (partial list): Boundary Scheme 1: {Maize leaf spot (initial weight 0.2, simplified representation thereafter)} → Internal consistency score 0.2; Boundary Scheme 2: {Maize (0.4), Large leaf spot (0.2)} → Internal consistency score 0.6; Boundary Scheme 3: {Corn (0.4)} → Internal consistency score 0.4; Boundary Scheme 4: {Large Spot (0.2)} → Internal Consistency Score 0.2; Boundary Scheme 5: {Corn Large (0.2)} → Internal Consistency Score 0.2; Boundary scheme 6: {large spot (0.2)} → internal consistency score 0.2; Boundary scheme 7: {corn (0.4), large spot (0.2)} → But the large spot [2,3] does not overlap with the corn [0,1], so it is valid and has an internal consistency score of 0.6; Boundary Scheme 8: Empty set → Internal consistency score 0; As can be seen, the highest internal consistency score is 0.6, corresponding to boundary scheme 2 (corn + large leaf spot) as the optimal boundary scheme.

[0032] Step S4: Iteratively correct the optimal boundary scheme using preset relation type compatibility constraints, and output the adjacent entity pairs in the corrected optimal boundary scheme as target relation triples. Specifically, please refer to Figure 4 Step S4, which iteratively corrects the optimal boundary scheme using preset relation type compatibility constraints, includes: Step S41: Construct a type compatibility matrix based on various entity types in the field of crop diseases and pests, and sort the entities in the optimal boundary scheme according to the starting character index to obtain a sorted entity list. Step S42: Traverse each adjacent entity pair in the entity list and use the type compatibility matrix to determine whether the entity types of adjacent entity pairs are compatible. In this embodiment, in the plant protection text for crop diseases and pests, the relationships between entities follow certain type compatibility rules (here, type refers to entity type, for simplification). For example, the "infection" relationship requires the head entity to be a disease or pest and the tail entity to be a crop, while "occurrence location" requires the head entity to be a disease or pest and the tail entity to be a location. If the type combination of adjacent entities in a certain boundary scheme (such as crop → disease) violates these rules, it indicates that the entity boundary of that boundary scheme is likely to have a deviation. Since the relationship classification results themselves contain reasonable constraints on entities (such as the aforementioned requirement that the head and tail entities be diseases and crops respectively for "infection"), this information could be used to reverse the entity boundary identification, but the existing architecture does not support this feedback.

[0033] In this embodiment, the optimal boundary scheme with the highest consistency score within each conflict group is selected. Then, the entity boundaries in the optimal boundary scheme are iteratively corrected using type compatibility constraints, and finally the corrected optimal boundary scheme is output. The optimal boundary scheme with the highest internal consistency score is selected as the correction starting point because it is most trusted by the original entity recognition model and has the lowest correction cost. For example (continuing from the previous example): The optimal boundary scheme for conflict group 1 is {corn (crop), large leaf spot (disease)}; in this optimal boundary scheme, two adjacent entities (corn end character index 1, large leaf spot start character index 2) do not conflict, but their entity type combination is crop → disease; in the type compatibility matrix, the combination of crop as head entity and disease as tail entity is usually incompatible (because "infection" requires disease → crop, not crop → disease), thus triggering correction; Specifically: First, obtain the entity list from the optimal boundary scheme, sort the entities in the optimal boundary scheme in ascending order by the starting character index, and if the starting character indices are the same, sort them in ascending order by the ending character index to obtain the sorted entity list. Each entity records its starting character index, ending character index, entity type, and initial weight; the entity type is obtained by matching the entity text in a pre-defined pest and disease dictionary; if there is no match in the dictionary, the entity type is marked as "unknown" and the corresponding entity does not participate in the correction; the pre-built pest and disease dictionary here can include various entity types in the field of crop pests and diseases; Type compatibility constraints can be constructed by building a type compatibility matrix. To achieve this, its dimension is the number of entity types multiplied by the number of entity types; entity types include diseases, pests, crops, parts, etc. Indicate entity type Head entity, entity type The tail entities can constitute at least one reasonable and valid semantic relation on crop diseases and pests (referred to as valid relation); this matrix From the existing labeled data, we can obtain the entity types of the head and tail entities of all valid relation pairs: If there exists a valid relation instance whose head entity has the following entity type... The entity type of the tail entity is ,but ,otherwise =0; the matrix Once determined, it remains unchanged during system operation; Next, the iterative correction process begins, with a maximum number of iterations T=5. In each iteration, each pair of adjacent entities in the entity list is traversed sequentially. (Left entity) and (Right entity), if or If the entity type is "unknown", skip the entity pair; otherwise, check... Is it 1, and Is it 1? Here Indicates the entity type of A. Indicates the entity type of B; like 1 or A value of 1 indicates that the entity types of A and B are compatible, requiring no correction, and the analysis continues to the next pair of adjacent entities; like =0 and A value of 0 indicates that the entity types of the two entities are incompatible, triggering a correction operation.

[0034] Step S43: If the entity types of any adjacent entity pair are incompatible, then the adjacent entity pairs in the optimal boundary scheme are iteratively corrected according to the preset iterative correction rule.

[0035] Further, please refer to Figure 5 Step S43, which iteratively corrects adjacent entity pairs in the optimal boundary scheme according to a preset iterative correction rule, includes: Step S431: Merge adjacent entity pairs to obtain merged entity, and determine whether the merged entity has a matching entity type in the preset pest and disease dictionary. Step S432: If the merged entity has a matching entity type in the preset pest and disease dictionary, then delete the adjacent entity pair from the entity list and insert the merged entity to update the entity list. Step S433: According to the updated entity list, re-traverse each adjacent entity pair in the entity list and iteratively correct the adjacent entity pairs in the optimal boundary scheme.

[0036] In this embodiment, if the entity types of any adjacent entity pair are incompatible, a merge-first strategy is adopted for that adjacent entity pair, because most boundary ambiguities (such as "corn" and "large leaf spot" should be merged into "corn large leaf spot") can be resolved by merging two adjacent entities; the merge operation is as follows: Entity and entity Merge into a new entity This is called the merged entity. ; The starting character index is equal to The starting character index, The index of the end character is equal to End character index, The corresponding text fragment is the original text from The beginning to The end; search for the text fragment in the preset pest and disease dictionary; if a match is found for the entity type, then... Set the entity type to match result; remove adjacent entity pairs from the entity list. and ,insert And reorder and update the entity list to get the updated entity list; and After the merge is complete, immediately mark that a correction has occurred in this round, and jump out of the current traversal to start a new round of iterative correction on the updated entity list from the beginning, following the above operations (because the length and order of the entity list have changed).

[0037] In one embodiment, after step S431, the method further includes: If the merged entity does not have a matching entity type in the preset pest and disease dictionary, the merged entity will be restored to an adjacent entity pair. Perform a boundary sliding operation on adjacent entity pairs to update them. Based on the updated adjacent entity pairs, use the type compatibility matrix to determine whether the entity types of the adjacent entity pairs are compatible. If the entity types of each adjacent entity pair are compatible or the iterative correction reaches the preset maximum number of iterations, then the iterative correction of the optimal boundary scheme is terminated.

[0038] like If the corresponding text fragment cannot be matched with any known entity type in the pest and disease dictionary, then the new entity will not be generated. Alternatively, the merged entities can be restored to adjacent entity pairs A and B. If merging A and B is deemed infeasible, the original entities can be retained. and And begin attempting the following boundary sliding operation to update adjacent entity pairs. and (Adjacent entity pairs can be accessed by sliding A or B individually) and (Update) ① Expand to the right: to The index of the ending character is increased by 1; like The new boundary exceeds the sentence length (out of bounds) or is related to... If there is overlap, skip it; otherwise, match the new entity type based on the new text corresponding to A. If the new entity type is not "unknown" and If A and B are compatible, then the modification is accepted. Indicates the new entity type of A after boundary sliding; ② Expand to the left: Decrease the starting character index by 1; like The new boundary crosses or is related to If there is overlap, skip it; otherwise, match the new entity type according to the new text corresponding to B. If so, then accept the correction; Indicates the new entity type of B after boundary sliding; ③Left contraction: to reduce to the left Decrease the index of the ending character by 1; like The corresponding new text matches the new entity type and is Compatibility, that is If so, then accept the correction; ④ Right contraction: to shrink to the right Increment the starting character index by 1; like The corresponding new text matches the new entity type and is Compatibility, that is If so, then accept the correction; It should be added that if the length of the character range of A or B is 1, that is, the starting character index is equal to the ending character index, the above "left shrinking" and "right shrinking" operations are not applicable and must be skipped (skipping itself means that the corresponding operation fails).

[0039] If all four sliding operations fail, then keep , If unchanged, continue analyzing the next pair of adjacent entities; After one iteration, if no corrections occur in this round, it means that the entity types of each adjacent entity pair are compatible, and the iteration terminates; otherwise, continue to the next round until the maximum number of iterations is reached. ; In one embodiment, if there are multiple conflict groups in a sentence, the above correction is performed independently on each conflict group (each group takes the optimal boundary scheme with the highest internal consistency score for correction) to obtain the corrected optimal boundary scheme for each conflict group; then the entities in these optimal boundary schemes are merged to form a sentence-level entity list, still sorted by the starting character index; for adjacent entity pairs across conflict groups (i.e., the last entity of the previous group and the first entity of the next group), the same iterative correction operation is performed again (at this time, the group distinction is not distinguished, and the global correction is performed directly), finally obtaining a globally corrected entity subset (the optimal boundary scheme itself is in the form of an entity subset). For ease of description, regardless of whether the sentence has a single conflict group or multiple conflict groups, the iterative correction of one or more optimal boundary schemes is collectively referred to as the globally corrected entity subset.

[0040] If two or more boundary schemes have the same highest score for internal consistency, the scheme with the fewest candidate entities will be selected first. If the number of entities is still the same, the original starting order of the entities involved in the scheme in the original text will be compared, and the scheme with the first position in the order of the first position will be selected as the unique optimal boundary scheme.

[0041] In one embodiment, step S4, which outputs adjacent entity pairs in the corrected optimal boundary scheme as target relation triples, includes: The relation type of adjacent entity pairs in the revised optimal boundary scheme is labeled as the related type to obtain the initial relation triplet; Based on the mapping table between relation types and entity type pairs in the field of crop diseases and pests, determine the actual relation types of adjacent entity pairs and adjust the initial relation triplets to output the target relation triplets.

[0042] In this embodiment, the modified optimal boundary scheme refers to the aforementioned global modified entity subset, which covers the case where there is a single conflict group or multiple conflict groups in the sentence.

[0043] For each pair of adjacent entities A and B in the globally modified entity subset, if If =1, then an initial relation triplet will be output, in the format (text of A, r, text of B). The relation type r of the initial relation triplet will be uniformly labeled as "related". All initial relation triplets will be output in order of sentence number.

[0044] Based on the initial relation triples, these entity pairs are converted into specific relation types and written into the knowledge graph; Due to the type compatibility matrix The legality of the entity type combinations of the head and tail entities has been recorded, but the specific relationship type has not been specified. Based on knowledge of crop diseases and pests, this embodiment predefines a default relationship type for each legal entity type combination. Specifically, the actual relationship type between adjacent entity pairs can be identified by constructing a mapping table between relationship types and entity type pairs.

[0045] For example: Disease → Crop corresponds to "Infection", Pest → Crop corresponds to "Damage", Disease → Part corresponds to "Occurrence Location", Pest → Part corresponds to "Occurrence Location", Pesticide → Disease corresponds to "Control", Pesticide → Pest corresponds to "Control", Disease → Disease corresponds to "Accompanying Occurrence", Pest → Pest corresponds to "Accompanying Occurrence". This mapping table can be fine-tuned based on actual corpus data without training. For each adjacent entity pair A and B, obtain the entity type of A and B respectively to get their entity type pair, query the above mapping table to get the actual relation type r, and thus obtain the target relation triple (A, r, B). Step S5: Write each target relation triple into the graph database to construct a knowledge graph for crop diseases and pests.

[0046] Summarize all target relation triples by sentence number; for cases where the same entity pair appears multiple times and the relation type is consistent, retain only one target relation triple; if the same entity pair appears multiple times but the relation types are inconsistent, retain the target relation triple with the more frequent occurrences of the relation type and record the conflict location for manual review. Furthermore, if the highest total number of occurrences of multiple specific relationships are all equal, the forced output of the associated results to the database for this batch of entities will be suspended. Instead, the original state of the output will be encapsulated and transferred to the manual anomaly judgment file list pool for subsequent anomaly processing.

[0047] Finally, the target relation triples are written into the graph database; each entity is a node, and the node attributes record the entity type and the position of occurrence; each relation is a directed edge, and the edge attributes record the relation type. Once the data is written, a knowledge graph for crop diseases and pests is obtained.

[0048] This invention introduces a feedback mechanism at the pipeline decoding end without altering the underlying structure of the entity recognition model. It utilizes semantic constraints at the relation level to inversely correct entity boundaries, thereby improving the accuracy of entity boundary recognition and reducing or preventing the omission of correct (entity, relation, entity) triples in the crop pest and disease knowledge graph. Specifically, addressing the technical shortcomings of traditional knowledge graph pipeline architectures—lack of interaction between entity boundary recognition and relation extraction, and the inability to correct entity boundary recognition errors—this invention employs bundle search to retain multiple candidate entity boundaries, enumerates non-overlapping schemes through conflict groups, and uses relation type compatibility constraints to drive iterative correction of boundary schemes, enabling relation constraints to inversely correct entity boundaries. This invention effectively suppresses the propagation of knowledge entity errors and improves the accuracy of entity boundary recognition and (entity, relation, entity) triple extraction without changing the existing model structure or performing joint training. It also maintains the simplicity and modularity of the pipeline architecture, allowing for low-cost adaptation to deployed systems and possessing significant engineering practical value.

[0049] Example 2: This invention also proposes a knowledge graph construction device for crop diseases and pests. The device can be a computer, a server, or a combination of multiple devices for data analysis and computation.

[0050] Based on the hardware structure of the above-mentioned knowledge graph construction device for crop diseases and pests, various embodiments of the knowledge graph construction method for crop diseases and pests of the present invention are implemented.

[0051] Furthermore, the present invention also provides a knowledge graph construction system for crop diseases and pests, the knowledge graph construction system for crop diseases and pests includes: The conflict partitioning module is used to decode sentences in plant protection texts through bundle search to obtain multiple label sequences, extract entities from each label sequence to obtain a candidate entity pool, determine the initial weights of candidate entities in the candidate entity pool, and divide the candidate entity pool into conflict groups according to the character index of the candidate entities. The boundary iteration module is used to combine non-overlapping entities in the conflict group to form a subset of entities as the boundary scheme. It uses the initial weights of each entity in the entity subset to determine the optimal boundary scheme. It iteratively corrects the optimal boundary scheme using preset relation type compatibility constraints, and outputs the adjacent entity pairs in the corrected optimal boundary scheme as target relation triples. Each target relation triple is written into the graph database to construct a knowledge graph for crop diseases and pests.

[0052] The method implemented by the knowledge graph construction system for crop diseases and pests can be referred to in various embodiments of the knowledge graph construction method for crop diseases and pests of this invention, and will not be repeated here.

[0053] Furthermore, the present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a knowledge graph construction program for crop diseases and pests, wherein when the knowledge graph construction program for crop diseases and pests is executed by a processor, it implements the steps of the knowledge graph construction method for crop diseases and pests as described above.

[0054] The method implemented when the knowledge graph construction program for crop diseases and pests is executed can be referred to in various embodiments of the knowledge graph construction method for crop diseases and pests of this invention, and will not be repeated here.

Claims

1. A method for constructing a knowledge graph for crop diseases and pests, characterized in that, The method includes: The sentences in the plant protection text are decoded by bundle search to obtain multiple label sequences, and the entities in each label sequence are extracted to obtain a candidate entity pool; Determine the initial weights of candidate entities in the candidate entity pool, and divide the candidate entity pool into conflict groups based on the character index of the candidate entities; The entity subset obtained by combining non-overlapping entities in the conflict group is used as the boundary scheme, and the optimal boundary scheme is determined by using the initial weights of each entity in the entity subset. The optimal boundary scheme is iteratively corrected using preset relation type compatibility constraints, and the adjacent entity pairs in the corrected optimal boundary scheme are output as target relation triples. Each target relation triple is written into a graph database to construct a knowledge graph for crop diseases and pests.

2. The method for constructing a knowledge graph for crop diseases and pests according to claim 1, characterized in that, The process of decoding sentences in plant protection texts using bundle search to obtain multiple tag sequences includes: Based on the character length of the target sentence in the plant protection text, determine the preset number of label sequences to retain by sorting them according to label probabilities; The target sentence is decoded using a bundle search to obtain multiple label sequences of a preset number. Each label sequence corresponds to a set of entity boundary and entity type annotation schemes.

3. The method for constructing a knowledge graph for crop diseases and pests according to claim 1, characterized in that, Determining the initial weights of candidate entities in the candidate entity pool includes: Determine the number of times the target candidate entity appears in all label sequences in the candidate entity pool, and determine the total number of sequences in all label sequences; The ratio of the number of target occurrences to the total number of sequences is calculated and used as the initial weight of the target candidate entity, where the initial weight represents the statistical confidence of the entity boundary and entity type of the target candidate entity.

4. The method for constructing a knowledge graph for crop diseases and pests according to claim 1, characterized in that, The step of dividing the candidate entity pool into conflict groups based on the character index of the candidate entities includes: The character range of the candidate entity is determined based on the starting character index and the ending character index of the candidate entity, and it is determined whether the character ranges of any two candidate entities overlap. If the character ranges of any two candidate entities overlap, then the two candidate entities are included in the same conflict group to divide the candidate entity pool into conflict groups.

5. The method for constructing a knowledge graph for crop diseases and pests according to claim 1, characterized in that, The method of determining the optimal boundary scheme using the initial weights of each entity in the entity subset includes: The internal consistency score of the boundary scheme is determined by using the initial weights of each entity in the entity subset, and the boundary scheme with the highest internal consistency score is determined as the optimal boundary scheme.

6. The method for constructing a knowledge graph for crop diseases and pests according to claim 1, characterized in that, The iterative correction of the optimal boundary scheme using preset relation type compatibility constraints includes: A type compatibility matrix is ​​constructed based on various entity types in the field of crop diseases and pests. The entities in the optimal boundary scheme are sorted according to the starting character index to obtain a sorted entity list. Iterate through each pair of adjacent entities in the entity list and use the type compatibility matrix to determine whether the entity types of adjacent entity pairs are compatible. If the entity types of any adjacent entity pair are incompatible, the adjacent entity pairs in the optimal boundary scheme are iteratively corrected according to the preset iterative correction rules.

7. The method for constructing a knowledge graph for crop diseases and pests according to claim 6, characterized in that, The iterative correction of adjacent entity pairs in the optimal boundary scheme according to the preset iterative correction rule includes: The adjacent entity pairs are merged to obtain the merged entity. It is then determined whether the merged entity has a matching entity type in the preset pest and disease dictionary. If the merged entity has a matching entity type in the preset pest and disease dictionary, then delete the adjacent entity pair from the entity list and insert the merged entity to update the entity list. Based on the updated entity list, re-traverse each adjacent entity pair in the entity list and iteratively correct the adjacent entity pairs in the optimal boundary scheme.

8. The method for constructing a knowledge graph for crop diseases and pests according to claim 7, characterized in that, The step of determining whether the merged entity has a matching entity type in a preset pest and disease dictionary also includes: If the merged entity does not have a matching entity type in the preset pest and disease dictionary, the merged entity will be restored to an adjacent entity pair. Perform a boundary sliding operation on adjacent entity pairs to update them. Based on the updated adjacent entity pairs, use the type compatibility matrix to determine whether the entity types of the adjacent entity pairs are compatible. If the entity types of each adjacent entity pair are compatible or the iterative correction reaches the preset maximum number of iterations, then the iterative correction of the optimal boundary scheme is terminated.

9. The method for constructing a knowledge graph for crop diseases and pests according to claim 1, characterized in that, The step of outputting adjacent entity pairs in the corrected optimal boundary scheme as target relation triples includes: The relation type of adjacent entity pairs in the revised optimal boundary scheme is labeled as the related type to obtain the initial relation triplet; Based on the mapping table between relation types and entity type pairs in the field of crop diseases and pests, determine the actual relation types of adjacent entity pairs and adjust the initial relation triplets to output the target relation triplets.

10. A knowledge graph construction system for crop diseases and pests, characterized in that, The system is used to implement the knowledge graph construction method for crop diseases and pests as described in any one of claims 1 to 9; the system includes: The conflict partitioning module is used to decode sentences in plant protection texts through bundle search to obtain multiple label sequences, extract entities from each label sequence to obtain a candidate entity pool, determine the initial weights of candidate entities in the candidate entity pool, and divide the candidate entity pool into conflict groups according to the character index of the candidate entities. The boundary iteration module is used to combine non-overlapping entities in the conflict group to form a subset of entities as the boundary scheme. It uses the initial weights of each entity in the entity subset to determine the optimal boundary scheme. It iteratively corrects the optimal boundary scheme using preset relation type compatibility constraints, and outputs the adjacent entity pairs in the corrected optimal boundary scheme as target relation triples. Each target relation triple is written into the graph database to construct a knowledge graph for crop diseases and pests.