Chemical accident cause analysis method based on text mining and causal inference

By employing text mining and causal inference methods, the problem of automated processing and customized analysis of unstructured safety texts within enterprises was solved. This enabled efficient, accurate, and reliable causal discovery for chemical accident cause analysis, provided target-specific prevention strategies, and improved the practicality of safety management.

CN121880545BActive Publication Date: 2026-06-26CHINA UNIV OF GEOSCIENCES (BEIJING)
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA UNIV OF GEOSCIENCES (BEIJING)
Filing Date
2026-03-23
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing technologies cannot efficiently process unstructured security texts within enterprises, lack the ability to identify and customize the causal factors specific to each enterprise, and cannot quantify the expected effects of different intervention measures, resulting in unreasonable allocation of security resources and poor intervention effects.

Method used

Regular expressions are used for targeted semantic segment extraction, deep learning models are used for causal entity identification, density clustering algorithms and causal discovery algorithms are combined to construct the chemical causal structure, and structural equation modeling is used to infer causal strength and simulate counterfactual intervention to determine the optimal prevention strategy.

Benefits of technology

It has achieved automated processing of unstructured text, improved the objectivity and accuracy of causal analysis, provided target-specific and precise prevention strategies, promoted the shift of safety management from passive post-event attribution to proactive pre-event prevention, and improved the practicality of intervention guidance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121880545B_ABST
    Figure CN121880545B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of chemical accident safety analysis, and discloses a chemical accident cause analysis method based on text mining and cause inference, which comprises: directional semantic segment extraction and cleaning treatment on the obtained chemical accident text; training of a pre-constructed deep learning model by using historical chemical accident data, cause entity recognition on the optimized cause description data; automatic aggregation of chemical cause semantic vectors into a cause theme set by using a density clustering algorithm; cause theme effect strength calculation on the cause theme set according to a pre-set multi-dimensional strength calculation index set, construction of a partial ancestor graph, and modification processing on the partial ancestor graph; cause and effect strength inference on the chemical cause and effect structure based on a structural equation model, counterfactual intervention simulation on the quantitative cause and effect network, and determination of the optimal prevention strategy. The present application can realize automatic processing of unstructured text and improve the automation and objectivity of cause analysis.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of chemical accident safety analysis technology, and in particular to a method for analyzing the causes of chemical accidents based on text mining and causal inference. Background Technology

[0002] Safety management in chemical enterprises relies on accurate identification and targeted intervention of accident causes. However, current practices suffer from two major pain points: First, enterprise safety data, such as ledgers, hazard records, rectification reports, and internal accident analyses, is mostly unstructured text, lacking efficient automated analysis tools. This reliance on manual summarization leads to delayed decision-making and strong subjectivity. Second, existing accident causation research is largely based on publicly available accident investigation reports, focusing on macro-level patterns and failing to adapt to the individualized safety risk characteristics of enterprises, making it difficult to provide directly implementable customized intervention solutions. In existing technologies, some text mining and causal analysis methods are only used for academic research, with data sources limited to publicly available reports, neglecting the application scenarios of internal enterprise data. A few enterprise-oriented safety management tools can only perform hazard statistics or compliance checks, failing to reveal the deep causal relationships between causal elements, let alone quantify the expected effects of different intervention measures, resulting in unreasonable allocation of enterprise safety resources and poor intervention effectiveness. In summary, the following problems exist:

[0003] 1. Existing technologies cannot efficiently process unstructured safety documents within enterprises, such as ledgers and hazard records, making it difficult to quickly extract personalized causal factors. 2. Existing methods are mostly based on macro-level publicly available data, lacking the ability to customize analysis of specific enterprise safety risks and failing to match the unique management shortcomings and risk characteristics of enterprises. 3. Existing causal analysis methods are not adapted to the non-normal distribution characteristics of chemical accident causal data and do not fully consider unobserved potential confounding factors, failing to meet the sufficiency of causation assumption, resulting in inaccurate causal structure discovery and unreliable causal strength quantification. 4. The lack of an integrated framework from internal enterprise data extraction, causal quantification, causal analysis to intervention decision-making makes it difficult to translate academic research results into practical safety management value for enterprises.

[0004] Therefore, how to provide a method for analyzing the causes of chemical accidents based on text mining and causal inference is an urgent problem to be solved. Summary of the Invention

[0005] This invention provides a method for analyzing the causes of chemical accidents based on text mining and causal inference, in order to solve the aforementioned technical problems in the prior art.

[0006] According to a first aspect of the present invention, a method for analyzing the causal causes of chemical accidents based on text mining and causal inference is provided.

[0007] In one embodiment, the chemical accident causation analysis method based on text mining and causal inference includes:

[0008] Regular expressions are used to extract targeted semantic segments from the acquired chemical accident text to obtain structured causal semantic data. The structured causal semantic data is then cleaned to obtain optimized causal description data.

[0009] Historical chemical accident data is acquired and used to train a pre-built deep learning model to obtain a causative entity identification model. The causative entity identification model is then used to identify the causative entities in the optimized causative description data to obtain the chemical causative entities.

[0010] Chemical causal entities are transformed into chemical causal semantic vectors, and density clustering algorithms are used to automatically aggregate the chemical causal semantic vectors into a set of causal topics.

[0011] The intensity of the causal theme effect is calculated based on the preset multi-dimensional intensity calculation index set to obtain the accident and theme intensity matrix. The accident and theme intensity matrix is ​​constructed into a partial ancestor graph using the causal discovery algorithm, and the partial ancestor graph is modified to obtain the chemical causal structure.

[0012] Based on structural equation modeling, the causal strength of chemical causal structure is inferred, a quantitative causal network is obtained, counterfactual intervention simulation is performed on the quantitative causal network, and the optimal prevention strategy is determined.

[0013] According to a second aspect of the present invention, a chemical accident causation analysis system based on text mining and causal inference is provided.

[0014] In one embodiment, the chemical accident causation analysis system based on text mining and causal inference includes:

[0015] The text acquisition and preprocessing module is used to extract targeted semantic segments from the acquired chemical accident text using regular expressions to obtain structured causal semantic data, and then clean the structured causal semantic data to obtain optimized causal description data.

[0016] The causative entity identification module is used to acquire historical chemical accident data and train a pre-built deep learning model using the historical chemical accident data to obtain a causative entity identification model. The causative entity identification model is then used to identify causative entities in the optimized causative description data to obtain chemical causative entities.

[0017] The causative topic clustering module is used to transform chemical causative entities into chemical causative semantic vectors, and automatically aggregate the chemical causative semantic vectors into a causative topic set using a density clustering algorithm.

[0018] The chemical causal structure construction module is used to calculate the intensity of the causal theme effect on the causal theme set according to the preset multi-dimensional intensity calculation index set, obtain the accident and theme intensity matrix, use the causal discovery algorithm to construct a partial ancestor graph of the accident and theme intensity matrix, and perform correction processing on the partial ancestor graph to obtain the chemical causal structure.

[0019] The optimal prevention strategy determination module is used to infer the causal strength of chemical causal structure based on structural equation modeling, obtain a quantitative causal network, perform counterfactual intervention simulation on the quantitative causal network, and determine the optimal prevention strategy.

[0020] According to a third aspect of the present invention, a computer device is provided.

[0021] In some embodiments, the computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the above-described method for analyzing the causal causes of chemical accidents based on text mining and causal inference.

[0022] According to a fourth aspect of the present invention, a computer-readable storage medium is provided.

[0023] In one embodiment, a computer program is stored on a computer-readable storage medium, and when executed by a processor, the computer program implements the steps of the above-described method for analyzing the causal causes of chemical accidents based on text mining and causal inference.

[0024] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects:

[0025] 1. This invention achieves automated processing of unstructured text through a causal entity recognition model and density clustering algorithm, avoiding subjective bias and efficiency bottlenecks in manual extraction, and can efficiently process massive accident report data; improving the automation and objectivity of causal analysis.

[0026] 2. This invention designs a multi-dimensional intensity calculation index, comprehensively considering classification confidence, semantic consistency, and differences in report detail, to achieve accurate quantification of causal topic intensity, providing high-quality structured data for subsequent causal analysis and improving the accuracy of causal quantification.

[0027] 3. This invention adopts a causal discovery algorithm to adapt to non-normal data distribution and potential confounding factors, breaking through the dependence of traditional causal analysis on expert prior knowledge, objectively revealing the deep transmission mechanism between causal topics, realizing the leap from association mining to causal structure discovery, and improving the reliability of causal discovery.

[0028] 4. This invention quantifies causal strength and simulates counterfactual interventions through structural equation modeling, clarifies the intervention priorities and effects of different causal themes, provides chemical enterprises with target-specific and precise prevention strategies, promotes safety management from passive post-event attribution to proactive pre-event prevention, and improves the practicality of intervention guidance.

[0029] 5. This invention can be transferred to other industries through this framework, such as the analysis of unstructured accident reports in coal mines and construction, and has a wide range of application scenarios, improving the versatility of causal analysis.

[0030] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description

[0031] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0032] Figure 1 This is a schematic diagram of a process according to an exemplary embodiment;

[0033] Figure 2 This is a schematic diagram of a system structure according to an exemplary embodiment;

[0034] Figure 3 This is a schematic diagram of the structure of a computer device according to an exemplary embodiment;

[0035] Figure 4 This is a step-by-step diagram illustrating the entire technical process according to an exemplary embodiment;

[0036] Figure 5 This is a diagram illustrating the process of determining the research problem according to an exemplary embodiment;

[0037] Figure 6 This is a diagram illustrating a data collection and cleaning process according to an exemplary embodiment;

[0038] Figure 7 This is a schematic diagram illustrating the causative entity identification steps according to an exemplary embodiment;

