Dangerous chemical accident-oriented affair map extraction method
Through the LERT model and Neo4j, a rational map of hazardous chemical accidents was constructed, which solved the problems of insufficient accident evolution and risk expression in the existing technology, realized the accurate event entity and relationship analysis of hazardous chemical accidents, and provided decision-making support.
Patent Information
- Application Number
- CN202411148745.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-12-03
AI Technical Summary
The prior art lacks effective expression of accident evolution and potential risks in the early warning system for hazardous chemical accidents, and the knowledge graph is difficult to describe the logical evolution of things and complex semantic relationships, and cannot provide effective decision-making support.
Using the LERT model combined with Neo4j, the event entity and relationship annotation is performed by pre-processing hazardous chemical information, and the linguistic information and knowledge triple prediction tasks are used to extract event entities and relationship identification, and a rational map is constructed to display hazardous chemical accidents. development logic.
It realizes more accurate event entity information refinement and relationship analysis of hazardous chemical accidents, establishes an intuitive hazardous chemical story logic map, and provides decision-making support for emergency management of hazardous chemicals.
Smart Images

Figure CN119067208A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of causal graphs, and more specifically, to a causal graph extraction method for hazardous chemical accidents. Background Art
[0002] Hazardous chemicals have always played an indispensable role in all walks of life, providing significant value and benefits in the fields of industry, medicine, agriculture, and daily necessities. Despite this, domestic hazardous chemical accidents occur frequently, and the occurrence of hazardous chemical incidents highlights the shortcomings in accident warning, especially the safety management mechanism for such chemicals, which still has room for improvement. How to effectively integrate the professional knowledge of hazardous chemicals with modern scientific and technological means to build an efficient early warning system has become a difficult problem that needs to be overcome urgently.
[0003] Currently, most early warnings for hazardous chemicals rely on high-cost manual labeling, and there are few strategies to seek solutions by analyzing the evolution of hazardous chemical incidents. At the same time, the large amount of hazardous chemical incident data accumulated on the Internet has not been effectively utilized.
[0004] Knowledge graphs have certain limitations, mainly reflected in the fact that knowledge graphs generally only depict static, deterministic facts, study noun entities, entity attributes and the relationship between entities, and lack the ability to depict the logical evolution and development process of things.
[0005] The application number CN202211292663.6, "A Method for Constructing a Hazardous Chemical Accident Knowledge Base Based on Knowledge Graph", classifies the causes of hazardous chemical accident data, optimizes data through graph alignment, entity disambiguation, and designs data storage mode. Generates an accident tree template library and integrates the knowledge graph to realize automatic reasoning of the causes of hazardous chemical accidents. However, this method does not involve the potential risks of hazardous chemicals and cannot express the evolution of hazardous chemical accidents.
[0006] The application number is 202210663568.6, "A method and system for constructing a hazardous chemical incident logic map". The process of constructing a hazardous chemical incident logic map involves collecting and analyzing a large number of accident cases, forming a pattern layer by defining event types, trigger words, and event element roles, and then preprocessing the text and using event extraction technology to extract key information. The extracted event pairs are then mapped to predefined patterns to form event tuples. Finally, the similarity between events and patterns is calculated to construct a complete map and visualize it. However, this method still has shortcomings and lacks the ability to correctly understand complex semantics and contextual relationships.
[0007] The application number CN116432647A, "BERT-BiLSTM-CRF Hazardous Chemical Named Entity Recognition Method Integrating Multiple Features", proposes a method for hazardous chemical named entity recognition. This method achieves efficient entity recognition through BERT, BiLSTM, attention mechanism and CRF. This method has good generalization ability, but is limited to entity recognition and does not cover event or relationship analysis. Summary of the invention
[0008] The purpose of the present invention is to address the deficiencies of the prior art and propose a method for extracting a causal graph for hazardous chemical accidents.
[0009] Firstly, a method for extracting a causal graph for hazardous chemical accidents is provided, including:
[0010] Step 1: Obtain hazardous chemicals information;
[0011] Step 2: preprocess the hazardous chemicals information, wherein the preprocessed hazardous chemicals information includes attribute data and risk information; the preprocessing includes data cleaning and screening;
[0012] Step 3: Label the preprocessed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals;
[0013] Step 4: Extract event entities using the LERT model based on the labeled hazardous chemicals information;
[0014] Step 5: Obtain event relations based on the extracted event entities;
[0015] Step 6: Based on the event entities and the event relationships, use Neo4j to visualize the event graph.
[0016] Preferably, step 4 comprises:
[0017] Step 4.1: Use the LERT model to introduce linguistic information prediction tasks and knowledge triple prediction tasks, and use the LTP tool to embed event trigger words;
[0018] Step 4.2: Encode the three dimensions of word, position, and sentence, concatenate the three embeddings, and use a fully connected network to mix the features while reducing the dimensionality to obtain word pair representation;
[0019] Step 4.3: Combine the fully connected predictor and the bi-affine predictor to predict the relationship between word pair representations; and obtain the event entity through decoding.
[0020] Preferably, step 5 comprises:
[0021] Step 5.1: embed the extracted event entities into the BERT model and fuse the entity location information through the encoder;
[0022] Step 5.2: Use the output of the encoder as the input of the decoder to identify whether each subject has a corresponding object to obtain the event relationship.
[0023] Preferably, step 4.2 comprises:
[0024] Step 4.2.1: Encode the three dimensions of word, position and sentence, which are expressed as and
[0025] Step 4.2.2: Concatenate the three embeddings and use a fully connected network to mix the features while reducing the dimensionality to get the word pair representation as The calculation process is:
[0026] C=MLP1([V;E d ; E t ])
[0027] Among them, MLP1 represents a fully connected network;
[0028] Step 4.2.3: Use multiple two-dimensional dilated convolutions with different dilation rates for interaction between word pairs. The calculation process is:
[0029] Q l =σ(DConv l (C)
[0030] in, represents the output of the dilated convolution with a dilation rate of l, σ is the GELU activation function; the final word pair is expressed as
[0031] Preferably, step 4.3 comprises:
[0032] Step 4.3.1: Given a word representation After the fully connected network, the main body x is calculated separately i Representation i , and object x j The expression o j ; Then the bi-radial classifier is used to calculate the score relationship between word pairs (xi, xj), as shown below:
[0033] s i =MLP2(h i )
[0034] o j =MLP3(h j )
[0035]
[0036] Among them, U, W and b are all learnable parameters. is the score of the predefined relation R;
[0037] Step 4.3.2, word pair (x i ,x j ) indicates Q ij As input to the fully connected network predictor, the resulting relationship score is as follows:
[0038] y″ ij =MLP(Q ij )
[0039] in For predefined relationships score;
[0040] Step 4.3.3, Final word pair (x i ,x j )’s relationship probability vector y″ ij Expressed as: y ij =softmax(y′ ij +y″ ij );
[0041] Step 4.3.4, according to the final word pair (x i ,x j ) and obtain the event entity through decoding.
[0042] Preferably, step 5.1 comprises:
[0043] Step 5.1.1: Embed the extracted entities into W s After the BERT model, the hidden state output h is obtained α , expressed as:
[0044] h0=SW s +W p
[0045] h α =trans(h α-1 ),α∈[1,N]
[0046] Among them, W s represents entity embedding, S represents the one-hot encoding of the words in the text, trans(x) represents the Transformer module, and h α represents the αth hidden state output;
[0047] Step 5.1.2, encode the entity position information, the encoding method is: mark the beginning of the entity with 1, the remaining part of the entity with 2, and the part that does not belong to any entity with 0;
[0048] Step 5.1.3, concatenate the tensor P of position length N and the sentence tensor H of BERT output length N to obtain a new tensor Z of length 2N. Pass the linear layer to obtain a tensor Y of length N, then normalize it, and finally multiply it with BERT output H one by one to obtain a code of length N. The calculation process is:
[0049] Y=UZ+B
[0050] x i =H i softmax(Y i )
[0051] Among them, U and B are both learnable parameters, Z is the new tensor after BERT and the position tensor are concatenated, Y is the tensor after Z is transformed by the linear layer, and H i is the i-th output of BERT, x i is the i-th output of the encoder.
[0052] Preferably, step 5.2 comprises:
[0053] Step 5.2.1, subject labeling: Use binary label assignment to identify the start and end positions of the subject. The formula is:
[0054]
[0055] Among them, x i is the encoding of the i-th token, is the probability of the starting index, is the probability of the last index. σ represents the sigmoid activation function;
[0056] Step 5.2.2, object labeling: identify the relationship and the object at the same time, the formula is:
[0057]
[0058] in, represents the encoded representation vector of the k-th subject.
[0059] In a second aspect, a device for extracting a cause-and-effect graph for hazardous chemical accidents is provided, which is used to execute any of the methods for extracting a cause-and-effect graph for hazardous chemical accidents described in the first aspect, including:
[0060] Acquisition module, used to obtain hazardous chemicals information;
[0061] A preprocessing module, used to preprocess the hazardous chemicals information, wherein the preprocessed hazardous chemicals information includes attribute data and risk information; the preprocessing includes data cleaning and screening;
[0062] A labeling module is used to label the pre-processed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals;
[0063] The extraction module is used to extract event entities using the LERT model based on the labeled hazardous chemicals information;
[0064] The acquisition module is used to obtain event relations based on the extracted event entities;
[0065] The display module is used to use Neo4j to visualize the event graph according to the event entities and the event relationships.
[0066] In a third aspect, a computer storage medium is provided, in which a computer program is stored; when the computer program is run on a computer, the computer executes any of the methods for extracting causal graphs for hazardous chemical accidents described in the first aspect.
[0067] The beneficial effects of the present invention are:
[0068] 1. The present invention incorporates a lot of semantic information into the pre-training model to extract more accurate event entity information from hazardous chemical accidents.
[0069] 2. Based on the subject and predicate extraction relationship model, the present invention proposes a coding method to embed more accurate entity location information of hazardous chemical incidents.
[0070] 3. The present invention uses the extracted entities and relationships to establish a causal map of hazardous chemical accidents and a corresponding early warning system, intuitively displaying the development logic of hazardous chemical accidents and providing decision-making support for emergency management of hazardous chemical accidents. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] Figure 1 This is a flowchart of a method for extracting causal graphs for hazardous chemical accidents;
[0072] Figure 2 This is a schematic diagram of the event entity extraction model structure;
[0073] Figure 3 This is a schematic diagram of the event relationship recognition model structure;
[0074] Figure 4 This is a schematic diagram of the construction of the methoxyethylmercuric chloride theory map;
[0075] Figure 5 It is the operation diagram of the early warning system;
[0076] Figure 6 This is a schematic diagram of the early warning link. DETAILED DESCRIPTION
[0077] The present invention is further described below in conjunction with embodiments. The description of the following embodiments is only used to help understand the present invention. It should be noted that for ordinary persons in the art, without departing from the principle of the present invention, the present invention can also be modified in some ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0078] Embodiment 1:
[0079] The causal graph is a logical knowledge base of causal relationships. It uses events as nodes and the causal and sequential relationships between events as edges to form a directed cyclic graph that depicts the development laws and evolutionary logic of events. The causal graph is a dynamic extension of the knowledge graph, focusing on solving the Why and How problems. Through the multi-dimensional information of events and using advanced semantic relationship analysis technology, it effectively mines the internal connections and development context in the event sequence. The causal graph can use event information and semantic relationships to mine corresponding events, which can be fully used for early warning of hazardous chemical accidents.
[0080] Furthermore, based on the characteristics of the event graph, this application provides a method for extracting event graphs for hazardous chemical accidents, such as Figure 1 As shown, including:
[0081] Step 1: Obtain hazardous chemicals information.
[0082] Specifically, in step 1, information is crawled from the "Catalogue of Hazardous Chemicals (2015 Edition)" and public website platforms, including 16 items of information such as fire protection information, hazard description, operation methods, toxicity, etc.
[0083] Step 2: preprocess the hazardous chemicals information, the preprocessed hazardous chemicals information includes attribute data and risk information; the preprocessing includes data cleaning and screening.
[0084] In step 2, the original data is cleaned, useless information is processed, and important content about hazardous chemicals is retained.
[0085] Step 3: Label the preprocessed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals.
[0086] In step 3, the retained data was further processed using the open source annotation tool Doccano to annotate the data and annotate the sequence and relationship of hazardous chemical events, thereby obtaining Figure 2 TEXT in .
[0087] Step 4: Based on the labeled hazardous chemicals information, use the LERT model to extract event entities.
[0088] In step 4, the LERT model is used to introduce two new tasks: linguistic information prediction and knowledge triple prediction. The event trigger words are embedded in combination with the LTP tool to capture more word segmentation information and word letter information to enhance the model's perception of semantics and correctly understand more complex semantic relationships.
[0089] The present invention adopts the LERT model for pre-training, which is based on BERT and combined with the LTP tool. Developed by Harbin Institute of Technology, it provides a series of Chinese natural language processing tools, including semantic role labeling, syntactic analysis, word segmentation and part-of-speech tagging, dependency analysis and named entity recognition. This article uses the tool to obtain the word segmentation information and part-of-speech tagging information of hazardous chemical incident sentences. At the same time, the output of LERT is used by bidirectional LSTM to capture the long-term dependencies in the sequence and obtain the hidden vector of each word or character. The output of LSTM is passed into CLN, and conditional layer normalization helps to control the numerical range within a relatively small interval, improve the learning speed, and avoid gradient disappearance, improve the versatility of the network, and reduce the sensitivity of the model.
[0090] Step 5: Obtain event relations based on the extracted event entities.
[0091] Step 6: Based on the event entities and the event relationships, use Neo4j to visualize the event graph.
[0092] Embodiment 2:
[0093] Based on Example 1, Example 2 of the present application provides a more specific method for extracting a causal graph for hazardous chemical accidents, including:
[0094] Step 1: Obtain hazardous chemicals information.
[0095] Step 2: preprocess the hazardous chemicals information, the preprocessed hazardous chemicals information includes attribute data and risk information; the preprocessing includes data cleaning and screening.
[0096] Step 3: Label the preprocessed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals.
[0097] Step 4: Based on the labeled hazardous chemicals information, use the LERT model to extract event entities.
[0098] like Figure 2As shown, step 4 includes:
[0099] Step 4.1: Use the LERT model to introduce the linguistic information prediction task and the knowledge triple prediction task, and use the LTP tool to embed event trigger words.
[0100] Step 4.2: Encode the three dimensions of word, position, and sentence, concatenate the three embeddings, and use a fully connected network to mix the features while reducing the dimensionality to obtain word pair representation.
[0101] Step 4.2 includes:
[0102] Step 4.2.1: In the convolutional layer of the present invention, the three dimensions of word, position and sentence are first encoded, which are represented as and
[0103] Step 4.2.2: Concatenate the three embeddings and use a fully connected network to mix the features while reducing the dimensionality to get the word pair representation as The calculation process is:
[0104] C=MLP1([V;E d ; E t ])
[0105] Among them, MLP1 represents a fully connected network;
[0106] Step 4.2.3: Use multiple two-dimensional dilated convolutions with different dilation rates for interaction between word pairs. The calculation process is:
[0107] Q l =σ(DConv l (C)
[0108] in, represents the output of the dilated convolution with a dilation rate of l, σ is the GELU activation function; the final word pair is expressed as
[0109] Step 4.3: In the joint prediction layer, the fully connected predictor and the bi-affine predictor are combined to predict the relationship between word pair representations; and the event entity is obtained through decoding.
[0110] The convolution operation obtains the word pair representation Q, and then a fully connected layer is used to predict the relationship between word pairs. Previous studies have shown that combining fully connected prediction with a bi-affine predictor is more effective in relation classification, so this paper adopts the strategy of selecting two predictions and combining them separately.
[0111] Step 4.3 includes:
[0112] Step 4.3.1. Encoder output is the input of the bi-affine predictor. Given a word representation After the fully connected network, the main body x is calculated separately i Representation i , and object x j The expression o j ; Then the double-radiation classifier is used to calculate the word pair (x i ,x j ) is as follows:
[0113] s i =MLP2(h i )
[0114] o j =MLP3(h j )
[0115]
[0116] Among them, U, W and b are all learnable parameters. For predefined relationships score;
[0117] Step 4.3.2, word pair (x i ,x j ) indicates Q ij As input to the fully connected network predictor, the resulting relationship score is as follows:
[0118] y″ ij =MLP(Q ij )
[0119] in For predefined relationships score;
[0120] Step 4.3.3, Final word pair (x i ,x j )’s relationship probability vector y″ ij It is obtained from the calculation results of the two predictors Biaffine and MLP, expressed as: y ij =softmax(y′ ij +y″ ij );
[0121] Step 4.3.4, according to the final word pair (x i ,x j ) and obtain the event entity through decoding.
[0122] Specifically, for each sentence X = {x1, x2, ..., x N}, whose goal is to minimize the negative log-likelihood loss as follows:
[0123]
[0124] Where N is the number of words, is a word pair (x i ,x j ), is the predicted probability vector, and r represents the predefined relationship set The rth relationship in .
[0125] The present invention is different from considering more accurate entity boundary identification. Instead, it predicts two types of relationships by modeling entity boundaries and adjacent relationships between entity words, which not only determines the boundaries of words, but also the relationships between words. Specifically, it is divided into three types: 1. There is no relationship between the two words and they do not belong to the same entity. 2. The adjacent position relationship of the two words in the same entity. 3. The two words are in the same entity, and one is at the beginning of the entity and the other is at the end of the entity, which is used to judge the boundaries and categories of the entities. Finally, it can be decoded into entity one, entity two and entity three through Decoding.
[0126] Step 5: Obtain event relations based on the extracted event entities.
[0127] Step 5 includes:
[0128] Step 5.1: Embed the extracted event entities into the BERT model and fuse the entity location information through the encoder.
[0129] Step 5.1 includes:
[0130] Step 5.1.1: Embed the extracted entities into W s After the BERT model, the hidden state output h is obtained α , expressed as:
[0131] h0=SW s +W p
[0132] h α =trans(h α-1 ),α∈[1,N]
[0133] Among them, W s represents entity embedding, S represents the one-hot encoding of the words in the text, trans(x) represents the Transformer module, and h α represents the αth hidden state output;
[0134] Step 5.1.2, encode the entity position information, the encoding method is: mark the beginning of the entity with 1, the remaining part of the entity with 2, and the part that does not belong to any entity with 0;
[0135] Step 5.1.3: Concatenate the tensor P of position length N and the sentence tensor H of BERT output length N to obtain a new tensor Z of length 2N. Pass the linear layer to obtain a tensor Y of length N, then normalize it and multiply it with BERT output H one by one to obtain a code of length N. The calculation process is:
[0136] Y=UZ+B
[0137] x i =H i softmax(Y i )
[0138] Among them, U and B are both learnable parameters, Z is the new tensor after BERT and the position tensor are concatenated, Y is the tensor after Z is transformed by the linear layer, and H i is the i-th output of BERT, x i is the i-th output of the encoder.
[0139] Step 5.2: Use the output of the encoder as the input of the decoder to identify whether each subject has a corresponding object to obtain the event relationship.
[0140] Among them, the encoder is divided into a subject tagger and an object tagger for a specific relationship. The process requires two steps. First, a subject is selected and identified, and for each candidate subject, each relationship is checked one by one to see if there is a corresponding object.
[0141] Specifically, Figure 3 As shown, step 5.2 includes:
[0142] Step 5.2.1, body labeling: binary label assignment is used, and the labeling method of 0 or 1 is used to detect the start and end positions of the body respectively. If this token is the start or end index of the body, the current position is classified as 1, otherwise it is 0. The specific formula is as follows:
[0143]
[0144] Among them, x i is the encoding of the i-th token, is the probability of the starting index, is the probability of the last index. σ represents the sigmoid activation function;
[0145] For a given token encoding result, the training objective is to maximize the likelihood function, as shown below:
[0146]
[0147] Where I(z) = 1 if and only if z = true, otherwise it is 0. L is the length of the entire sentence, Indicates the binary label (0 or 1) corresponding to the start position of the i-th token. θ (s|x), given a sentence x, try to find the body of the sentence.
[0148] Step 5.2.2, object labeling: Identify relations and objects at the same time. Each relation corresponds to its own object identifier. The formula is:
[0149]
[0150] in, represents the encoding representation vector of the kth subject. i and The dimensions need to remain consistent.
[0151] The training objectives are consistent with the main tagger, as follows:
[0152]
[0153] Step 6: Based on the event entities and the event relationships, use Neo4j to visualize the event graph.
[0154] The original information used to create the hazardous chemicals incident data set contains a lot of useful information. Static information can be directly added to the event graph as the attribute of the hazardous chemicals node. Some information is easy to extract and can also be added to the event graph through new nodes and relationships after processing. This information is visualized using Neo4j, such as Figure 4 As shown, this is the construction of the theoretical map of methoxyethylmercury chloride.
[0155] Embodiment 3:
[0156] On the basis of Examples 1 and 2, Example 3 of the present application provides a device for extracting a cause-effect graph for hazardous chemical accidents, including:
[0157] Acquisition module, used to obtain hazardous chemicals information;
[0158] A preprocessing module, used to preprocess the hazardous chemicals information, wherein the preprocessed hazardous chemicals information includes attribute data and risk information; the preprocessing includes data cleaning and screening;
[0159] A labeling module is used to label the pre-processed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals;
[0160] The extraction module is used to extract event entities using the LERT model based on the labeled hazardous chemicals information;
[0161] The acquisition module is used to obtain event relations based on the extracted event entities;
[0162] The display module is used to use Neo4j to visualize the event graph according to the event entities and the event relationships.
[0163] Specifically, the device provided in this embodiment is a device corresponding to the method provided in Embodiments 1 and 2. Therefore, the parts in this embodiment that are the same or similar to Embodiments 1 and 2 can be referenced to each other and will not be repeated in this application.
Claims
1. A method for extracting a causal graph for hazardous chemical accidents, characterized in that: include: Step 1: Obtain hazardous chemicals information; Step 2: preprocess the hazardous chemicals information, wherein the preprocessed hazardous chemicals information includes attribute data and risk information; The preprocessing includes data cleaning and screening; Step 3: Label the preprocessed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals; Step 4: Extract event entities using the LERT model based on the labeled hazardous chemicals information; Step 5: Obtain event relations based on the extracted event entities; Step 6: Based on the event entities and the event relationships, use Neo4j to visualize the event graph.
2. The method for extracting the cause and effect graph of hazardous chemical accidents according to claim 1 is characterized in that: Step 4 includes: Step 4.1: Use the LERT model to introduce linguistic information prediction tasks and knowledge triple prediction tasks, and use the LTP tool to embed event trigger words; Step 4.2: Encode the three dimensions of word, position, and sentence, concatenate the three embeddings, and use a fully connected network to mix the features while reducing the dimensionality to obtain word pair representation; Step 4.3: Combine the fully connected predictor and the bi-affine predictor to predict the relationship between word pair representations; and obtain the event entity through decoding.
3. The method for extracting the cause and effect graph of dangerous chemical accidents according to claim 2 is characterized in that: Step 5 includes: Step 5.1: embed the extracted event entities into the BERT model and fuse the entity location information through the encoder; Step 5.2: Use the output of the encoder as the input of the decoder to identify whether each subject has a corresponding object to obtain the event relationship.
4. The method for extracting the cause and effect graph of dangerous chemical accidents according to claim 3 is characterized in that: Step 4.2 includes: Step 4.2.1: Encode the three dimensions of word, position and sentence, which are expressed as and Step 4.2.2: Concatenate the three embeddings and use a fully connected network to mix the features while reducing the dimensionality to get the word pair representation as The calculation process is: C=MLP1([V;E d ;E t ]) Among them, MLP1 represents a fully connected network; Step 4.2.3: Use multiple two-dimensional dilated convolutions with different dilation rates for interaction between word pairs. The calculation process is: Q l =σ(DConv l (W)) in, represents the output of the dilated convolution with a dilation rate of l, σ is the GELU activation function; the final word pair is expressed as 5. The method for extracting the cause and effect graph of dangerous chemical accidents according to claim 4 is characterized in that: Step 4.3 includes: Step 4.3.1: Given a word representation After the fully connected network, the main body x is calculated separately i Representation i , and object x j The expression o j ; Then the double-radiation classifier is used to calculate the word pair (x i , x j ) is as follows: s i =MLP2(h i ) o j =MLP3(h j ) Among them, U, W and b are all learnable parameters. For predefined relationships score; Step 4.3.2, word pair (x i , x j ) indicates Q ij As input to the fully connected network predictor, the resulting relationship score is as follows: and' ij =MLP(Q ij ) in For predefined relationships score; Step 4.3.3, Final word pair (x i , x j )’s relationship probability vector y″ ij Expressed as: y ij =softmax(y′ ij +y″ ij ); Step 4.3.4, according to the final word pair (x i , x j ) and obtain the event entity through decoding.
6. The method for extracting the cause and effect graph of dangerous chemical accidents according to claim 5 is characterized in that: Step 5.1 includes: Step 5.1.1: Embed the extracted entities into W s After the BERT model, the hidden state output h is obtained α , expressed as: h0=SW s +W p h α =trans(h α-1 ),α∈[1,N] Among them, W s represents entity embedding, S represents the one-hot encoding of the words in the text, trans(x) represents the Transformer module, and h α represents the αth hidden state output; Step 5.1.2, encode the entity position information, the encoding method is: mark the beginning of the entity with 1, the remaining part of the entity with 2, and the part that does not belong to any entity with 0; Step 5.1.3, concatenate the tensor P of position length N and the sentence tensor H of BERT output length N to obtain a new tensor Z of length 2N. Pass the linear layer to obtain a tensor Y of length N, then normalize it, and finally multiply it with BERT output H one by one to obtain a code of length N. The calculation process is: Y=UZ+B x i =H i softmax(Y i ) Among them, U and B are both learnable parameters, Z is the new tensor after BERT and the position tensor are concatenated, Y is the tensor after Z is transformed by the linear layer, and H i is the i-th output of BERT, x i is the i-th output of the encoder.
7. The method for extracting the cause and effect graph of dangerous chemical accidents according to claim 5 is characterized in that: Step 5.2 includes: Step 5.2.1, subject labeling: Use binary label assignment to identify the start and end positions of the subject. The formula is: Among them, x i is the encoding of the i-th token, is the probability of the starting index, is the probability of the last index. σ represents the sigmoid activation function; Step 5.2.2, object labeling: identify the relationship and the object at the same time, the formula is: in, represents the encoded representation vector of the k-th subject.
8. A device for extracting causal graphs for dangerous chemical accidents, characterized in that: The method for extracting a causal graph for a hazardous chemical accident according to any one of claims 1 to 7 comprises: Acquisition module, used to obtain hazardous chemicals information; A preprocessing module, used to preprocess the hazardous chemicals information, wherein the preprocessed hazardous chemicals information includes attribute data and risk information; the preprocessing includes data cleaning and screening; A labeling module is used to label the pre-processed hazardous chemicals information and divide it into a training set, a validation set, and a test set; the labeling includes sequence labeling and relationship labeling of hazardous chemicals; The extraction module is used to extract event entities using the LERT model based on the labeled hazardous chemicals information; The acquisition module is used to obtain event relations based on the extracted event entities; The display module is used to use Neo4j to visualize the event graph according to the event entities and the event relationships.
9. A computer storage medium, characterized in that The computer storage medium stores a computer program; when the computer program is run on a computer, the computer executes the method for extracting a causal graph for hazardous chemical accidents as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Dangerous chemical library construction method based on knowledge graph
CN112541088A
BERT-BiLSTM-CRF dangerous chemical named entity identification method fusing multiple features
CN116432647A
Establishment method of affair map about dangerous chemical accidents
CN117787405A
Intelligent hotline assignment method based on knowledge graph
CN118332075A
