Limited awareness of allergen content in traditional Indonesian foods poses a potential health risk because recipe platforms rarely provide explicit allergen information. This study develops an automated allergen classification system for Indonesian recipes using the Bernoulli Naïve Bayes algorithm. The contributions include the construction of a recipe-level allergen dataset, the integration of text preprocessing, augmentation, and resampling techniques, and the introduction of multi-scenario allergen classification to support safer food choices. Recipe data were collected from Cookpad, producing 9,921 cleaned recipes after preprocessing. To increase data diversity and address class imbalance, rule-based ingredient augmentation expanded the dataset to 15,030 recipes. The model was evaluated under three classification scenarios: binary allergen detection (0–1), allergen exposure levels (0–3), and detailed allergen counts (0–14). Each scenario was tested using four dataset configurations: raw data, raw + ROS (Random Oversampling), augmented data, and augmented + ROS. Class distributions become increasingly imbalanced as the number of classes grows, particularly in the 15-class scenario. The binary scenario achieved perfect performance, with accuracy, precision, recall, and F1-score all equal to 1.0 across all dataset variants. Scenario 2 achieved the best multi-class performance with an F1-score of 0.9293 using Augmented + ROS data. Performance decreased in the 15-class setting due to increased classification complexity. Although a perfect binary score may raise concerns about overfitting, the result likely reflects the clear separability of the dataset’s allergen features. It should be interpreted cautiously when applied to broader culinary data.
Copyrights © 2026