A method for constructing a grape planting knowledge graph database
Through deep language model and multi-feature fusion efficient knowledge extraction network, knowledge in the field of grape cultivation is extracted from multi-source heterogeneous data and assembled into a knowledge graph database, which solves the problem of small database size and incomplete knowledge coverage in the existing technology. and the problem of slow updates achieve efficient and accurate knowledge construction and update.
Patent Information
- Application Number
- CN202210624917.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-02
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-06-02
AI Technical Summary
The existing knowledge graph database in the grape cultivation field is small in scale, incomplete in knowledge coverage, low construction efficiency and accuracy, and slow knowledge update and high cost.
The deep language model is used to extract knowledge from multi-source heterogeneous data, and the extracted knowledge is assembled into a knowledge graph based on the ontology layer of the grape planting field, and trained through a multi-feature fusion high-efficiency knowledge extraction network (BERT+BiGRU+CRF). Generate formatted text and assemble it into triples, and use the Neo4j graph database for persistence.
The built knowledge graph database is low cost, high knowledge integrity, and convenient update and maintenance, which improves the efficiency of triple construction and reduces the cost of model training while ensuring accuracy.
Smart Images

Figure CN114996474B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of agronomy and relates to the construction of a knowledge graph database, and specifically to a method for constructing a grape planting knowledge graph database. Background Art
[0002] The essence of knowledge graph is semantic network, which can be used to describe objective entities, concepts and their relationships in the real world. Google released the knowledge graph in 2012 and applied it to search engines, effectively improving search efficiency. Knowledge graphs are usually composed of a large number of triples such as "entity-relationship-entity" and "entity-attribute name-attribute". Generally speaking, knowledge graphs can be divided into general knowledge graphs and domain knowledge graphs. The former contains a large number of common sense entities, while the latter consists of professional knowledge in the field, emphasizing the depth and accuracy of knowledge.
[0003] The logical structure of the knowledge graph can be divided into two parts: the model layer and the entity layer. The former is also called the ontology layer. The model layer stores the core concepts and logic of the domain. It is generally a knowledge framework formed through abstraction and refinement and does not contain instances. The entity layer stores specific knowledge content.
[0004] According to the order of constructing the ontology layer and the entity layer, the construction of the knowledge graph can be divided into three methods: top-down, bottom-up, and a mixture of the two. The top-down method is to first construct the ontology layer of the knowledge graph, refine it from the highest level concept step by step, and clarify the relationship between the concepts to form a complete knowledge framework, and then fill the corresponding knowledge into the constructed ontology layer to form the entity layer. This method is suitable for situations where the knowledge scope is clear, the data source is guaranteed, and the purpose of the built knowledge graph is clear. Bottom-up is to first extract knowledge instances such as entities, attributes, relationships, and events from the data to construct the entity layer. When the knowledge accumulates to a certain extent, it is summarized and summarized to abstract the concept of knowledge to construct the ontology layer. This method is suitable for situations where the knowledge scope is unclear and the data source is not guaranteed. The combination of the two is to summarize and summarize on the basis of extracting a small amount of knowledge, construct a preliminary ontology layer, and then continue to extract knowledge to iteratively update the current ontology layer. After the update, a new round of knowledge filling is carried out, so that the entity layer and the ontology layer can interact until the knowledge graph is constructed.
[0005] Building a domain knowledge graph database involves a series of natural language processing technologies such as named entity recognition and relationship extraction. Applying knowledge graphs to the field of grape cultivation can connect fragmented and partially observed entities and concepts together to form a complete structured knowledge system, which is convenient for managing, retrieving, using and understanding the information contained therein.
[0006] Currently, agricultural knowledge graphs are just getting started, and there are even fewer knowledge graph databases in the field of grape cultivation. Most of them are built based on manual or traditional machine learning methods, so there are the following problems: (A) small scale and incomplete knowledge coverage; (B) low construction efficiency and accuracy. The models used in the construction process often only focus on a single feature and have poor generalization ability; (C) knowledge updates are slow and costly. Summary of the invention
[0007] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a method for constructing a grape planting knowledge graph database to solve the technical problem that the completeness of database knowledge obtained by the construction method in the prior art needs to be further improved.
[0008] In order to solve the above technical problems, the present invention adopts the following technical solutions to achieve the above problems:
[0009] A method for constructing a grape planting knowledge graph database, the method is carried out according to the following steps:
[0010] Step S1, design the relationship between the top concepts and concepts in the knowledge graph database to obtain the ontology layer;
[0011] Step S1 specifically includes the following steps:
[0012] Step S101, constructing the relationship between top-level concepts and concepts;
[0013] Step S102, refining the top-level concepts to obtain the second-level concepts, thus realizing the construction of the ontology layer;
[0014] Step S103, storing the constructed ontology layer in the "grape ontology.owl" file;
[0015] Step S2, constructing a grape text dataset, annotating 7 types of entities using the BIO annotation method, and extracting character radicals to obtain an annotated dataset;
[0016] The seven types of entities are variety names, place names, pest names, disease names, chemical drug names, fertilizer names, and agricultural technical terms;
[0017] Step S2 specifically includes the following steps:
[0018] Step S201, crawling data from multiple data sources, and storing the crawled data into "grape data set.corpus";
[0019] Step S202, using semi-automatic annotation technology to perform BIO annotation on "grape dataset.corpus", and storing the annotation result in "grape dataset_BIO.corpus";
[0020] Step S203: Extract radicals, update the "Grape Dataset_BIO.corpus", and obtain the labeled dataset;
[0021] Step S3: Divide the labeled dataset into a training set, a validation set, and a test set according to 8:1:1;
[0022] Step S4: Input the training set into the multi-feature fusion efficient knowledge extraction network for training to obtain the trained network model;
[0023] The multi-feature fusion efficient knowledge extraction network is an improved BERT+BiGRU+CRF network;
[0024] The BERT is a deep pre-trained language model;
[0025] The BiGRU is a feature extraction module;
[0026] The CRF is a feature decoding module;
[0027] The improvement method of the BERT+BiGRU+CRF network includes the following steps:
[0028] Step S401: The original input of the BERT+BiGRU+CRF network is the embedded character vector set {h1, h2, h3,..., h n}, and integrate the radical features into {h1, h2, h3,..., h n};
[0029] The embedded character vector h i is the character vector h i of size 120*1 mapped from the i-th character in a sentence S;
[0030] The improvement process of integrating radical features is as follows:
[0031] As shown in Equation Ⅰ, extract the radical d i of the character c i ;
[0032] h i = h i * d_rate Equation Ⅰ;
[0033] In the formula, d_rate is a coefficient; if the radical d i is "艹", "疒", or "虫", then set d_rate to 1.05 to update h i ; if the radical d i is other, then set d_rate to 1.0 to update h i ;
[0034] Step S402, improving the feature extraction module in the BERT+BiGRU+CRF network architecture;
[0035] The improvement method is as follows: after BERT, a residual module is added in parallel with BiGRU;
[0036] The residual module consists of a dropout layer, a convolutional layer and a ReLU function;
[0037] Step S5, pre-processing the multi-source heterogeneous grape text and inputting it into the trained network model to obtain formatted text;
[0038] The preprocessing is as follows: segmenting the original multi-source heterogeneous grape text according to periods, and extracting the radical of each character in the sentence; randomly initializing each character in each sentence to a 120*1 dimensional original feature vector, and updating it according to the method described in step S401;
[0039] The process of obtaining the formatted text includes the following steps:
[0040] Step S501: After the original multi-source heterogeneous grape text is preprocessed, the sentence containing num_step characters is converted into a feature matrix of num_step*120 dimensions including character features, word segmentation features and radical features, which is input into BERT to obtain a feature matrix of num_step*768 dimensions including global character dependency features;
[0041] Step S502: Input the feature matrix containing global character dependency features of num_step*768 dimensions into the forward GRU network, the reverse GRU network and the residual module respectively, and obtain the feature matrices with forward and backward character dependency features of num_step*300 dimensions respectively. num_step*600-dimensional feature matrix h with global character dependency features RS ;
[0042] Step S503, merging the three feature matrices obtained in step S502;
[0043] Specifically, the feature matrix with forward and backward character-dependent features The fusion method is as in formula II, and after fusion, With the feature matrix h with global character dependence features RS The fusion method is as shown in formula III; finally, the feature matrix H is obtained;
[0044]
[0045]
[0046] Step S504, input the feature matrix H into CRF to obtain the annotation sequence of the original input sentence; according to the annotation result, format it into one sentence per line, including the original input text, entity start position, entity end position and entity category;
[0047] Step S6, under the guidance and constraints of the ontology layer, assembling the formatted text into triples, i.e., the entity layer;
[0048] Step S7, using the Neo4j graph database to persist the triples, so as to realize the construction of the grape planting knowledge graph database.
[0049] The present invention also has the following technical features:
[0050] In step S101, the top-level concepts include: grape variety concept, grape origin concept, grape pest concept, grape disease concept, grape pest control chemical drug concept, fertilizer concept and agricultural technical term concept.
[0051] In step S101, the relationships between the concepts include: an origin relationship between the grape variety concept and the grape origin concept, a susceptibility relationship between the grape variety concept and the grape disease concept, a fertilization relationship between the grape variety concept and the fertilizer concept, a harm relationship between the grape variety concept and the grape insect pest concept, a prevention and control relationship between the concept of chemical drugs for preventing and controlling grape diseases and insect pests and the grape insect pest concept and the grape disease concept, and an operation relationship between the grape variety concept and the agricultural technical term concept.
[0052] In step S102, the concept of grape diseases includes infectious diseases and physiological diseases; the concept of chemical drugs for preventing and controlling grape diseases and pests includes pest control pesticides and disease control pesticides; the concept of agricultural technology terms includes seedling breeding technology, tree management, establishment of high-yield vineyards, harvesting, packaging and storage and transportation, soil, fertilizer and water management and protected cultivation; the concept of grape varieties includes fresh food varieties, rootstock varieties and winemaking and juice making varieties.
[0053] In step S201, the multiple data sources include abstracts of published public papers and encyclopedia websites.
[0054] In step S202, the BIO notation is as follows: the first character of a type entity is marked as Ba, the middle character or the end character is marked as Ia, and other irrelevant characters are marked as O.
[0055] In step S203, if a certain character contains the grass radical (艹), append the marker X after the corresponding character; if a disease name entity contains the disease radical (疒), append the marker Y after the corresponding character; if a pest name (insect name) entity contains the insect radical (虫), append the marker Z after the corresponding character; for characters containing other radicals, append the marker O; update the "Grape Dataset_BIO.corpus" according to the above rules, and the final form is that each line stores a character, a category marker, and a radical marker, with blank lines separating sentences from each other.
[0056] In step S5, the multi-source heterogeneous grape texts are agricultural websites, monographs in the grape field, and encyclopedia websites.
[0057] In step S5, the 120*1-dimensional original feature vector contains a 100*1-dimensional original character feature vector and a 20*1-dimensional original word segmentation feature vector.
[0058] In step S502, the residual module is composed of a dropout layer, a 1*1 convolutional layer, and a ReLU function.
[0059] In step S6, the form of the triple is <head entity, relation, tail entity> or <head entity, attribute, attribute name>.
[0060] Compared with the prior art, the present invention has the following technical effects:
[0061] (Ⅰ) The method of the present invention uses a deep language model to extract knowledge from multi-source heterogeneous data and assembles the extracted knowledge into a knowledge graph according to the ontology in the grape planting field. The constructed knowledge graph database has low cost, high knowledge integrity, and is convenient for updating and maintenance.
[0062] (Ⅱ) The method of the present invention divides the construction of the grape planting knowledge graph database into two stages: ontology layer construction and entity layer construction. Under the constraint of the ontology layer, the efficiency of triple construction can be improved.
[0063] (Ⅲ) The knowledge extraction model of the present invention integrates multiple features, fully utilizes the deep pre-training model and dataset information, and the adopted residual structure can reduce the model training cost while ensuring the accuracy. Description of the Drawings
[0064] Figure 1 is a flowchart of the method for constructing a grape planting knowledge graph.
[0065] Figure 2 is a structural diagram of the named entity recognition model.
[0066] Figure 3 is a structural diagram of the residual.
[0067] Figure 4 It is a schematic diagram of knowledge extraction.
[0068] Figure 5 This is a schematic diagram of the knowledge graph database (part).
[0069] The specific contents of the present invention are further explained in detail below in conjunction with embodiments. DETAILED DESCRIPTION
[0070] It should be noted that, unless otherwise specified, all software, modules and layers in the present invention are software, modules and layers known in the prior art.
[0071] In accordance with the above technical scheme, specific embodiments of the present invention are given below. It should be noted that the present invention is not limited to the following specific embodiments, and all equivalent changes made on the basis of the technical scheme of this application fall within the protection scope of the present invention.
[0072] Example:
[0073] This embodiment provides a method for constructing a grape planting knowledge graph database. Figure 1 As shown, the method is performed according to the following steps:
[0074] Step S1, design the relationship between the top-level concepts and concepts in the knowledge graph database to obtain the ontology layer.
[0075] Specifically, step S1 specifically includes the following steps:
[0076] Step S101, constructing the relationship between top-level concepts and concepts based on domain monographs;
[0077] The top-level concepts include: grape variety concept, grape origin concept, grape pest concept, grape disease concept, chemical medicine concept for preventing and controlling grape pest, fertilizer concept and agricultural technical term concept.
[0078] The relationships between the concepts include: the origin relationship between the concept of grape variety and the concept of grape origin, the susceptibility relationship between the concept of grape variety and the concept of grape disease, the fertilization relationship between the concept of grape variety and the concept of fertilizer, the harm relationship between the concept of grape variety and the concept of grape insect pest, the prevention and control relationship between the concept of chemical drugs for preventing and controlling grape diseases and insect pests and the concept of grape insect pests and grape diseases, and the operational relationship between the concept of grape variety and the concept of agricultural technical terms;
[0079] Preferably, the monographs in the field include the publicly published "Efficient Cultivation of Grapes and Prevention of Pests and Diseases by Looking at Pictures", "Healthy Cultivation of Grapes and Prevention of Pests and Diseases", "Scientific Management of Vineyard Nutrition and Fertilizer and Water", "Chinese Grape Varieties", "Questions and Answers on New and Superior Grape Varieties and Cultivation Techniques" and "Reasonable Shaping and Pruning of Grapes".
[0080] Step S102, based on the domain monographs, the top-level concepts are refined to obtain the secondary concepts, thus realizing the construction of the ontology layer;
[0081] The concept of grape diseases includes infectious diseases and physiological diseases;
[0082] The concept of chemical drugs for controlling grape pests and diseases includes pest control pesticides and disease control pesticides;
[0083] The agricultural technology concepts mentioned include seedling propagation technology, tree management, establishment of high-yield vineyards, harvesting, packaging and storage and transportation, soil, fertilizer and water management, and protected cultivation;
[0084] The concept of grape varieties includes fresh food varieties, rootstock varieties and wine-making and juice-making varieties.
[0085] Preferably, in step S102, the top-level concept may be refined into multiple levels.
[0086] Step S103, storing the constructed ontology layer in the "grape ontology.owl" file;
[0087] owl file is a common file format for storing the ontology layer of the knowledge graph database, which stores the constructed ontology hierarchical structure and content.
[0088] Step S2, constructing a grape text dataset, annotating 7 types of entities using the BIO annotation method, and extracting character radicals to obtain an annotated dataset;
[0089] The seven types of entities are variety names, place names, pest names (insect names), disease names, chemical drug names, fertilizer names, and agricultural technical terms;
[0090] Step S2 specifically includes the following steps:
[0091] Step S201, crawling data from multiple data sources, and storing the crawled data into "grape data set.corpus";
[0092] Preferably, the multiple data sources include abstracts of published public papers and encyclopedia websites;
[0093] Specifically, the method for obtaining the abstracts of the published papers is: using web crawler technology to parse the Wanfang database (https: / / www.wanfangdata.com.cn / ), setting the "topic" to "grapes" and the "subject category" to "agricultural science". After parsing, extract the abstracts marked as " summary: " and save the result into "Grape Dataset.corpus". Each line stores the abstract of a paper in utf-8 encoding format.
[0094] In this embodiment, the web crawler technology adopts the known web crawler technology.
[0095] Specifically, the encyclopedia website data acquisition method is: manually construct common entries in the field of grape planting, search Baidu Encyclopedia (https: / / baike.baidu.com / ) and parse the page, extract the words marked as " <div class=’lemma-summary’label-module=’lemmasummary’>For the text below, store the results in "grape dataset.corpus", with each line storing the abstract of a term, and the encoding format being utf-8;
[0096] In step S202, use semi-automatic annotation technology to perform BIO annotation on "grape dataset.corpus", and store the marked results in "grape dataset_BIO.corpus";
[0097] Specifically, the semi-automatic annotation technology is to manually construct common entities in the field and store them in the "field entities.dict" file with the encoding format of utf-8, and use the third-party Python library Jieba to annotate "grape dataset.corpus";
[0098] Specifically, the BIO annotation method is that the first character of type-a entity is marked as B-a, the middle character or the ending character is marked as I-a, and other irrelevant characters are marked as O. For example, for the sentence "White rot is the most main disease that causes fruit rot during the grape growth period", the annotation sequence using the BIO annotation method is "B-DIS I-DIS E-DIS O O O O O O O OO O O O O O O O O O O"; store the marked results in "grape dataset_BIO.corpus" with the encoding format of utf-8, and each line stores a character and a mark, and there is a blank line between sentences;
[0099] In step S203, extract radicals and update "grape dataset_BIO.corpus" to obtain the annotated dataset;
[0100] Specifically, if a character contains the grass radical (艹), append the mark X after the corresponding character; if a disease name entity in the disease category contains the disease radical (疒), append the mark Y after the corresponding character; if an insect name entity in the insect pest name (insect name) category contains the insect radical (虫), append the mark Z after the corresponding character; append the mark O for characters containing other radicals; update "grape dataset_BIO.corpus" according to the above rules, and the final form is that each line stores a character, a category mark and a radical mark, and there is a blank line between sentences.
[0101] In step S3, divide the annotated dataset into a training set, a validation set and a test set according to 8:1:1;
[0102] In this embodiment, the "grapes dataset_BIO.corpus" is randomly divided into three files, "grapes.train", "grapes.dev" and "grapes.test", according to 8:1:1, and the encoding format is utf-8; the three files described in step S3 all contain the 7 types of entities described in step S2, as well as category tags and radical tags.
[0103] Step S4, inputting the training set into a multi-feature fusion efficient knowledge extraction network for training to obtain a trained network model;
[0104] Specifically, in step S4, the multi-feature fusion efficient knowledge extraction network is an improved BERT+BiGRU+CRF network, and the specific structural diagram is as follows: Figure 2 As shown, Figure 2 middle:
[0105] BERT is a deep pre-trained language model that provides global character dependency features;
[0106] BiGRU is a feature extraction module that can provide local character dependency features;
[0107] RS represents residual structure;
[0108] CRF is a feature decoding module;
[0109] {E CLS ,E1,E2,…,E N } Input character vector to the model, including original embedding vector and radical feature weight vector;
[0110] Specifically, in step S4, the method for improving the BERT+BiGRU+CRF network includes the following steps:
[0111] Step S401: The original input of the BERT+BiGRU+CRF network is the embedded character vector set {h1,h2,h3,…,h n }, integrating radical features into {h1,h2,h3,…,h n };
[0112] The embedded character vector h i Map the i-th character in a sentence S into a character vector h of size 120*1 i ;
[0113] The improvement process of incorporating radical features is as follows:
[0114] As shown in formula I, extract character c i The radical d i ;
[0115] h i = h i * d_rate, Equation Ⅰ;
[0116] In the formula, d_rate is a coefficient; if the radical d i is "艹", "疒" or "虫", then set d_rate to 1.05 to update h i ; if the radical d i is other, then set d_rate to 1.0 to update h i ;
[0117] In this embodiment, the introduction of radical features is to further utilize the information contained in the dataset, thereby strengthening the character vector features and improving the accuracy of named entity recognition.
[0118] Step S402, improve the feature extraction module in the BERT+BiGRU+CRF network architecture;
[0119] The improvement method is: after BERT, add a residual module parallel to BiGRU;
[0120] Specifically, as Figure 3 shown, the residual module consists of a dropout layer, a convolutional layer and a ReLU function; in Figure 3 this embodiment, two residual modules are provided, and the difference lies in the size of the convolutional kernel in the convolutional module;
[0121] The above adjustments in this embodiment retain the global character dependency features provided by BERT on the basis that the original BERT+BiGRU+CRF network mainly uses local character dependency features for entity recognition. The multi-feature fusion is beneficial to the model to identify the subtle differences between different entities, thereby improving the recognition accuracy.
[0122] Step S5, preprocess the multi-source heterogeneous grape texts and input them into the trained network model to obtain formatted texts;
[0123] The multi-source heterogeneous grape texts are agricultural websites, grape field monographs and encyclopedia websites;
[0124] The preprocessing is: split the original multi-source heterogeneous grape texts by full stops and extract the radicals of each character in the sentences; randomly initialize each character in each sentence as a 120*1-dimensional original feature vector and update it according to the method described in step S401;
[0125] Specifically, the 120*1-dimensional original feature vector includes a 100*1-dimensional original character feature vector and a 20*1-dimensional original word segmentation feature vector;
[0126] Specifically, the process of obtaining the formatted text in step S5 includes the following steps:
[0127] Step S501: After the original multi-source heterogeneous grape text is preprocessed, the sentence containing num_step characters is converted into a feature matrix of num_step*120 dimensions including character features, word segmentation features and radical features, which is input into BERT to obtain a feature matrix of num_step*768 dimensions including global character dependency features;
[0128] Step S502: Input the feature matrix containing global character dependency features of num_step*768 dimensions into the forward GRU network, the reverse GRU network and the residual module respectively, and obtain the feature matrices with forward and backward character dependency features of num_step*300 dimensions respectively. num_step*600-dimensional feature matrix h with global character dependency features Rs ;
[0129] Specifically, in step S502, the residual module comprises a dropout layer, a 1*1 convolution layer and a ReLU function;
[0130] Step S503, merging the three feature matrices obtained in step S502;
[0131] Specifically, the feature matrix with forward and backward character-dependent features The fusion method is as in formula II, and after fusion, With the feature matrix h with global character dependence features RS The fusion method is as shown in formula III; finally, the feature matrix H is obtained;
[0132]
[0133]
[0134] Step S504, input the feature matrix H into CRF to obtain the annotation sequence of the original input sentence; according to the annotation result, format it into one sentence per line, including the original input text, entity start position, entity end position and entity category;
[0135] Step S6, under the guidance and constraints of the ontology layer, assembling the formatted text into triples, i.e., the entity layer;
[0136] Specifically, the triple is in the form of <head entity, relationship, tail entity> or <head entity, attribute, attribute name>;
[0137] Specifically, for entities within a fixed range, such as Figure 4 As shown, the original text is "Eros Rose, requires sufficient potassium fertilizer, pay attention to the prevention and control of downy mildew in the rainy season.", and its corresponding formatted text is "{text:"Eros Rose, requires sufficient potassium fertilizer, pay attention to the prevention and control of downy mildew in the rainy season.", entities:[["Eros Rose",1,4,"GRA"],["Potassium fertilizer",8,9,"FER"],["Downy mildew",19,21,"DIS"]]}", according to the "grape ontology.owl" obtained in step S1, the relationship between GRA (grape variety concept) and FER (fertilizer concept) is "fertilization relationship", so the triple <Eros Rose, fertilization, potassium fertilizer> is obtained; the relationship between GRA (grape variety concept) and DIS (grape disease concept) is "susceptible relationship", so the triple <Eros Rose, susceptible, downy mildew> is obtained;
[0138] Specifically, the fixed range in this embodiment is 3 natural segments;
[0139] Step S7, the triples are stored persistently using the Neo4j graph database, such as Figure 5 As shown, the construction of the grape planting knowledge graph database is realized.
[0140] Comparative Example 1:
[0141] This comparative example provides a knowledge extraction method network, which differs from the multi-feature fusion efficient knowledge extraction network in the embodiment in that the method does not include residual structure and radical features.
[0142] Comparative Example 2:
[0143] This comparative example provides a knowledge extraction network. The difference between this method and the multi-feature fusion efficient knowledge extraction network in the embodiment is that this method does not include radical features.
[0144] Comparative Example 3:
[0145] This comparative example provides a knowledge extraction network. The difference between this method and the multi-feature fusion efficient knowledge extraction network in the embodiment is that the network does not contain a residual structure.
[0146] Experimental verification:
[0147] The multi-feature fusion efficient knowledge extraction network of the present invention is compared with the comparative example.
[0148] Experimental background: In order to prove the accuracy of the multi-feature fusion efficient knowledge extraction network in the present invention, the results of knowledge extraction using the present invention and only using the BERT+BiGRU+CRF network will be compared.
[0149] Experimental environment: The operating system is Windows 10 and the GPU is NVIDA RTX2080ti.
[0150] Experimental method: The test data uses the grape data in this example. Currently, there is no public data set in the agricultural field, so the model generalization ability test uses the social media public data set WEIBO (i.e., Weibo data set). It is randomly divided into training set, test set, and validation set in a ratio of 8:1:1. The experimental parameters are set to,
[0151] The maximum input sequence length is 128 characters, and a total of 50 epochs are trained. The number of layers of the BiGRU network is 1, and the dimension is 300. To prevent overfitting, dropout is set to 0.5 to prevent gradient explosion, and clip is set to 5. To ensure smooth training of the model, a warmup mechanism is introduced and the parameter is set to 0.1. ADAM is selected as the optimization algorithm, and the learning rate is 0.00002. The experimental evaluation indicators are shown in Equations IV to VI.
[0152]
[0153]
[0154]
[0155] Where:
[0156] P represents precision;
[0157] R represents recall;
[0158] F1 indicates comprehensive evaluation;
[0159] T P Indicates the number of positive samples for which both the model annotation results and the actual results are positive;
[0160] F P Indicates the number of samples that are actually negative but marked as positive by the model;
[0161] F N Indicates the number of actual positive samples that are marked as negative samples by the model.
[0162] The experimental results are shown in Tables 1 and 2.
[0163] Table 1 Performance of each model on the grape dataset
[0164] method P R F1 Comparative Example 1 89.23 88.91 89.67 Comparative Example 2 90.05 89.73 89.88 Comparative Example 3 89.61 90.26 90.15 Embodiments of the present invention 90.24 90.31 90.98
[0165] Table 2 Performance of each model on the WEIBO dataset
[0166] method P R F1 Comparative Example 1 70.69 72.05 71.50 Comparative Example 2 74.06 71.03 72.51 Comparative Example 3 70.45 71.69 71.78 Embodiments of the present invention 73.75 72.63 71.95
[0167] Result analysis:
[0168] As shown in Table 1, the embodiments of the present invention have improvements in various indicators compared with the three comparative examples. At the same time, due to the introduction of the residual structure or radical feature proposed in the present invention, the original BERT+BiGRU+CRF network mainly focuses on local character dependency features, while the residual structure can retain the global character dependency features provided by BERT; the radical feature is a special semantic feature. The three radicals used in this embodiment can fully represent the corresponding three types of entities. Integrating the radical feature into the original input character vector can make full use of the information of the data set, and therefore it is also improved to a certain extent compared with comparative example 1.
[0169] As shown in Table 2, the embodiments of the present invention are also the best in various indicators on the public dataset WEIBO. The results of Comparative Example 3 are not much different from those of Comparative Example 1, because Comparative Example 3 only contains radical features but not residual structures, and the WEIBO dataset is mainly social data, so the three preset radical features are almost not included. Comparative Example 2 and the embodiments of the present invention contain residual structures, which capture global character dependency features, and therefore have certain improvements in various indicators.
[0170] The final experimental results fully prove that the multi-feature fusion efficient knowledge extraction network proposed in the present invention has a certain generalization ability. The method of the present invention has achieved excellent results in the three indicators of P, R and F1 when extracting knowledge from multi-source heterogeneous data sets. It is an efficient knowledge extraction method and can be used for the construction of knowledge graph database.
Claims
1. A method for constructing a grape planting knowledge graph database, characterized in that: The method proceeds as follows: Step S1, design the relationship between the top concepts and concepts in the knowledge graph database to obtain the ontology layer; Step S1 specifically includes the following steps: Step S101, constructing the relationship between top-level concepts and concepts; Step S102, refining the top-level concepts to obtain the second-level concepts, thus realizing the construction of the ontology layer; Step S103, storing the constructed ontology layer in the "grape ontology.owl" file; Step S2, constructing a grape text dataset, annotating 7 types of entities using the BIO annotation method, and extracting character radicals to obtain an annotated dataset; The seven types of entities are variety names, place names, pest names, disease names, chemical drug names, fertilizer names, and agricultural technical terms; Step S2 specifically includes the following steps: Step S201, crawling data from multiple data sources, and storing the crawled data into "grape data set.corpus"; Step S202, using semi-automatic annotation technology to perform BIO annotation on "grape dataset.corpus", and storing the annotation result in "grape dataset_BIO.corpus"; Step S203, extracting radicals, updating "Grape Dataset_BIO.corpus", and obtaining a labeled data set; Step S3, dividing the labeled data set into a training set, a validation set, and a test set according to a ratio of 8:1:1; Step S4, inputting the training set into a multi-feature fusion efficient knowledge extraction network for training to obtain a trained network model; The multi-feature fusion efficient knowledge extraction network is an improved BERT+BiGRU+CRF network; The BERT described is a deep pre-trained language model; The BiGRU is a feature extraction module; The CRF is a feature decoding module; The improved method of the BERT+BiGRU+CRF network includes the following steps: Step S401: The original input of the BERT+BiGRU+CRF network is the embedded character vector set. , integrating radical features into ; Embedded character vector For a sentence The i-th character in is mapped into a character vector of size 120*1 ; The improvement process of incorporating radical features is as follows: As shown in formula I, extract the characters Radical ; In the formula, d_rate is a coefficient; if the radical is "艹", "疒" or "虫", then set d_rate to 1.05 and update ; if the radical is other, then set d_rate to 1.0 and update ; Step S402, improving the feature extraction module in the BERT+BiGRU+CRF network architecture; The improvement method is as follows: after BERT, a residual module is added in parallel with BiGRU; The residual module consists of a dropout layer, a convolutional layer and a ReLU function; Step S5, pre-processing the multi-source heterogeneous grape text and inputting it into the trained network model to obtain formatted text; The preprocessing is as follows: segmenting the original multi-source heterogeneous grape text according to periods, and extracting the radical of each character in the sentence; randomly initializing each character in each sentence to a 120*1 dimensional original feature vector, and updating it according to the method described in step S401; The process of obtaining the formatted text includes the following steps: Step S501: After the original multi-source heterogeneous grape text is preprocessed, the sentence containing num_step characters is converted into a feature matrix of num_step*120 dimensions including character features, word segmentation features and radical features, which is input into BERT to obtain a feature matrix of num_step*768 dimensions including global character dependency features; Step S502: Input the feature matrix containing global character dependency features of num_step*768 dimensions into the forward GRU network, the reverse GRU network and the residual module respectively, and obtain the feature matrices with forward and backward character dependency features of num_step*300 dimensions respectively. , num_step*600-dimensional feature matrix with global character dependency features ; Step S503: Fuse the three feature matrices obtained in Step S502. Specifically, the feature matrix with forward and backward character-dependent features The fusion method is as in formula II, and after fusion, ; With the feature matrix with global character dependency features The fusion method is as shown in formula III; finally, the feature matrix is obtained ; Step S504: The feature matrix Input CRF to obtain the annotation sequence of the original input sentence; according to the annotation results, format it into one sentence per line, including the original input text, entity start position, entity end position and entity category; Step S6: Under the guidance and constraints of the ontology layer, assemble the formatted text into triples, i.e., the entity layer. Step S7: Persistently store the triples using the Neo4j graph database to build the grape cultivation knowledge graph database.
2. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S101, the top-level concepts include: grape variety concept, grape origin concept, grape pest concept, grape disease concept, chemical drug concept for preventing and controlling grape diseases and pests, fertilizer concept, and agricultural technical term concept.
3. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S101, the relationships between the concepts include: the origin relationship between the grape variety concept and the grape origin concept, the susceptibility relationship between the grape variety concept and the grape disease concept, the fertilization relationship between the grape variety concept and the fertilizer concept, the harm relationship between the grape variety concept and the grape pest concept, the prevention and control relationship between the chemical drug concept for preventing and controlling grape diseases and pests and the grape pest concept and the grape disease concept, and the operation relationship between the grape variety concept and the agricultural technical term concept.
4. The method for constructing a grape planting knowledge graph database according to claim 2, characterized in that: In Step S102, the grape disease concept includes infectious diseases and physiological diseases; the chemical drug concept for preventing and controlling grape diseases and pests includes pesticides for pest control and pesticides for disease control; the agricultural technical term concept includes nursery stock breeding techniques, tree body management, establishment of high-yield vineyards, harvesting, packaging, storage, and transportation, soil, fertilizer, and water management, and protected cultivation; the grape variety concept includes fresh food varieties, rootstock varieties, and wine and juice-making varieties.
5. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S201, the multiple data sources include published public paper abstracts and encyclopedia websites.
6. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S202, the BIO annotation method is that the first character of a type-a entity is marked as B-a, the middle character or the ending character is marked as I-a, and other irrelevant characters are marked as O.
7. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S203, if a character contains a grass radical, append the mark X after the corresponding character; if a disease name type-a entity contains a disease radical, append the mark Y after the corresponding character; if a pest name type-a entity contains an insect radical, append the mark Z after the corresponding character; append the mark O for characters with other radicals; update the "grape dataset_BIO.corpus" according to the above rules, and the final form is that each line stores a character, a category mark, and a radical mark, with blank lines separated between sentences.
8. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S5, the multi-source heterogeneous grape texts are agricultural websites, grape field monographs, and encyclopedia websites. In Step S5, the 120*1-dimensional original feature vector contains a 100*1-dimensional original character feature vector and a 20*1-dimensional original word segmentation feature vector.
9. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S502, the residual module consists of a dropout layer, a 1*1 convolutional layer, and a ReLU function.
10. The method for constructing a grape planting knowledge graph database according to claim 1, characterized in that: In Step S6, the form of the triples is <head entity, relationship, tail entity> or <head entity, attribute, attribute name>.
Citation Information
Patent Citations
Knowledge graph construction method based on improved BERT model
CN110390023A
Electric power communication network knowledge graph construction method based on BERT model
CN112613314A