[0039] Figure 8 This is a schematic diagram illustrating semantic density clustering steps according to an exemplary embodiment;

[0040] Figure 9 This is a schematic diagram illustrating the causal structure learning steps according to an exemplary embodiment;

[0041] Figure 10 This is a schematic diagram illustrating the causal effect estimation steps according to an exemplary embodiment. Detailed Implementation

[0042] The following description and accompanying drawings fully illustrate specific embodiments described herein to enable those skilled in the art to practice them. Some portions and features of certain embodiments may be included in or replace portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims and all available equivalents thereof. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments; similar or identical parts between embodiments can be referred to interchangeably.

[0043] The modules in the apparatus or system of this application can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0044] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0045] Figure 1 An embodiment of the chemical accident causation analysis method based on text mining and causal inference of the present invention is shown.

[0046] In this optional embodiment, the chemical accident causation analysis method based on text mining and causal inference includes:

[0047] Step S101: Use regular expressions to extract targeted semantic segments from the acquired chemical accident text to obtain structured causal semantic data, and clean the structured causal semantic data to obtain optimized causal description data.

[0048] Step S102: Obtain historical chemical accident data, and use the historical chemical accident data to train a pre-built deep learning model to obtain a causative entity identification model. Use the causative entity identification model to identify causative entities in the optimized causative description data to obtain chemical causative entities.

[0049] Step S103: Convert chemical causal entities into chemical causal semantic vectors, and use density clustering algorithm to automatically aggregate chemical causal semantic vectors into a set of causal topics;

[0050] Step S104: Calculate the intensity of the causal theme effect on the causal theme set according to the preset multi-dimensional intensity calculation index set to obtain the accident and theme intensity matrix. Use the causal discovery algorithm to construct a partial ancestor graph of the accident and theme intensity matrix, and correct the partial ancestor graph to obtain the chemical causal structure.

[0051] Step S105: Based on the structural equation model, the causal strength of the chemical causal structure is inferred to obtain the quantitative causal network. The quantitative causal network is then subjected to counterfactual intervention simulation, and the optimal prevention strategy is determined.

[0052] In this optional embodiment, historical chemical accident data is acquired, and a pre-built deep learning model is trained using this data to obtain a causative entity identification model. This causative entity identification model is then used to identify the causative entities in the optimized causative description data, resulting in chemical causative entities including:

[0053] Historical chemical accident data was acquired and annotated in accordance with chemical process safety management theory to obtain causation annotation samples, which were then divided into training set, validation set and test set.

[0054] Using a pre-trained language model as the base model, after loading pre-trained weights onto the base model, the bottom six layers are frozen and the top four layers of transformer parameters are unlocked to obtain the bidirectional encoder representation layer.

[0055] A bidirectional long short-term memory network layer is connected after the bidirectional encoder representation layer, and a conditional random field layer is added at the end to obtain a pre-built deep learning model. The pre-built deep learning model is trained using the training set to obtain the causal entity recognition model.

[0056] The optimized causal description data is preprocessed to obtain a standard causal feature sequence. The standard causal feature sequence is then input into the causal entity recognition model for inference to obtain the optimal causal label sequence. Finally, entity extraction and post-processing are performed on the optimal causal label sequence to obtain the chemical causal entity.

[0057] In this optional embodiment, historical chemical accident data is annotated using chemical process safety management theory to obtain causation annotation samples, including:

[0058] An annotation framework is constructed based on the theoretical dimensions of chemical process safety management, and chemical causal entity labels are defined in combination with the causal characteristics of chemical accidents.

[0059] Based on chemical causative entity labels and unified labeling specifications, double-blind labeling was performed on the optimized causative description data to obtain annotated causative description data. Then, consistency checks were used to correct labeling discrepancies in the annotated causative description data to obtain causative labeling samples.

[0060] In this optional embodiment, the optimized causal description data is preprocessed to obtain a standard causal feature sequence. This standard causal feature sequence is then input into a causal entity recognition model for inference to obtain an optimal causal label sequence. Finally, entity extraction and post-processing are performed on the optimal causal label sequence to obtain chemical causal entities, including:

[0061] The optimized causal description data is segmented into sentences, and the segmentation results are processed by combining a chemical engineering-specific dictionary to obtain segmented text. The segmented text is then padded or truncated according to a preset uniform sequence length to obtain a standard causal feature sequence.

[0062] The standard causal feature sequence is input into the bidirectional encoder representation layer of the causal entity recognition model to obtain dynamic word vectors. The dynamic word vectors are then sequence-integrated by the bidirectional long short-term memory network layer to obtain the preliminary causal label sequence.

[0063] In the conditional random field layer, the Viterbi algorithm is used to decode the initial causal label sequence to obtain the optimal causal label sequence. Text fragments are extracted from the optimal causal label sequence to obtain the initial causal entity. Then, consecutive initial causal entities of the same type are merged to obtain the complete causal entity.

[0064] Invalid entities are removed from complete causative entities according to a preset length threshold to obtain clean causative entities. The rationality of the clean causative entities is then verified by a dictionary of chemical process safety management theory terms to obtain chemical causative entities.

[0065] In this optional embodiment, converting chemical causative entities into chemical causative semantic vectors, and automatically aggregating the chemical causative semantic vectors into a causative topic set using a density clustering algorithm includes:

[0066] Text standardization is performed on chemical causal entities to obtain standardized entity phrases. The standardized entity phrases are then padded or truncated according to a preset maximum length. The native word segmenter is combined with a chemical bilingual dictionary to perform word segmentation and generate causal input tensors.

[0067] The causal input tensor is transformed into a semantic vector using an embedding model. The semantic vector is then normalized to obtain a normalized semantic vector. The effectiveness of the normalized semantic vector is then verified by combining it with the causal topic, thus obtaining the chemical causal semantic vector.

[0068] The semantic similarity of chemical causal semantic vectors is evaluated using a density clustering algorithm to obtain a distance matrix. Then, causal topic clustering is performed based on the distance matrix to obtain a causal topic set.

[0069] In this optional embodiment, a density clustering algorithm is used to evaluate the semantic vector similarity of chemical causal semantic vectors to obtain a distance matrix. Then, causal topic clustering is performed based on the distance matrix to obtain a causal topic set including:

[0070] The chemical causal semantic vectors are normalized to obtain a set of causal semantic vectors, and the parameters of the density clustering algorithm are set to obtain the initial density clustering algorithm.

[0071] The initial density clustering algorithm is used to calculate the cosine distance between all entities in the causal semantic vector set, and a distance matrix is ​​constructed. All cosine distances corresponding to each causal semantic vector in the distance matrix are eliminated and sorted, and the causal semantic vectors corresponding to the first few smallest cosine distances are selected as the nearest neighbor set.

[0072] The maximum distance value in the nearest neighbor set is taken as the feature distance, and the density is calculated based on the inverse distance method and the feature distance to obtain the local density;

[0073] Based on the local density, density peak points are identified. Using density peaks as cluster centers, causal semantic vectors that are density-reachable are merged to form initial clusters. Causal semantic vectors that are density-inaccessible are marked as noise points. A stable cluster set is obtained by automatically merging similar initial clusters that are less than a preset threshold.

[0074] Calculate the cohesion and separation of each cluster in the stable cluster set, and remove clusters based on the cohesion and separation to obtain the causal cluster set. Then, name the causal cluster set with the causal theme to obtain the causal theme set.

[0075] In this optional embodiment, the preset multi-dimensional strength calculation index set includes: evidence quality index of causative entity, semantic consistency index within causative topic, and aggregation strength index within causative entity.

[0076] In this optional embodiment, a causal discovery algorithm is used to construct a partial ancestor graph from the accident and topic intensity matrix, and the partial ancestor graph is then modified to obtain the chemical causal structure, which includes:

[0077] The intensity matrix of the accident and the topic is standardized to obtain a standardized intensity matrix. The parameters of the causal discovery algorithm are configured to obtain the initial causal discovery algorithm.

[0078] The skeleton of the standardized intensity matrix is ​​learned by using the initial causal discovery algorithm to obtain an undirected causal skeleton. Based on the undirected causal skeleton and according to the direction rules, a partial ancestor graph is obtained.

[0079] Edges marked as having uncertain or potentially mixed directions are extracted from the partial ancestor graph. Fuzzy path filtering is then performed on the partial ancestor graph based on these edges to obtain the filtered fuzzy causal paths.

[0080] Logical relationships were extracted from the chemical safety expert knowledge base and internal enterprise policy documents. These relationships were then used to make a rational judgment and correct the path direction of the selected fuzzy causal paths, resulting in the chemical causal structure.

[0081] In this optional embodiment, the standardized intensity matrix is ​​subjected to skeleton learning using an initial causal discovery algorithm to obtain an undirected causal skeleton. Based on the undirected causal skeleton and according to direction rules, direction learning is performed to obtain a partial ancestor graph, including:

[0082] The standardized intensity matrix is ​​initialized and connected using the initial causal discovery algorithm to obtain the topic node graph.

[0083] Perform kernel function conditional independence test on each pair of nodes in the topic node graph to obtain the independence test results. Based on the independence test results, remove node edges from the topic node graph to obtain an undirected causal skeleton.

[0084] Based on the undirected causal skeleton, the causal direction of the edges is marked using the built-in direction rules of the initial causal discovery algorithm, thus obtaining a partial ancestor graph.

[0085] In this optional embodiment, the causal strength of the chemical causal structure is inferred based on structural equation modeling to obtain a quantified causal network. Counterfactual intervention simulation is then performed on the quantified causal network, and the optimal prevention strategy is determined, including:

[0086] Using the chemical causal structure as the framework of the structural equation model, the attribution and path direction of exogenous and endogenous variables are clarified, and the standardized path coefficients are solved by maximum likelihood estimation to form a quantitative causal network.

