diff options
-rwxr-xr-x | langid-polyglot | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/langid-polyglot b/langid-polyglot new file mode 100755 index 0000000..0b0b20c --- /dev/null +++ b/langid-polyglot @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import polyglot +from polyglot.detect import Detector +import fileinput + +for line in fileinput.input(): + try: + for lang in Detector(line).languages: + if lang.confidence > 80.0: + print(lang.confidence) + else: + print("??") + break + except polyglot.detect.base.UnknownLanguage: + print("??") + pass + |