BERTopic-based accident potential text theme feature recognition method and system

By employing a BERTopic-based approach, including preprocessing, text embedding, dimensionality reduction, and clustering, combined with the C-TF-IDF algorithm, the problem of overlapping and inaccurate classification of topic features in text data on coal mine accident hazards was solved. This approach achieves efficient and accurate hazard topic identification, thereby improving the scientific nature and effectiveness of coal mine safety management.

CN121787418APending Publication Date: 2026-04-03QINGHAI NORMAL UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively identify thematic features in textual data on coal mine accident hazards, resulting in overlapping hazard types and inaccurate classification. Traditional methods are inefficient and lack interpretability when processing short text data.

Method used

The method based on BERTopic is adopted. Through preprocessing, text embedding, dimensionality reduction and clustering operations, combined with the C-TF-IDF algorithm to extract the topic word distribution, the method can automatically identify the types of potential hazards. The UMAP and HDBSCAN algorithms are used for clustering to remove noise points, so as to achieve efficient and accurate topic identification.

Benefits of technology

It significantly improves the scientific rigor and effectiveness of identifying potential coal mine accident hazards, automatically determines the types and number of hazards, enhances the accuracy and interpretability of data analysis, and provides targeted guidance for hazard investigation and mitigation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121787418A_ABST
    Figure CN121787418A_ABST
Patent Text Reader

Abstract

The invention relates to the field of text semantic processing, and provides an accident potential text theme feature recognition method and system based on BERTopic. The method comprises the following steps: preprocessing accident potential text data to generate a potential text data set; converting the hidden danger text data set into a text embedding vector through a language model; carrying out dimension reduction on the text embedding vector and executing clustering operation to obtain a plurality of text clusters; extracting subject term distribution in the plurality of text clusters, and determining hidden danger subject types corresponding to the plurality of text clusters; and according to the subject term of the hidden danger subject type, dividing the text data in the hidden danger text data set into the corresponding hidden danger subject type so as to complete subject feature identification of the accident hidden danger text. According to the invention, the accuracy of subject feature recognition of hidden danger text data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text semantic processing technology, and in particular to a method and system for identifying accident hazard text topic features based on BERTopic. Background Technology

[0002] The volume of textual data on coal mine accident hazards is enormous, encompassing a wide variety of hazard types. In coal mine safety management practice, simply classifying and statistically analyzing hazard records by personnel according to hazard categories is insufficient to effectively uncover the underlying thematic characteristics of hazards hidden within these records. Statistical analysis of collected historical coal mine hazard textual data reveals overlapping hazard types and inaccurate or incorrect hazard classifications, severely impacting the rationality and effectiveness of data analysis and decision-making. Therefore, to scientifically and rationally analyze the distribution patterns of coal mine accident hazards and obtain hazard thematic types that reflect on-site production safety issues in coal mines, it is necessary to identify thematic features of historical hazard textual data and redefine hazard thematic types.

[0003] Existing topic modeling methods have significant limitations when processing large-scale short text data. Traditional LDA (Latent Dirichlet Allocation) generative topic models require pre-setting the number of topics and are inefficient when processing short text data. The resulting topic models also lack interpretability, making it difficult to intuitively understand the meaning of the topics. Furthermore, the expressive power of short text data is limited, and traditional methods struggle to fully extract semantic and syntactic information, leading to insufficient accuracy in topic identification. In addition, existing methods cannot effectively address the issues of overlapping hazard types and inaccurate classification when dealing with text data on coal mine accident hazards, making it difficult to accurately determine the topic types and quantity of the hazard text data. Summary of the Invention

[0004] This invention provides a method and system for identifying accident hazard text topic features based on BERTopic, in order to overcome the shortcomings of existing technologies.

[0005] This invention provides a method for identifying accident hazard text topic features based on BERTopic, including: S1. Preprocess the accident hazard text data to generate a hazard text dataset; S2. Convert the hidden danger text dataset into text embedding vectors using a language model; S3. Perform dimensionality reduction and clustering operations on the text embedding vectors to obtain multiple text clusters; S4. Extract the topic word distribution from multiple text clusters and determine the potential topic types corresponding to multiple text clusters; S5. Based on the keywords of the hazard topic type, divide the text data in the hazard text dataset into the corresponding hazard topic type to complete the topic feature identification of the accident hazard text.