[0087] Based on the quantitative causal network, upstream or hub nodes are selected as intervention targets, the intervention intensity is uniformly set, and the intensity of the intervention target is fixed by structural equation model simulation tool to predict the intensity value of downstream theme after intervention.

[0088] The change in downstream themes is calculated based on the intensity value after intervention. The change in downstream themes is then standardized to obtain the intervention effect value. The intervention effect values ​​are sorted from largest to smallest. Based on the sorting results, intervention targets for each downstream failure mode are screened, and the optimal prevention strategy is formed in combination with the enterprise's resource constraints.

[0089] Figure 2 An embodiment of the chemical accident causation analysis system based on text mining and causal inference of the present invention is shown.

[0090] In this optional embodiment, the chemical accident causation analysis system based on text mining and causal inference includes:

[0091] The text acquisition and preprocessing module 201 is used to extract targeted semantic segments from the acquired chemical accident text using regular expressions to obtain structured causal semantic data, and to clean the structured causal semantic data to obtain optimized causal description data.

[0092] The causative entity identification module 202 is used to acquire historical chemical accident data, and to train a pre-built deep learning model using the historical chemical accident data to obtain a causative entity identification model. The causative entity identification model is then used to identify causative entities in the optimized causative description data to obtain chemical causative entities.

[0093] The causative topic clustering module 203 is used to convert chemical causative entities into chemical causative semantic vectors, and automatically aggregate the chemical causative semantic vectors into a causative topic set using a density clustering algorithm.

[0094] The chemical causal structure construction module 204 is used to calculate the intensity of the causal theme effect on the causal theme set according to the preset multi-dimensional intensity calculation index set, obtain the accident and theme intensity matrix, use the causal discovery algorithm to construct the accident and theme intensity matrix into a partial ancestor graph, and perform correction processing on the partial ancestor graph to obtain the chemical causal structure.

[0095] The optimal prevention strategy determination module 205 is used to infer the causal strength of the chemical causal structure based on the structural equation model, obtain the quantitative causal network, perform counterfactual intervention simulation on the quantitative causal network, and determine the optimal prevention strategy.

[0096] To facilitate understanding of the above technical solutions of the present invention, the following further explains the above technical solutions of the present invention from the perspective of architecture and principle, as follows:

[0097] This invention enables end-to-end analysis from unstructured accident reports to quantitative causal intervention. The specific steps include: 1. Enterprise safety text collection and preprocessing: collecting unstructured texts (i.e., chemical accident texts) from target enterprises, such as safety ledgers, hazard investigation records, and internal accident analysis reports. Optional import of publicly available reports from the same industry is also possible. Key semantic segments, such as hazard causes and management deficiencies, are extracted using regular expressions to obtain structured causal semantic data. This data is then processed by deduplication, removal of irrelevant characters, and standard sentence segmentation. High-quality samples with complete causal descriptions are selected to obtain optimized causal description data. 2. Causative entity recognition: using the BERT-BiLSTM-CRF deep learning model (i.e., causal entity recognition model), named entity recognition is performed on the preprocessed report text to extract entity words and phrases related to the accident's cause. Statistical information such as accident name, location, and type is also extracted. 3. Causative Topic Clustering: This involves using the BAAI / bge-large-zh-v1.5 model (i.e., a Chinese text embedding model) to transform causal entities into high-dimensional semantic vectors. Then, the HDBSCAN density clustering algorithm automatically aggregates semantically related entities into causal topics. These topics are then named using professional knowledge to obtain a core set of causal topics. 4. Accident and Topic Intensity Matrix Construction: This involves designing a multi-dimensional intensity calculation index set to quantify the influence intensity of each causal topic in each accident. The specific calculation process is as follows:

[0098] (1) Calculate the evidence quality index of the causal entity:

[0099] ;

[0100] in, For entity clustering membership probability, For entity semantic vectors, This is the theme center vector.

[0101] (2) Calculate the semantic consistency index within the causal topic:

[0102] ;

[0103] in, This is the local center vector of the subject in a single incident.

[0104] (3) Calculate the polymerization strength index within the causative entity:

[0105] ;

[0106] in, For indicator functions; represents the subject attribution number of the k-th causative entity in accident i; j represents the causative subject index; k represents the causative entity index in accident i; i represents the chemical accident index.

[0107] (4) The final strength is obtained after complexity normalization:

[0108] ;

[0109] in, The total number of entities involved in a single accident is used to form the intensity matrix of accidents and themes.

[0110] 5. Causal Structure Discovery: This involves employing the FCI-Kci algorithm (a causal discovery algorithm) to perform conditional independence tests based on the intensity matrix. Allowing for unobserved confounding variables, a partial ancestor graph of the causal subjects is output. This graph is then refined using expertise in chemical safety to arrive at the final causal structure. 6. Causal Strength Inference and Intervention Simulation: This involves estimating the parameters of the causal structure using structural equation modeling (SEM) to obtain the standardized path coefficients of each causal path, quantifying the strength of the causal relationship. Counterfactual intervention simulation is then used to reduce the intensity of upstream causal subjects by one standard deviation, quantifying their intervention effect on downstream subjects and determining the optimal prevention strategy. The causal strength quantification is completed based on structural equation modeling (SEM), and the intervention effect is accurately assessed by combining counterfactual inference. The specific process includes (1) SEM parameter estimation, that is, taking the causal structure as the skeleton, clarifying exogenous variables, such as lack of safety education and design change defects; and endogenous variables, such as inadequate supervision and management, and the attribution and path direction of illegal operations; using maximum likelihood estimation (ML) to solve the standardized path coefficient (β), and verifying the model fit by comparing the fit index, such as CFI≥0.90; approximate error square root, such as RMSEA≤0.08 and other indicators. If it does not meet the standard, the path is adjusted according to the correction index, and finally the quantitative causal network and the statistical significance p value of each path are output. The specific implementation process of SEM parameter estimation includes variable attribution and path clarification, that is, the exogenous variables are defined as the lack of safety education in G2 and the design and change management defects in G12 are exogenous variables without in-degree, only containing variance parameters, and without prior causal paths. Endogenous variable definition: Insufficient risk identification (G1), inadequate supervision and management (G4), deficiencies in safety measures and protection (G5), discrepancies between work permits and qualifications (G7), accidental energy release in hazardous environments (G8), structural failures (G9), violations of regulations and operational failures (G10), and equipment malfunctions and human error (G11) are defined as endogenous variables. The preceding path coefficients and error variances need to be estimated. Path direction locking retains only causal paths identified by the FCI-Kci algorithm and verified by experts, such as G2 to G4, G4 to G10, etc. Initially, the coefficients of paths without clear definition are set to 0 to ensure that path direction is consistent with the causal structure.

[0111] Maximum likelihood estimation (ML) to solve for the standardized path coefficients (β) includes data preprocessing and hypothesis testing. Using the intensity matrix of accidents and themes as input, the normal distribution characteristics of the 12 causal theme variables are verified through the Shapiro-Wilk test. This invention has adjusted the weights to approximate a normal distribution. The Pearson correlation matrix and covariance matrix between variables are calculated, denoted as S. Outliers are removed using the 3σ criterion to ensure data reliability. The latent covariance matrix is ​​constructed by deriving the model's latent covariance matrix Σ(θ) based on the structural equation model expression, where θ is the vector of parameters to be estimated, including path coefficients, variances, and error variances. For endogenous variables... ,satisfy ,in For path coefficients, For the preceding variable, For error terms, The variance is Exogenous variables The variance is Finally, matrix operations are used to obtain... Where B is the path coefficient matrix, and Ψ is the diagonal matrix composed of the error variance and the variance of exogenous variables. The construction and optimization of the log-likelihood function involves constructing the log-likelihood function. Where n is the sample size 2102, For matrix trace operations, The matrix determinant is used; the Newton-Raphson iterative algorithm is employed to minimize the negative log-likelihood function, providing an accurate and reproducible parameter estimation scheme for quantifying the causal intensity of the original cultural and industrial accident. Specifically, using the causal structure of a structural equation model (SEM) as the framework, it adapts to 12 causal themes, 19 causal paths, and 1097 sample features. Through multiple rounds of iteration, the parameters to be estimated are adjusted to reduce the deviation between model predictions and actual data, locking in the optimal parameter combination, and providing reliable unstandardized parameters for subsequent analysis. The specific process includes: first, completing preliminary preparations, centering the intensity matrix of the accident and themes, removing outliers using the 3σ criterion, retaining 1097 valid samples, and calculating the observation covariance matrix S, variable standard deviation σ, and Pearson correlation coefficient; the parameters to be estimated θ contain 19 path unstandardized coefficients, 10 endogenous variable error variances, and 2 exogenous variable variances, totaling 31 terms; constructing the negative log-likelihood function: This is done to achieve optimal fitting between the model's implicit and observed covariance matrices. Initial values ​​are then set: path coefficients are taken as the corresponding Pearson correlation coefficients; exogenous variable variances are directly calculated from the sample variance; and endogenous variable error variances are taken as 1 - R² (where R is the multiple correlation coefficient). The iterative core process then proceeds as follows: Iteration, where θ (k+1) θ represents the updated value of the parameter vector after the (k+1)th iteration.(k) H(θ) represents the current parameter vector value at the k-th iteration. (k) ) represents the Hessian matrix at the k-th iteration, i.e., the second-order partial derivative matrix; This represents the 31-dimensional gradient vector at the k-th iteration, i.e., the first-order partial derivative of the objective function. The algorithm updates all parameters by calculating the first-order partial derivatives and the approximate Hessian matrix (i.e., adding diagonal perturbations to avoid matrix singularities), and then iterating to the parameter change. The iteration count is set to convergence, with a maximum of 30 iterations. If convergence fails, the system is either re-initialized or extreme outliers are removed. After each iteration, standardized coefficients are converted from exogenous to endogenous variables, with the unstandardized coefficients equal to the exogenous coefficients. Endogenous to endogenous variable β = unstandardized coefficient The influence of dimensions is eliminated. Finally, a reasonableness test is conducted, namely, the absolute value of the path coefficient is ≤1, the variance is positive, and the results are verified to ensure the reliability of the parameters. The final output includes standardized coefficients and related variance parameters for 19 paths, providing support for causal strength quantification and intervention simulation. The standardized coefficients are converted to standardized coefficients β = unstandardized coefficients when transforming exogenous variables into endogenous variables. , For the standard deviation of exogenous variables, The standard deviation of the endogenous variable; the standardized coefficient β from the endogenous variable to the unstandardized coefficient. , For the variance of the endogenous variable, the influence of dimensions is eliminated.

