diff --git a/Project/Tools/stream_language_detector.py b/Project/Tools/stream_language_detector.py index 23666d5..08d4a2e 100755 --- a/Project/Tools/stream_language_detector.py +++ b/Project/Tools/stream_language_detector.py @@ -8,10 +8,9 @@ import sys # other lines are just passing through so that this script can be used in a shell pipeline for line in fi.input(): - s = str.split(line.lstrip(' '), ":") - if s[0] == '"text"': + if line.startswith(' "text"'): try: - sys.stdout.write(' "lang": "' + detect(s[1]) + '"\n') + sys.stdout.write(' "lang": "' + detect(line[10:]) + '"\n') except Exception: sys.stdout.write(' "lang": "NaN"\n') sys.stdout.write(line)