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
|
# other lines are just passing through so that this script can be used in a shell pipeline
|
||||||
|
|
||||||
for line in fi.input():
|
for line in fi.input():
|
||||||
s = str.split(line.lstrip(' '), ":")
|
if line.startswith(' "text"'):
|
||||||
if s[0] == '"text"':
|
|
||||||
try:
|
try:
|
||||||
sys.stdout.write(' "lang": "' + detect(s[1]) + '"\n')
|
sys.stdout.write(' "lang": "' + detect(line[10:]) + '"\n')
|
||||||
except Exception:
|
except Exception:
|
||||||
sys.stdout.write(' "lang": "NaN"\n')
|
sys.stdout.write(' "lang": "NaN"\n')
|
||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
|
Loading…
Reference in New Issue
Block a user