[0006] According to the BERTopic-based method for identifying accident hazard text topics provided by the present invention, step S1 further includes: S11. Delete invalid information from the accident hazard text data to obtain the cleaning hazard text data; S12. Standardize the format and correct typos in the cleaning hazard text data to obtain formatted hazard text data; S13. Construct a custom dictionary for the field of accident hazards; S14. Using a word segmentation tool and the custom dictionary, the formatted hidden danger text data is segmented, and the segmentation results are filtered by a stop word library to generate a hidden danger text dataset.

[0007] According to the BERTopic-based method for identifying accident hazard text topics provided by the present invention, the language model in step S2 is a BERT-based Chinese pre-trained language model; In step S3, the dimensionality reduction of the text embedding vector is achieved by the UMAP algorithm, and the clustering operation of the text embedding vector is achieved by the HDBSCAN algorithm.

[0008] According to the BERTopic-based method for identifying accident hazard text topics provided by the present invention, step S4 further includes: S41. For each text cluster in multiple text clusters, concatenate similar texts within a single text cluster into a corresponding single document to obtain multiple concatenated documents; S42. Calculate the importance score of keywords in each individual document in multiple concatenated documents using the C-TF-IDF algorithm; S43. Based on the ranking results of importance scores, filter the keywords of each individual document to form multiple keyword distributions corresponding to multiple linked documents; S44. Review and name the distribution of multiple keywords to determine the potential topic type corresponding to each text cluster.

[0009] According to the BERTopic-based method for identifying accident hazard text topics provided by the present invention, in step S42, the expression for the importance score is:

[0010] in, This is the keyword index value. is the index value for a single document, is the average number of words in all concatenated documents, is the keyword in a single document importance score, is the keyword in a single document occurrence probability, is the keyword total probability of occurrence in all concatenated documents.

[0011] According to an accident hidden danger text theme feature recognition method based on BERTopic provided by the present invention, the hidden danger theme types in step S44 include: monitoring and communication hidden dangers, transportation hidden dangers, mining hidden dangers, system hidden dangers, ventilation hidden dangers, blasting hidden dangers, mine pressure hidden dangers, tunneling hidden dangers.

[0012] According to an accident hidden danger text theme feature recognition method based on BERTopic provided by the present invention, after step S4, it further includes: S45: Perform visual analysis on multiple text clusters using the hierarchical clustering method, identify highly similar text clusters and merge them to obtain optimized hidden danger theme types.

[0013] The present invention also provides an accident hidden danger text theme feature recognition system based on BERTopic, including: A preprocessing module: used to preprocess accident hidden danger text data to generate a hidden danger text data set; An embedding module, the embedding module is configured as a pre-trained language model, and is used to convert the hidden danger text data set into text embedding vectors; A clustering module: used to perform dimensionality reduction on the text embedding vectors and perform clustering operations to obtain multiple text clusters; A calculation module: used to extract the topic word distribution in multiple text clusters and determine the hidden danger theme types corresponding to the multiple text clusters; A partitioning module: used to partition the text data in the hidden danger text data set into the corresponding hidden danger theme types according to the topic words of the hidden danger theme types, so as to complete the theme feature recognition of accident hidden danger text.

[0014] The third aspect of the present invention also provides an accident hidden danger text theme feature recognition device based on BERTopic, including: a memory and at least one processor, and instructions are stored in the memory; at least one of the processors calls the instructions in the memory, so that an accident hidden danger text theme feature recognition device based on BERTopic executes an accident hidden danger text theme feature recognition method as described in any one of the above.

[0015] A fourth aspect of the present invention also provides a computer-readable storage medium storing instructions that, when executed by a processor, implement a method for identifying accident hazard text topic features based on BERTopic as described in any of the preceding claims.

