diff --git a/main.py b/main.py index 0d1f17b..c3690d6 100644 --- a/main.py +++ b/main.py @@ -2,7 +2,8 @@ def path_to_file_list(path: str) -> List[str]: """Reads a file and returns a list of lines in the file""" - li = open(path, 'w') + with open(path, 'r') as f: + lines = f.read().split('\n') return lines def train_file_list_to_json(english_file_list: List[str], german_file_list: List[str]) -> List[str]: @@ -17,6 +18,7 @@ def process_file(file): return file # Template for json file + # Now its all used :) template_start = '{\"German\":\"' template_mid = '\",\"German\":\"' template_end = '\"}' @@ -25,9 +27,10 @@ def process_file(file): processed_file_list = [] for english_file, german_file in zip(english_file_list, german_file_list): english_file = process_file(english_file) - english_file = process_file(german_file) + german_file = process_file(german_file) ### Change here - processed_file_list.append(template_mid + english_file + template_start + german_file + template_start) + ## change here too: + processed_file_list.append(template_start + english_file + template_mid + german_file + template_end) return processed_file_list