I\'m faced with a situation where I\'m reading a string of text and I need to detect the language code (en, de, fr, es, etc).
Is there a simple way to do this in py
In my case I only need to determine two languages so I just check the first character:
import unicodedata def is_greek(term): return 'GREEK' in unicodedata.name(term.strip()[0]) def is_hebrew(term): return 'HEBREW' in unicodedata.name(term.strip()[0])