← all repositories
abadojack/whatlanggo

Go package guesses your language from three-letter chunks

A zero-dependency port of a Rust/JS language detector that uses trigram frequency tables to figure out what you're writing.

688 stars Go Other AI
whatlanggo
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does

whatlanggo takes a string and tells you the language, the script (Latin, Cyrillic, Arabic, etc.), and a confidence score. It supports 84 languages and works entirely inside Go with no external dependencies. You can also blacklist or whitelist specific languages if you already have a hunch.

The interesting bit

The detection is based on trigram frequency models — essentially counting which three-character sequences appear and comparing them against precomputed tables. The reliability check uses a hyperbola-shaped threshold based on how many unique trigrams the text contains and how far ahead the top guess is from the runner-up. (There’s even a graph.)

Key highlights

  • 84 languages supported; see the full list in SUPPORTED_LANGUAGES.md
  • Zero external dependencies, pure Go
  • Returns language, script, and confidence in one call
  • Optional blacklist/whitelist for constraining guesses
  • Derived from the Rust whatlang-rs and JavaScript franc projects

Caveats

  • Requires Go 1.8 or higher (somewhat dated; unclear if newer versions are fully tested)
  • The README notes it is “fast” but provides no benchmarks or comparative numbers
  • Travis CI badge suggests older CI setup; project activity level is unclear

Verdict

Useful if you need lightweight language detection inside a Go service and don’t want to pull in heavy ML frameworks or call external APIs. Skip it if you need deep confidence calibration or active maintenance guarantees.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.