Automating Legal Document Classification with Transformer-XLM-RoBERTa: A Case Study on the Moroccan Court of Cassation
摘要
Due to the large number of legal judgments submitted to the Moroccan court of cassation, manually assigning these documents to the appropriate chambers has become a time-consuming and error-prone operation. To address this challenge, we propose a classification model for categorizing legal judgments into chambers using a fine-tuned cross-lingual robustly optimized bidirectional encoder representations from transformers approach (XLM-RoBERTa). We trained and evaluated the model using a corpus that we created based on 17,321 judicial judgments from the Moroccan court of cassation. The model achieved an F1-score of 98.52% and an accuracy of 98.48%. Furthermore, the model's adaptability was evaluated on an external Arabic legal dataset from the scientific judicial site (SJP) controlled by Saudi Arabia's ministry of justice, and it achieved an F1-score of 93.31%. These findings emphasize the model's ability to improve categorization accuracy and efficiency, with major implications for automating judicial operations, decreasing human error, and enhancing legal document preservation.