Babylon is the simplest, easiest-to-use language detector.
$ composer require programarivm/babylon
LanguageDetector to detect a text's language.
use Babylon\LanguageDetector; $text = 'You will have your data soon, I remarked, pointing with my finger; this is the Brixton Road, and that is the house, if I am not very much mistaken.'; $isoCode = (new LanguageDetector($text))->detect();
Note: The text needs to be a few words length in order for the language to be detected correctly; otherwise false positives may take place.
Please read the Documentation to find out which languages can be detected so far, and also to learn how to add new ones easily.
The MIT License.
Would you help make this library better? Contributions are welcome.
- Feel free to send a pull request
- Drop an email at email@example.com with the subject "Babylon Contributions"
- Leave me a comment on Twitter
- Say hello on Google+