Forest fire knowledge modeling method based on named entity recognition and relation extraction

By combining multi-granularity adaptive word segmentation and dynamic standardization with a pre-trained language model and a spatiotemporal causal attention mechanism, the accuracy and stability issues of named entity recognition and relation extraction in the field of forest fires are solved, and a high-quality forest fire knowledge graph is constructed to support forest fire prevention and control decisions.

CN121524352BActive Publication Date: 2026-03-31山东省林业保护和发展服务中心 +2
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-01-15
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

Existing technologies for named entity recognition and relation extraction in the field of forest fires suffer from limitations in entity recognition accuracy, lack of coordination between entity type and relation information, high uncertainty in relation extraction results, lack of spatiotemporal constraints and causal priors in the fire domain, and difficulty in constructing high-quality knowledge graphs.

Method used

We employ multi-granularity adaptive word segmentation and dynamic standardization to process forest fire texts. Combining a pre-trained language model and a spatiotemporal causal attention mechanism, we optimize named entity recognition and relation extraction models through a multi-task joint training framework to construct a structured forest fire knowledge graph.

Benefits of technology

It improved the accuracy of entity recognition and the stability of relationship extraction, and realized the construction of a high-quality forest fire knowledge graph, enhancing the understanding of fire-related knowledge and decision support capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121524352B_ABST
    Figure CN121524352B_ABST
Patent Text Reader

Abstract

This invention relates to a method for forest fire knowledge modeling based on named entity recognition and relation extraction, specifically as follows: First, raw text data in the forest fire domain is collected, and a text dataset is constructed through preprocessing and entity and relation annotation. Then, a named entity recognition and relation extraction model is built, using multi-granularity adaptive word segmentation, dynamic standardization, and pre-trained language model encoder feature enhancement to achieve entity recognition and relation extraction of forest fire knowledge to obtain the global confidence of triples. Next, a multi-task joint training framework is used to calculate the model's loss function, and the model parameters are optimized end-to-end based on the loss function. New forest fire text is then input into the trained model to select high-confidence relation triples. Finally, a structured forest fire domain knowledge graph is constructed based on the extracted triples. This invention can efficiently mine knowledge in the forest fire domain, providing accurate knowledge support for forest fire prevention and control.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing technology, and in particular to a method for forest fire knowledge modeling based on named entity recognition and relation extraction. Background Technology

[0002] Existing technologies objectively suffer from the following shortcomings: Most existing technologies employ fixed-granularity word segmentation or general-purpose word segmentation tools, which are difficult to adapt to the large number of specialized and complex terms and nested entity structures in the field of forest fires, resulting in limited entity recognition accuracy; existing named entity recognition and relation extraction methods are mostly pipeline-style or weakly coupled modeling, lacking effective coordination between entity types and relation information, making errors prone to propagation and amplification between stages; existing relation extraction models mainly rely on semantic similarity or contextual features, without explicitly introducing spatiotemporal constraints and causal priors in the fire domain, which easily leads to relation results that violate common sense or domain rules; existing methods usually lack a unified quantification mechanism for the uncertainty of extraction results, making it difficult to evaluate the reliability of relation triples, which is not conducive to building high-quality domain knowledge graphs that can be used for decision support.

[0003] Therefore, this invention proposes a forest fire knowledge modeling method based on named entity recognition and relation extraction to solve the above problems. Summary of the Invention

[0004] To address the shortcomings of existing technologies, this invention develops a forest fire knowledge modeling method based on named entity recognition and relation extraction. This invention can efficiently mine knowledge in the field of forest fires, providing accurate knowledge support for forest fire prevention and control.

[0005] The technical solution of this invention to solve the technical problem is a method for forest fire knowledge modeling based on named entity recognition and relation extraction, comprising the following steps:

[0006] S1. Collect raw text data in the field of forest fires to build a raw text corpus. Clean and preprocess the data in the raw text corpus, and then label the entities and relations in the data to form a text dataset, which includes text content, entity labels and a list of entity relation triples.

[0007] S2. Construct a named entity recognition and relation extraction model, perform multi-granularity adaptive word segmentation and dynamic standardization on the text data in the text dataset to generate standardized multi-granularity word sequences, and then perform feature enhancement on the standardized multi-granularity subsequences based on the pre-trained language model encoder. Finally, perform entity recognition and relation extraction for forest fire knowledge to obtain the global confidence of triples of instances and relations.

[0008] S3. A multi-task joint training framework is adopted. Based on labeled data and model prediction results, the total loss function of the model is calculated. The total loss function consists of three parts: entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss. The model parameters are jointly optimized in an end-to-end manner to obtain the trained model.

[0009] S4. Input new, unlabeled forest fire domain text into the trained model, perform named entity recognition and relation extraction, obtain the final type prediction for each entity, and then obtain the global confidence of the triplet of the instance and relation. Select the relation triplet with a confidence higher than the preset threshold as the final extraction result.

[0010] S5. Based on relation triples extracted from a large number of forest fire texts, construct a structured knowledge graph for the forest fire domain.

[0011] S1 is as follows:

[0012] We collected raw text data in the field of forest fires to build a raw text corpus. We cleaned and preprocessed the data in the raw text corpus, and then labeled the entities and relations in the data to form a text dataset, which includes text content, entity labels and a list of entity relation triples.

[0013] Raw text data was collected through a combination of web crawling technology and manual collection. Data sources included publicly available academic literature databases related to forest fires, publicly available disaster investigation reports, publicly available historical fire event records, and publicly available reports of real forest fires.

[0014] Cleaning and preprocessing operations include removing irrelevant formatting, correcting obvious typos, and standardizing the expression of numbers and units;

[0015] Manual annotation is performed on the entity boundaries and types, as well as the relationships between entities, in the text according to predefined annotation specifications. The annotation categories of entities are set according to the characteristics of knowledge in the field of forest fires, including geographical location, fire source type, disaster event, meteorological conditions, and rescue forces; the interaction types between entities are defined through the annotation of relationships.

[0016] The S2.1 multi-granularity adaptive word segmentation and dynamic standardization operations are as follows:

[0017] S2.1.1 Based on the text content in the text dataset, construct domain dictionaries at three preset granularity levels (character level, word level, and phrase level) using the spectral clustering algorithm, and initialize the center point and width parameters of the sliding window for each dictionary segment; the total number of preset granularity levels... This is used to organize a multi-scale dictionary structure, corresponding to three semantic scales: character, word, and phrase. Indicates granularity level index, When we take 1, 2, and 3, we represent the character level, word level, and phrase level, respectively.

[0018] The domain text vectors are dynamically divided using a spectral clustering algorithm. Clusters, Indicates the first The total number of dictionary segments at each granularity level, the first The granularity level is the first Each dictionary segment is represented as follows: , Indicates the first Dictionary segment index within each granularity level; the... The granularity level is the first The cluster center vector of each dictionary segment is represented as: , No. The granularity level is the first The center point parameter of each dictionary segment is represented as follows: , No. The granularity level is the first The window width parameter for each dictionary segment is expressed as: .

[0019] S2.1.2. Based on the global semantic vector of the current text content and the cluster centers of each dictionary segment, The distance is used to dynamically calculate the weight coefficient of each dictionary segment in the current word segmentation process;

[0020] The process involves inputting the string of the current text content into a pre-trained BERT language model to obtain the final hidden state vector of its [CLS] tag, or performing average pooling on the hidden states of all tags to obtain a global semantic vector representation.

[0021] S2.1.3. By combining a Gaussian kernel with a nonlinear adjustment function in a sliding window function, the context range of word segmentation operations at each granularity level is dynamically determined.

[0022] The input to the adaptive sliding window function at each granularity level is the length offset of the current text, calculated by subtracting the center point parameter from the string length. Divide by the window width parameter The output of the adaptive sliding window function at each granularity level is used to modulate the intensity or confidence of word segmentation at that granularity level.

[0023] S2.1.4. The original text is matched with the dictionary segments at each granularity level through matching and transformation functions to perform multi-pattern matching, and then the matching results are converted into corresponding feature vector representations.

[0024] The matching and transformation function includes a matching pattern function and an embedding transformation function. The matching pattern function outputs different matching scores based on different matching patterns, while the embedding transformation function is used to convert the matched text fragments into feature vectors of fixed dimensions.

