MACHINE LEARNING

NLP CLASSIFIER

April 1, 2026

A specialized machine learning pipeline for topic classification and language detection across English, Tagalog, and Cebuano using BERTopic and BART models.

LanguagesEnglish, Tagalog, and Cebuano
ModelsBERTopic and BART-based classification
OutputTopic classification and language detection

Overview

This project tackles the complexity of multi-dialect natural language processing. It combines a custom language detection model with advanced Transformer-based topic extractors to accurately classify unstructured text in code-switched environments.

Architecture

Tech Stack

Python

FastAPI

BERTopic

BART-Large-MNLI

Scikit-Learn

Design Decisions

The backend API leverages FastAPI to serve heavily cached .pkl model states. By pre-training the Logistic Regression, LDA, and BERTopic embeddings, the system reduces cold-start latency and can route input text to the correct model based on instant language identification.

Model Metrics

Performance Statistics

  • Language Detection Accuracy: 96.67%

  • LDA Classification Accuracy: 62.00%

  • BART Zero-Shot Accuracy: 100.00%

  • Trilingual BERTopic assignment rate: 70.22%

Why the discrepancy? The traditional LDA model (62%) relies on simple word frequencies (bag-of-words), which severely struggles with short, code-switched text (Taglish/Bislish). In contrast, the BART model (100%) and our custom N-gram Language Detector (96%) leverage deep contextual embeddings, allowing them to perfectly understand semantic intent across multiple dialects. Finally, the 70% BERTopic assignment rate means the model successfully grouped 70% of the raw documents into highly coherent topics while filtering out the remaining 30% as low-quality noise.

Accuracy Overview

Block media