Skip to content
Snippets Groups Projects
Commit b654f6d6 authored by Kamil Kanclerz's avatar Kamil Kanclerz
Browse files

Change method of saving result to file

parent 5f20e113
Branches
Tags
No related merge requests found
Pipeline #2298 failed with stages
in 30 seconds
......@@ -26,11 +26,15 @@ class Speller2Worker(nlp_ws.NLPWorker):
model = self._model
data = self._read_file(input_file)
print(data.split('\n'))
corrected_data = [model(line) for line in data.split('\n')]
corrected_data = model(data)
with open(output_file, 'w', encoding='utf-8') as f:
f.write('\n'.join(corrected_data))
with io.open(output_file, 'w', encoding='utf-8') as f:
json.dump(corrected_data, f, ensure_ascii=False)
#with io.open(output_file, 'w', encoding='utf-8') as f:
#json.dump(corrected_data, f, ensure_ascii=False)
#for line in corrected_data:
@classmethod
def _read_file(cls, input_path):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment