Guess the natural language of a text
Project description
Example usage
>>> from guess_language import guess_language, UNKNOWN >>> guess_language("I’ve been feeling déjà vu all morning.") 'en' >>> guess_language("Tienes que seguir tu corazón.") 'es' >>> guess_language("いいえ!忍者がいます") 'ja'
Can’t guess if the text is too short.
>>> guess_language("Bonjour !") is UNKNOWN True
Installation
You can use pip to install or uninstall:
$ pip install guess_language-spirit
On Windows, you can use one of the MSI binary packages provided on the download page.
Requirements
Python 3.2+ (or 2.7, using lib3to2)
This is basically my branch of guess-language, ported to Python 3 and optimized for my own needs. Speed has been much improved.