Bhojpuri vs Hindi detector

A very small, dependency-free classifier that tells Bhojpuri (bho) from Hindi (hin) in Devanagari text. Both languages share a script and a lot of vocabulary, which is exactly why general language-ID tools often confuse them. The model is a naive-Bayes style scorer over word and character n-grams: about 98 KB of weights, pure Python, runs in microseconds.

Large language-ID systems such as GlotLID also cover Bhojpuri among hundreds of languages. This model is not a replacement for them. It is a small, open, easy-to-inspect baseline for the one hard pair, with its numbers published.

Use

from detect import detect, score

detect("रउआ कइसन बानी?")      # 'bho'
detect("आप कैसे हैं?")          # 'hin'
score("हमनी के गाँव में छठ पूजा")  # positive = Bhojpuri, negative = Hindi

Or from the command line: python detect.py "रउआ कइसन बानी?"

Returns unknown when the text has no Devanagari or no known features. The score is a sum of log-odds weights, so it is not a calibrated probability.

How it was built

  • Data: random article introductions from the Bhojpuri and Hindi Wikipedias (about 1,700 articles each), split into sentences, digits and non-Devanagari characters removed, de-duplicated.
  • Split by article, so no article appears in both train and test. Training set balanced to 5,520 sentences per language.
  • Features: word unigrams plus character 2-4-grams inside each word; the 8,000 most informative are kept.

Results (held-out Wikipedia sentences)

Subset Sentences Accuracy
All 3,105 (1,627 Bhojpuri / 1,478 Hindi) 99.5%
Short (under 60 characters) 820 98.5%
Long (60 characters or more) 2,285 99.8%

Limits, please read

  • The test data is formal encyclopedia text from the same source as the training data. Accuracy on chat messages, social media, song text, or speech transcripts will be lower, and I have not measured it.
  • Labels come from the Wikipedia edition, not from a native-speaker review of each sentence. Some Bhojpuri Wikipedia text is close to Hindi, so a few labels are probably noisy.
  • Devanagari only. Romanised text, Maithili, Awadhi, Magahi and other neighbouring languages are not handled and may be forced into one of the two classes.
  • Very short inputs (a word or two) are unreliable.
  • A handful of hand-written sentence pairs also came out right, but that is a sanity check, not a benchmark.

Feedback and corrections from Bhojpuri speakers are very welcome.

License and credit

Trained on text from Wikipedia (CC BY-SA 4.0), so the weights are shared under CC BY-SA 4.0. Built by apoorv079.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using apoorv079/bhojpuri-hindi-detector 1