[0016] This invention first systematically preprocesses accident hazard text data to generate a hazard text dataset, effectively removing invalid information, standardizing text format, and correcting typos. Combined with a custom dictionary and stop word library for the accident hazard domain, it performs precise word segmentation, significantly improving data quality and the accuracy of subsequent analysis. Second, this invention uses a BERT-based pre-trained Chinese language model to convert hazard text into text embedding vectors, fully capturing the semantic and syntactic information in short text data, overcoming the limited expressive power of traditional methods, and effectively reflecting the semantic similarity of the text. Third, this invention uses the UMAP algorithm for dimensionality reduction and the HDBSCAN algorithm for clustering operations, which not only reduces computation time and improves computational accuracy but also automatically recommends the optimal clustering results and identifies noise as outliers for exclusion, avoiding errors. The invention addresses the issue of misclassified texts into clusters, ensuring clustering quality. Furthermore, by extracting keyword distribution and determining hazard topic types based on the C-TF-IDF algorithm, it accurately reflects the characteristics of each text cluster. By calculating keyword importance scores, it effectively distinguishes between high-frequency feature words and low-frequency general words, making topic representation more precise and highly interpretable. This helps researchers and management departments intuitively understand the core meaning of each topic. Additionally, the invention categorizes text data into corresponding hazard topic types based on keyword information, solving the problems of overlapping hazard types and inaccurate classification in existing technologies. It automatically determines the type and quantity of hazard topics without requiring manual parameter presets, significantly improving the scientific rigor and effectiveness of coal mine accident hazard identification. This provides targeted guidance for on-site accident hazard investigation and management in coal mines, contributing to the prevention of major coal mine accidents. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 A schematic diagram of a method for identifying accident hazard text topic features based on BERTopic is provided in an embodiment of the present invention. Figure 2A schematic diagram of a text topic feature recognition system for accident hazards based on BERTopic is provided in this embodiment of the invention. Figure 3 This is a schematic diagram illustrating the trend of confusion level and number of topics provided in an embodiment of the present invention. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, embodiments of this invention, and should not be construed as limiting the invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention. In the description of this invention, it should be understood that the terminology used is for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0020] The embodiments of the present invention are described below with reference to the figures.

[0021] This invention provides a method for identifying accident hazard text topic features based on BERTopic, including: S1. Preprocess the accident hazard text data to generate a hazard text dataset.

[0022] Step S1 further includes: S11. Delete invalid information in the accident hazard text data to obtain cleaning hazard text data.

[0023] In step S11, the present invention identifies and removes invalid information unrelated to the text topic feature identification from the original data sample, including redundant content such as blank characters, special symbols, repeated punctuation, and meaningless numbers. Specifically, the present invention iterates through each piece of potential hazard text data, detects null values, missing values, and abnormal characters, and removes the parts containing this invalid information from the text, reducing data dimensionality and the computational burden of subsequent processing, ultimately obtaining clean potential hazard text data.

[0024] S12. Standardize the format and correct typos in the cleaning hazard text data to obtain formatted hazard text data.

[0025] Further, for the cleaning hazard text data, the present invention first performs format normalization processing, converts full-width characters to half-width characters, unifies the case formats of numbers and English letters, and standardizes the representation forms of dates and times. Subsequently, typo correction is performed. By constructing a common typo comparison table in the coal mine field, incorrect expressions in the text are replaced with correct words. For example, "spray blockage inside the coal mining machine" is corrected to "spray inside the coal mining machine blockage". After format normalization and typo correction, formatted hazard text data with unified format and accurate expression is obtained.

[0026] S13. Construct a custom dictionary for the field of accident hazards.

[0027] In step S13, the present invention summarizes the proprietary vocabulary in the field of coal mine accident hazards involved in relevant public materials, and combines it with the coal mine safety production knowledge entity to establish a custom dictionary for the field of accident hazards. In addition, the custom dictionary of the present invention also includes coal mine professional terms such as "fully-mechanized caving face", "internal spray", "coal mining machine", "heading roadway", "gas sensor", etc., covering proprietary vocabulary in multiple dimensions such as equipment names, technological processes, safety facilities, and hazard types.

[0028] S14. Use a word segmentation tool to perform word segmentation on the formatted hazard text data in combination with the custom dictionary, and filter the word segmentation results through a stop word library to generate a hazard text data set.

[0029] In step S14, the present invention uses the Jieba word segmentation tool to perform word segmentation on the formatted hazard text data. Specifically, during the word segmentation process, first, the custom dictionary constructed in step S13 is loaded by the Jieba word segmentation tool, and the proprietary vocabulary in the dictionary is recognized and segmented as a complete phrase; after word segmentation, the present invention uses the stop word library to filter the word segmentation results, deletes stop words such as "have", "of", "one", etc., and retains valid words, and finally generates a hazard text data set containing multiple data samples, and each data is represented as a sequence of segmented words.

