Text Analysis of Workplace Accident Chronology for Hazard Identification Using BERT and Random Forest Algorithms - Mohammad Zoqi Sarwani; Anang Aris Widodo (LPPM POLITEKNIK LP3I BANDUNG, 2026)
Workplace accidents in industrial environments continue to cause significant human, economic, and operational losses, making proactive hazard identification a critical priority for occupational health and safety (OHS) management. This study develops a workplace hazard-identification pipeline that automatically analyzes accident chronology texts using BERT (Bidirectional Encoder Representations from Transformers) as a contextual feature extractor and Random Forest as an ensemble classifier. The publicly available IHMStefanini Industrial Safety and Health dataset was used as the source corpus; after data-quality screening, stratified train-validation-test splitting (80:10:10), and class-imbalance handling using SMOTE applied only to BERT embedding vectors in the training partition, the final modeling matrix covered 14 Critical Risk hazard categories. Text preprocessing included controlled normalization, tokenization with bert-base-uncased, padding and truncation to 128 tokens, and contextual embedding extraction into 768-dimensional feature vectors. Experimental results on the held-out test set show that the proposed BERT-Random Forest model achieved an accuracy of 94.7%, precision of 93.8%, recall of 94.2%, and F1-score of 94.0%, outperforming TF-IDF with SVM, Word2Vec with LSTM, BERT with SVM, and standalone BERT fine-tuning baselines. Statistical comparison using the McNemar-Bowker paired error test confirmed that the performance difference between the proposed model and the strongest baseline was significant (p < 0.01). The main contribution of this study is not the generic superiority of a hybrid BERT-Random Forest architecture, but its practical adaptation for multi-class workplace hazard identification from industrial accident narratives with lower computational cost than full transformer fine-tuning. The proposed method can support automatic incident triage, hazard monitoring, prioritization of safety investigations, and decision.