Datasets:
Add download_script
Browse files- .gitignore +2 -1
- download_adjudications.py +20 -0
.gitignore
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
outcomes
|
2 |
-
.env
|
|
|
|
1 |
outcomes
|
2 |
+
.env
|
3 |
+
data/annotated
|
download_adjudications.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from datasets import load_dataset
|
3 |
+
from huggingface_hub import hf_hub_download
|
4 |
+
|
5 |
+
def download_data(repo_name: str = "Persius/imr-appeals", output_dir="./data"):
|
6 |
+
"""Download adjudication data from HF hub, and save it locally in the format expected by HICRIC codebase."""
|
7 |
+
train = load_dataset(repo_name, split="train")
|
8 |
+
test = load_dataset(repo_name, split="test")
|
9 |
+
train.to_json(os.path.join(output_dir, "outcomes", "train_backgrounds_suff.jsonl"))
|
10 |
+
test.to_json(os.path.join(output_dir, "outcomes", "test_backgrounds_suff.jsonl"))
|
11 |
+
|
12 |
+
_path = hf_hub_download(repo_id="Persius/imr-appeals",
|
13 |
+
filename="case-backgrounds.jsonl",
|
14 |
+
local_dir=output_dir,
|
15 |
+
subfolder="annotated",
|
16 |
+
repo_type="dataset")
|
17 |
+
return None
|
18 |
+
|
19 |
+
if __name__ == "__main__":
|
20 |
+
download_data()
|