[0030] S2. Convert the hazard text data set into text embedding vectors through a language model.

[0031] Among them, the language model in step S2 is a Chinese pre-trained language model based on BERT.

[0032] In step S2, the present invention uses a Chinese pre-trained language model based on BERT to convert each text data in the hazard text data set into a text embedding vector. The BERT (Bidirectional Encoder Representations from Transformers) is a bidirectional encoder model, which learns the context semantic representation of vocabulary through pre-training on a large-scale Chinese corpus.

[0033] In the specific conversion process, this invention inputs the segmented word sequence into the BERT model. The BERT model generates a high-dimensional vector representation for each word in the sequence. Then, it performs average pooling on the vector representations of all words in the sequence to obtain a fixed-dimensional embedding vector representing the entire text. After the conversion, the text data in step S1 is represented as text embedding vectors, forming a set of text embedding vectors.

[0034] S3. Perform dimensionality reduction and clustering operation on the text embedding vector to obtain multiple text clusters.

[0035] In step S3, the dimensionality reduction of the text embedding vector is achieved by the UMAP algorithm, and the clustering operation of the text embedding vector is achieved by the HDBSCAN algorithm.

[0036] In step S3, the present invention first employs the UMAP (Uniform Manifold Approximation and Projection for Dimension Reduction) algorithm to reduce the dimensionality of the text embedding vectors. Based on manifold learning theory, the UMAP algorithm maps the text embedding vectors to a lower-dimensional space by constructing topological relationships between data points in a high-dimensional space. Specifically, the UMAP algorithm calculates the distance between each text embedding vector and its neighboring vectors, constructing a weighted adjacency graph to represent the local topological structure between vectors. Then, it projects the high-dimensional topological structure to the low-dimensional space by optimizing the objective function. During the dimensionality reduction process, the local and global structural features of the dataset are preserved. After UMAP dimensionality reduction, the text embedding vectors are transformed into dimensionality-reduced embedding vectors.

[0037] Subsequently, this invention employs the HDBSCAN (Hierarchical Density-Based Spatial Clustering of Applications with Noise) algorithm to perform clustering operations on the dimensionality-reduced embedding vectors. HDBSCAN is a density-based hierarchical clustering method that does not require pre-setting the number of clusters and can automatically identify clusters of different densities. Specifically, during the clustering process, the HDBSCAN algorithm first calculates the core distance of each dimensionality-reduced embedding vector, i.e., the distance from that vector to its k-th nearest neighbor vector. Then, it constructs a minimum spanning tree to represent the connections between vectors, dividing the vectors into multiple clusters by cutting the edges of the minimum spanning tree. During clustering, the HDBSCAN algorithm identifies vectors with low density as noise points, marking them as outliers and excluding them from the clusters. After the clustering operation, this invention divides the dimensionality-reduced embedding vectors into several text clusters, each containing semantically similar text data, while noise points are separately marked as unclassified data.

[0038] S4. Extract the topic word distribution from multiple text clusters and determine the potential topic types corresponding to the multiple text clusters.

[0039] Step S4 further includes: S41. For each text cluster in multiple text clusters, concatenate similar texts within a single text cluster into a corresponding single document to obtain multiple concatenated documents.

[0040] In step S41, for each text cluster obtained in step S3, the present invention sequentially concatenates the word segmentation results of all text data within the cluster into a complete word sequence, forming a concatenated document corresponding to the cluster. For example, if a text cluster contains 100 text data entries, and the word segmentation result of each text data entry is several words, the present invention concatenates all the words of these 100 text data entries sequentially to form a concatenated document containing thousands of words. Through the concatenation operation, the present invention integrates scattered short texts into a long document, capturing the shared context and topic features of the text within the cluster. After processing in step S41, the present invention obtains multiple concatenated documents, each corresponding to a text cluster.

[0041] S42. Calculate the importance score of keywords in each individual document in multiple concatenated documents using the C-TF-IDF algorithm.

[0042] In step S42, the expression for the importance score is:

[0043] in, This is the keyword index value. For a single document index value, The average number of words across all concatenated documents. Keywords In a single document Importance score in Keywords In a single document The probability of occurrence in Keywords The total probability of occurrence in all concatenated documents.