[0112] Model fit validation, path adjustment, and fit index testing include calculating core fit indices. The thresholds for compliance are set as CFI ≥ 0.90, RMSEA ≤ 0.08, and χ² / df ∈ [1,3], comprehensively assessing the degree of model-data fit. The path adjustment strategy is as follows: if the fit is not met, priority is given to adding significant paths or deleting statistically insignificant paths based on the correction index (MI > 3.84, p < 0.05), and the parameter estimation process is repeated until the model meets the fit criteria.

[0113] The results output quantifies the causal network and clarifies the standardized path coefficients (β) of each path. The standard error (SE) of the parameters is obtained by taking the square root of the diagonal elements of the inverse Hessian matrix. The p-value is calculated by z test, i.e., z = standardized coefficient / SE. The statistical significance is marked, i.e., p < 0.05 is significant and p < 0.01 is highly significant. Finally, a complete quantified causal network and path significance results are formed.

[0114] (2) The counterfactual intervention design selects upstream nodes and intermediate hub nodes of the causal network as intervention targets, and uniformly sets the intervention intensity to reduce the average intensity of the target topic by 1 standard deviation, i.e., σ=1, while keeping other model parameters, such as path coefficients and residual variances, unchanged.

[0115] (3) The intervention effect is quantified by fixing the intensity of the intervention target point using SEM simulation tools and predicting the intensity value of the downstream theme after intervention; the change in the downstream theme ΔY = Y after intervention - Y before intervention is calculated, and the intervention effect value is obtained by standardization: Effect = ΔY / σ_Y, where σ_Y is the standard deviation of the downstream theme before intervention. The bootstrap method is used to sample 1000 times to calculate the 95% confidence interval and eliminate non-significant effects. The specific process for predicting the intensity value of the downstream theme after intervention includes first setting the intervention parameters and constraints, identifying the intervention targets such as the lack of safety education in G2 and the inadequate supervision and management of G4 based on the causal network, and fixing the target point intensity to the baseline value before intervention - 1 standard deviation according to the research preset, that is, S after intervention = μ_S - σ_S, where μ_S is the sample mean of the target point intensity before intervention and σ_S is the standard deviation of the target point intensity before intervention, so as to ensure the standardization and comparability of the intervention magnitude; during the prediction process, the path coefficient (β), error variance (ψ) and exogenous variable variance (σ_S) estimated by SEM need to be fixed. The method involves only changing the intensity value of the intervention target to avoid prediction bias caused by parameter re-estimation and ensure consistency between the causal transmission logic and the quantitative results. Subsequently, causal transmission paths are analyzed and hierarchically divided. Based on SEM quantification of the causal network, all direct and indirect downstream themes pointed to by the intervention target are extracted. For example, the direct downstream of target G4 is G10's violation of regulations and operational failure, and G7's non-compliance with work permits and qualifications; the indirect downstream is G9's structural failure and G8's accidental energy release in a hazardous environment. The transmission hierarchy of each path is clearly defined: the first level is the theme directly affected by the target, the second level is the theme affected by the first level, and so on. Simultaneously, only causal paths that are statistically significant (p < 0.05) are retained, while paths without significant correlation are eliminated to avoid errors introduced by spurious correlation paths and ensure that predictions are based solely on genuine causal transmission relationships. Next, baseline intensity values ​​are initialized before intervention. The sample mean μ_Y of each downstream theme in the intensity matrix of the accident and themes is used as the baseline intensity value before intervention, i.e., Y_pre-intervention = μ_Y. Simultaneously, the standard deviation σ_Y of each downstream theme is recorded to provide data support for subsequent standardization and effect calculation. All theme intensity values ​​use quantified standardized data with a mean of 0 and a standard deviation of 1, ensuring the comparability of intensity values ​​before and after intervention and the numerical stability of the prediction process. The core step is to iteratively calculate the post-intervention intensity values ​​of downstream themes level by level: For first-level downstream themes directly affected by the intervention target, such as G10 in G4 to G10, the post-intervention intensity value is calculated based on the SEM structural equation model, using the following formula: After intervention After intervention ,in The standardized path coefficients for intervention targets pointing to this primary theme. Other significant antecedent variables for this primary theme, i.e., non-intervention targets, with intensity values ​​retaining pre-intervention baseline values. , The mean of the error term for this first-level topic is given, and its error term satisfies... Therefore For secondary and higher-level downstream themes, such as G9 and G8 in G10 to G9 and then to G8, the intensity value of the intervention of the higher-level theme is used as input, and structural equation modeling is applied iteratively. The formula is as follows: After intervention After intervention ,in The standardized path coefficient from the parent topic to the current topic. For other significant preceding variables of the current topic, i.e., variables not from the next higher level of transmission path, and with intensity values ​​retaining baseline values, If a downstream theme has multiple transmission paths, for example, G8 is simultaneously affected by G9 and G11, then the intervention transmission contribution of all paths is summarized, as shown in the formula. After intervention ,in These are the path coefficients for each upstream transmission path. The post-intervention intensity values ​​are then presented as the corresponding upstream themes. Next, consistency verification of the prediction results is performed. For the same intervention target, predictions are repeated 100 times using SEM simulation tools. The coefficient of variation (CV) of the downstream theme's post-intervention intensity values ​​is calculated, i.e., CV = standard deviation / mean. A CV < 5% is required to ensure the stability and reliability of the prediction results. Simultaneously, knowledge from the chemical safety field is incorporated to verify whether the prediction results conform to causal transmission logic. For example, after strengthening G4 supervision and management, the intensity of G10 violations should significantly decrease. Outliers with logical contradictions are eliminated. If the proportion of outliers > 3%, the path coefficients and intervention parameter settings are re-examined. Finally, a post-intervention intensity value dataset is output, organizing the post-intervention intensity values ​​of all downstream themes (Y after intervention) and corresponding them one-to-one with the baseline values ​​before intervention (Y before intervention), forming a three-dimensional dataset of theme, pre-intervention intensity, and post-intervention intensity for subsequent analysis. Calculation, effect standardization, and confidence interval estimation provide the underlying data.

[0116] (4) The optimal strategy is to sort the downstream failure modes from largest to smallest and screen the top 3 intervention targets for each downstream failure mode, such as illegal operation and protection defects; verify the specificity of the targets, such as illegal operation corresponding to supervision and management, and protection defects corresponding to safety education. Combined with the enterprise's resource constraints, a differentiated prevention plan for failure modes, optimal targets and intervention measures is formed, and the high priority intervention direction is clarified.

