Java port of langid.py (language identifier)