[0025] S2.1.5 integrates the weight coefficients of each granularity layer, the output of the adaptive sliding window function, and the output of the matching and transformation functions, and generates a standardized multi-granularity word sequence representation matrix through splicing operations.

[0026] S2.2 Feature enhancement operations based on the pre-trained language model encoder are as follows:

[0027] Feature enhancement is performed using a pre-trained language model encoder. This encoder employs a pre-trained BERT model, taking the standardized multi-granularity word sequence representation matrix of the current text content as input. Through BERT's internal multi-layer self-attention mechanism, semantic associations and dependencies are automatically captured, thereby obtaining the contextual representation and yielding the hidden state matrix output by BERT. The dimension of the hidden state matrix is... , Indicates the length of the input sequence. This represents the hidden layer dimension of the BERT model.

[0028] The specific operations for entity recognition and relation extraction of forest fire knowledge in S2.3 are as follows:

[0029] S2.3.1. A gated fusion module is used to adaptively fuse the standardized multi-granularity word sequence representation matrix with the hidden state matrix to generate enhanced entity candidate representations, and entity boundary detection is performed on this basis.

[0030] Specifically, an alignment matrix is ​​first calculated using an attention mechanism to semantically align the two feature matrices along the sequence length dimension; then, through an alignment operation, the length of the hidden state matrix is ​​obtained. Consistent alignment of multi-granularity feature matrices; then, a gating mechanism is used to fuse the hidden state matrix and the aligned multi-granularity feature matrix to generate an enhanced feature matrix; entity boundary detection is completed through dual affine markers, predicting the label probability of each enhanced feature vector in the enhanced feature matrix belonging to the beginning of an entity, inside an entity, or outside an entity;

[0031] Among them, the dual affine marker is a neural network layer used for sequence labeling;

[0032] S2.3.2. The spatiotemporal causal attention mechanism is used to directly model the potential relationship strength between any two candidate entities across the span, and the prior knowledge of fire events is incorporated.

[0033] The specific assumption is decoded from the boundary detection results. There are *n* candidate entities, each with its representation vector and type embedding vector. For any two candidate entities, calculate the relation strength score of the entity pair; the representation vectors of any two candidate entities are represented as follows: and The type embedding vector is represented as and , and Indicates the index of candidate entity M. ;

[0034] The relationship strength score is obtained by adding three data items, including the product of the representation vectors of any two candidate entities and the weight matrix of their semantic interaction, the causal prior term, and the spatiotemporal constraint term. The causal prior term is used to inject causal logical priors specific to the forest fire domain, and the spatiotemporal constraint term is used to model the attenuation effect of spatial distance and time interval on the relationship strength.

[0035] S2.3.3 Utilize relationship strength scores as attention guides to perform collaborative reasoning for type prediction of each entity;

[0036] Specifically for the first The first entity, by weighted aggregation of information from all other entities related to it, obtains the second entity. The context aggregation vector of the nth entity is then used to aggregate the context information and pass it through the Softmax activation function to obtain the nth entity. The probability of predicting the final type of an entity;

[0037] S2.3.4. Integrating entity boundary, entity type, and entity relationship strength information, calculate the global confidence of each candidate triplet, and obtain the final output through threshold filtering;

[0038] Specifically, the probability of converting the relation strength score into a specific relation type is determined by the global confidence of the triple, which is jointly determined by the entity type confidence, relation type confidence, and entity boundary confidence.

[0039] The calculation process for the total loss function in S3.1 is as follows:

[0040] (1) The entity recognition composite loss includes boundary detection loss and entity type classification loss, and introduces a focus loss variant based on entity distribution patterns;

[0041] The boundary detection loss uses the cross-entropy loss function, which is calculated based on the true distribution of boundary labels from manual annotation and the boundary label probabilities calculated from the model.

[0042] The entity type classification loss adopts an improved focus loss function, which is specifically calculated from the manually labeled real type one-hot encoding vector and the probability of the entity's predicted type.

[0043] The boundary detection loss and entity type classification loss are weighted and added together to obtain the entity recognition composite loss.

[0044] (2) Relation extraction adaptive contrast loss adopts the contrast loss with adaptive margin. The contrast loss with adaptive margin brings positive triples closer and pushes negative triples further away.

[0045] (3) Multi-granularity consistency regularization loss adopts a consistency regularization term based on multi-granularity features to constrain the output stability of the model under perturbations of different granularity features;

[0046] The entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss are weighted and summed to obtain the total loss function.

[0047] The joint training process for the model in S3.2 is as follows:

[0048] End-to-end joint training of named entity recognition and relation extraction models is performed based on the total loss function;

[0049] The text dataset in S1 is divided into a training set and a validation set. The training process uses the data in the training set and uses the AdamW optimizer to perform gradient descent based on the total loss value to iteratively update all trainable parameters in the model.

[0050] In each training iteration, batch data undergoes forward propagation to calculate entity boundary probability, entity type probability, relation strength score, and final triplet confidence. Subsequently, the total loss function is calculated based on the ground truth annotations. Through backpropagation, the gradient of the total loss function is calculated and used to update all trainable parameters, enabling the model to simultaneously optimize its entity recognition and relation extraction capabilities. During training, the model performance is periodically evaluated using a validation set to monitor changes in entity recognition and relation extraction metrics.

[0051] Set the criteria for stopping iterations: when the overall performance metric on the validation set no longer improves within multiple consecutive training cycles, or when the preset maximum number of training cycles is reached;

[0052] Save the optimal model parameters from the validation set as the trained named entity recognition and relation extraction model.

[0053] S4 is as follows:

[0054] The new, unprocessed original text is taken as input and processed by a trained named entity recognition and relation extraction model. After multi-granularity adaptive word segmentation and dynamic standardization, a standardized multi-granularity word sequence representation matrix is ​​generated. This matrix is ​​then enhanced using a pre-trained BERT encoder to obtain a hidden state matrix rich in contextual semantic information. Next, a trained entity representation and boundary detection module, fusing multi-granularity features, identifies the boundaries of all candidate entities in the text and their corresponding enhanced feature vectors. Finally, based on these candidate entities, a trained entity relation strength modeling module based on a spatiotemporal causal attention mechanism is invoked to calculate the potential relation strength score between any two entities. Simultaneously, relation-aware entity type collaborative reasoning is performed to obtain the final type prediction for each entity.

[0055] Finally, based on the triple confidence integration and threshold filtering mechanism, the global confidence of all possible triples is calculated by combining the entity boundary confidence, entity type confidence, and relation type probability. Then, the triples are filtered according to the preset dynamic threshold, and relation triples with confidence higher than the threshold are retained as the final extraction result.

[0056] S5 is detailed below:

[0057] First, all extracted triples are post-processed and fused, including entity normalization, relation verification, and confidence weighting.

[0058] Then, the processed triples are used as knowledge units and stored and organized using Neo4j graph database or dedicated knowledge graph building tools;

[0059] In the graph, each unique entity is a node, whose attributes include entity name, type, and additional information that may be extracted from the original text; each relationship is a directed edge connecting two nodes, whose attributes include relationship type and extraction confidence.

[0060] Ultimately, the unstructured text data is transformed into a semantic network with entities as nodes and relationships as edges, forming a forest fire knowledge graph.

[0061] The effects described in the invention are merely those of the embodiments, and not all the effects of the invention. The above technical solutions have the following advantages or beneficial effects:

[0062] This invention discloses a forest fire knowledge modeling method based on named entity recognition and relation extraction. It employs a multi-granularity adaptive word segmentation and dynamic standardization mechanism for the forest fire domain, effectively addressing the problems of ambiguous professional terminology boundaries and severe entity nesting through character-level, word-level, and phrase-level collaborative modeling, combined with trainable cluster centers and sliding window parameters. A gated enhanced entity representation method integrating multi-granularity dictionary features and pre-trained language model context representation is constructed, achieving deep complementarity between general semantic understanding and domain prior knowledge through attention alignment and gating fusion. An entity relation strength modeling mechanism based on spatiotemporal constraints and causal priors is adopted, explicitly integrating spatial distance, time intervals, and fire causal type compatibility into the relation modeling process, overcoming the limitations of purely data-driven relation extraction in its insufficient perception of physical and logical laws. A joint training framework of entity recognition, relation extraction, and multi-granularity consistency regularization is employed, using composite loss and adaptive contrastive learning to achieve collaborative optimization of entity boundaries, entity types, and relation triples, improving the overall stability and reliability of knowledge extraction. Attached Figure Description