[0117] like Figure 4-10As shown, the specific implementation process of the present invention includes: 1. Data collection and preprocessing, that is, collecting accident-related records stored in text form within the enterprise, including but not limited to safety management ledgers, equipment failure and maintenance logs, work violation registration forms, accident scene handling records, and hidden danger reporting and rectification texts, etc. The time range covers the complete record cycle of the enterprise for the past 3-5 years, and a total of 1860 text records of various types were collected, namely chemical accident texts. Data cleaning was performed using Python scripts. First, duplicate records were removed based on a triple check of the accident's time, the parties involved, and the core cause. For example, multiple reports of the same accident were removed, as were records with incomplete content or no clear cause description. Ultimately, 1097 valid records containing complete accident cause descriptions were selected. Next, targeting the format characteristics of internal records, such as fixed fields like workshop number, equipment model, responsible person, and processing result, regular expressions (e.g., `r"[A-Z0-9\-]{3,15}"`) were used to extract equipment models and structured information, resulting in structured causal semantic data. Then, `re.sub(r"[^\u4e00-\u9fa5a-zA-Z0-9\s\,\。\;]","",text)` removed handwritten annotations, table border symbols, and other irrelevant characters. Standard sentence segmentation based on punctuation was performed to obtain a clean text dataset, i.e., the optimized causal description data. 2. Root cause entity identification, that is, the present invention adopts PSM (Process Safety Management), hereinafter referred to as PSM, which is also the Chemical Process Safety Management Guidelines (AQ / T3034-2022), which includes the so-called twenty elements. The BERT-BiLSTM-CRF deep learning model (i.e., the causal entity recognition model) pre-trained on PSM theoretical labeled data completes the accurate extraction of causal entities. The specific training, construction and recognition steps include (1) Model training and construction, including 1.1 PSM theoretical labeled dataset construction, that is, based on the 12 dimensions of the core of PSM theory, such as process safety information, risk assessment, operating procedures, training and education, equipment maintenance, and emergency management, and combined with the causal characteristics of chemical accidents, defining 6 types of core causal entity labels, such as causal behavior, equipment defects, management defects, process abnormalities, environmental factors, and protection deficiencies; selecting 500 typical chemical accident records, and having 3 chemical safety experts with more than 5 years of practical experience in the PSM system perform double-blind labeling according to the unified labeling specifications, and correcting the labeling discrepancies through consistency test, that is, Kappa value ≥ 0.85, and finally forming more than 20,000 high-quality causal labeling samples, which are divided into training set, validation set and test set in 8:1:1.1.2 Basic Model Initialization and Structure Building: The `bert-base-chinese` pre-trained model (i.e., a pre-trained language model) is used as the base model. After loading the pre-trained weights, the parameters of the bottom 6 Transformer layers are frozen, and the top 4 layers are retained for domain adaptation. A bidirectional LSTM layer (i.e., a bidirectional long short-term memory network layer) is added after the BERT layer (i.e., the bidirectional encoder representation layer). Its hidden layer dimension is 256, and the dropout probability is 0.1 to capture long-distance dependencies in the text. A CRF layer (i.e., a conditional random field layer) is added at the end. The transition matrix dimension is defined as (6 entity labels + 2) × (6 entity labels + 2), including START and END labels. The transition probability is optimized by the log-likelihood function. To address the highly specialized and complex causal descriptions in chemical accident reports, a customized BERT-BiLSTM-CRF deep learning causal entity recognition model was developed, adapted for the chemical industry. Its architecture, inter-layer relationships, training process, and technical performance are all precisely optimized for chemical safety scenarios: the model is based on a bert-base-chinese pre-trained model. After loading pre-trained weights, the parameters of the bottom 6 transformer layers are frozen to retain general semantic understanding capabilities, while the top 4 layers are unlocked for fine-tuning to adapt to the chemical industry, ensuring the model can accurately capture reactor maintenance exceeding standards and related issues. Semantic features of specific terms such as "unregistered" are removed from the lock. After the BERT layer, a bidirectional LSTM layer with a hidden layer dimension of 256 and a dropout probability of 0.1 is connected to capture the long-distance dependencies of the cause description in both directions. The end is connected to the CRF layer. Based on the chemical cause entity labeling rules, 6 types of core cause entity labels + START / END labels are defined to construct a (12+2)×(12+2) transition matrix. The transition probability is optimized by the log-likelihood function. Invalid transitions that jump directly across major cause labels are explicitly prohibited, such as from B-equipment defect to I-environmental factors, to ensure the logical rationality of the label sequence. The data flow between layers strictly follows the logic of text input, semantic vector, sequence features, and label output. First, the text, after being segmented into a chemical engineering-specific dictionary containing equipment models and PSM core terms, is standardized into a 128-dimensional sequence (input_ids, attention_mask, token_type_ids) and input into the BERT layer, outputting a 768-dimensional dynamic semantic vector. This vector is then fed into the BiLSTM layer and integrated into 512 dimensions, namely 256 forward and 256 backward sequence features. Finally, the CRF layer decodes and outputs the optimal causal entity label sequence using the Viterbi algorithm.The training process is based on PSM theory. 500 typical chemical accident records were selected, and over 20,000 high-quality samples were generated through double-blind annotation by three experts with over five years of experience in PSM systems. These samples were divided into training, validation, and test sets in an 8:1:1 ratio, with a Kappa coefficient of ≥0.85 for annotation consistency. A custom loss function (λ=0.3) using CRF negative log-likelihood function and label balancing factor was employed to correct the imbalance of chemical causal entity categories. The AdamW optimizer (weight decay rate 0.01), learning rate of 5e-5 (linearly decaying to 1e-6 in the later stages of training), batch size of 32, 10 training epochs, and an early stopping strategy (patience=3) were used to ensure model convergence stability and prevent overfitting. The core hyperparameters were all validated in chemical engineering scenarios. Specifically, BERT achieved a 91.2% F1 score on the validation set when frozen at 6 layers, exhibited overfitting at 4 layers and underfitting at 8 layers. BiLSTM, with its 256 dimensions, balanced performance and computational efficiency, achieving an F1 score of 87.3% at 128 dimensions and no improvement at 512 dimensions. Dropout of 0.1 effectively suppressed overfitting without compromising key semantics. Empirical verification showed a 92.3% recognition rate for core causal entities, a 96.8% accuracy rate for chemical engineering terminology, and an 85.7% recognition rate for low-frequency causal entities, significantly outperforming the general BERT-CRF model and traditional CRF models. It accurately extracts enterprise-specific causal entity phrases, providing high-quality structured data for subsequent topic clustering and causal analysis. Furthermore, the model can be quickly adapted to the internal text formats of different chemical enterprises by replacing the target enterprise's PSM theoretical annotation corpus, demonstrating strong practical applicability. 1.3 Model training parameter configuration: AdamW optimizer is used, learning rate is set to 5e-5, batch size is 32, training epochs are 10, and an early stopping strategy with patience=3 is introduced. Training stops when the F1 score on the validation set does not improve for 3 consecutive epochs, and the optimal pre-trained weights are saved. The training objective is to minimize the label sequence prediction error of labeled samples, which is suitable for the causal entity recognition task in the chemical industry.

[0118] (2) The specific implementation steps of Named Entity Recognition (NER) include 2.1 text preprocessing, which involves segmenting the clean text (i.e., the optimized causal description data) into sentences, loading a chemical industry-specific dictionary containing equipment models, PSM core terms, and operational terms, and using the jieba word segmentation tool for word segmentation; padding or truncation processing is performed on the segmented text, with a unified sequence length of 128, padding with 0s for insufficient parts and truncating excessively long parts, to generate an input format (input_ids, attention_mask, token_type_ids) acceptable to the model, i.e., the standard causal feature sequence. 2.2 model inference, which involves inputting the preprocessed features (i.e., the standard causal feature sequence) into the trained BERT-BiLSTM-CRF model, with the BERT layer outputting dynamic word vectors, which are then integrated by the BiLSTM layer to integrate sequence dependency information, and finally decoded by the CRF layer using the Viterbi algorithm to obtain the optimal label sequence, outputting the entity label for each token, such as B-equipment defect, I-management defect. 2.3 Entity Extraction and Post-processing: This involves extracting text fragments corresponding to consecutive tags "B-XXX" and "I-XXX" to obtain initial causal entities. Consecutive entities of the same type are merged to obtain complete causal entities. Invalid entities with a length less than 2 are removed. The rationality of entities is verified using a PSM theoretical terminology dictionary. After deduplication, 6706 causal-related entities are obtained, and 2669 independent entity phrases are ultimately retained. These phrases include company-specific causal descriptions such as "reactor maintenance cycle exceeded standard" and "operator not wearing protective equipment according to SOP," i.e., chemical causal entities. Simultaneously, 12 categories of statistical information, including the workshop where the accident occurred, the equipment involved, and the accident level, are extracted. The recognition rate for accident name, occurrence time, and workshop is 100%, the accident type recognition rate is 98.62%, and the core causal entity recognition rate is 92.3%.

[0119] 3. Causative topic clustering includes (1) BAAI / bge-large-zh-v1.5 model (i.e. Chinese text embedding model) training and semantic vector transformation steps including 1.1 Model training and construction, i.e., loading the `BAAI / bge-large-zh-v1.5` pre-trained model and native weights from huggingface, without freezing any layer parameters, retaining the 768-dimensional output dimension of the model for domain adaptation fine-tuning; based on 2669 independent causal entity phrases and the corresponding 12 causal topics, constructing a pairing dataset of entities and topics. 1.2 The specific transformation from entity phrases to semantic vectors includes text standardization, i.e., removing special characters such as punctuation and garbled characters from entity phrases; deleting redundant spaces to ensure consistent text format; model input construction, setting `max_length=64` according to model requirements, performing padding / truncation processing on the standardized entity phrases to generate tensor-formatted input tensors; semantic vector generation, calling the model encoding method, setting `return_tensors="pt"` and `normalize_embeddings=True`, outputting 768-dimensional semantic vectors, which are L2 normalized with a magnitude of 1; vector validity verification, calculating the average cosine similarity of entity vectors within the same topic (≥0.85) and the average cosine similarity of entity vectors between different topics (≤0.3), with unqualified vectors being regenerated. This invention is based on the paraphrase-multilingual-mpnet-base-v2 pre-trained model (i.e., a multilingual pre-trained embedding model). Addressing the core need for semantic vector transformation of causal entities in chemical accidents, it overcomes the limitations of existing monolingual models in semantic capture and the insufficient adaptability of general models to various scenarios. Through in-depth modifications including multilingual dual semantic capture, inter-layer customization for chemical scenarios, and dedicated semantic verification, it achieves precise binding between the model and the chemical accident domain. Its technical solution is not a direct call to conventional models in this field, but rather a full-process domain adaptation design, resulting in a 35% improvement in entity vector clustering purity and a 28% improvement in causal path identification accuracy. This supports the subsequent implementation of HDBSCAN clustering and FCI-Kci causal discovery algorithms.In the model input construction stage, the first input source is chemical causal entity phrases after text standardization (removing punctuation, garbled characters, and redundant spaces), covering bilingual professional expressions. Considering the 3-15 character length difference of chemical entity phrases, `max_length=64` is set, employing a tail truncation and header padding strategy: ultra-long entities retain core causal semantics, while ultra-short entities are padded with 0s. Simultaneously, a chemical-specific dictionary containing 237 categories of equipment English terms and 12 categories of PSM system bilingual terms is loaded to ensure accurate encoding of bilingual terms such as interlock and work permits. Subsequently, the model's native word segmenter, combined with the chemical bilingual dictionary, completes word segmentation, generating `input_ids`, which contains an index of chemical-specific terms; `attention_mask`, which masks padding positions and strengthens effective semantic weights; and `tok`. `en_type_ids` is a tensor input format where a single entity phrase is uniformly marked as 0. The tensor has `input_idsshape=[batch_size,64]`, `attention_maskshape=[batch_size,64]`, and `token_type_idsshape=[batch_size,64]`. This tensor is directly used as the input to the underlying Transformer layer of the model. `input_ids` provides semantic indexing, and `attention_mask` controls semantic focus, constructing a coherent input chain for text preprocessing, word segmentation and encoding, and tensor generation. This solves the defect of conventional input construction that does not distinguish between chemical engineering semantics and padding positions, laying the foundation for intermediate-layer semantic extraction.

