Update LongConL.py
Browse files- LongConL.py +10 -10
LongConL.py
CHANGED
|
@@ -9,9 +9,9 @@ _LICENSE = ""
|
|
| 9 |
|
| 10 |
# Updated URLs to dynamically handle task names
|
| 11 |
_URLS = {
|
| 12 |
-
"train": "data/LongConL-tasks-
|
| 13 |
-
"validation": "data/LongConL-tasks-
|
| 14 |
-
"test": "data/LongConL-tasks-
|
| 15 |
}
|
| 16 |
|
| 17 |
TASK_NAMES = [
|
|
@@ -34,8 +34,8 @@ _CONFIGS = {
|
|
| 34 |
"Full Case Name": datasets.Value("string"),
|
| 35 |
"Opinion Text": datasets.Value("string"),
|
| 36 |
"Numerical Label": datasets.Value("string"), # Will be optional for some tasks
|
| 37 |
-
"Text Label": datasets.Value("string"), # Will be optional for some tasks
|
| 38 |
-
|
| 39 |
},
|
| 40 |
}
|
| 41 |
for task_name in TASK_NAMES
|
|
@@ -53,8 +53,8 @@ class LongConLDataset(datasets.GeneratorBasedBuilder):
|
|
| 53 |
"Full Case Name": datasets.Value("string"),
|
| 54 |
"Opinion Text": datasets.Value("string"),
|
| 55 |
"Numerical Label": datasets.Value("string"), # Will be optional for some tasks
|
| 56 |
-
"Text Label": datasets.Value("string"), # Will be optional for some tasks
|
| 57 |
-
|
| 58 |
})
|
| 59 |
return datasets.DatasetInfo(
|
| 60 |
description=_DESCRIPTION,
|
|
@@ -70,7 +70,7 @@ class LongConLDataset(datasets.GeneratorBasedBuilder):
|
|
| 70 |
valid_task_name = task_name.replace("-", "_") # Replace hyphens with underscores
|
| 71 |
|
| 72 |
# Update URLs with the valid task name
|
| 73 |
-
urls = {key: val.format(task_name=
|
| 74 |
downloaded_files = dl_manager.download_and_extract(urls)
|
| 75 |
|
| 76 |
return [
|
|
@@ -103,8 +103,8 @@ class LongConLDataset(datasets.GeneratorBasedBuilder):
|
|
| 103 |
"Full Case Name": row["Full Case Name"],
|
| 104 |
"Opinion Text": row["Opinion Text"],
|
| 105 |
"Numerical Label": row.get("Numerical Label", None), # Use .get() to handle missing keys
|
| 106 |
-
"Text Label": row["Text Label"],
|
| 107 |
-
|
| 108 |
}
|
| 109 |
|
| 110 |
# Use a dynamic config
|
|
|
|
| 9 |
|
| 10 |
# Updated URLs to dynamically handle task names
|
| 11 |
_URLS = {
|
| 12 |
+
"train": "data/LongConL-tasks-syllabus/{task_name}/LongConL-{task_name}_with_syllabus_filtered_date_token_train.csv",
|
| 13 |
+
"validation": "data/LongConL-tasks-syllabus/{task_name}/LongConL-{task_name}_with_syllabus_filtered_date_token_val.csv",
|
| 14 |
+
"test": "data/LongConL-tasks-syllabus/{task_name}/LongConL-{task_name}_with_syllabus_filtered_date_token_test.csv",
|
| 15 |
}
|
| 16 |
|
| 17 |
TASK_NAMES = [
|
|
|
|
| 34 |
"Full Case Name": datasets.Value("string"),
|
| 35 |
"Opinion Text": datasets.Value("string"),
|
| 36 |
"Numerical Label": datasets.Value("string"), # Will be optional for some tasks
|
| 37 |
+
#"Text Label": datasets.Value("string"), # Will be optional for some tasks
|
| 38 |
+
"Syllabus": datasets.Value("string") # Will be optional for some tasks
|
| 39 |
},
|
| 40 |
}
|
| 41 |
for task_name in TASK_NAMES
|
|
|
|
| 53 |
"Full Case Name": datasets.Value("string"),
|
| 54 |
"Opinion Text": datasets.Value("string"),
|
| 55 |
"Numerical Label": datasets.Value("string"), # Will be optional for some tasks
|
| 56 |
+
#"Text Label": datasets.Value("string"), # Will be optional for some tasks
|
| 57 |
+
"Syllabus": datasets.Value("string") # Will be optional for some tasks
|
| 58 |
})
|
| 59 |
return datasets.DatasetInfo(
|
| 60 |
description=_DESCRIPTION,
|
|
|
|
| 70 |
valid_task_name = task_name.replace("-", "_") # Replace hyphens with underscores
|
| 71 |
|
| 72 |
# Update URLs with the valid task name
|
| 73 |
+
urls = {key: val.format(task_name=task_name) for key, val in _URLS.items()}
|
| 74 |
downloaded_files = dl_manager.download_and_extract(urls)
|
| 75 |
|
| 76 |
return [
|
|
|
|
| 103 |
"Full Case Name": row["Full Case Name"],
|
| 104 |
"Opinion Text": row["Opinion Text"],
|
| 105 |
"Numerical Label": row.get("Numerical Label", None), # Use .get() to handle missing keys
|
| 106 |
+
#"Text Label": row["Text Label"],
|
| 107 |
+
"Syllabus": row["Syllabus"]
|
| 108 |
}
|
| 109 |
|
| 110 |
# Use a dynamic config
|