[0063] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used together with the embodiments of the invention to explain the invention and do not constitute a limitation thereof.

[0064] Figure 1 This is a schematic diagram of the method flow of the present invention.

[0065] Figure 2 This is a schematic diagram of a multi-granularity dictionary for the field of forest fires.

[0066] Figure 3 The entity recognition result is obtained using the method of the present invention.

[0067] Figure 4 This is an example of a knowledge graph constructed using the method of the present invention.

[0068] Figure 5 This is a ternary relation with forest fire as the queried entity. Detailed Implementation

[0069] To clearly illustrate the technical features of this solution, the invention will be described in detail below through specific implementation methods and in conjunction with the accompanying drawings.

[0070] Example 1

[0071] like Figure 1 As shown, a method for forest fire knowledge modeling based on named entity recognition and relation extraction includes the following steps:

[0072] S1. Collect raw text data in the field of forest fires to build a raw text corpus. Clean and preprocess the data in the raw text corpus, and then label the entities and relations in the data to form a text dataset, which includes text content, entity labels and a list of entity relation triples.

[0073] S2. Construct a named entity recognition and relation extraction model, perform multi-granularity adaptive word segmentation and dynamic standardization on the text data in the text dataset to generate standardized multi-granularity word sequences, and then perform feature enhancement on the standardized multi-granularity subsequences based on the pre-trained language model encoder. Finally, perform entity recognition and relation extraction for forest fire knowledge to obtain the global confidence of triples of instances and relations.

[0074] S3. A multi-task joint training framework is adopted. Based on labeled data and model prediction results, the total loss function of the model is calculated. The total loss function consists of three parts: entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss. The model parameters are jointly optimized in an end-to-end manner to obtain the trained model.

[0075] S4. Input new, unlabeled forest fire domain text into the trained model, perform named entity recognition and relation extraction, obtain the final type prediction for each entity, and then obtain the global confidence of the triplet of the instance and relation. Select the relation triplet with a confidence higher than the preset threshold as the final extraction result.

[0076] S5. Based on relation triples extracted from a large number of forest fire texts, construct a structured knowledge graph for the forest fire domain.

[0077] In a specific implementation, S1 is as follows:

[0078] We systematically collect raw text data in the field of forest fires. The data sources mainly include publicly available academic literature databases related to forest fires, publicly available disaster investigation reports, publicly available historical fire event records, and publicly available authoritative news media reports on forest fires. We construct a large-scale, high-quality raw text corpus by combining web crawling technology with manual collection.

[0079] After obtaining the original text, it undergoes rigorous cleaning and preprocessing, including removing irrelevant formatting, correcting obvious typos, and standardizing the expression of numbers and units to ensure text quality.

[0080] Next, a training dataset was constructed, and the text was finely annotated. Manual annotation was performed on entity boundaries, types, and relationships between entities according to predefined annotation specifications. Entity annotation categories were set based on the characteristics of forest fire domain knowledge, mainly including: geographical location (e.g., mountainous areas, forest farms), fire source type (e.g., lightning strikes, human-caused fires), disaster events (e.g., fires, smoke), meteorological conditions (e.g., high temperatures, dryness, strong winds), and rescue forces (e.g., fire brigades, helicopters). Relationship annotation categories defined the main interaction types between entities, such as: "occurred at" connecting disaster events and geographical locations, "caused by," connecting disaster events and fire source types, "led to," connecting fire sources or meteorological conditions and disaster events, and "taken," connecting rescue forces and specific actions. The annotation process employed a multi-person annotation and expert arbitration model to ensure consistency and accuracy.

[0081] The labeled text data is divided into training and validation sets to form a standardized dataset for model training and evaluation, which includes text content, corresponding entity labeling sequences, and a list of entity relation triples.

[0082] In a specific implementation, S2 constructs the named entity recognition and relation extraction model as follows:

[0083] S2.1 Multi-granularity adaptive word segmentation and dynamic standardization

[0084] Forest fire knowledge text data contains a large number of specialized and complex terms, with blurred entity boundaries and multi-scale nested semantic structures. Conventional word segmentation methods based on general dictionaries are unable to accurately segment domain-specific terms and effectively handle entity nesting problems. Fixed-granularity word segmentation strategies are also difficult to adapt to the semantic representation needs of texts of varying lengths, from short reports to detailed papers. This invention addresses the challenges of diverse terminology, blurred entity boundaries, and multi-scale semantics by using multi-granularity adaptive word segmentation and dynamic standardization to process raw forest fire text data. The raw text is converted into a standardized multi-granularity word sequence representation. The specific steps are as follows:

[0085] S2.1.1 Multi-granularity dictionary and parameter initialization

[0086] Based on the corpus of forest fire domain, domain dictionaries at three preset granularity levels—character level, word level, and phrase level—are constructed using spectral clustering algorithm. The center point and width parameters of the sliding window are initialized for each dictionary segment.

[0087] The domain corpus consists of academic literature, disaster reports, and news texts related to forest fires. It is automatically divided based on the semantic vector similarity of text fragments using a spectral clustering algorithm to form a hierarchical dictionary structure.

[0088] Specifically, the total number of preset granularity levels This is used to organize a multi-scale dictionary structure, corresponding to three semantic scales: character, word, and phrase. This represents a granularity level index, used to identify a specific level. Time represents the character level. Time represents word level, The time period represents a phrase level;

[0089] definition Indicates the first The total number of dictionary segments at each granularity level is used to dynamically divide the domain text vectors into segments using a spectral clustering algorithm. A cluster, defined Indicates the first The dictionary segment index within each granularity level is a positive integer used to identify a specific segment at that level. Indicates the first The granularity level is the first Each dictionary segment contains a set of semantically similar domain terms;

[0090] definition Indicates the first The granularity level is the first The cluster center vector of each dictionary segment represents the average semantic feature of the terms within that segment. Defined... Indicates the first The granularity level is the first The center point parameters of each dictionary segment, representing the preferred text length center of that segment, are trainable parameters that are dynamically updated during training. They are defined as follows: Indicates the first The granularity level is the first The window width parameter of each dictionary segment controls the sensitivity range of the segment to changes in text length. It is a trainable parameter and is dynamically updated during training.

[0091] A multi-granularity dictionary for forest fire research is available for details. Figure 2 .

[0092] S2.1.2 Calculate the piecewise adaptive weight coefficients

[0093] Based on the distance between the global semantic vector of the current text sample and the cluster centers of each dictionary segment, the weight coefficient of each dictionary segment in the current word segmentation process is dynamically calculated, enabling the model to adaptively focus on the domain term fragments most relevant to the current text, as shown below:

[0094]

[0095] In the formula, Indicates for the first The text sample, the first The first granularity level The adaptive weight coefficient of each dictionary segment, the larger the value, the higher the feature contribution of the segment to the current text; Indicates the first A text sample string The vectorized representation of the text is obtained through a pre-trained language model and serves as a global semantic representation of the text. Indicates the first The weight decay coefficient at each granular level controls the sensitivity of the difference between the text representation and the cluster center to the weight calculation, and is a trainable parameter. This represents the index of the text sample within the batch, and is a positive integer. ; Indicates batch size; This represents the L2 norm.

[0096] It is obtained through a pre-trained BERT language model. The specific steps are as follows: ... A text sample string Input the pre-trained BERT language model to obtain the final hidden state vector of its [CLS] tags, or perform average pooling on the hidden states of all tags to obtain the vector representation of the entire text.

[0097] S2.1.3 Applying the adaptive sliding window function

[0098] By combining a Gaussian kernel with a sliding window function that employs a nonlinear adjustment function, the contextual range of word segmentation operations at each granularity level is dynamically determined to smooth boundaries and enhance adaptability to language units of varying lengths. This is expressed as follows:

[0099]