[0120] In the semantic vector generation stage, domain adaptation optimization is performed based on the user's actual application code framework. First, the model is loaded and the native vocabulary is replaced with a chemical engineering bilingual dictionary. Domain terms are added and word vector dimensions are adjusted using `model.tokenizer.add_tokens`. Then, 2669 chemical causal independent entity phrases are used as training data. The parameters of the bottom 8 layers of the model are frozen to retain general semantic capabilities, while the top 4 layers are fine-tuned to adapt to chemical engineering semantics. The optimization objective is set as the semantic matching loss of entities and topics. A 5e-5 learning rate and 5 training epochs are used to ensure the model accurately captures specific semantics such as equipment defects and management deficiencies. Subsequently, m... The `odel.encode` method, by setting `normalize_embeddings=True`, directly implements L2 normalization, with a vector magnitude of 1; `return_tensors="pt"` outputs tensor format, and `batch_size=32` adapts to batch processing requirements, ultimately generating semantic vectors with shape=[batch_size,768]. Verification shows that the cosine similarity of bilingual synonym vectors in chemical engineering is ≥0.92, and the similarity of heteronymous topic vectors is ≤0.25, significantly improving semantic discriminability and solving the core pain point of semantic discriminativeness in general multilingual models of bilingual synonyms.

[0121] In the vector validity verification stage, considering the strong correlation and clear boundary requirements of chemical causal themes, a dedicated verification standard was designed. This standard involves calculating the pairwise cosine similarity of all entity vectors within the same causal theme and taking the mean, requiring a value ≥0.85 to ensure theme cohesion; and calculating the cosine similarity of the central vectors of different causal themes, requiring a value ≤0.3 to ensure theme separability. During the verification process, a Python script was used to batch filter out vectors that did not meet the standard. Entity phrases with ambiguous semantics were returned to the text preprocessing stage for supplementary annotation. Entities with clear semantics but unqualified vectors were re-encoded. Entities that failed multiple verifications were marked as noise entities and excluded from subsequent analysis. After this process, the purity of causal theme clustering increased from 68% in the conventional model to 93%, and the false path identification rate in causal structure discovery decreased by 42%, providing high-quality data support for the construction of the intensity matrix between accidents and themes and the discovery of FCI-Kci causal structures.

[0122] (2) The specific implementation steps of the HDBSCAN algorithm for automatically aggregating causal topics include 2.1 data preprocessing, that is, performing L2 normalization on the above 768-dimensional semantic vectors to ensure the rationality of vector space distance calculation; 2.2 algorithm parameter configuration, that is, setting the core parameters of HDBSCAN, including minimum cluster size (min_cluster_size=5); minimum number of samples (min_samples=3); distance metric is cosine, adapted to semantic vector similarity calculation; maximum distance threshold allowed for clustering (cluster_selection_epsilon=0.5); 2.3 clustering execution process includes the first step of calculating the local density of each entity vector, that is, based on the k nearest neighbor distance, k=min_samples; the specific steps include input data preparation, that is, clarifying that the calculation object is the set of 768-dimensional semantic vectors after L2 normalization. Where n is the total number of unique causal entity phrases after deduplication (2678), and the vector already satisfies... The L2 norm is 1 to ensure consistency in cosine distance calculations. The pairwise cosine distance matrix is ​​constructed by calculating the cosine distance between all entities on the vector set V. A dimensional distance matrix D, where matrix elements Represents entity vector and The cosine distance is calculated using the following formula: Because L2 normalization has already been performed, Simplified to ,in, This represents the vector dot product operation; The value ranges from [0,2], with smaller values ​​indicating higher semantic similarity between the two vectors. Entity-by-entity k-nearest neighbors (k=3) are selected, meaning for each entity in the distance matrix... corresponding row vector That is, including Distance to all other entities, excluding its own distance. The elements are sorted in ascending order of distance, and the entities corresponding to the k smallest distances are selected as... k-nearest neighbor set Record the distance values ​​of these k nearest neighbors. , Determine the k-nearest neighbor feature distance, i.e., take... The maximum distance value in the k-nearest neighbor set is used as the feature distance. ,Right now If multiple entities exist and If the distances are the same and all are the k-th smallest distances, indicating a tie, then the maximum value of these distances is taken as the k-th smallest distance. This ensures the uniqueness of the feature distance. Local density calculation, specifically, uses the inverse distance method to calculate the local density. The formula is ,in This is a minimum value, used to avoid... When the denominator is 0; The range of values ​​is A higher value indicates a higher semantic density in the region where the entity vector is located, making it more likely to become a cluster core. Density peak points, i.e., points with local density higher than surrounding vectors, are identified as cluster cores. Vectors reachable by density peaks are merged to form initial clusters, while vectors unreachable by density are marked as noise points. Close clusters with a distance less than a threshold are automatically merged to obtain the final stable cluster set. Clustering results are validated and topics are named by calculating the cohesion of each cluster (e.g., average similarity of vectors within a cluster ≥ 0.8) and the separation (e.g., similarity of central vectors between clusters ≤ 0.3). Clusters with insufficient cohesion (e.g., less than 0.6) are removed. Combining high-frequency core words within clusters with chemical safety scenarios and PSM theoretical dimensions, 12 core causal topics are named, including lack of safety education, inadequate supervision and management, and accidental energy release in hazardous environments. Each topic exhibits high semantic consistency and good distinguishability between topics.

[0123] 4. Construction of the intensity matrix of accidents and themes: Based on the aforementioned intensity calculation formula, a calculation script was written in Python to calculate the final intensity of each of the 12 themes of 1097 accidents. This forms a 1097×12 strength matrix. When calculating the quality of entity evidence... This represents the probability of cluster k belonging to entity k output by the HDBSCAN model. Let k be the semantic vector of entity k. Let be the center vector of topic j, i.e., the mean of all entity vectors under this topic; when calculating semantic consistency within a topic, where Let I be the local center vector of theme j in incident i, which is calculated only from the entity vectors belonging to theme j in incident i; when calculating the internal cohesion strength, I is an indicator function, i.e., it takes 1 when entity k belongs to theme j, and 0 otherwise. Let j represent the subject index of the k-th causative entity in accident i, j represent the causative subject index, k represent the causative entity index in accident i, and i represent the chemical accident index; when the complexity is normalized... denoted as the total number of entities in accident i. The matrix results show that the theme of accidental energy release in hazardous environments has a high intensity in most accidents, and some accidents exhibit the characteristics of multiple themes working together. It can also intuitively reflect the distribution of high-frequency causative themes in specific workshops / equipment of an enterprise.

[0124] 5. Causal structure discovery includes (1) The specific implementation steps of the FCI-Kci algorithm (i.e., causal discovery algorithm) combined with the intensity matrix to obtain a partial ancestor graph include 1.1 data preprocessing, that is, standardizing the intensity matrix of 1097×12 incidents and topics to make the mean=0 and the standard deviation=1, eliminating the difference in dimensions and satisfying the algorithm's assumptions about the data distribution; 1.2 algorithm parameter configuration, that is, calling the FCI-Kci algorithm interface in the `causal-learn` library to set the core parameters, namely, the kernel function is a Gaussian kernel (kernel_type="rbf"), the kernel width is automatically calculated by the median heuristic method (median_heuristic=True), the significance level α=0.05, and the maximum condition set size of the conditional independence test = 3 to avoid the curse of dimensionality; 1.3 algorithm execution flow includes skeleton learning, that is, initializing a fully connected topic node graph containing 12 nodes, and for each pair of nodes (i,j), performing the kernel function conditional independence test (Kci) in sequence under the condition set of k=0 to 3. If there exists a set of conditions that makes i and j conditionally independent, i.e., p value ≥ 0.05, the edge between nodes i and j is removed, ultimately obtaining an undirected causal skeleton; direction learning, i.e., based on the skeleton structure, uses built-in direction rules of the algorithm, such as V-structure recognition and collision point detection, to mark the causal direction of edges, including edges with definite direction (→), edges with uncertain direction (—), and potentially mixed edges (…). The output is a partial ancestor graph, which is a graph containing 12 nodes with edge type labels after the algorithm is executed. It is saved as a .dot file for subsequent visualization and correction.

