Text Classification
fastText
language-identification

NusaX fastText Language Identification

A fastText classifier that identifies Indonesian, English and 10 Indonesian regional languages, trained on NusaX-MT.

Labels

Labels use the __label__<iso639-3>_<script> format of facebook/fasttext-language-identification.

Label Language Precision Recall F1
ind_Latn Indonesian 0.9679 0.9800 0.9739
eng_Latn English 0.9780 1.0000 0.9889
ace_Latn Acehnese 0.9975 0.9925 0.9950
ban_Latn Balinese 0.9875 0.9900 0.9888
bjn_Latn Banjarese 0.9847 0.9650 0.9747
bug_Latn Buginese 0.9900 0.9950 0.9925
jav_Latn Javanese 0.9924 0.9850 0.9887
mad_Latn Madurese 0.9925 0.9925 0.9925
min_Latn Minangkabau 0.9801 0.9850 0.9825
nij_Latn Ngaju 0.9875 0.9850 0.9862
sun_Latn Sundanese 0.9975 0.9875 0.9925
bbc_Latn Toba Batak 0.9925 0.9900 0.9912

Test accuracy: 0.9873 (4800 sentences, official NusaX test split)

Accuracy on short text (test sentences cut to the first N words)

3 words 5 words 10 words full sentence
0.8148 0.9058 0.9788 0.9873

Usage

import fasttext
from huggingface_hub import hf_hub_download

model = fasttext.load_model(hf_hub_download("smapproyek/fasttext-id-region-lang-detection", "model.bin"))
model.predict("abdi bade angkat ka bandung enjing", k=3)
# (('__label__sun_Latn', ...), array([...]))

A quantized, smaller model.ftz is also provided.

Preprocessing

The model was trained on text that was lowercased, had emojis converted to text aliases, @mentions replaced with user, URLs removed, and every character other than [a-z0-9] and whitespace replaced with a space. Apply the same cleaning at inference for best results.

Training

  • Data: NusaX-MT official train split (500 sentences Γ— 12 languages), plus random 3–8-word windows of each sentence for robustness on short text. Hyperparameters were checked on the valid split and evaluated on the test split.
  • fasttext.train_supervised with lr=0.5, epoch=30, dim=64, wordNgrams=2, minn=2, maxn=5, minCount=1, loss=softmax.

Limitations

  • Closed set of 12 labels. Text in any other language is still forced into one of these labels. Run a general-purpose language identifier first if the input can be in any language.
  • NusaX sentences come from Indonesian reviews and comments translated by native speakers, so performance may drop on other domains, on heavy slang, or on code-mixed text.
  • Closely related languages (for example Indonesian, Banjarese and Minangkabau) are the most frequent confusions, especially on very short text.

Citation

@misc{winata2022nusax,
  title={NusaX: Multilingual Parallel Sentiment Dataset for 10 Indonesian Local Languages},
  author={Winata, Genta Indra and Aji, Alham Fikri and Cahyawijaya, Samuel and Mahendra, Rahmad and Koto, Fajri and Romadhony, Ade and Kurniawan, Kemal and Moeljadi, David and Prasojo, Radityo Eko and Fung, Pascale and Baldwin, Timothy and Lau, Jey Han and Sennrich, Rico and Ruder, Sebastian},
  year={2022},
  eprint={2205.15960},
  archivePrefix={arXiv},
  primaryClass={cs.CL}
}
Downloads last month
37
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Dataset used to train smapproyek/fasttext-id-region-lang-detection

Paper for smapproyek/fasttext-id-region-lang-detection