Update io_utils.py
Browse files- io_utils.py +4 -6
io_utils.py
CHANGED
@@ -5,11 +5,9 @@ def save_remaining_text_to_txt(text, output_folder, page_num):
|
|
5 |
txt_filename = os.path.join(output_folder, f'page_{page_num + 1}_remaining_text.txt')
|
6 |
with open(txt_filename, "w", encoding="utf-8") as f:
|
7 |
f.write(text)
|
8 |
-
return txt_filename #
|
9 |
|
10 |
-
def save_to_csv(data,
|
11 |
-
os.makedirs(output_folder, exist_ok=True) # Ensure output folder exists
|
12 |
-
csv_file_path = os.path.join(output_folder, csv_filename)
|
13 |
df = pd.DataFrame(data)
|
14 |
-
df.to_csv(
|
15 |
-
return
|
|
|
5 |
txt_filename = os.path.join(output_folder, f'page_{page_num + 1}_remaining_text.txt')
|
6 |
with open(txt_filename, "w", encoding="utf-8") as f:
|
7 |
f.write(text)
|
8 |
+
return txt_filename # Trả về đường dẫn file .txt
|
9 |
|
10 |
+
def save_to_csv(data, csv_filename):
|
|
|
|
|
11 |
df = pd.DataFrame(data)
|
12 |
+
df.to_csv(csv_filename, index=False)
|
13 |
+
return csv_filename # Trả về đường dẫn file CSV
|