In recent years, transportation system safety analysis has become increasingly challenging and highly demanding. Unstructured data contain sufficient information from which inherent interactions can be extracted. Determining how to process and fuse a large amount of unstructured data is a challenging task. In this paper, we propose a text-based Bayesian network (TBN) method to establish a Bayesian network (BN) based on text records, where the BNs arcs are obtained from barrier relationships identified by a graphical model and its prior probabilities stem from fault trees. The comparative experimental results illustrate that the text-based method in TBN is efficient. The precision, recall and F-measure of TBN are 8.64%, 10.70% and 9.84% higher, respectively, than the most frequent (MF) result. Moreover, compared to the traditional BN, whose prior probabilities are frequently acquired from experts, the prior probabilities of the proposed text-based BN (TBN) have a high confidence. The experimental results of a train derailment accident case study show that with changes in the train derailment probabilities and the safety potentials of the barriers, the TBN generates quantitative results and reveals the critical risks of derailment accidents. Additionally, this work demonstrates relevant nonlinear relationships to improve the assessment results. Therefore, based on text-based data, this study reveals that barrier safety analysis has the potential to identify high-risk barriers, which can guide managers to enhance these barriers.