Language Detector (TF-IDF char n-grams + linear SVM Classifier)

Module 1 of the RAG-Based Mental Health Support Chatbot. Predicts the language code of a short text (e.g. en, fr, ar).

Files

  • vectorizer.joblib โ€” fitted TfidfVectorizer (character n-grams)
  • classifier.joblib โ€” fitted linear classifier

Usage

import joblib
from huggingface_hub import hf_hub_download

vec = joblib.load(hf_hub_download("GAD01/svm-language-detector", "vectorizer.joblib"))
clf = joblib.load(hf_hub_download("GAD01/svm-language-detector", "classifier.joblib"))
print(clf.predict(vec.transform(["Bonjour, comment allez-vous ?"]))[0])  # -> "fr"

Trained on papluca/language-identification.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support