From b654f6d6aff1c26dfc5b51c7d2f43017964a6ee6 Mon Sep 17 00:00:00 2001
From: Kamil Kanclerz <kamil.kanclerz@e-science.pl>
Date: Sat, 16 Jan 2021 00:11:48 +0100
Subject: [PATCH] Change method of saving result to file

---
 src/speller2_worker.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/speller2_worker.py b/src/speller2_worker.py
index 6bc142e..1729723 100755
--- a/src/speller2_worker.py
+++ b/src/speller2_worker.py
@@ -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):
-- 
GitLab