[0100] In the formula, Indicates the first An adaptive sliding window function at each granularity level, whose output value is used to modulate the intensity or confidence of word segmentation at that granularity level; This represents the input variable of the function, and in the adaptive sliding window function, it refers to the standardized text length offset, denoted as... ; Indicates the first A text sample string Length; Indicates the first The nonlinear adjustment coefficients at each granular level are trainable parameters used to adjust the slope of the hyperbolic tangent activation function; they are also trainable parameters. This represents the hyperbolic tangent activation function, which introduces nonlinear adjustment to enhance the model's ability to model cases with blurred boundaries.

[0101] It should be noted that, The term uses a Gaussian kernel calculation method to characterize... The weight distribution of the centered local text window is used for dictionary segmentation. Define a Centered on The probability density function of the variance is used to generate a weight value based on the length of the current text and the offset of the center point. The larger the weight value, the closer the current text length is to the typical length preferred by the segment, and the higher the confidence of the segment being activated during word segmentation. Using a Gaussian kernel can smoothly model the nonlinear relationship between text length and word segmentation granularity, making the model robust to length changes.

[0102] S2.1.4 Perform multi-pattern matching and feature transformation

[0103] The original text is segmented into dictionary segments at various granular levels for multi-pattern matching, and the matching results are converted into corresponding feature vector representations, as follows:

[0104]

[0105] In the formula, Indicates the first The granularity level is the first The function for matching and transforming the dictionary segments takes the nth segment as input. A text sample string and the The granularity level is the first Each dictionary segment The output is the first... Feature representation at each granularity level; Indicates the first Level 1 The total number of matching patterns used in a segment is a hyperparameter, manually set according to task requirements. Common matching patterns include: exact matching, prefix matching, suffix matching, containment matching, and fuzzy matching based on edit distance. All segments can take the same value, such as 3 or 4; This represents the index of the matching pattern, which is a positive integer; Indicates the first The granularity level is the first The first dictionary segment The weight coefficients of each matching pattern are trainable parameters used to measure the importance of different matching patterns;

[0106] Indicates the first The granularity level is the first The first dictionary segment Such matching pattern functions, for example, when For exact string matching, For fuzzy matching based on edit distance, this function outputs a matching score;

[0107] Indicates the first The granularity level is the first The dictionary segment and the first The embedding transformation function corresponding to each matching pattern is used to convert the matched text fragments into feature vectors of fixed dimensions.

[0108] function Used to calculate the A text sample string Segmentation with dictionary In the Scoring in various matching modes, taking two common modes as examples, when If the time corresponds to an exact match, then the function can be defined as follows: In implementation, an efficient multi-pattern string matching algorithm can be used to simultaneously detect the occurrence of all terms, such as the Aho-Corasick algorithm. For time-based fuzzy matching based on edit distance, the function can be defined as follows: ,in, This indicates calculating the Levenstein distance between two strings. Indicates dictionary segmentation A term string, Indicates the first A text sample string The length of the characters, Term string The character length, further, the score is normalized to The interval is defined by the value; a higher value indicates greater similarity.

[0109] function The matched text fragments are converted into fixed-dimensional feature vectors. Taking a pre-trained BERT model as an example, for text fragments from... Text fragments matched Input it into the pre-trained BERT model to obtain the fragment representation, which is represented as ,in, This represents the vector labeled [CLS] in the BERT output. Representing fragments The Middle A vector of tags.

[0110] It should be noted that, It is used to measure the contribution of the current matching pattern to the final matching result. As a trainable parameter, it enables the model to automatically learn the importance of different matching patterns in different contexts. For example, for professional terms, the weight of exact matching may be higher, while for colloquial descriptions, the weight of fuzzy matching may be higher.

[0111] S2.1.5. Generate a standardized multi-granularity word sequence

[0112] Integrate the weighted, windowed, and matching conversion results at each granularity level, and generate a standardized multi-granularity word sequence representation matrix through concatenation operation, denoted as:

[0113]

[0114] In the formula, represents the standardized multi-granularity word sequence representation matrix of the th text sample, which is the feature representation matrix output after multi-granularity adaptive word segmentation and dynamic standardization, with a dimension of ; represents the multi-granularity adaptive word segmentation and dynamic standardization processing function, which is used to convert unstructured original text into a standardized feature matrix that integrates multi-scale semantic information; represents the concatenation operator, which is used to concatenate the feature representations calculated at different granularity levels on the feature dimension; represents the sequence length after the finest granularity division; represents the total dimension of the concatenated multi-granularity feature vector.

[0115] In the specific implementation process, assume a sentence "The forest fire risk level has increased". After the finest granularity division , that is, after division, we get "森", "林", "火", "险", "等", "级", "升", "高". Assume the character-level feature dimension is 64, the word-level is 128, and the phrase-level is 64, then , so is a matrix, and each row of the matrix corresponds to a character position, but the row vector integrates the feature information of characters, words, and phrases at three granularity levels.

[0116] S2.2. Feature enhancement based on the pre-trained language model encoder

[0117] [[ID=4,6]]Use the pre-trained language model encoder for feature enhancement. The pre-trained language model encoder adopts the pre-trained BERT model, and use the standardized multi-granularity word sequence representation matrix of the th text sample As input, contextual representations are obtained through a pre-trained BERT model. BERT's multi-layered self-attention mechanism automatically captures semantic associations and dependencies, yielding the hidden state matrix output by BERT. (Definition...) This represents the first output of BERT. The hidden state matrix of *n* text samples, with dimension *n*. ;

[0118] in, Indicates the length of the input sequence, based on the number of BERT tokens, including special markers such as [CLS] and [SEP]. This represents the hidden layer dimension of the BERT model, such as the hidden layer dimension of BERT-base. .

[0119] In the specific implementation process, if the input sentence "Forest fire risk level increased" is segmented into 8 tokens by BERT, then... , The dimension is .

[0120] S2.3 Entity Recognition and Relation Extraction for Forest Fire Knowledge

[0121] To address the diverse entity types and complex relationships in the field of forest fires, conventional sequence labeling and relation classification models struggle to effectively model deep semantic relationships and complex interactions between entities. This invention, based on context-enhanced features obtained through feature enhancement using a pre-trained language model encoder, employs a joint relation extraction mechanism that integrates entity type priors and multi-granularity interaction awareness. By modeling the interdependencies between entity boundaries, entity types, and relation triples, it achieves accurate domain knowledge extraction. The specific steps are as follows:

[0122] S2.3.1 Entity Representation and Boundary Detection Integrating Multi-Granularity Features

[0123] Directly utilizing the context-enhanced features output by the pre-trained language model encoder for entity recognition may overlook the multi-scale semantic information generated by multi-granularity adaptive word segmentation and dynamic standardization. This invention employs a gated fusion module to adaptively fuse the standardized multi-granularity word sequence representation matrix with the context-enhanced features output by the encoder, generating enhanced entity candidate representations. Based on this, entity boundary detection is performed. Specifically...

[0124] First, an alignment matrix is ​​calculated using an attention mechanism to achieve semantic alignment of the two features along the sequence length dimension, as shown below:

[0125]

[0126] In the formula, Represents the alignment matrix The Middle Line 1 The element value of the column, i.e., the first element of the encoder output sequence. The position and the multi-granularity sequence The semantic alignment weight between positions, the larger the value, the more related the two positions are; This represents the position index in the encoder output sequence, and is a positive integer with a value range of 1 to 2. ; Representation matrix of standardized multi-granular word sequence The row index in the table corresponds to the position after the finest-grained partitioning, and is a positive integer with a value range of 1 to 2. ; Indicates the first The length of a text sample after being divided into the finest-grained segments, with the default finest-grained segment being the character level; Represents the natural exponential function; This represents the first output of BERT. The hidden state matrix of each text sample The Row vector, dimension ; Indicates the first Standardized multi-granularity word sequence representation matrix of a text sample The Row vector, dimension ;

[0127] This represents the scaled cosine similarity function, used to measure the semantic similarity between two vectors. The calculation method is expressed as follows: ; This represents the first input vector used to calculate similarity, i.e. ; This represents the second input vector used to calculate similarity, i.e. ; express Transpose of; The weight matrix used to calculate similarity is a trainable parameter with dimension 1. .

[0128] By performing an alignment operation, the length of the encoder output sequence is obtained. Consistent alignment and multi-granularity feature representation, represented as ;

[0129] in, Indicates the first Aligned multi-granularity feature matrices for text samples, with dimensions of The multi-granular features are aggregated through the attention weight matrix and transformed into a matrix with the same length as the encoder output sequence, i.e., dimension 1. This achieves semantic alignment of the two features in the sequence dimension.

[0130] A gating mechanism is used to fuse the encoder output features with the aligned multi-granular features to generate an enhanced feature matrix, represented as follows:

[0131]

[0132] In the formula, Indicates the first Enhanced feature matrix of each text sample In the The enhanced feature vectors at each position have a dimension of . By adaptively fusing the deep contextual semantics output by the encoder and the aligned multi-scale dictionary features through a gating mechanism, it combines global contextual understanding with sensitivity to domain-specific, multi-granular terms. Indicates the first A gating vector at each position is used to control the fusion ratio of the two feature sources, with a dimension of . The calculation method is expressed as ; This represents a vector concatenation operation; Indicates the first Aligned multi-granularity feature matrix of text samples The Row vectors; The weight matrix in the gating mechanism represents trainable parameters with dimension 1. This is used to perform a linear transformation on the spliced ​​features; The bias vector in the gating mechanism is a trainable parameter with dimension . ; This represents the Sigmoid activation function, which maps the input to... interval; This indicates element-wise multiplication.

[0133] Entity boundary detection is performed using a dual affine tagger, which predicts the probability of each position in the sequence belonging to the start of an entity, inside an entity, or outside an entity, as follows:

[0134]

[0135] In the formula, Indicates the first The probability distribution of boundary labels at each position is a three-dimensional vector, corresponding to the three types of labels: start, inside, and outside. The weight tensor representing the biaffine transformation is a trainable parameter with dimension . , is the core weight tensor of the biaffine transformation; The bias term representing the boundary prediction has a dimension of . This provides a learnable bias for each boundary label; express The transpose of .

[0136] It should be noted that the biaffine labeler is a neural network layer used for sequence labeling. Its core structure is the biaffine transformation, which calculates a score matrix for each position pair in the sequence to jointly predict the label at each position. It can model the dependencies between labels better than a simple linear classifier.

[0137] S2.3.2 Entity Relationship Strength Modeling Based on Spatiotemporal Causal Attention Mechanism

[0138] The relationships between entities in forest fires often exhibit strong spatiotemporal characteristics or causal logic. A spatiotemporal causal attention mechanism is employed to directly model the strength of the potential relationship between any two candidate entities across their spans, incorporating prior knowledge of fire events. Specifically,

[0139] Suppose that the boundary detection results are decoded There are 10 candidate entities, each with its own representation vector and type embedding vector. The relation strength score of entity pairs is calculated as follows:

[0140]

[0141] In the formula, Indicates the first The candidate entity and the first The strength score of the relationship between candidate entities is given; the higher the score, the greater the likelihood that a relationship exists. The index of the first candidate entity is a positive integer, with a value range of 1 to 2. ; The index of the second candidate entity is a positive integer, with a value range of 1 to 2. ,and ; This indicates the number of candidate entities decoded from the boundary detection results; Indicates the first The representation vectors of each candidate entity are aggregated using a max-pooling operation to obtain the vectors with the start and end positions on the enhanced feature matrix, resulting in a dimension of . , for Transpose of; Indicates the first The representation vectors of each candidate entity; The weight matrix representing the semantic interaction of relations is a trainable parameter with dimension . Model the semantic interaction pattern between two entity vectors; This indicates that the spatiotemporal constraint term is a scalar value, used to model the attenuation effect of spatial distance and time interval on the strength of the relationship; This represents a causal prior term, which is a scalar value used to inject specific causal logical priors into the field of forest fires.

[0142] The calculation method for the spatiotemporal constraint term is expressed as follows:

[0143]

[0144] In the formula, Indicates the first The spatial coordinate encoding vector of each entity is set to 0 if no spatial information can be extracted from the text. Vector, with a default dimension of ; Indicates the first Spatial coordinate encoding vector of an entity; Indicates the first The timestamp encoding scalar of each entity is set to 0 if no time information can be extracted from the text. ; Indicates the first A timestamp encoding scalar for each entity; This represents the spatial term scaling factor, used to adjust the weight of spatial distance's contribution to the strength of the relationship; it is a trainable parameter. This represents the time term scaling factor, used to adjust the weight of the time interval's contribution to the strength of the relationship; it is a trainable parameter. This represents the spatial decay coefficient, used to control the negative impact of spatial distance on the strength of the relationship; it is a trainable parameter. This represents the time decay coefficient, used to control the negative impact of time intervals on the strength of the relationship; it is a trainable parameter.

[0145] The calculation method for causal priors is expressed as follows:

[0146]

[0147] In the formula, Indicates the first The type embedding vector of each entity is obtained by looking up its entity type index through a trainable embedding table, with a default dimension of 1. , for Transpose of; Indicates the first Type embedding vectors of each entity; The causal type compatibility matrix is ​​a trainable parameter with dimension O(n). This is used to model potential causal compatibility between different entity types; Indicates the first The predicted or true type index of an entity during the model training phase. This refers to the entity's true type index obtained from the labeled data, which is used during the model inference phase. This refers to the entity type index predicted by the model itself; Indicates the first Index of the predicted or true type of an entity; This represents a predefined set of causal entity types, that is, a set of entity types that serve as "causes," for example... ; This represents a predefined set of causal entity types, that is, a set of entity types that serve as the "result," for example... ; This indicates an indicator function whose value is true when all conditions within the parentheses are true. Otherwise .

[0148] It should be noted that, An item represents the strength of semantic interaction between two entity representations, used to capture general semantic associations between entities. The term characterizes the modulating effect of spatiotemporal constraints on the strength of the relationship; the closer the spatial distance and the smaller the time interval, the greater the positive contribution of this term to the relationship score. The term represents the enhancing effect of causal prior knowledge on relation strength. When the head entity type belongs to the cause set and the tail entity type belongs to the result set, the relation score is increased through type embedding and compatibility matrix. The three work together to make relation strength modeling both dependent on data-driven semantic matching and in line with the physical and logical constraints of domain events.

[0149] S2.3.3 Relationship-Aware Entity Type Collaborative Reasoning

[0150] There is a strong correlation between entity type and relation type. Using relation strength scores as attention guides, collaborative reasoning is performed on the type prediction of each entity, enhancing the context-awareness of type prediction. Specifically,

[0151] For the An entity, whose context-aware type representation is obtained by weighted aggregation of information from all other related entities, is represented as follows:

[0152]

[0153] In the formula, Indicates the first The context aggregation vector of each entity, with dimension . It represents contextual clues implied by association with other entities in the current textual context, which help in infer the entity type; Denotes a linear transformation matrix with dimension . , are trainable parameters used to perform linear transformations on the representations of related entities.

[0154] After aggregating context information, the first The final type prediction probability for each entity is:

[0155]

[0156] In the formula, Indicates the first The probability distribution of the type prediction for each entity, with dimension [ ]. is a probability distribution vector, where each element represents an entity. The probability of belonging to a specific entity type, the sum of all elements is 1; The total number of preset entity types; The weight matrix representing the type classification is a trainable parameter with dimension 1. This is used to map the concatenated vector, which integrates its own features and contextual features, onto the dimension of the number of entity types in order to calculate a score for each type; The bias vector representing the type classification is a trainable parameter with dimension . It provides a learnable bias for each entity type.

[0157] S2.3.4, Triple Confidence Integration and Threshold Filtering

[0158] By combining entity boundary, entity type, and entity relationship strength information, the global confidence of each candidate triplet is calculated, and the final output is obtained through threshold filtering. Specifically,

[0159] First, the probability of converting the relation strength score into a specific relation type is expressed as:

[0160]

[0161] In the formula, Indicates the first The entity and the first The entities are related to the first... The probability of a relation type represents the probability of the first relation type. and the Given that there is a relationship between several entities, the specific relationship is the first... Conditional probabilities of different relation types; Represents a relation type index, which is a positive integer with a value range of 1. ; This indicates the total number of preset relation types; The relation type probability weight matrix is ​​a trainable parameter with dimension O(n). This provides a common interactive representation for calculating the probabilities of different types of relationships; Indicates the first The query vector of each relation type is a trainable parameter with dimension . This is used to calculate the dot product similarity with the public interaction representation, thereby obtaining a score for this relationship type; express The transpose of .

[0162] The global confidence of a triple is determined by the entity type confidence, relation type confidence, and entity boundary confidence, and is expressed as:

[0163]

[0164] In the formula, Indicates the first The first entity is the head entity, the second... The entity is the tail entity, the first... The global confidence score of triples of a relation type has a range of values. ; Indicates the first Each entity was predicted to be its most likely type. The probability value, i.e. The index in the distribution is That probability value; Indicates the first Each entity was predicted to be its most likely type. The probability value; Indicates the first The prediction type index for each entity, i.e. The index corresponding to the type with the highest probability. Indicates the first Index of prediction types for each entity; Indicates the first The boundary confidence of an entity is calculated from the average start or internal label probability of all its constituent locations, with a value range of [value range missing]. ; This represents the power-law hyperparameter of entity type confidence, used to adjust its contribution to the total confidence. An example value is shown below. ; This represents the power-law hyperparameter of the relation type confidence score, used to adjust the contribution of this part to the total confidence score. Example values ​​are provided. ; The hyperparameter representing the power of the entity boundary confidence score is used to adjust its contribution to the total confidence score. An example value is shown below. .

[0165] Set dynamic threshold Only retain global confidence level The triplet is used as the final output. Example of values: .

[0166] It should be noted that, The item represents the confidence level of the entity type. The confidence level of the relation type is represented by the item. The term represents the confidence level of the entity boundary. The product of the three terms is the global confidence level. Only when a candidate triplet achieves high scores in all three aspects—accurate entity boundary, correct entity type, existence of relation, and credible type—will its global confidence level be high and thus be retained as the final result. It is a decision-making mechanism that integrates multiple pieces of evidence.

[0167] Figure 3 The entity recognition result is obtained using the method of the present invention.

[0168] In a specific implementation, the S3 loss function calculation and joint training are as follows:

[0169] S3.1 Loss Function Calculation

[0170] To optimize multiple interrelated subtasks in entity recognition and relation extraction, and to fully utilize limited forest fire annotation data, this invention employs a multi-task joint training framework. Its total loss function consists of three parts: entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss. The model parameters are jointly optimized end-to-end. The specific steps are as follows:

[0171] (1) Calculation of composite loss for entity recognition

[0172] The entity recognition composite loss includes boundary detection loss and entity type classification loss, and introduces a variant of the focus loss based on entity distribution patterns to alleviate the class imbalance problem. Specifically,

[0173] The boundary detection loss uses the cross-entropy loss function, expressed as:

[0174]

[0175] In the formula, This represents the boundary detection loss, used to train the model to accurately predict entity boundary labels at each position in a text sequence; Indicates the first The true distribution of boundary labels at each location is a three-dimensional one-hot encoded vector, which is obtained by converting manually annotated entity boundary information; The model predicts the first This location belongs to the boundary label. The probability of; Indicates the category of the boundary label.

[0176] The entity type classification loss employs an improved focus loss function, introducing adjustable focus parameters for different entity types, expressed as:

[0177]

[0178] In the formula, This represents the entity type classification loss, used to train the model to accurately predict the specific type of each identified entity. This represents the total number of entities correctly identified in all text samples in the current training batch, i.e., the number of entities with true type labels. Indicates the first The true type one-hot encoded vector of each entity, with dimension . The manual annotations from the training data are the first... One-hot encoded representation of the real type index of each entity; This represents a logarithmic function, with the default base being the natural constant. The model predicts the first The entity belongs to the first The probability of the first type is the probability of the second type. Type prediction probability distribution of each entity The middle corresponds to the first Scalar probability values ​​for each entity type; Indicates the relationship with the first An adjustable focusing parameter related to entity type is used to assign larger values ​​to entity types that appear less frequently in the training set, in order to increase the model's attention to difficult samples. Specifically, it is set to be the inverse ratio of the frequency of the entity type in the training set.

[0179] It should be noted that during training, the model first predicts entity boundaries. Then, based on the alignment between the predicted boundaries and the ground truth boundaries, it determines which predicted entity spans need to be included in the type loss calculation. Only predicted entities that match the ground truth entity labels on the boundary (e.g., IoU exceeds a certain threshold) are included. China's participation The calculation ensures that the loss function only performs type supervision on samples that are "considered as entities by the model", thus avoiding forced type classification on non-entity fragments.

[0180] The entity recognition composite loss is a weighted sum of the boundary detection loss and the entity type classification loss, expressed as:

[0181]

[0182] In the formula, The composite loss for entity recognition, which integrates and optimizes the two sub-tasks of entity boundary detection and entity type classification, is the overall training objective of the entity recognition part. This represents the weight hyperparameter used to balance the boundary detection loss, with examples of possible values. This is used to adjust the relative weight of the boundary detection loss in the composite loss, balancing the impact of the two subtasks on the overall gradient. This represents the weight hyperparameter used to balance the loss for entity type classification. Examples of possible values ​​are provided. This is used to adjust the relative weight of entity type classification loss in the composite loss.

[0183] (2) Adaptive contrastive loss calculation for relation extraction

[0184] For relation extraction tasks, an adaptive margin contrastive loss is designed to better distinguish between positive and negative relation triples, bringing the representations of positive triples closer together and pushing the representations of negative triples further apart. The calculation method of the adaptive contrastive loss for relation extraction is expressed as follows:

[0185] ,

[0186] In the formula, This represents the adaptive contrastive loss for relation extraction, used to train the relation strength modeling module. This represents the set of positive triples, that is, the (head entity, relation, tail entity) triples that actually exist in the training data; This represents the set of negative triples, which are incorrect triples constructed by randomly replacing the head entity, tail entity, or relation type of positive triples. Indicates the relationship with the first A subset of negative instance triples related to each entity; This represents the temperature coefficient, used to adjust the smoothness of the probability distribution. Examples of possible values ​​are shown below. ; This represents the adaptive negative instance margin, calculated as follows: Semantically similar entity pairs are required to have lower confidence levels when used as negative examples; This indicates taking the larger of the two values; This represents the basic margin hyperparameter, with examples of possible values. This is used to control the base size of adaptive margins; This represents the cosine similarity function.

[0187] (3) Calculation of multi-granularity consistency regularization loss

[0188] To facilitate the model's benefit from multi-granularity word segmentation and ensure knowledge consistency between entity recognition and relation extraction tasks, a consistency regularization term based on multi-granularity features is adopted to constrain the model's output stability under perturbations of different granularity features. The calculation method of multi-granularity consistency regularization loss is expressed as follows:

[0189]

[0190] In the formula, This represents the multi-granularity consistency regularization loss, which constrains the model to maintain relative stability of the output for small perturbations of the input multi-granularity features; This represents the Kullback-Leibler divergence, which measures the difference between two probability distributions; the smaller the value, the closer the distributions are. This represents the distribution function, which normalizes the set of confidence scores for all candidate triples of a sample to form a discrete probability distribution. Indicates the first Each text sample is based on the original multi-granularity features. The calculated set of triple confidence scores; Indicates the first Multi-granularity features of a text sample The set of triple confidence scores is recalculated after applying a small random Gaussian perturbation. This indicates that the gradient operation is stopped, and the variables within it are not updated during backpropagation to prevent... The distribution is excessively smoothed by the consistency objective.

[0191] (4) Calculation of total loss function

[0192] The total loss function is a weighted sum of the entity recognition composite loss, the relation extraction adaptive contrast loss, and the multi-granularity consistency regularization loss. Through joint optimization, the model learns the various capabilities required for forest fire knowledge extraction end-to-end, and is expressed as:

[0193]

[0194] In the formula, This represents the total loss value during model training and is the ultimate goal of backpropagation optimization. The weight hyperparameters representing the relation extraction loss term are used to control the importance of the relation extraction task in joint training. Examples of their values ​​are shown below. ; The weight hyperparameter represents the consistency regularization loss term, used to control the strength of multi-granularity consistency constraints. Examples of possible values ​​are provided. .