[0044] Furthermore, topic representation is modeled based on the text in each text data cluster, with each cluster corresponding to a topic. When explaining the differences between a topic and other topics through the specific word distribution of each topic, existing techniques often use the Term Frequency-Inverse Document Frequency (TF-IDF) concept, a method for measuring the importance of words to a document within a document set or corpus. The classic TF-IDF algorithm combines term frequency and inverse document frequency statistical methods, and its formula is as follows:

[0045] In the formula, word frequency Keywords In the target document Frequency of occurrence in the document, inverse document frequency This refers to the total number of documents. With keywords Total number of documents Take the logarithm of the quotient.

[0046] When there is a large amount of document data input, directly using the classic TF-IDF algorithm will generate too many topic terms, thus affecting the accuracy of topic modeling. Therefore, this invention organizes similar documents into a cluster and treats them as a whole. This allows for the capture of the shared context and topics within the cluster, leading to a better understanding of the main topics of the cluster and improving the efficiency and accuracy of topic modeling. The classic TF-IDF algorithm is applied to different types of clusters to reflect their characteristics; the calculation formula is shown in the importance score in step S42 above.

[0047] This invention uses the C-TF-IDF algorithm to represent topics, changing the importance of keywords in a cluster rather than individual texts. This allows for the generation of topic word distributions for each text cluster. Furthermore, the algorithm can merge the most similar topics, ultimately reducing the number of topics to a user-specified value.

[0048] S43. Based on the ranking results of importance scores, filter the keywords of each individual document to form multiple keyword distributions corresponding to multiple linked documents.

[0049] In step S43, for each linked document, the present invention sorts all the keywords calculated in step S42 according to their importance scores from high to low. Then, the present invention selects the top 10 keywords with the highest scores from the sorting results as the subject words of the linked document. Through the filtering operation, the present invention generates corresponding subject word lists for multiple linked documents, forming multiple subject word distributions. Each subject word distribution contains 10 subject words and their importance scores.

[0050] S44. Review and name the distribution of multiple keywords to determine the potential topic type corresponding to each text cluster.

[0051] The types of potential hazards mentioned in step S44 include: monitoring and communication hazards, transportation hazards, mining hazards, system hazards, ventilation hazards, blasting hazards, mine pressure hazards, and tunneling hazards.

[0052] Furthermore, this invention manually reviews multiple keyword distributions based on publicly available information. During the review process, based on the semantic meaning of the keywords and knowledge of coal mine safety, this invention determines the corresponding hazard category name for each keyword distribution. For example, for distributions containing keywords such as "gas," "sensor," "ventilation," and "air volume," this invention names them "ventilation hazard"; for distributions containing keywords such as "belt conveyor," "transportation," "roadway," and "hoisting," it names them "transportation hazard." After review and naming, this invention ultimately determines multiple core hazard category types. Simultaneously, this invention filters and removes noise words from the keyword distributions, such as deleting meaningless words like "in progress," "situation," and "existence," thus optimizing the expression quality of the keyword distributions.

[0053] After step S4, the following steps are also included: S45: Use hierarchical clustering to perform visual analysis on multiple text clusters, identify highly similar text clusters and merge them to obtain optimized potential hazard topic types.

[0054] Furthermore, this invention utilizes the visualization technology of the BERTopic model, employing a hierarchical clustering method to perform cluster analysis on 19 text clusters, generating a hierarchical clustering dendrogram to display the distance relationships between clusters. Simultaneously, this invention generates a heatmap to display the similarity between each text cluster, showing the degree of similarity between any two clusters. After establishing the icons, this invention identifies text cluster pairs that are close in distance or have high similarity by analyzing the hierarchical clustering dendrogram and heatmap. For example, the "gas hazard" cluster and the "ventilation hazard" cluster have high similarity. Then, this invention manually merges these highly similar clusters, combining the text data of two clusters into a new cluster, and recalculates the topic word distribution and hazard topic type names of the merged cluster. Through this merging operation, this invention optimizes the original text clusters, reduces the complexity of the topic model, and improves the accuracy of topic types.

[0055] S5. Based on the keywords of the hazard topic type, divide the text data in the hazard text dataset into the corresponding hazard topic type to complete the topic feature identification of the accident hazard text.

[0056] This invention utilizes a trained BERTopic topic model to predict the topic type of each text in a hazard text dataset. Specifically, it extracts the word segmentation results of each text, calculates the frequency of each topic word in the text, and counts the number of times topic words for multiple hazard topic types appear in the text. Then, it assigns the text to the hazard topic type with the highest topic word frequency. Through this prediction process, all text data is classified into hazard topic types, thus completing the topic feature identification of accident hazard texts.

