Early detection of food safety risks using BERT and large language models - Gasbaoui, Mohammed El Amin; Benkrama, Soumia; Bendjima, Mostefa (Indonesian Journal of Electrical Engineering and Computer Science, 2025)
Sentiment analysis can be a powerful tool in safeguarding public health. This allows authorities to investigate and take action before a foodborne illness outbreak spreads. This paper introduces a novel system that proactively empowers restaurants to identify potential food safety hazards and hygiene regulation violations. The system leverages the power of natural language processing (NLP) to analyze Arabic restaurant reviews left by customers. By fine-tuning a pre-trained BERT mini-Arabic model on three targeted datasets: Sentiment Twitter Corpus, an Algerian dialect dataset, and an Arabic restaurant dataset, the system achieves an impressive accuracy of 91%. Additionally, the system caters to spoken feedback by accepting audio reviews. We utilized Whisper AI for accurate text transcription, followed by classification using a fine-tuned Gemini model from Google on Algerian local comments and others generated using large language models (LLMs) through few-shot learning techniques, reaching an accuracy of 93%. Notably, both models operate independently and concurrently. Leveraging RESTful APIs, the system integrates the solved sub-solutions from each microservice into a fusion layer for a comprehensive restaurant evaluation. This multifaceted approach delivers remarkable results for both modern standard Arabic (MSA) and the Algerian dialect, demonstrating its effectiveness in addressing restaurant food safety concerns.