1. László Andrási
  2. guess_language

Overview

HTTPS SSH

guess_language – Guess the natural language of a text

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'

If text is very short and PyEnchant is available, check against installed spelling dictionaries.

>>> guess_language("Hello, World!")
'en'

Installation

You can use the setup script:

$ ./setup.py install

On Windows, you can use one of the MSI binary packages provided on the download page.

Requirements

This is basically my branch of guess-language, ported to Python 3 and optimized for my own needs.