[0125] (2) The specific steps for correcting fuzzy causal paths by combining chemical safety expert knowledge and enterprise systems include 2.1 Fuzzy path screening, that is, extracting edges marked "—" (i.e., uncertain directions) from a partial ancestor graph; and " The potentially mixed edges identified a total of 5 fuzzy paths, such as "inadequate equipment maintenance" — "illegal operation, inadequate supervision and management". "2.2 Preparation of Correction Basis: This involves compiling a chemical safety expert knowledge base, including judgment rules from experts with over 10 years of experience in chemical safety management and internal company regulations, such as the 'Equipment Maintenance Management Measures,' 'Safety Training and Assessment Standards,' and 'Work Permit Approval Process.' Logical relationships within these regulations are extracted; for example, inadequate equipment maintenance can lead to equipment malfunctions, which in turn can induce violations of regulations. 2.3 Path-by-Path Verification and Correction: To ensure the scientific validity and practical applicability of the causal structure, three experts with over 10 years of experience in chemical safety management or accident investigation, covering equipment operation and maintenance, on-site supervision, and regulatory compliance, are organized to independently assess the rationality of each fuzzy path. The Delphi method is used to reach consensus, with a 5-point scoring system; a score of ≥4 is considered logically valid. Simultaneously, the clear logic within core company regulations such as the 'Equipment Maintenance Management Measures' and 'Safety Training and Assessment Standards' is combined to correct the path direction one by one, ensuring that the causal relationship aligns with industrial realities. The core steps for reaching consensus using the Delphi method include..." Expert anonymization involves assigning unique identifiers to experts and communicating through a third-party platform to ensure independence and objectivity by protecting personal information and judgment results. The first round of consultation and scoring involves providing path theme definitions, algorithm outputs, and relevant regulations or case materials for selected fuzzy paths. Experts independently score these paths and explain their reasoning, such as citing relevant regulations or accident experience. Results are summarized and feedback on disagreements is provided by calculating the average score. For paths with significant disagreements, such as design and change management deficiencies ("—structural failure"), the core points of contention are identified, supporting evidence is added, and feedback is provided to experts for a second assessment. Consensus is determined by a final score of ≥4. All fuzzy paths reach consensus within two rounds, with no eliminations. Path corrections are made based on regulations and consensus. For example, for inadequate equipment maintenance ("—violation of regulations"), the rule in the "Equipment Maintenance Management Regulations" that insufficient maintenance leading to equipment malfunctions strictly prohibits unauthorized operations to maintain production is corrected to inadequate equipment maintenance ("→ violation of regulations"). For inadequate supervision and management... "Regarding deficiencies in protective measures, the expert consensus is that supervision and management are the core guarantee for the implementation of protective measures. There is no reverse causal relationship. Considering the logic that the lack of supervision in the system leads to measures becoming mere formalities, the revised wording is 'inadequate supervision and management' → 'deficiencies in protective measures.' Regarding the discrepancy between work permits and qualifications → 'deficiencies in gas detection and ventilation,' referring to the requirement in the 'Work Permit Approval Process' that qualification review directly affects the standardization of detection operations, the revised wording is 'discrepancies between work permits and qualifications' → 'deficiencies in gas detection and ventilation.'"

[0126] 6. Causal strength inference and intervention simulation include (1) The specific content of the structural equation model (SEM) is as follows: 1.1 Variable definition, namely 2 exogenous variables, namely G2 lack of safety education and G12 design and change management defects, with no in-degree, which are the starting nodes of the causal network; 10 endogenous variables, namely G1 insufficient risk identification, G3 insufficient emergency response, G4 inadequate supervision and management, G5 safety measures and protection defects, G6 gas detection and ventilation defects, G7 work permit and qualification mismatch, G9 structural failure, G10 illegal operation, G11 equipment failure and personnel error, G8 accidental energy release in hazardous environment, all of which are affected by other theme nodes. 1.2 Path assumption, namely, based on the modified causal graph, 19 linear causal paths are set. The core paths include G2 to G1, G2 to G4, G2 to G10, G12 to G4, G4 to G7, G4 to G10, G9 to G8, etc. All paths are assumed to be unidirectional linear influence. 1.3 Error Term Setting: Each endogenous variable is configured with an independent residual term (ε1-ε10). It is assumed that the residual terms follow a normal distribution N~(0,σ²), and that the residual terms are independent of each other and with respect to the exogenous variables. The residual variance is a freely estimable parameter. 1.4 Constraints: There is no correlation (covariance=0) between exogenous variables G2 and G12; the path coefficients are freely estimable parameters with no fixed values. 1.5 Fit Criteria: The model must meet the following fit indices: Comparative Fit Index (CFI) ≥ 0.90, Root Mean Square Error of Approximation (RMSEA) ≤ 0.08, Root Mean Square Residue of Standardized Residues (SRMR) ≤ 0.05, and Chi-square degrees of freedom ratio. 1.6 Parameter estimation results: AMOS software was used to construct a structural equation model. The structural equation model was based on 12 causal topics (G1-G12) and 19 causal relationships as determined after modification. Among them, G2 (lack of safety education) and G12 (deficiencies in design and change management) are exogenous variables without in-degree, while the remaining 10 topics are endogenous variables affected by in-model variables. An independent error term was set for each endogenous variable. The model assumes that the error term follows a normal distribution with a mean of 0 and constant variance, and is independent of exogenous variables and other error terms. The model uses a standardized accident and theme intensity matrix as input data, with 1097 valid samples, mean = 0, and standard deviation = 1. AMOS software is used to visualize the path diagram, clarifying all causal relationships, including direct paths such as G2 to G4, G4 to G10, and indirect paths such as G12 to G4 to G7 to G6. The data is presumed to follow a multivariate normal distribution, and the KS test verifies that the p-value of the KS statistic for all variables is >0.05. The model assumes a linear causal relationship between variables and no significant measurement error in the observed variables. The theme intensity values ​​are semantically consistent and complexity-corrected. Maximum likelihood estimation (ML) is used to solve for the parameters, ultimately obtaining the standardized coefficients of each causal path: (The text then abruptly shifts to a seemingly unrelated topic about safety education deficiencies and supervision.) The path with poor management had the highest coefficient, β=0.479, p<0.001. Other core path coefficients included G2 to G1 (insufficient risk identification, β=0.295, p<0.001); G2 to G10 (violations and operational failures, β=0.212, p<0.01); G4 to G10 (β=0.242, p<0.001); and G9 (structural failure) to G8 (accidental energy release in hazardous environments, β=0.223, p<0.001). The standardized coefficients of the remaining 14 paths were all between 0.12 and 0.187 and passed the statistical significance test (e.g., p<0.05). Model fitting results showed good comparison of the fit index (CFI=0.92), root mean square error of approximation (RMSEA=0.065), root mean square of standardized residuals (SRMR=0.042), and chi-square degrees of freedom ratio (…). All of them meet the preset fitting criteria, namely CFI≥0.90, RMSEA≤0.08, SRMR≤0.05, The results indicate that the model fits the data well and can effectively quantify the causal strength among the 12 causal themes, providing a reliable parameter basis for subsequent counterfactual intervention simulations. The standardized intensity matrix data (1097 samples) was input, and maximum likelihood estimation (ML) was used to solve for the parameters, obtaining the standardized coefficients of each causal path. The path from lack of safety education to inadequate supervision and management had the largest coefficient, β=0.479, p<0.001. The coefficients of other core paths included G2 to G1 (β=0.295, p<0.001); G2 to G10 (β=0.212, p<0.01); G4 to G10 (β=0.242, p<0.001); and G9 to G8 (β=0.223, p<0.001). Model fitting results: CFI=0.92, RMSEA=0.065, SRMR=0.042. All met the preset fitting criteria, and the model and data showed good agreement.

[0127] (2) Intervention simulation and optimal strategy determination: Intervention analysis was performed using the AMOS counterfactual simulation tool to screen exogenous and intermediate pivotal variables, namely G2, G4, G7, etc., as intervention targets. The intervention intensity was uniformly set to reduce the average intensity of the target theme by 1 standard deviation, i.e., σ=1, that is, the post-intervention target intensity = pre-intervention mean - 1 × pre-intervention standard deviation; the intensity value of the intervention target was fixed, i.e., the post-intervention level, while keeping other model parameters, i.e., path coefficients and residual variance, unchanged, to predict the post-intervention intensity values ​​of all downstream endogenous variables. The intervention effect was quantified by calculating the change in downstream variables. After intervention Before intervention, Y represents the mean strength of downstream variables, and the standardized intervention effect is... ,That The standard deviation of the upstream and downstream variables before intervention is used, and the results are represented by σ. The 95% confidence interval of the effect value is calculated using the Bootstrap method (sampling times = 1000) to exclude insignificant effects including 0. The results show that after simulating a reduction of 1 standard deviation in the intensity of G4 (inadequate supervision and management), the mean intensity of G10 (violation of regulations) decreased from 0.82 to 0.58, with a standardized effect value of (0.58-0.82) / 0.99 = 0.242σ, 95% CI: 0.186-0.298, which is the optimal intervention target for G10. After reducing the intensity of G2 (lack of safety education) by 1 standard deviation, the intervention effect of G5 (deficiencies in safety measures and protection) reached 0.309σ, 95% CI: 0.251-0.367, which is the optimal intervention target for G5, verifying the characteristics of the differentiated intervention strategy for this enterprise. In this embodiment, all algorithms are implemented based on a Python 3.8 environment. The core libraries relied upon include transformers (for the BERT model), hdbscan (for clustering algorithms), causal-learn (for the FCI-Kci algorithm), statsmodels (for structural equation modeling), and jieba (for word segmentation). The analysis process and results of this invention can be reproduced through the above steps, and it can be directly adapted to the internal text record formats of different chemical enterprises. Only minor adjustments to the training corpus of the entity recognition model are needed, i.e., replacing it with the target enterprise's PSM theoretical annotation corpus, for rapid application. The specific process is as follows... Figure 10 The results include a structured causal database, causal inference based on the Dowhy framework, causal effect estimation, conditional independence hypothesis testing, and counterfactual speculation.

[0128] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores static and dynamic information data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps described in the embodiment of the chemical accident causation analysis method based on text mining and causal inference.

[0129] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present invention and does not constitute a limitation on the computer device to which the present invention is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0130] Furthermore, the present invention also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described embodiments of the chemical accident causation analysis method based on text mining and causal inference.

[0131] In addition, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described embodiments of the chemical accident causation analysis method based on text mining and causal inference.

[0132] Those skilled in the art will understand that implementing all or part of the processes in the above-described embodiments of the chemical accident causation analysis method based on text mining and causal inference can be accomplished by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the chemical accident causation analysis method based on text mining and causal inference described above. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include at least non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0133] This invention is not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this invention is limited only by the appended claims.

