changed language detector streamer
This commit is contained in:
parent
c9e182b5fa
commit
7e1af5ac2c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user