[0057] like Figure 2 As shown, the present invention also provides a text topic feature recognition system for accident hazards based on BERTopic, comprising: Preprocessing module 100: Used to preprocess the accident hazard text data to generate a hazard text dataset; Embedding module 200, configured as a pre-trained language model, is used to convert the hidden danger text dataset into text embedding vectors; Clustering module 300: used to reduce the dimensionality of the text embedding vector and perform clustering operations to obtain multiple text clusters; Calculation module 400: used to extract the topic word distribution in multiple text clusters and determine the potential topic types corresponding to multiple text clusters; Segmentation module 500: used to segment the text data in the hidden danger text dataset into the corresponding hidden danger theme type according to the theme words of the hidden danger theme type, so as to complete the theme feature recognition of the accident hidden danger text.

[0058] A third aspect of the present invention also provides a BERTopic-based accident hazard text topic feature recognition device, comprising: a memory and at least one processor, wherein the memory stores instructions; at least one processor invokes the instructions in the memory to cause the BERTopic-based accident hazard text topic feature recognition device to perform an accident hazard text topic feature recognition method as described in any of the preceding claims.

[0059] A fourth aspect of the present invention also provides a computer-readable storage medium storing instructions that, when executed by a processor, implement a method for identifying accident hazard text topic features based on BERTopic as described in any of the preceding claims.

[0060] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0061] To verify the actual performance of the BERTopic model, a comparative experiment was conducted with the traditional LDA generative topic model. Due to limitations in computing resources and data representativeness, one-tenth of the data samples from the 469,548 data samples constructed in this invention were selected as the comparative experimental dataset based on stratified sampling according to the "discovery time" field.

[0062] When using LDA models for topic modeling, perplexity is often used as one of the metrics to evaluate the quality of the topic model and to determine the optimal number of topics. Generally, lower perplexity corresponds to better topic feature recognition performance. In this experiment, the number of topics was set to range from 3 to 50, with a step size of 1, and the number of iterations was set to 500. In this way, a graph showing the relationship between perplexity and the number of topics in the comparative experimental dataset was obtained, as shown below. Figure 3 As shown.

[0063] Depend on Figure 3 It can be seen that the perplexity is lowest when the number of topics is 21, indicating that this is likely the optimal number of topics. Considering that the LDA model requires a preset number of topics, the same number of topics was set in the BERTopic model experiment to ensure the fairness and reasonableness of the comparison experiment; combined with Figure 3The inflection point changes of different number of topics were investigated. Comparative experiments were conducted with 12, 15, 17, 19, 21, 23, 25, 28, 30, 32, 37 and 41 topics selected from the range of 3 to 50 topics. The performance of the two models was evaluated according to the preset evaluation index. The experimental results are shown in Table 1.

[0064] Table 1. Comparison of Thematic Model Evaluation

[0065] Analysis of Table 1 shows that, in terms of topic consistency, whether measured by TCC_V or TCC_NPMI, the BERTopic model scores significantly higher than the LDA model. This is mainly attributed to the fact that the BERTopic model can better understand the context and word relevance. This further illustrates that in the topics generated by the BERTopic model, the keywords of the topics are more consistent and the words within the topics are more related.

[0066] Regarding topic diversity, the diversity of the BERTopic model of this invention increases with the number of topics, while the LDA model shows the opposite, with its diversity decreasing with the number of topics; this demonstrates the advantage of the BERTopic model in capturing and distinguishing different topics.

[0067] In summary, the BERTopic topic model proposed in this invention demonstrates significant advantages in topic consistency and diversity, effectively capturing different topics in text data while maintaining consistency and diversity among them. Furthermore, the model's high interpretability provides users with clear topic explanations and keywords, helping them better understand and utilize text data. Therefore, the BERTopic topic model proposed in this invention has broad application prospects and potential in the study of actual coal mine accident hazard texts.

[0068] This invention aims to address the problems existing in current technologies by more scientifically, effectively, and rationally determining the topic types in text. It introduces the BERTopic model to mine the topic features of large-scale textual data on coal mine accident hazards. By utilizing the BERTopic model to extract semantic information and contextual relationships from text, this invention can more accurately determine the topic types and quantities of hazard-related textual data. This further helps researchers and relevant departments better understand and manage the patterns of coal mine accident hazards, thereby improving coal mine safety and management levels.

