#116 · Primary category: NLP Tools & Text Processing

language-detection

language language-detection n-grams natural-language-processing nlp php training

A language detection library for PHP. Detects the language from a given text string.

Project last updated:03/25/25

GitHub Stars

857

Forks

86

Contributors

14

License

MIT

Why we included this project

PHP teams that need to know what language a chunk of text is written in have a small, honest option here. The library builds N-gram profiles from its bundled training samples in 110 languages, then scores an input string against those profiles and returns a guess with a confidence value. When the default corpus falls short for specialized vocabulary, a training mode lets you feed your own text samples, which fixes cases where generic models get confused. It installs as a Composer package with a plain API, so wiring it into moderation queues, search indexing, or front-end localization is an afternoon task. One catch: it needs the mbstring extension, so check that before committing.

Articles for this project

No articles for this project yet.

To suggest a topic or contribute an article, contact us.

Related projects in this category