[0195] S3.2 Joint Training of Named Entity Recognition and Relation Extraction Models

[0196] Based on the total loss function, the named entity recognition and relation extraction models are jointly trained end-to-end.

[0197] The training process uses the training dataset built in step S1, and uses the AdamW optimizer to perform gradient descent based on the total loss value to iteratively update all trainable parameters in the model.

[0198] In each training iteration, the batch data undergoes multi-granularity adaptive word segmentation and dynamic standardization, pre-trained language model encoder feature enhancement, and entity recognition and relation extraction steps in sequence. Forward propagation calculates entity boundary probability, entity type probability, relation strength score, and final triple confidence. Then, based on the real annotation, entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss are calculated and weighted summed to obtain the total loss.

[0199] Through the backpropagation algorithm, the gradient of the total loss is calculated and used to update all trainable parameters, enabling the model to simultaneously optimize its ability to recognize entities and extract relationships.

[0200] During training, the model performance is evaluated periodically using a validation set, and changes in entity recognition and relation extraction metrics (such as precision, recall, and F1 score) are monitored.

[0201] The criteria for stopping iteration are usually set as follows: the overall performance index on the validation set no longer improves within several consecutive training cycles (i.e., the early stopping patience value), or the preset maximum number of training cycles is reached.

[0202] Save the optimal model parameters from the validation set as the trained named entity recognition and relation extraction model for subsequent extraction tasks.

[0203] In a specific implementation, S4 named entity recognition and relation extraction are as follows:

[0204] After the joint training of the models is completed, named entity recognition and relation extraction can be performed on new, unlabeled text in the forest fire domain. The specific process is as follows:

[0205] The original text to be extracted is taken as input, and it first undergoes multi-granularity adaptive word segmentation and dynamic standardization processing to generate a standardized multi-granularity word sequence representation matrix of the text.

[0206] Then, the matrix is ​​fed into the pre-trained BERT encoder for feature enhancement to obtain a hidden state matrix rich in contextual semantic information;

[0207] Then, using the trained entity representation and boundary detection module that integrates multi-granularity features, the boundaries of all candidate entities in the text and their corresponding enhanced feature vectors are identified from the enhanced features.

[0208] Then, based on these candidate entities, the trained entity relationship strength modeling module based on spatiotemporal causal attention mechanism is invoked to calculate the potential relationship strength score between any two entities, and relationship-aware entity type collaborative reasoning is performed simultaneously to obtain the final type prediction for each entity.

[0209] Finally, based on the triple confidence integration and threshold filtering mechanism, the global confidence of all possible triples is calculated by combining the entity boundary confidence, entity type confidence, and relation type probability. Then, the triples are filtered according to the preset dynamic threshold, and relation triples with confidence higher than the threshold are retained as the final extraction result.

[0210] The output of this process is the structured knowledge automatically extracted from the input text, presented as a list of triples in the form of (head entity, relation type, tail entity).

[0211] In a specific implementation, the generation of S5 triples and the construction of the knowledge graph are as follows:

[0212] Based on relation triples extracted from a large number of forest fire texts using the S4 step, a structured knowledge graph of the forest fire domain is constructed.

[0213] First, all extracted triples are post-processed and merged, including entity normalization (merging entities with the same reference but different expressions, such as "East Forest Area" and "East Side Forest Area" being unified into one entity if they refer to the same location), relation verification (eliminating obviously contradictory or erroneous triples based on domain logic), and confidence weighting (retaining the extraction confidence of each triple as a reliability weight).

[0214] Then, the processed triples are used as knowledge units and stored and organized using Neo4j graph database or a dedicated knowledge graph construction tool.

[0215] In the graph, each unique entity is a node, and its attributes include entity name, type, and additional information that may be extracted from the original text (such as time and spatial coordinate encoding).

[0216] Each relation is a directed edge connecting two nodes, and its attributes include relation type and extraction confidence.

[0217] In this way, unstructured text data is transformed into a semantic network with entities as nodes and relationships as edges. Ultimately, the resulting forest fire knowledge graph can intuitively display the complex relationships between elements such as fire events, causative factors, environmental conditions, and response capabilities. It supports graph-based querying, reasoning, and analysis, providing structured knowledge support for fire risk assessment, emergency response decision-making, and disaster knowledge research.

[0218] like Figure 4 As shown, this is an example of a constructed knowledge graph, with forest fire as the queried entity, and its triplet relationships are as follows: Figure 5 As shown.

[0219] Although the specific embodiments of the invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the invention. Based on the technical solutions of the invention, various modifications or variations that can be made by those skilled in the art without creative effort are still within the scope of protection of the invention.

Claims

1. A forest fire knowledge modeling method based on named entity recognition and relation extraction, characterized in that, Includes the following steps: S1. Collect raw text data in the field of forest fires to build a raw text corpus. Clean and preprocess the data in the raw text corpus, and then label the entities and relations in the data to form a text dataset, which includes text content, entity labels and a list of entity relation triples. S2. Construct a named entity recognition and relation extraction model, perform multi-granularity adaptive word segmentation and dynamic standardization on the text data in the text dataset to generate standardized multi-granularity word sequences, and then perform feature enhancement on the standardized multi-granularity subsequences based on the pre-trained language model encoder. Finally, perform entity recognition and relation extraction for forest fire knowledge to obtain the global confidence of triples of instances and relations. S2.1 The multi-granularity adaptive word segmentation and dynamic standardization operations are as follows: S2.1.1 Based on the text content in the text dataset, construct domain dictionaries at three preset granularity levels—character level, word level, and phrase level—using the spectral clustering algorithm, and initialize the center point and width parameters of the sliding window for each dictionary segment. Total number of preset granularity levels , for organizing a multi-scale dictionary structure, respectively corresponding to three semantic scales of character, word, and phrase, setting indicates the granularity level index, 1, 2, and 3 respectively represent the character level, the word level, and the phrase level; The domain text vectors are dynamically divided into clusters by a spectral clustering algorithm, denotes the total number of dictionary segments at the th granularity level, the th dictionary segment at the th granularity level is denoted as , denotes the index of the dictionary segment within the th granularity level; the cluster center vector of the th dictionary segment at the th granularity level is denoted as , the center point parameter of the th dictionary segment at the th granularity level is denoted as , and the window width parameter of the th dictionary segment at the th granularity level is denoted as ; S2.1.2, distance between global semantic vector of current text content and each dictionary segment clustering center weight coefficient of each dictionary segment in current segmentation process is dynamically calculated according to the distance. The process involves inputting the string of the current text content into a pre-trained BERT language model to obtain the final hidden state vector of its [CLS] tag, or performing average pooling on the hidden states of all tags to obtain a global semantic vector representation. S2.1.

3. By combining a Gaussian kernel with a nonlinear adjustment function in a sliding window function, the context range of word segmentation operations at each granularity level is dynamically determined. The input of the adaptive sliding window function of each granularity level is the length offset of the current text, which is obtained by subtracting the center point parameter from the string length and then divided by the window width parameter obtained; the output of the adaptive sliding window function of each granularity level is used to modulate the strength or confidence of the segmentation of the granularity level S2.1.

4. The original text is matched with the dictionary segments at each granularity level through matching and transformation functions to perform multi-pattern matching, and then the matching results are converted into corresponding feature vector representations. The matching and transformation function includes a matching pattern function and an embedding transformation function. The matching pattern function outputs different matching scores based on different matching patterns, while the embedding transformation function is used to convert the matched text fragments into feature vectors of fixed dimensions. S2.1.5 Integrate the weight coefficients of each granularity layer, the output of the adaptive sliding window function, and the output of the matching and transformation function, and generate a standardized multi-granularity word sequence representation matrix through concatenation operation; S3. A multi-task joint training framework is adopted. Based on labeled data and model prediction results, the total loss function of the model is calculated. The total loss function consists of three parts: entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss. The model parameters are jointly optimized in an end-to-end manner to obtain the trained model. S4. Input new, unlabeled forest fire domain text into the trained model, perform named entity recognition and relation extraction, obtain the final type prediction for each entity, and then obtain the global confidence of the triplet of the instance and relation. Select the relation triplet with a confidence higher than the preset threshold as the final extraction result. S5. Based on relation triples extracted from a large number of forest fire texts, construct a structured knowledge graph for the forest fire domain.

2. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 1, characterized in that, S1 is as follows: We collected raw text data in the field of forest fires to build a raw text corpus. We cleaned and preprocessed the data in the raw text corpus, and then labeled the entities and relations in the data to form a text dataset, which includes text content, entity labels and a list of entity relation triples. Raw text data was collected through a combination of web crawling technology and manual collection. Data sources included publicly available academic literature databases related to forest fires, publicly available disaster investigation reports, publicly available historical fire event records, and publicly available reports of real forest fires. Cleaning and preprocessing operations include removing irrelevant formatting, correcting obvious typos, and standardizing the expression of numbers and units; Manual annotation is performed on the entity boundaries and types, as well as the relationships between entities, in the text according to predefined annotation specifications. The annotation categories of entities are set according to the characteristics of knowledge in the field of forest fires, including geographical location, fire source type, disaster event, meteorological conditions, and rescue forces. The type of interaction between entities is defined by the annotation of the relationship.

3. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 1, characterized in that, S2.2 Feature enhancement operations based on the pre-trained language model encoder are as follows: Feature enhancement is performed using a pre-trained language model encoder. This encoder employs a pre-trained BERT model, taking the standardized multi-granularity word sequence representation matrix of the current text content as input. Through BERT's internal multi-layer self-attention mechanism, semantic associations and dependencies are automatically captured, thereby obtaining the contextual representation and yielding the hidden state matrix output by BERT. The dimension of the hidden state matrix is... , Indicates the length of the input sequence. This represents the hidden layer dimension of the BERT model.

4. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 3, characterized in that, The specific operations for entity recognition and relation extraction of forest fire knowledge in S2.3 are as follows: S2.3.

1. A gated fusion module is used to adaptively fuse the standardized multi-granularity word sequence representation matrix with the hidden state matrix to generate enhanced entity candidate representations, and entity boundary detection is performed on this basis. Specifically, an alignment matrix is ​​first calculated using an attention mechanism to semantically align the two feature matrices along the sequence length dimension; then, through an alignment operation, the length of the hidden state matrix is ​​obtained. Consistent alignment of multi-granularity feature matrices; then, a gating mechanism is used to fuse the hidden state matrix and the aligned multi-granularity feature matrix to generate an enhanced feature matrix; Entity boundary detection is accomplished using a dual affine labeler, which predicts the probability of the enhanced feature vector at each position in the enhanced feature matrix belonging to the start of an entity, inside an entity, or outside an entity. Among them, the dual affine marker is a neural network layer used for sequence labeling; S2.3.

2. The spatiotemporal causal attention mechanism is used to directly model the potential relationship strength between any two candidate entities across the span, and the prior knowledge of fire events is incorporated. The specific assumption is decoded from the boundary detection results. There are candidate entities, each with its own representation vector and type embedding vector. For any two candidate entities, calculate the relationship strength score of the entity pair. The representation vectors of any two candidate entities are represented as follows: and The type embedding vector is represented as and , and Indicates the index of candidate entity M. ; The relationship strength score is obtained by adding three data items, including the product of the representation vectors of any two candidate entities and the weight matrix of their semantic interaction, the causal prior term, and the spatiotemporal constraint term. The causal prior term is used to inject causal logical priors specific to the forest fire domain, and the spatiotemporal constraint term is used to model the attenuation effect of spatial distance and time interval on the relationship strength. S2.3.3 Utilize relationship strength scores as attention guides to perform collaborative reasoning for type prediction of each entity; Specifically for the first The first entity, by weighted aggregation of information from all other related entities, obtains the second entity. The context aggregation vector of the nth entity is then used to aggregate the context information and pass it through the Softmax activation function to obtain the nth entity. The probability of predicting the final type of an entity; S2.3.

4. Integrating entity boundary, entity type, and entity relationship strength information, calculate the global confidence of each candidate triplet, and obtain the final output through threshold filtering; Specifically, the probability of converting the relation strength score into a specific relation type is determined by the global confidence of the triple, which is jointly determined by the entity type confidence, relation type confidence, and entity boundary confidence.

5. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 4, characterized in that, The calculation process for the total loss function in S3.1 is as follows: (1) The entity recognition composite loss includes boundary detection loss and entity type classification loss, and introduces a focus loss variant based on entity distribution patterns; The boundary detection loss uses the cross-entropy loss function, which is calculated based on the true distribution of boundary labels from manual annotation and the boundary label probabilities calculated from the model. The entity type classification loss adopts an improved focus loss function, which is specifically calculated from the manually labeled real type one-hot encoding vector and the probability of the entity's predicted type. The boundary detection loss and entity type classification loss are weighted and added together to obtain the entity recognition composite loss. (2) Relation extraction adaptive contrast loss adopts the contrast loss with adaptive margin. The contrast loss with adaptive margin brings positive triples closer and pushes negative triples further away. (3) Multi-granularity consistency regularization loss adopts a consistency regularization term based on multi-granularity features to constrain the output stability of the model under perturbations of different granularity features; The entity recognition composite loss, relation extraction adaptive contrast loss, and multi-granularity consistency regularization loss are weighted and summed to obtain the total loss function.

6. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 1, characterized in that, The joint training process for the model in S3.2 is as follows: End-to-end joint training of named entity recognition and relation extraction models is performed based on the total loss function; The text dataset in S1 is divided into a training set and a validation set. The training process uses the data in the training set and uses the AdamW optimizer to perform gradient descent based on the total loss value to iteratively update all trainable parameters in the model. In each training iteration, the batch data is forward propagated to calculate the entity boundary probability, entity type probability, relation strength score and final triple confidence. Then, the total loss function is calculated based on the real annotation. Through the backpropagation algorithm, the gradient of the total loss function is calculated and used to update all trainable parameters, so that the model can simultaneously optimize the ability of entity recognition and relation extraction. During training, the model performance is evaluated periodically using a validation set to monitor changes in entity recognition and relation extraction metrics. Set the criteria for stopping iterations: when the overall performance metric on the validation set no longer improves within multiple consecutive training cycles, or when the preset maximum number of training cycles is reached; Save the optimal model parameters from the validation set as the trained named entity recognition and relation extraction model.

7. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 1, characterized in that, S4 is as follows: The new, original text to be extracted is taken as input, and after being trained by the named entity recognition and relation extraction model, it undergoes multi-granularity adaptive word segmentation and dynamic standardization processing to generate a standardized multi-granularity word sequence representation matrix of the text. The pre-trained BERT encoder then enhances the features to obtain a hidden state matrix rich in contextual semantic information. The trained entity representation and boundary detection module, which integrates multi-granular features, then identifies the boundaries of all candidate entities in the text and their corresponding enhanced feature vectors from the enhanced features. Then, based on these candidate entities, the trained entity relationship strength modeling module based on spatiotemporal causal attention mechanism is invoked to calculate the potential relationship strength score between any two entities, and relationship-aware entity type collaborative reasoning is performed simultaneously to obtain the final type prediction for each entity. Finally, based on the triple confidence integration and threshold filtering mechanism, the global confidence of all possible triples is calculated by combining the entity boundary confidence, entity type confidence, and relation type probability. Then, the triples are filtered according to the preset dynamic threshold, and relation triples with confidence higher than the threshold are retained as the final extraction result.

8. The forest fire knowledge modeling method based on named entity recognition and relation extraction according to claim 1, characterized in that, S5 is detailed below: First, all extracted triples are post-processed and fused, including entity normalization, relation verification, and confidence weighting. Then, the processed triples are used as knowledge units and stored and organized using Neo4j graph database or dedicated knowledge graph construction tools; In the graph, each unique entity is a node, and its attributes include entity name, type, and additional information that may be extracted from the original text; Each relation is a directed edge connecting two nodes, and its attributes include relation type and extraction confidence. Ultimately, the unstructured text data is transformed into a semantic network with entities as nodes and relationships as edges, forming a forest fire knowledge graph.

Citation Information

Patent Citations

  • Medical text big data intelligent labeling and knowledge graph construction method and system

    CN119851968A