Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
Portuguese
Size:
1K - 10K
License:
Andre Barbosa commited on
Commit ·
13c340f
1
Parent(s): cc1b79b
update sourceB link and improve listdir
Browse files- aes_enem_dataset.py +7 -5
aes_enem_dataset.py
CHANGED
|
@@ -15,6 +15,7 @@
|
|
| 15 |
import csv
|
| 16 |
import math
|
| 17 |
import os
|
|
|
|
| 18 |
import re
|
| 19 |
|
| 20 |
import datasets
|
|
@@ -76,7 +77,7 @@ _LICENSE = ""
|
|
| 76 |
_URLS = {
|
| 77 |
"sourceAOnly": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/sourceAWithGraders.tar.gz",
|
| 78 |
"sourceAWithGraders": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/sourceAWithGraders.tar.gz",
|
| 79 |
-
"sourceB": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/
|
| 80 |
"PROPOR2024": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/propor2024.tar.gz",
|
| 81 |
"gradesThousand": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/scrapedGradesThousand.tar.gz"
|
| 82 |
}
|
|
@@ -869,13 +870,14 @@ class HTMLParser:
|
|
| 869 |
elif config_name == "sourceB":
|
| 870 |
self.sourceB = f"{filepath}/sourceB/sourceB.csv"
|
| 871 |
file = self.sourceA if self.sourceA else self.sourceB
|
| 872 |
-
|
| 873 |
-
|
| 874 |
-
|
|
|
|
| 875 |
writer = csv.writer(final_file)
|
| 876 |
writer.writerow(CSV_HEADER)
|
| 877 |
sub_folders = [
|
| 878 |
-
name for name in sorted_files if
|
| 879 |
]
|
| 880 |
essay_id = 0
|
| 881 |
essay_title = None
|
|
|
|
| 15 |
import csv
|
| 16 |
import math
|
| 17 |
import os
|
| 18 |
+
from pathlib import Path
|
| 19 |
import re
|
| 20 |
|
| 21 |
import datasets
|
|
|
|
| 77 |
_URLS = {
|
| 78 |
"sourceAOnly": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/sourceAWithGraders.tar.gz",
|
| 79 |
"sourceAWithGraders": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/sourceAWithGraders.tar.gz",
|
| 80 |
+
"sourceB": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/sourceB.tar.gz",
|
| 81 |
"PROPOR2024": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/propor2024.tar.gz",
|
| 82 |
"gradesThousand": "https://huggingface.co/datasets/kamel-usp/aes_enem_dataset/resolve/main/scrapedGradesThousand.tar.gz"
|
| 83 |
}
|
|
|
|
| 870 |
elif config_name == "sourceB":
|
| 871 |
self.sourceB = f"{filepath}/sourceB/sourceB.csv"
|
| 872 |
file = self.sourceA if self.sourceA else self.sourceB
|
| 873 |
+
file_path = Path(file)
|
| 874 |
+
file_dir = file_path.parent
|
| 875 |
+
sorted_files = sorted(file_dir.iterdir())
|
| 876 |
+
with open(file_path, "w", newline="", encoding="utf8") as final_file:
|
| 877 |
writer = csv.writer(final_file)
|
| 878 |
writer.writerow(CSV_HEADER)
|
| 879 |
sub_folders = [
|
| 880 |
+
name for name in sorted_files if name.suffix != ".csv"
|
| 881 |
]
|
| 882 |
essay_id = 0
|
| 883 |
essay_title = None
|