test
Browse files- LongConL.py +45 -35
LongConL.py
CHANGED
|
@@ -14,45 +14,56 @@ _URLS = {
|
|
| 14 |
"test": "data/LongConL-tasks/{task_name}/test.csv",
|
| 15 |
}
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
common_features = {
|
| 19 |
-
"Citation": datasets.Value("string"),
|
| 20 |
-
"Full Case Name": datasets.Value("string"),
|
| 21 |
-
"Opinion Text": datasets.Value("string"),
|
| 22 |
-
"Text Label": datasets.Value("string"),
|
| 23 |
-
}
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
}
|
| 36 |
-
|
| 37 |
-
# List of task names with their numerical label presence
|
| 38 |
-
tasks = {
|
| 39 |
-
"ATS-Jurisdiction": False,
|
| 40 |
-
"ATS-FavorableJudgment": False,
|
| 41 |
-
"JRC-AREA1": True
|
| 42 |
-
# Add other tasks here with True/False for numerical label presence
|
| 43 |
}
|
| 44 |
|
| 45 |
-
# Generate the configs dynamically
|
| 46 |
-
_CONFIGS = {task_name: create_task_config(task_name, has_numerical_label) for task_name, has_numerical_label in tasks.items()}
|
| 47 |
|
| 48 |
class LongConLDataset(datasets.GeneratorBasedBuilder):
|
| 49 |
"""Legal opinion classification dataset for LongConL tasks"""
|
| 50 |
|
| 51 |
def _info(self):
|
| 52 |
"""Return dataset information."""
|
| 53 |
-
features =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
return datasets.DatasetInfo(
|
| 55 |
-
description=
|
| 56 |
features=features,
|
| 57 |
homepage=_HOMEPAGE,
|
| 58 |
citation=_CITATION,
|
|
@@ -97,13 +108,12 @@ class LongConLDataset(datasets.GeneratorBasedBuilder):
|
|
| 97 |
"Text Label": row["Text Label"],
|
| 98 |
}
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
| 101 |
BUILDER_CONFIGS = [
|
| 102 |
-
datasets.BuilderConfig(
|
| 103 |
-
|
| 104 |
-
version=datasets.Version("1.0.0"),
|
| 105 |
-
description=config["description"],
|
| 106 |
-
)
|
| 107 |
-
for task_name, config in _CONFIGS.items()
|
| 108 |
]
|
| 109 |
|
|
|
|
|
|
| 14 |
"test": "data/LongConL-tasks/{task_name}/test.csv",
|
| 15 |
}
|
| 16 |
|
| 17 |
+
TASK_NAMES = ["ATS-Jurisdiction", "ATS-FavorableJudgment"] # Add more task names as needed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
_CONFIGS = {
|
| 20 |
+
task_name: {
|
| 21 |
+
"description": "Jurisdiction-specific legal opinions",
|
| 22 |
+
"features": {
|
| 23 |
+
"Citation": datasets.Value("string"),
|
| 24 |
+
"Full Case Name": datasets.Value("string"),
|
| 25 |
+
"Opinion Text": datasets.Value("string"),
|
| 26 |
+
"Numerical Label": datasets.Value("string"), # Will be optional for some tasks
|
| 27 |
+
"Text Label": datasets.Value("string"),
|
| 28 |
+
},
|
| 29 |
+
},
|
| 30 |
+
"ATS-FavorableJudgment": {
|
| 31 |
+
"description": "Description for other task 1",
|
| 32 |
+
"features": {
|
| 33 |
+
"Citation": datasets.Value("string"),
|
| 34 |
+
"Full Case Name": datasets.Value("string"),
|
| 35 |
+
"Opinion Text": datasets.Value("string"),
|
| 36 |
+
"Numerical Label": datasets.Value("string", id=None),
|
| 37 |
+
"Text Label": datasets.Value("string"),
|
| 38 |
+
},
|
| 39 |
+
},
|
| 40 |
+
"ATS-FavorableJudgment": {
|
| 41 |
+
"description": "Description for other task 1",
|
| 42 |
+
"features": {
|
| 43 |
+
"Citation": datasets.Value("string"),
|
| 44 |
+
"Full Case Name": datasets.Value("string"),
|
| 45 |
+
"Opinion Text": datasets.Value("string"),
|
| 46 |
+
"Numerical Label": datasets.Value("string", id=None),
|
| 47 |
+
"Text Label": datasets.Value("string"),
|
| 48 |
+
},
|
| 49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
|
|
|
|
|
|
| 52 |
|
| 53 |
class LongConLDataset(datasets.GeneratorBasedBuilder):
|
| 54 |
"""Legal opinion classification dataset for LongConL tasks"""
|
| 55 |
|
| 56 |
def _info(self):
|
| 57 |
"""Return dataset information."""
|
| 58 |
+
features = datasets.Features({
|
| 59 |
+
"Citation": datasets.Value("string"),
|
| 60 |
+
"Full Case Name": datasets.Value("string"),
|
| 61 |
+
"Opinion Text": datasets.Value("string"),
|
| 62 |
+
"Numerical Label": datasets.Value("string"), # Will be optional for some tasks
|
| 63 |
+
"Text Label": datasets.Value("string"),
|
| 64 |
+
})
|
| 65 |
return datasets.DatasetInfo(
|
| 66 |
+
description=_DESCRIPTION,
|
| 67 |
features=features,
|
| 68 |
homepage=_HOMEPAGE,
|
| 69 |
citation=_CITATION,
|
|
|
|
| 108 |
"Text Label": row["Text Label"],
|
| 109 |
}
|
| 110 |
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
# Use a dynamic config
|
| 114 |
BUILDER_CONFIGS = [
|
| 115 |
+
datasets.BuilderConfig(name=task_name, version=datasets.Version("1.0.0"), description=task_name)
|
| 116 |
+
for task_name in ["ATS-Jurisdiction", "ATS-FavorableJudgment",] # Add your task names here
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
]
|
| 118 |
|
| 119 |
+
|