Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,19 +194,17 @@ def create_dictionary(word_list, word_dict = {}):
|
|
| 194 |
word_dict[key].append(word)
|
| 195 |
return word_dict
|
| 196 |
|
| 197 |
-
def merge_lines(
|
| 198 |
-
|
| 199 |
merged_lines = []
|
| 200 |
|
| 201 |
-
with open(
|
| 202 |
-
open(
|
| 203 |
-
open("merged_lines.txt", "w") as f_out:
|
| 204 |
for lines in zip(f1, f2, f3, f4):
|
| 205 |
merged_line = "".join(line.strip() for line in lines)
|
| 206 |
-
f_out.write(merged_line + "\n")
|
| 207 |
merged_lines.append(merged_line)
|
| 208 |
|
| 209 |
-
return merged_lines
|
| 210 |
|
| 211 |
def TTSforListeningPractice(text):
|
| 212 |
return "not finished"
|
|
|
|
| 194 |
word_dict[key].append(word)
|
| 195 |
return word_dict
|
| 196 |
|
| 197 |
+
def merge_lines(roman_file, w4w_file, full_mean_file, macaronic_file):
|
| 198 |
+
files = [roman_file, w4w_file, full_mean_file, macaronic_file]
|
| 199 |
merged_lines = []
|
| 200 |
|
| 201 |
+
with open(roman_file.name, "r") as f1, open(w4w_file.name, "r") as f2, \
|
| 202 |
+
open(full_mean_file.name, "r") as f3, open(macaronic_file.name, "r") as f4:
|
|
|
|
| 203 |
for lines in zip(f1, f2, f3, f4):
|
| 204 |
merged_line = "".join(line.strip() for line in lines)
|
|
|
|
| 205 |
merged_lines.append(merged_line)
|
| 206 |
|
| 207 |
+
return "\n".join(merged_lines)
|
| 208 |
|
| 209 |
def TTSforListeningPractice(text):
|
| 210 |
return "not finished"
|