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