An explainable AI-driven expert system for risk level determination in process safety using sentiment analysis: A HAZOP study

Abstract

Hazard and Operability (HAZOP) studies are fundamental to process safety but remain limited by their qualitative and text-based nature, which often hinders consistent hazard interpretation and prioritization. This study introduces an explainable artificial intelligence (XAI)-driven expert system designed to support risk level determination in HAZOP analysis by combining text mining, sentiment analysis, and interpretable machine learning. The proposed framework integrates two core modules: (1) a risk prediction module that employs transformer-based aspect-based sentiment analysis (ABSA) to extract contextual information from unlabeled HAZOP reports and classify textual entries into five quantitative risk levels; and (2) a risk assessment expert system that utilizes SHapley Additive exPlanations (SHAP) for transparent decision support and recommendation generation. A key methodological innovation is the introduction of a negative sampling technique, which intelligently addresses data imbalance by identifying and emphasizing borderline misclassified samples during retraining, leading to improved model robustness and accuracy. The SHAP-based interpretability mechanism provides class-specific insights, highlighting the most influential textual features behind each risk classification. These insights are stored in a structured Knowledge Base, enabling the expert system to generate human-readable explanations and recommendations in two phases: justifying correct predictions and diagnosing assessor–model disagreements. The proposed framework was validated using a HAZOP dataset from a PEMFC-based power system, demonstrating its capability to enhance consistency, explainability, and linguistic precision in risk assessment. This approach establishes a foundation for intelligent, interpretable, and linguistically consistent safety analysis in complex process industries.