[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for identifying accident hazard text topic features based on BERTopic, characterized in that, include: S1. Preprocess the accident hazard text data to generate a hazard text dataset; S2. Convert the hidden danger text dataset into text embedding vectors using a language model; S3. Perform dimensionality reduction and clustering operations on the text embedding vectors to obtain multiple text clusters; S4. Extract the topic word distribution from multiple text clusters and determine the potential topic types corresponding to multiple text clusters; S5. Based on the keywords of the hazard topic type, divide the text data in the hazard text dataset into the corresponding hazard topic type to complete the topic feature identification of the accident hazard text.

2. The method for identifying accident hazard text topic features based on BERTopic according to claim 1, characterized in that, Step S1 further includes: S11. Delete invalid information from the accident hazard text data to obtain the cleaning hazard text data; S12. Standardize the format and correct typos in the cleaning hazard text data to obtain formatted hazard text data; S13. Construct a custom dictionary for the field of accident hazards; S14. Using a word segmentation tool and the custom dictionary, the formatted hidden danger text data is segmented, and the segmentation results are filtered by a stop word library to generate a hidden danger text dataset.

3. The method for identifying accident hazard text topic features based on BERTopic according to claim 1, characterized in that, The language model mentioned in step S2 is a BERT-based pre-trained Chinese language model; In step S3, the dimensionality reduction of the text embedding vector is achieved by the UMAP algorithm, and the clustering operation of the text embedding vector is achieved by the HDBSCAN algorithm.

4. The method for identifying accident hazard text topic features based on BERTopic according to claim 1, characterized in that, Step S4 further includes: S41. For each text cluster in multiple text clusters, concatenate similar texts within a single text cluster into a corresponding single document to obtain multiple concatenated documents; S42. Calculate the importance score of keywords in each individual document in multiple concatenated documents using the C-TF-IDF algorithm; S43. Based on the ranking results of importance scores, filter the keywords of each individual document to form multiple keyword distributions corresponding to multiple linked documents; S44. Review and name the distribution of multiple keywords to determine the potential topic type corresponding to each text cluster.

5. The method for identifying accident hazard text topic features based on BERTopic according to claim 4, characterized in that, In step S42, the expression for the importance score is: in, This is the keyword index value. For a single document index value, The average number of words across all concatenated documents. Keywords In a single document Importance score in Keywords In a single document The probability of occurrence in Keywords The total probability of occurrence in all concatenated documents.

6. The method for identifying accident hazard text topic features based on BERTopic according to claim 4, characterized in that, The types of potential hazards mentioned in step S44 include: monitoring and communication hazards, transportation hazards, mining hazards, system hazards, ventilation hazards, blasting hazards, mine pressure hazards, and tunneling hazards.

7. The method for identifying accident hazard text topic features based on BERTopic according to claim 1, characterized in that, After step S4, the following also includes: S45: Use hierarchical clustering to perform visual analysis on multiple text clusters, identify highly similar text clusters and merge them to obtain optimized potential hazard topic types.

8. A text topic feature recognition system for accident hazards based on BERTopic, characterized in that, include: Preprocessing module: Used to preprocess accident hazard text data to generate hazard text dataset; An embedding module, configured as a pre-trained language model, is used to convert the hidden danger text dataset into text embedding vectors; Clustering module: used to reduce the dimensionality of the text embedding vectors and perform clustering operations to obtain multiple text clusters; Calculation module: used to extract the topic word distribution in multiple text clusters and determine the potential topic types corresponding to multiple text clusters; The segmentation module is used to segment the text data in the hidden danger text dataset into the corresponding hidden danger theme type based on the theme words of the hidden danger theme type, so as to complete the theme feature identification of the accident hidden danger text.

9. A text topic feature recognition device for accident hazards based on BERTopic, characterized in that, include: A memory and at least one processor, wherein the memory stores instructions; At least one of the processors invokes the instructions in the memory to cause a BERTopic-based accident hazard text topic feature recognition device to perform a BERTopic-based accident hazard text topic feature recognition method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed by a processor, implement a method for identifying accident hazard text topic features based on any one of claims 1 to 7.