Claims

1. A method for analyzing the causal causes of chemical accidents based on text mining and causal inference, characterized in that, include: Regular expressions are used to extract targeted semantic segments from the acquired chemical accident text to obtain structured causal semantic data. The structured causal semantic data is then cleaned to obtain optimized causal description data. Historical chemical accident data is acquired and used to train a pre-built deep learning model to obtain a causative entity identification model. The causative entity identification model is then used to identify the causative entities in the optimized causative description data to obtain the chemical causative entities. Chemical causal entities are transformed into chemical causal semantic vectors, and density clustering algorithms are used to automatically aggregate the chemical causal semantic vectors into a set of causal topics. The intensity of the causal theme effect is calculated based on the preset multi-dimensional intensity calculation index set to obtain the accident and theme intensity matrix. The accident and theme intensity matrix is ​​constructed into a partial ancestor graph using the causal discovery algorithm, and the partial ancestor graph is modified to obtain the chemical causal structure. The preset multi-dimensional strength calculation index set includes: evidence quality index of causative entity, semantic consistency index within causative topic, and aggregation strength index within causative entity; Calculate the evidence quality index of the causative entity: ; in, For entity clustering membership probability, For entity semantic vectors, The central vector of the topic; Calculate the semantic consistency index within the causal topic: ; in, This represents the local center vector of the subject in a single incident; Calculate the polymerization intensity index within the causative entity: ; in, For indicator functions; represents the subject-attribution number of the k-th causative entity in accident i; j represents the causative subject index; k represents the causative entity index in accident i; i represents the chemical accident index; The incident and topic intensity matrix is ​​obtained after complexity normalization: ; in, This refers to the total number of entities involved in a single accident. Based on structural equation modeling, the causal strength of chemical causal structure is inferred, a quantitative causal network is obtained, counterfactual intervention simulation is performed on the quantitative causal network, and the optimal prevention strategy is determined.

2. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 1, characterized in that, The process involves acquiring historical chemical accident data and training a pre-built deep learning model using this data to obtain a causative entity identification model. This causative entity identification model is then used to identify causative entities in the optimized causative description data, resulting in chemical causative entities including: Historical chemical accident data was acquired and annotated in accordance with chemical process safety management theory to obtain causation annotation samples, which were then divided into training set, validation set and test set. Using a pre-trained language model as the base model, after loading pre-trained weights onto the base model, the bottom six layers are frozen and the top four layers of transformer parameters are unlocked to obtain the bidirectional encoder representation layer. A bidirectional long short-term memory network layer is connected after the bidirectional encoder representation layer, and a conditional random field layer is added at the end to obtain a pre-built deep learning model. The pre-built deep learning model is trained using the training set to obtain the causal entity recognition model. The optimized causal description data is preprocessed to obtain a standard causal feature sequence. The standard causal feature sequence is then input into the causal entity recognition model for inference to obtain the optimal causal label sequence. Finally, entity extraction and post-processing are performed on the optimal causal label sequence to obtain the chemical causal entity.

3. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 2, characterized in that, The annotation of historical chemical accident data based on chemical process safety management theory yields the following causation annotation samples: An annotation framework is constructed based on the theoretical dimensions of chemical process safety management, and chemical causal entity labels are defined in combination with the causal characteristics of chemical accidents. Based on chemical causative entity labels and unified labeling specifications, double-blind labeling was performed on the optimized causative description data to obtain annotated causative description data. Then, consistency checks were used to correct labeling discrepancies in the annotated causative description data to obtain causative labeling samples.

4. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 2, characterized in that, The optimized causal description data undergoes text preprocessing to obtain a standard causal feature sequence. This standard causal feature sequence is then input into the causal entity recognition model for inference to obtain the optimal causal label sequence. Finally, entity extraction and post-processing are performed on the optimal causal label sequence to obtain the chemical causal entities, including: The optimized causal description data is segmented into sentences, and the segmentation results are processed by combining a chemical engineering-specific dictionary to obtain segmented text. The segmented text is then padded or truncated according to a preset uniform sequence length to obtain a standard causal feature sequence. The standard causal feature sequence is input into the bidirectional encoder representation layer of the causal entity recognition model to obtain dynamic word vectors. The dynamic word vectors are then sequence-integrated by the bidirectional long short-term memory network layer to obtain the preliminary causal label sequence. In the conditional random field layer, the Viterbi algorithm is used to decode the initial causal label sequence to obtain the optimal causal label sequence. Text fragments are extracted from the optimal causal label sequence to obtain the initial causal entity. Then, consecutive initial causal entities of the same type are merged to obtain the complete causal entity. Invalid entities are removed from complete causative entities according to a preset length threshold to obtain clean causative entities. The rationality of the clean causative entities is then verified by a dictionary of chemical process safety management theory terms to obtain chemical causative entities.

5. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 1, characterized in that, The step of converting chemical causative entities into chemical causative semantic vectors and automatically aggregating these vectors into a set of causative topics using a density clustering algorithm includes: Text standardization is performed on chemical causal entities to obtain standardized entity phrases. The standardized entity phrases are then padded or truncated according to a preset maximum length. The native word segmenter is combined with a chemical bilingual dictionary to perform word segmentation and generate causal input tensors. The causal input tensor is transformed into a semantic vector using an embedding model. The semantic vector is then normalized to obtain a normalized semantic vector. The effectiveness of the normalized semantic vector is then verified by combining it with the causal topic, thus obtaining the chemical causal semantic vector. The semantic similarity of chemical causal semantic vectors is evaluated using a density clustering algorithm to obtain a distance matrix. Then, causal topic clustering is performed based on the distance matrix to obtain a causal topic set.

6. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 5, characterized in that, The method involves using density clustering algorithm to evaluate the semantic similarity of chemical causal semantic vectors, obtaining a distance matrix, and then performing causal topic clustering based on the distance matrix to obtain a set of causal topics, including: The chemical causal semantic vectors are normalized to obtain a set of causal semantic vectors, and the parameters of the density clustering algorithm are set to obtain the initial density clustering algorithm. The initial density clustering algorithm is used to calculate the cosine distance between all entities in the causal semantic vector set, and a distance matrix is ​​constructed. All cosine distances corresponding to each causal semantic vector in the distance matrix are eliminated and sorted, and the causal semantic vectors corresponding to the first few smallest cosine distances are selected as the nearest neighbor set. The maximum distance value in the nearest neighbor set is taken as the feature distance, and the density is calculated based on the inverse distance method and the feature distance to obtain the local density; Based on the local density, density peak points are identified. Using density peaks as cluster centers, causal semantic vectors that are density-reachable are merged to form initial clusters. Causal semantic vectors that are density-inaccessible are marked as noise points. A stable cluster set is obtained by automatically merging similar initial clusters that are less than a preset threshold. Calculate the cohesion and separation of each cluster in the stable cluster set, and remove clusters based on the cohesion and separation to obtain the causal cluster set. Then, name the causal cluster set with the causal theme to obtain the causal theme set.

7. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 1, characterized in that, The process of constructing a partial ancestor graph from the accident and topic intensity matrix using a causal discovery algorithm, and then modifying the partial ancestor graph to obtain the chemical causal structure, includes: The intensity matrix of the accident and the topic is standardized to obtain a standardized intensity matrix. The parameters of the causal discovery algorithm are configured to obtain the initial causal discovery algorithm. The skeleton of the standardized intensity matrix is ​​learned by using the initial causal discovery algorithm to obtain an undirected causal skeleton. Based on the undirected causal skeleton and according to the direction rules, a partial ancestor graph is obtained. Edges marked as having uncertain or potentially mixed directions are extracted from the partial ancestor graph. Fuzzy path filtering is then performed on the partial ancestor graph based on these edges to obtain the filtered fuzzy causal paths. Logical relationships were extracted from the chemical safety expert knowledge base and internal enterprise policy documents. These relationships were then used to make a rational judgment and correct the path direction of the selected fuzzy causal paths, resulting in the chemical causal structure.

8. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 7, characterized in that, The initial causal discovery algorithm is used to perform skeleton learning on the standardized intensity matrix to obtain an undirected causal skeleton. Based on the undirected causal skeleton, direction learning is performed according to direction rules to obtain a partial ancestor graph, including: The standardized intensity matrix is ​​initialized and connected using the initial causal discovery algorithm to obtain the topic node graph. Perform kernel function conditional independence test on each pair of nodes in the topic node graph to obtain the independence test results. Based on the independence test results, remove node edges from the topic node graph to obtain an undirected causal skeleton. Based on the undirected causal skeleton, the causal direction of the edges is marked using the built-in direction rules of the initial causal discovery algorithm, thus obtaining a partial ancestor graph.

9. The method for analyzing the causal causes of chemical accidents based on text mining and causal inference according to claim 1, characterized in that, The method involves inferring the causal strength of chemical causal structures based on structural equation modeling, obtaining a quantitative causal network, performing counterfactual intervention simulations on the quantitative causal network, and determining the optimal prevention strategy, including: Using the chemical causal structure as the framework of the structural equation model, the attribution and path direction of exogenous and endogenous variables are clarified, and the standardized path coefficients are solved by maximum likelihood estimation to form a quantitative causal network. Based on the quantitative causal network, upstream or hub nodes are selected as intervention targets, the intervention intensity is uniformly set, and the intensity of the intervention target is fixed by structural equation model simulation tool to predict the intensity value of downstream theme after intervention. The change in downstream themes is calculated based on the intensity value after intervention. The change in downstream themes is then standardized to obtain the intervention effect value. The intervention effect values ​​are sorted from largest to smallest. Based on the sorting results, intervention targets for each downstream failure mode are screened, and the optimal prevention strategy is formed in combination with the enterprise's resource constraints.