Drainage basin flood control plan rapid generation method based on mapping knowledge domain
Through the rapid generation method of flood control plans based on knowledge graphs, the problems of low preparation efficiency and insufficient information utilization during the generation of flood control plans are solved, and rapid and accurate flood control plans are achieved to support faster decision-making support.
Patent Information
- Application Number
- CN202411036137.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-08
Smart Images

Figure CN118917291A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of knowledge graphs and relates to a method for quickly generating a river basin flood control plan based on a knowledge graph. Background Art
[0002] As knowledge graphs continue to mature in the fields of medicine, military, and computers, and as they are able to integrate and associate multi-source heterogeneous data to form outstanding capabilities for knowledge mining and discovery, knowledge graphs are gradually being used in the field of water conservancy. Flood control plans are an important foundation for flood control work and an important basis for flood control command departments at all levels to make flood control preparations, implement command decisions, and conduct flood control and disaster relief. Traditional flood control plans are of many types, large in number, and cover a wide range of content, resulting in a large amount of manpower and material resources being consumed in learning, consulting, and application. Although computer storage and management have been partially realized, the level of automation is still low and cannot meet the needs of rapid consultation and accurate decision-making for flood control plans.
[0003] Knowledge graphs describe concepts, entities, events, and the relationships between them in the objective world in a structured way of semantic networks. Compared with traditional ontologies and semantic networks, knowledge graphs have higher entity coverage and more complex semantic relationships. At the same time, it is of great significance to apply deep learning to human-computer dialogues and develop dialogue systems that can better understand human intentions, better generate natural language sentences to explore and meet user needs, and match dialogue systems that conform to the way humans speak. Summary of the invention
[0004] The purpose of the present invention is to provide a method for quickly generating basin flood control plans based on knowledge graphs, which solves the problem that in the process of generating flood control plans in the prior art, the plans are compiled through manual mode, with low compilation efficiency and insufficient utilization of relevant information.
[0005] The technical solution adopted by the present invention is a method for quickly generating a basin flood prevention plan based on a knowledge graph, comprising the following steps:
[0006] Step 1: Obtain basin flood control information and flood control plan text;
[0007] Step 2: Sort out the existing flood emergency plans and build a template framework for flood emergency plans;
[0008] Step 3: Construct the model layer and map the knowledge graph of the basin flood control plan;
[0009] Step 4: Preprocess the flood control plan text and construct a data set for entity recognition;
[0010] Step 5: Build an entity recognition model, input the data set, implement entity, relationship and attribute extraction, and extract emergency elements of the plan;
[0011] Step 6: Based on the input flood information, query relevant flood prevention plan knowledge based on the knowledge graph, match similar cases, and quickly generate corresponding flood prevention plans.
[0012] The beneficial effect of the present invention is that network data, literature data and industry data in the field of river basin flood control are mined through natural language processing technology, so as to construct a knowledge graph of river basin flood control; through the knowledge graph, guided by flood control needs, the generation process of flood control plans is fast and efficient, and the flood control plan service system can be flexibly updated; it can quickly and accurately give flood control plans for floods in the river basin, and assist managers to make river basin flood control decisions faster and more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 It is a flow chart of the method for quickly generating a watershed flood prevention plan based on a knowledge graph of the present invention;
[0014] Figure 2 A schematic diagram of the structure of the entity recognition model used in the method of the present invention;
[0015] Figure 3 A simplified diagram of the input representation of the BERT layer used in the method of the present invention;
[0016] Figure 4 Schematic diagram of knowledge graph retrieval content in Example 1 of the method of the present invention. DETAILED DESCRIPTION
[0017] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0018] Example 1
[0019] Reference Figure 1 The method for quickly generating a flood control plan for a river basin based on a knowledge graph of the present invention comprises the following steps:
[0020] Step 1: Obtain basin flood control information and flood control plan text.
[0021] Crawler technology is used to obtain flood control information and flood control plan texts for this river basin from Baidu Wenku, national flood control and drought relief departments, local government official websites and other relevant websites.
[0022] In Example 1, the request library in the Python programming language is used to implement a crawler program, which simulates a browser sending data request information to relevant websites such as water conservancy departments and local government official websites to obtain the basin data returned by the website.
[0023] In this embodiment 1, the collected data formats include but are not limited to (.doc), (.pdf) and (.jpg) formats. After the data collection is completed, further inspection and classification are carried out to eliminate redundant and invalid data from old years, and finally 61 flood control plan texts from 2017 to 2024 are obtained for seven urban areas around the Weihe River Basin, such as Baoji City and Xianyang City.
[0024] Step 2: Organize existing flood emergency plans and build a flood emergency plan template framework.
[0025] Combining the collected basin flood control information and flood control plan texts, and referring to relevant standards and documents such as the "National Flood and Drought Relief Emergency Plan", a template outline of the flood control plan for this basin was constructed to provide a basic framework for generating flood control plans.
[0026] With reference to the "National Flood and Drought Relief Emergency Plan" and the "Shaanxi Province Flood Emergency Plan", the flood control plan template outline is divided into nine categories based on the sorting, including: "General Principles", "Basic Situation", "Emergency Command System and Responsibilities", "Prevention and Early Warning Mechanism", "Emergency Response", "Emergency Guarantee", "Post-disaster Work", "Supplementary Provisions" and "Appendix". The basic framework of the content scope covered by the nine categories is shown in Table 1 below.
[0027] Table 1: Basic framework of the content scope of the nine categories in Example 1
[0028]
[0029] Step 3: Construct the model layer and map the knowledge graph of the flood control plan for this basin.
[0030] According to the organized flood prevention plan text, Protege software is used to build the ontology structure and give it specific content. The import of XML files into Neo4j graph data is completed through the Neo4j semantic plug-in.
[0031] The steps for creating the knowledge graph of the flood prevention plan for this basin include:
[0032] Organize the acquired flood prevention plan text, and subdivide the text content according to the flood prevention plan template outline; use Protege software to build the ontology structure, give each ontology text content, and complete the construction of the model layer; create a new graph database, and import the XML file by citing the Neo4j semantic plug-in; check the knowledge graph mapping, further modify and improve it, and obtain the knowledge graph of the flood prevention plan. The graph database is created based on the Neo4j graph database.
[0033] In this step, the Protege software tool is used to further subdivide the nine categories of modules in step 2, draw the model layer of the knowledge graph and save it in RDF / XML Syntax, and then use the Neosemantics plug-in to import it into Neo4j for storage and visualization.
[0034] Furthermore, during the operation of this embodiment 1, considering the differences between the texts of flood control plans at different levels, it was determined to remove the "Appendix" module, and re-divide the text structure of the flood control plan into eight categories: "General Principles", "Basic Situation", "Emergency Command System and Responsibilities", "Prevention and Early Warning Mechanism", "Emergency Response", "Emergency Guarantee", "Aftermath", and "Appendix", and the ontology model layer was built based on this. The total number of nodes in the knowledge graph finally built in this embodiment 1 is 1,170, and the number of relationships between entities is 979.
[0035] Step 4: Preprocess the flood prevention plan text and build a data set for entity recognition.
[0036] Data preprocessing includes the following two steps:
[0037] A1. Data cleaning: Considering that various sequence symbols appear frequently in the flood control plan text, such as (1) and 1., which have more ways but contain less semantic information, they are imported into the re module to remove the sequence symbols in the text to ensure the refinement of the text data to be extracted. For example, the regular expression "\d+[\.\s]" is used to match numbers with dots or spaces, and the sequence number "2." in the flood control plan text such as "2. Emergency command system and responsibilities" is removed.
[0038] A2. Removal of too short text: Delete sentences with a length less than 4. For example, use an if statement to delete shorter sentences such as "1. General Principles" to obtain a data set in which entities are easy to identify.
[0039] Step 5: Build an entity recognition model, input the data set, implement entity, relationship and attribute extraction, and extract emergency elements of the plan.
[0040] 5.1) Consider the nested relationship from a global perspective and build an entity recognition model, referred to as the 2BG model, such as Figure 2 As shown in the figure, the overall structure of the 2BG model consists of three modules: the BERT feature encoding module (BERT layer for short), the BiLSTM semantic modeling module (BiLSTM layer for short), and the Global Pointer recognition module (Global Pointer layer or GP layer for short). The specific process is:
[0041] B1. Label the preprocessed data set, use the doccano tool (text data labeling tool) to label the entities and relationships of each sentence, and construct the emergency plan data set required for training, which contains a total of 1,060 corpora;
[0042] B2. At the BERT layer, each word in the labeled data set is mapped to a low-dimensional vector space to obtain a feature vector representation of each word;
[0043] B3. In the BiLSTM layer, the output of the BERT layer is input, and contextual semantic mining is performed on the input text sequence to obtain a text feature vector containing more comprehensive semantic information;
[0044] B4. In the Global Pointer layer, input the output information of the BiLSTM layer, build a global output view of the text sequence, and predict the entity types of all head and tail entity pairs.
[0045] 5.2) Use the entity recognition model to extract information from the emergency elements of the flood control plan. The steps are as follows:
[0046] After data preprocessing is completed, the corpus must be annotated before it can be put into the model for operation. During annotation, doccano is used to annotate the BIO data format: each element in the text is annotated as "BX", "IX" or "O", where "BX" means that the segment where the element is located belongs to type X and the element is at the beginning of this segment, "IX" means that the segment where the element is located belongs to type X and the element is in the middle of this segment, and "O" means that it does not belong to any type, and O means that it is not part of a named entity.
[0047] The BIO data format marked in this embodiment 1 is shown in Table 2 below.
[0048] Table 2. BIO data format marked in Example 1
[0049]
[0050] 5.3) Reference Figure 3 In the BERT layer, the input vector is converted into an embedding vector by three embedding layers: token embedding (i.e., Token embedding layer), segment embedding (i.e., Segment embedding layer), and position embedding (i.e., Position embedding layer).
[0051] Token embedding is used to convert each word into a vector of fixed dimension. The input text is tokenized before being sent to the tokenembedding layer. At the same time, two special tokens, [CLS] and [SEP], are inserted at the beginning and end of the tokenization result.
[0052] Segment embedding is used to distinguish the vector representations of two sentences. The Segment Embeddings layer has only two vector representations. The first vector assigns 0 to each token in the first sentence, and the second vector assigns 1 to each token in the second sentence.
[0053] Position embedding is used to encode the position information of each word into a feature vector. After the above steps, the input plan training data is converted into an embedding vector to facilitate the operation and processing of the next module.
[0054] 5.4) When the BiLSTM layer inputs the output of the BERT layer and performs contextual semantic mining on the input text sequence, the output of the BiLSTM layer is the predicted score of each label, which indicates the probability of a word being labeled with a certain label. The formula for the label score y of the predicted label sequence of the entity recognition model is as follows:
[0055]
[0056] Among them, X is the predicted sentence, such as "The relevant city (district) initiated the emergency response of the city (district) and department at the corresponding level", y is the sequence label of X, n represents the sentence length, Indicates the label value at time t-1 transferred to time t, obtained from the label transfer matrix A. Represents the output value of BiLSTM at time t.
[0057] Reference Figure 2 In this embodiment 1, for unit h1, the BiLSTM layer outputs 0.15 (BR-level), 0.8 (IR-level), 0.5 (B-Role), 0.01 (I-Role), and 0.08 (O); among them, "B-Role" has the highest score of 0.5, so "B-Role" is selected as the predicted label of h1; the same is true for the rest, and the label with the highest output score of each unit is selected as the label of the unit.
[0058] 5.5) The BiLSTM layer is composed of two independent LSTM units, which are responsible for processing the input sequence from the forward and reverse directions (two opposite directions) respectively; each independent LSTM unit is composed of an input gate, a forget gate, an output gate, and a cell state. The calculation formulas of these four components are:
[0059] Input gate: i t =σ(W ai a t +W bi b t-1 +W ci c t-1 +d i ),
[0060] Forget gate: f t =σ(W af a t +W bf b t-1 +W cf c t-1 +d f ),
[0061] Cell status update:
[0062] Output gate: o t =σ(W co a t |W bo b t-1 |W co c t-1 |d o ),
[0063] Among them, i t is the input gate output value at the current time step (an activation value between 0 and 1); a t is the input vector at time step t, b t-1 is the hidden state of the previous time step, c t-1 is the cell state at the previous time step, σ is the sigmoid function, which maps the input to the range between 0 and 1;
[0064] ft is the forget gate output value of the current time step (an activation value between 0 and 1); when the forget gate is close to 1, the information of the cell state is completely retained; when the forget gate is close to 0, the information of the cell state is completely forgotten;
[0065] is the candidate cell state, c tis the final updated cell state, tanh is the hyperbolic tangent function;
[0066] o t is the output gate;
[0067] W and d are model parameters, then: W ai is the input vector a t and the weight matrix of the input gate, W bi is the hidden state b t-1 and the weight matrix of the input gate, W ci is the cell state c t-1 and the weight matrix of the input gate, d i is the bias term of the input gate; W af is the input vector a t and the weight matrix of the forget gate, W bf is the hidden state b t-1 and the weight matrix of the forget gate, W cf is the cell state c t-1 and the weight matrix of the forget gate, d f is the bias term of the forget gate; W ac , W bc d c , W ao , W bo , W co d o The meaning of is similar.
[0068] 5.6) The output of the BiLSTM layer is input into the Global Pointer layer to solve the complex dependencies of the BiLSTM output and simplify it into a linear assignment process from global context to label. The Global Pointer layer consists of the following two parts: the Token Embedding learning layer, which learns the representation of the input sequence through the pre-trained language model; the Span prediction layer, which predicts entity fragments from the sequence representation.
[0069] Suppose an input t of length n is obtained, after encoding, the vector sequence [h 1 ,h 2 ,…,h n ], the original GlobalPointer is passed through q i,α and k i,α Linear transformation, the corresponding sequence vector [q 1,α ,q 2,α ,…,q n,α ] and [k 1,α ,k 2,α ,…,k n,α ], then:
[0070] q i,α =W q,a h,
[0071] k i,α =W k,a h,
[0072] q i,α is the entity-starting representation of the i-th element, k i,α is the characterization of the end position of the i-th element, α represents the entity type, and W q,a ,W k,a Represents the matrix corresponding to entity type α.
[0073] Furthermore, the score for the segment s[i:j] belonging to entity type α is In order to make full use of boundary information, ROPE position coding is introduced. What can be determined for ROPE position coding is Therefore, the score s(i,j) that a segment s[i:j] belongs to entity type α is:
[0074]
[0075] Among them, i, j represent the position of the element, R i , R j , R j-i Both represent transformation matrices.
[0076] 5.7) Considering the problem of unbalanced number of categories, the "softmax+cross entropy" loss function is introduced in the Global Pointer layer for optimization. The specific calculation formula is as follows:
[0077]
[0078] Among them, P α is the head and tail set of all entity types α, Q α is the head and tail set of all non-entities or entities of non-α type, and the calculation formula is as follows:
[0079] θ={(i,j)|1≤i≤j≤n}, P α ={(i,j)|t [i:j] is an entity of type α},
[0080] Q α =θ-P α ,
[0081] In the decoding stage, all segments t[i:j] satisfying s(i,j)>0 are regarded as outputs of entity type α.
[0082] 5.8) After the above steps are completed, the performance of the entity recognition model needs to be evaluated. This step uses precision P (Precision), recall R (Recall) and harmonic mean F1 value (F-score) as evaluation indicators of model performance. The calculation formula is as follows:
[0083]
[0084] Among them, TP (True Negative) represents the number of actual positive samples predicted as positive samples; FP (False Positive) represents the number of actual negative samples predicted as positive samples; FN (False Negative) represents the number of actual negative samples predicted as negative samples.
[0085] Based on the above steps, the three modules of the BERT layer, BiLSTM layer and Global Pointer layer in the model of the present invention are built. The labeled data is input for training under the setting of corresponding parameters such as "epoch=50, Max length=512", and the experimental results are compared with the BiLSTM+CRF model and BERT+BiLSTM+CRF model in the prior art.
[0086] The comparison results show that the model adopted by the method of the present invention uses the idea of global normalization to perform named entity recognition. Compared with the two existing methods, the F1 value is improved by 5.28% and 4.39% respectively, the Recall value is improved by 5.74% and 4.63% respectively, and the Precision value is improved by 4.85% and 4.17% respectively. It reflects that the model in the method of the present invention has a significant improvement in the extraction performance under the experimental extraction environment, and verifies the effectiveness of the model in the method of the present invention. The comparative data are shown in Table 3 below.
[0087] Table 3. Comparison of effectiveness of the model of Example 1 of the present invention and two prior arts
[0088] Model Name Precision Recall F1 BiLSTM+CRF 72.47 73.93 73.20 BERT+BiLSTM+CRF 73.15 75.04 74.09 BERT+BiLSTM+GP 77.32 79.67 78.48
[0089] Step 6: Based on the input flood information, query relevant flood prevention plan knowledge based on the knowledge graph, match similar cases, and quickly generate corresponding flood prevention plans.
[0090] 6.1) Generate a flood prevention plan based on the preset flood prevention plan template framework, including:
[0091] Based on the emergency information extracted by the model from the text data, the emergency task unit is generated. After the emergency task unit is generated, the relationship between the emergency task units is identified. After the relationship identification is completed, the emergency task sequence flow and the emergency task execution flow are constructed, and the workflow information of the emergency plan is stored.
[0092] First, before generating this flood prevention plan, the input flood information needs to be parsed to obtain key information, such as the city or geographical area where the flood occurred, the flood magnitude, or the amount of rainfall; then, the Cypher query statement is used to retrieve the corresponding node in the knowledge graph, and the corresponding emergency response action is queried according to the flood magnitude; see Figure 4 It is based on the statement "match(a:flood prevention plan)-[r]->(b:emergency response)return a,b" to query the modules and related contents included in the emergency response in the emergency plan.
[0093] 6.2) After retrieving the required information, input it into the trained 2BG model to identify and extract emergency elements and relationships. After obtaining the corresponding set, the emergency elements are combined to generate emergency task units.
[0094] Taking emergency response as an example, the generated emergency task unit should contain necessary emergency elements such as the identified entities "Department" and "R-action". The final emergency task unit should represent the response action of a certain department after the emergency is initiated. For example, when a "Level IV emergency response" occurs, some of the generated emergency task units are: "Provincial Flood Control Headquarters" "Issue an order to initiate Level IV flood control emergency response", "Related cities (districts)" "Initiate emergency responses at the corresponding level of cities (districts) and departments", "Members of the Provincial Flood Control Headquarters" "Initiate emergency responses at the corresponding level of cities (districts) and departments"; after the generation of the emergency task unit is completed, the relationship between the emergency task units is identified. For example, it is identified that the relationship between the two emergency units "Related cities (districts)" "Initiate emergency responses at the corresponding level of cities (districts) and departments" and "Members of the Provincial Flood Control Headquarters" "Initiate emergency responses at the corresponding level of cities (districts) and departments" should be a parallel relationship; after the relationship identification is completed, the emergency task sequence flow and the emergency task execution flow are constructed to store the workflow information of the emergency plan.
[0095] 6.3) Use BPMN modeling method to draw and reconstruct the emergency response flowchart to realize the generation of flood prevention plan.
[0096] Among them, the emergency task sequence flow describes the connection relationship between all emergency task units, and is stored and represented by a two-dimensional matrix (n×n matrix). The relevant calculation formula is as follows:
[0097]
[0098] Where n is the number of emergency task units, f i,j Represents emergency task unit T i and T j The relationship between them, where fi,j=1,2,…,n respectively correspond to the relationship of including, belonging to, etc. When there is no relationship between emergency task units, f i,j The value is 0;
[0099] Furthermore, the emergency task execution flow is also stored in a two-dimensional matrix, i.e., an m×n matrix. The relevant calculation formula is as follows:
[0100]
[0101] Where m is the number of emergency entities; c i,j Indicates the subject of the emergency i Emergency mission unit T j The serial number, c i,j =0,1,2,…,n, when T j It's Sub i When executing the pth task, c i,j The value is p; if T j Not by Sub i When executed, c i,j The value is 0.
[0102] 6.4) Based on the above steps, according to the BPMN modeling method, an emergency response flowchart is drawn in the Visio drawing software, and the emergency work flow of each department and emergency role in the emergency stage is clearly displayed. For example, in the entity and relationship identification, the content: "Provincial Flood Control Headquarters" "issued an order to start the IV level flood control emergency response", "relevant cities (districts)" "start the city (district) and department's corresponding level of emergency response", "Provincial Flood Control Headquarters members" "start the city (district) and department's corresponding level of emergency response"; in the emergency response flowchart, it will be transformed into "1 Issued an order to start the IV level flood control emergency response -> 2 Start the city (district) and department's corresponding level of emergency response + 3 Start the city (district) and department's corresponding level of emergency response", and the process information in the emergency response process is consistent with the flood control plan text, which is conducive to the query and arrangement of tasks.
[0103] After the emergency response flowchart is constructed, it is reconstructed. In the reconstruction part, the task unit similarity calculation is required, that is, the cosine semantic similarity calculation method is used to quantify the semantic similarity of different emergency action elements to achieve the matching of the same emergency task unit. The semantic similarity calculation formula of entity a and entity b is as follows:
[0104]
[0105] Among them, M represents the word frequency vector of entity a; N represents the word frequency vector of entity b; e represents the total number of segmentations obtained after entity a and entity b are segmented in the semantic space; cosθ represents the similarity between entity a and entity b. The larger its value, the higher the semantic similarity between the two.
[0106] 6.6) Based on the above steps, the integration and reorganization of multiple flood control plan text flow charts are realized. For example, the provincial flood control emergency plan and the municipal emergency plan are reorganized, and the workflows of the emergency departments and roles in the two levels of plans during the flood control process are integrated, which can significantly improve the integrity and executability of the generated content of the flood control plan.
[0107] Example 2
[0108] Reference Figure 1 , a flood control plan for the Weihe River Basin in Shaanxi Province based on the knowledge graph is quickly generated. The steps are as follows:
[0109] Step 1: Obtain basin flood control information and flood control plan text.
[0110] Crawler technology was used to obtain flood control information and flood control plan texts from Baidu Wenku, the national flood control and drought relief department, local government official websites and other related websites. After the data collection was completed, further inspection and classification were carried out to eliminate redundant and invalid data from years as old as 2004.
[0111] Based on the collected plan texts and after completing data preprocessing, we finally obtained 61 flood control emergency plans for seven urban areas around the Weihe River Basin, including Baoji City and Xianyang City, from 2017 to 2024. Some of the data are shown in Table 4 below.
[0112] Table 4. List of collected flood emergency plans
[0113] years Plan Name 2024 Xi'an Flood Control Emergency Plan 2020 Xianyang City Flood Control Emergency Plan 2021 Tongchuan City Flood Control Emergency Plan 2022 Emergency Plan for Flood Control and Drainage in Chencang District, Baoji City
[0114] Step 2: Organize existing flood emergency plans and build a flood emergency plan template framework.
[0115] Combining the collected flood control information and flood control plan texts, and referring to relevant standards and documents such as the "National Flood and Drought Relief Emergency Plan", a flood control plan template outline was constructed to provide a basic framework for generating flood control plans.
[0116] The template outline of the plan mainly refers to the "National Flood and Drought Relief Emergency Plan" and the "Shaanxi Province Flood Emergency Plan". Based on the sorting, the sub-modules contained in each module are shown in Table 5 below.
[0117] Table 5: Contents of each module in Example 2
[0118]
[0119] Step 3: Use Protege to build the model layer and map the knowledge graph of the basin flood control plan.
[0120] Referring to Example 1, the total number of nodes in the knowledge graph finally constructed in Example 2 is 1170, and the number of relationships between entities is 979. The specific contents included in the total number of nodes are shown in Table 6 below.
[0121] Table 6. List of specific contents included in the total number of nodes
[0122] Entity Type quantity Place 41 Emergency Response 48 Flood prevention plan 415 Preparation basis 57 Responsibilities 405 department 143 Plan Documents 61
[0123] Step 4: Preprocess the flood prevention plan text and build a data set for entity recognition.
[0124] Referring to Example 1, the data in the plan text is preprocessed according to step 4. Part of the results obtained in Example 2 are shown in Table 7 below. The form of the remaining data after preprocessing is similar.
[0125] Table 7. Partial results obtained after data preprocessing in Example 2
[0126]
[0127] Step 5: Build an entity recognition model, input the data set into the entity recognition model to extract entities, relationships and attributes, and extract emergency elements of the plan.
[0128] Considering the entity recognition model of nested relationships between entities from a global perspective, the overall structure is as follows Figure 2 As shown in the figure, it includes three modules: BERT feature encoding module, BiLSTM semantic modeling module, and GP entity recognition module. The doccano tool is used to annotate the entities and relations of each sentence to construct the emergency plan dataset required for training, which contains a total of 1060 corpora. The annotation results are shown in Table 8.
[0129] Table 8. List of emergency plan data sets
[0130]
[0131] Furthermore, when the BiLSTM layer inputs the output of the BERT layer and performs contextual semantic mining on the input text sequence, the output of the BiLSTM layer is the predicted score of each label, indicating the probability of a word being labeled with a certain label. The score formula of the model's predicted label sequence y is as follows:
[0132]
[0133] Among them, X is the predicted sentence, such as "The relevant city (district) initiated the emergency response of the city (district) and department at the corresponding level", y is the sequence label of X, n represents the sentence length, Indicates the label value at time t-1 transferred to time t, obtained from the label transfer matrix A. Represents the output value of BiLSTM at time t.
[0134] Reference Figure 2 For unit h1, the BiLSTM layer outputs 0.15 (BR-level), 0.8 (IR-level), 0.5 (B-Role), 0.01 (I-Role), and 0.08 (O). Among them, "B-Role" has the highest score of 0.5, so "B-Role" is selected as the predicted label of h1. The same is true for the rest. The label with the highest output score of each unit is selected as the label of the unit.
[0135] Furthermore, after all the above steps to extract information, the performance of the model needs to be evaluated. The precision P (Precision), recall R (Recall) and harmonic mean F1 value (F-score) are used as evaluation indicators of model performance. The calculation formula is as follows:
[0136]
[0137] Among them, TP (True Negative) represents the number of actual positive samples predicted as positive samples; FP (False Positive) represents the number of actual negative samples predicted as positive samples; FN (False Negative) represents the number of actual negative samples predicted as negative samples.
[0138] Based on the above steps, the model of the present invention is built, and the labeled data is input for training under the setting of corresponding parameters such as "epoch = 50, Max length = 512". The experimental results are compared with the traditional BiLSTM+CRF and BERT+BiLSTM+CRF models. The results show that the model uses the idea of global normalization to perform named entity recognition, and the F1 value is improved by 5.28% and 4.09% respectively, which reflects the significant improvement of the extraction performance of the model of the present invention in the experimental extraction environment, and verifies the effectiveness of the model, as shown in Table 9.
[0139] Table 9. Comparison of effectiveness of the model of Example 2 of the present invention and two prior arts
[0140] Model Name Precision Recall F1 BiLSTM+CRF 72.42 73.97 73.28 BERT+BiLSTM+CRF 73.12 75.07 74.08 BERT+BiLSTM+GP 77.32 79.67 78.48
[0141] Step 6: Based on the input flood information, query relevant flood prevention plan knowledge based on the knowledge graph, match similar cases, and quickly generate corresponding flood prevention plans.
[0142] Before generating this flood prevention plan, the input flood information needs to be parsed to obtain key information, such as the city or geographical area where the flood occurred, the magnitude of the flood or the amount of rainfall, etc. Based on the above feature information, a Cypher query statement is used to retrieve the corresponding nodes in the knowledge graph. The query method is shown in Example 1. Based on "match(a: plan file)-[r:ˋcontainsˋ]->(b: plan file)return a,b", the emergency plan files for different time periods in various regions contained in the plan file can be obtained.
[0143] After retrieving the required information, it is input into the trained 2BG model to identify and extract emergency elements and relationships. After obtaining the corresponding set, the emergency elements are combined to generate emergency task units.
[0144] Taking the 2024 Xi'an flood emergency response as an example, the generated emergency unit should contain necessary emergency elements such as the identified entities "Role" and "R-action", and the final emergency unit should represent the response action of a certain department after the emergency is initiated. For example, when a "level three emergency response" occurs, some of the generated emergency units are: "Deputy Chief Commander of the Municipal Flood Control Headquarters" "Command in Person", "Deputy Chief Commander of the Municipal Flood Control Headquarters" "Consultation with the Main Leaders of the Organization Department and Relevant Districts and Counties (Development Zones)", "Meteorological Department" "Participate in Consultation", "Fire and Rescue Department" "Participate in Consultation", etc. After the generation of the emergency task unit is completed, the relationship between the emergency task units is identified. For example, it is identified that the relationship between the two emergency units "Deputy Chief Commander of the Municipal Flood Control Headquarters" "Command in Person" and "Deputy Chief Commander of the Municipal Flood Control Headquarters" "Consultation with the Main Leaders of the Organization Department and Relevant Districts and Counties (Development Zones)" should be a sequential relationship. After the relationship identification is completed, the emergency task sequence flow and the emergency task execution flow are constructed to store the workflow information of the emergency plan;
[0145] Furthermore, the BPMN modeling method is used to draw and reconstruct the emergency response flowchart to realize the generation of flood control plans. Based on the above work, the emergency response flowchart drawn according to the BPMN modeling process should clearly display the emergency work processes of various departments and emergency roles in the emergency stage. For example, the content in entity and relationship identification: "Deputy Commander-in-Chief of the Municipal Flood Control Headquarters" "Command in Situ", "Deputy Commander-in-Chief of the Municipal Flood Control Headquarters" "Organize mobilization and deployment, and dispatch and command in time" will be transformed into "4 Command in Situ -> 5 Organize mobilization and deployment, and dispatch and command in time" in the emergency process handling process model. The process information in the handling model is consistent with the flood control plan text, which is conducive to task query and arrangement.
[0146] Example 3
[0147] Referring to the steps of Example 1, a flood control plan for the Weihe River Basin in Shaanxi Province is quickly generated based on the knowledge graph. The coverage of the collected plans is shown in Table 10 below.
[0148] Table 10. List of collected flood emergency plans
[0149]
[0150] Finally, the effectiveness of the method of the present invention was verified by conducting an entity relationship extraction test on the "Xi'an Flood Control Emergency Plan (2024 Revised Edition)", as shown in Table 11 below.
[0151] Table 11. Comparison of effectiveness between Example 3 of the present invention and two prior arts
[0152] Model Name Precision Recall F1 BiLSTM+CRF 72.52 73.57 73.04 BERT+BiLSTM+CRF 73.30 74.87 74.08 BERT+BiLSTM+GP 77.62 78.77 78.19
[0153] Furthermore, the six steps of the aforementioned method for rapidly generating a flood control plan for a river basin based on a knowledge graph are solidified and integrated to obtain a rapid generation system for a flood control plan for a river basin based on a knowledge graph. The structure of the rapid generation system for a flood control plan for a river basin based on a knowledge graph includes six parts, namely:
[0154] 1) A plan processing module, which is used to complete the process of step 1 of the method of the present invention, obtain the flood control information and flood control plan text of the river basin, and process the collected flood control plan text;
[0155] 2) A flood control plan module, which is used to complete the process of the aforementioned step 2 of the method of the present invention, organize the existing flood control emergency plans, and construct a flood control plan template framework;
[0156] 3) A knowledge graph module, which is used to complete the process of step 3 of the method of the present invention, construct a model layer, and map the knowledge graph of the flood control plan for the river basin;
[0157] 4) a preprocessing module, which is used to complete the process of step 4 of the method of the present invention, perform data preprocessing on the flood control plan text, and construct a data set for entity recognition;
[0158] 5) An entity recognition module, which is used to complete the process of step 5 of the method of the present invention, construct an entity recognition model, input a data set, implement entity, relationship and attribute extraction, and extract emergency elements of the plan;
[0159] 6) A flood prevention plan generation module is used to complete the process of the aforementioned step 6 of the method of the present invention. Based on the knowledge graph and the input flood information, the module queries relevant flood prevention plan knowledge, matches similar cases, and quickly generates a corresponding flood prevention plan.
[0160] Based on this, the deep learning method is applied to the rapid generation system of flood control plans for river basins based on the flood control knowledge graph, which can realize the rapid generation of flood control plans for river basins, solve the problems of many omissions and low efficiency in the information acquisition process of the existing technology, and has important practical significance and application value. Compared with the existing technology, the system of the present invention can quickly generate flood control plans for river basins, provide timely decision-making support for flood control related departments, help users reduce the corresponding network query time, reduce labor and time cost investment, and improve the utilization rate of various information resources.
[0161] Furthermore, the method for quickly generating watershed flood prevention plans based on the knowledge graph of the present invention is programmed and pre-installed in an electronic device, and the internal structure of the electronic device is: including a memory, a processor, and a computer program stored in the memory and executable by the processor, and the processor implements the steps of the method for quickly generating watershed flood prevention plans based on the knowledge graph when executing the computer program; it can also include a terminal display and operation device.
[0162] The present invention applies knowledge graph technology to the rapid generation of flood control plans for river basins, which helps to extract structured knowledge from massive text information, fuse data from different sources, form a knowledge network rich in semantic relationships, and provide high-quality information for the generation of flood control plans for river basins based on knowledge graphs. By integrating knowledge graphs, the data accuracy, data relevance, and data structuring level of the method for rapid plan generation of the present invention will be significantly improved, enhancing the understanding and matching of text semantics and knowledge semantics.
Claims
1. A rapid generation method of basin flood control plans based on knowledge graph, characterized in that: The following steps are involved: Step 1: Obtain basin flood control information and flood control plan text; Step 2: Sort out the existing flood emergency plans and build a template framework for flood emergency plans; Step 3: Construct the model layer and map the knowledge graph of the basin flood control plan; Step 4: Preprocess the flood control plan text and construct a data set for entity recognition; Step 5: Input the data set into the entity recognition model to extract entities, relationships and attributes, and extract emergency elements of the plan; Step 6: Based on the input flood information, query relevant flood prevention plan knowledge based on the knowledge graph, match similar cases, and quickly generate corresponding flood prevention plans.
2. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 1 is characterized in that: In step 1, The method for obtaining the text of the flood control plan is to use crawler technology to obtain the flood control information and flood control plan text of the basin from Baidu Wenku, the national flood control and drought relief department, and the local government official website.
3. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 1 is characterized in that: In step 2, Combining the collected flood control information and flood control plan texts, and referring to the relevant standards and relevant documents of the "National Flood and Drought Relief Emergency Plan", a flood control plan template outline was constructed.
4. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 1 is characterized in that: In step 3, According to the organized flood prevention plan text, Protege software is used to build the ontology structure and give it specific content. The import of XML files into Neo4j graph data is completed through the Neo4j semantic plug-in.
5. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 1 is characterized in that: In step 4, Data preprocessing includes the following two steps: A1. Data cleaning: Considering that various sequence symbols in the flood control plan text appear frequently but contain less semantic information, it is imported into the re module to remove the sequence symbols in the text; A2. Removal of too short text: Delete sentences with a length less than 4 to obtain a data set that is convenient for entity recognition.
6. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 1 is characterized in that: In step 5, The entity recognition model includes three modules: BERT layer, BiLSTM layer, and Global Pointer layer. The specific process is: B1. Label the preprocessed data set, use the doccano tool to label the entities and relationships of each sentence, and construct the emergency plan data set required for training; B2. At the BERT layer, each word in the labeled dataset is mapped to a low-dimensional vector space to obtain a feature vector representation of each word; B3. In the BiLSTM layer, the output of the BERT layer is input, and contextual semantic mining is performed on the input text sequence to obtain a text feature vector containing more comprehensive semantic information; B4. In the Global Pointer layer, input the output information of the BiLSTM layer, build a global output view of the text sequence, and predict the entity types of all head and tail entity pairs.
7. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 6 is characterized in that: The specific process of using doccano to annotate BIO data format is: Mark each element in the text as "BX", "IX" or "O", where "BX" means that the segment where the element is located is of type X and the element is at the beginning of the segment, "IX" means that the segment where the element is located is of type X and the element is in the middle of the segment, and "O" means that it does not belong to any type, and O means that it is not part of a named entity.
8. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 6 is characterized in that: In the BERT layer, the input vector is composed of the token embedding layer, the segment embedding layer, and the position embedding layer. These three embedding layers convert the input into an embedded vector. Token embedding is used to convert each word into a vector of fixed dimension. The input text is tokenized before being sent to the tokenembedding layer. At the same time, two special tokens, [CLS] and [SEP], are inserted at the beginning and end of the tokenization result. Segment embedding is used to distinguish the vector representations of two sentences. The Segment Embeddings layer has only two vector representations. The first vector assigns 0 to each token in the first sentence, and the second vector assigns 1 to each token in the second sentence. Position embedding is used to encode the position information of each word into a feature vector. At this point, the input plan training data is converted into an embedding vector.
9. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 6 is characterized in that: When the BiLSTM layer inputs the output of the BERT layer and performs contextual semantic mining on the input text sequence, the output of the BiLSTM layer is the predicted score of each label, which indicates the probability that a word is labeled with a certain label. The formula for the label score y of the predicted label sequence of the entity recognition model is as follows: Among them, X is the predicted sentence, y is the sequence label of X, and n represents the sentence length. Indicates the label value at time t-1 transferred to time t, obtained from the label transfer matrix A. Represents the output value of BiLSTM at time t.
10. The method for rapidly generating a flood control plan for a river basin based on a knowledge graph according to claim 1, characterized in that: In step 6, Generate a flood prevention plan based on the preset flood prevention plan template framework, including: Generate emergency task units based on the emergency information extracted by the model from the text data, and after the emergency task units are generated, identify the relationship between the emergency task units; After the relationship identification is completed, the emergency task sequence flow and emergency task execution flow are constructed to store the workflow information of the emergency plan.
