From 1d1acb29b32f56a7338ad18c7dacd0c81e655110 Mon Sep 17 00:00:00 2001 From: zyr Date: Mon, 7 Jun 2021 18:42:22 +0800 Subject: [PATCH] update the procedure of processing data --- process_data/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/process_data/utils.py b/process_data/utils.py index f26b57c..6183db4 100644 --- a/process_data/utils.py +++ b/process_data/utils.py @@ -9,3 +9,10 @@ def read_file(filename): with open(filename, "r", encoding="utf-8") as fin: return fin.readlines() + +def write_file(sents, filename): + print("Writing data to {}...".format(filename)) + with open(filename, "w", encoding="utf-8") as fout: + for sent in sents: + fout.write(sent) +