Jonathan Li
commited on
Commit
·
7eb3a8d
1
Parent(s):
265465b
Split data
Browse files- dev.jsonl → data/dev.jsonl +0 -0
- test.jsonl → data/test.jsonl +0 -0
- train.jsonl → data/train.jsonl +0 -0
- data_anon/dev.jsonl +3 -0
- data_anon/test.jsonl +3 -0
- data_anon/train.jsonl +3 -0
- echr.py +70 -0
- process.ipynb +4 -4
dev.jsonl → data/dev.jsonl
RENAMED
File without changes
|
test.jsonl → data/test.jsonl
RENAMED
File without changes
|
train.jsonl → data/train.jsonl
RENAMED
File without changes
|
data_anon/dev.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e860b89584bd88e27da41139204a05a96f6d64aa06331051d420c307d2822fcc
|
3 |
+
size 20379694
|
data_anon/test.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de6ec0c0cc97bb2c15e0fd3d09537807f95046068ea497ec31e7ecd126f43947
|
3 |
+
size 33869151
|
data_anon/train.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:209755f6dfee89849455b89918babee0e33618c40e65a99e9a8cbd6164394dbd
|
3 |
+
size 98259925
|
echr.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import datasets
|
2 |
+
|
3 |
+
_CITATION = """\
|
4 |
+
@inproceedings{chalkidis-etal-2019-neural,
|
5 |
+
title = "Neural Legal Judgment Prediction in {E}nglish",
|
6 |
+
author = "Chalkidis, Ilias and
|
7 |
+
Androutsopoulos, Ion and
|
8 |
+
Aletras, Nikolaos",
|
9 |
+
booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
|
10 |
+
month = jul,
|
11 |
+
year = "2019",
|
12 |
+
address = "Florence, Italy",
|
13 |
+
publisher = "Association for Computational Linguistics",
|
14 |
+
url = "https://aclanthology.org/P19-1424",
|
15 |
+
doi = "10.18653/v1/P19-1424",
|
16 |
+
pages = "4317--4323",
|
17 |
+
}
|
18 |
+
"""
|
19 |
+
|
20 |
+
_HOMEPAGE = "https://archive.org/details/ECHR-ACL2019"
|
21 |
+
|
22 |
+
ARTICLES = {
|
23 |
+
"2": "Right to life",
|
24 |
+
"3": "Prohibition of torture",
|
25 |
+
"4": "Prohibition of slavery and forced labour",
|
26 |
+
"5": "Right to liberty and security",
|
27 |
+
"6": "Right to a fair trial",
|
28 |
+
"7": "No punishment without law",
|
29 |
+
"8": "Right to respect for private and family life",
|
30 |
+
"9": "Freedom of thought, conscience and religion",
|
31 |
+
"10": "Freedom of expression",
|
32 |
+
"11": "Freedom of assembly and association",
|
33 |
+
"12": "Right to marry",
|
34 |
+
"13": "Right to an effective remedy",
|
35 |
+
"14": "Prohibition of discrimination",
|
36 |
+
"15": "Derogation in time of emergency",
|
37 |
+
"16": "Restrictions on political activity of aliens",
|
38 |
+
"17": "Prohibition of abuse of rights",
|
39 |
+
"18": "Limitation on use of restrictions on rights",
|
40 |
+
"34": "Individual applications",
|
41 |
+
"38": "Examination of the case",
|
42 |
+
"39": "Friendly settlements",
|
43 |
+
"46": "Binding force and execution of judgments",
|
44 |
+
"P1-1": "Protection of property",
|
45 |
+
"P1-2": "Right to education",
|
46 |
+
"P1-3": "Right to free elections",
|
47 |
+
"P3-1": "Right to free elections",
|
48 |
+
"P4-1": "Prohibition of imprisonment for debt",
|
49 |
+
"P4-2": "Freedom of movement",
|
50 |
+
"P4-3": "Prohibition of expulsion of nationals",
|
51 |
+
"P4-4": "Prohibition of collective expulsion of aliens",
|
52 |
+
"P6-1": "Abolition of the death penalty",
|
53 |
+
"P6-2": "Death penalty in time of war",
|
54 |
+
"P6-3": "Prohibition of derogations",
|
55 |
+
"P7-1": "Procedural safeguards relating to expulsion of aliens",
|
56 |
+
"P7-2": "Right of appeal in criminal matters",
|
57 |
+
"P7-3": "Compensation for wrongful conviction",
|
58 |
+
"P7-4": "Right not to be tried or punished twice",
|
59 |
+
"P7-5": "Equality between spouses",
|
60 |
+
"P12-1": "General prohibition of discrimination",
|
61 |
+
"P13-1": "Abolition of the death penalty",
|
62 |
+
"P13-2": "Prohibition of derogations",
|
63 |
+
"P13-3": "Prohibition of reservations",
|
64 |
+
}
|
65 |
+
|
66 |
+
class Echr(datasets.GeneratorBasedBuilder):
|
67 |
+
BUILDER_CONFIGS = [
|
68 |
+
datasets.BuilderConfig(name="non-anon", data_dir="data"),
|
69 |
+
datasets.BuilderConfig(name="anon", data_dir="data_anon"),
|
70 |
+
]
|
process.ipynb
CHANGED
@@ -72,9 +72,9 @@
|
|
72 |
"metadata": {},
|
73 |
"outputs": [],
|
74 |
"source": [
|
75 |
-
"train = pd.read_json(\"train.jsonl\", lines=True, orient=\"records\")\n",
|
76 |
-
"test = pd.read_json(\"test.jsonl\", lines=True, orient=\"records\")\n",
|
77 |
-
"dev = pd.read_json(\"dev.jsonl\", lines=True, orient=\"records\")"
|
78 |
]
|
79 |
},
|
80 |
{
|
@@ -85,7 +85,7 @@
|
|
85 |
"source": [
|
86 |
"import re\n",
|
87 |
"\n",
|
88 |
-
"number = re.compile(\"^[0-9]
|
89 |
"train[\"text\"] = train[\"text\"].map(lambda r: [re.sub(number, \"\", line) for line in r])\n",
|
90 |
"test[\"text\"] = test[\"text\"].map(lambda r: [re.sub(number, \"\", line) for line in r])\n",
|
91 |
"dev[\"text\"] = dev[\"text\"].map(lambda r: [re.sub(number, \"\", line) for line in r])"
|
|
|
72 |
"metadata": {},
|
73 |
"outputs": [],
|
74 |
"source": [
|
75 |
+
"train = pd.read_json(\"data_anon/train.jsonl\", lines=True, orient=\"records\")\n",
|
76 |
+
"test = pd.read_json(\"data_anon/test.jsonl\", lines=True, orient=\"records\")\n",
|
77 |
+
"dev = pd.read_json(\"data_anon/dev.jsonl\", lines=True, orient=\"records\")"
|
78 |
]
|
79 |
},
|
80 |
{
|
|
|
85 |
"source": [
|
86 |
"import re\n",
|
87 |
"\n",
|
88 |
+
"number = re.compile(\"^([0-9]+|CARDINAL)\\s?\\. \")\n",
|
89 |
"train[\"text\"] = train[\"text\"].map(lambda r: [re.sub(number, \"\", line) for line in r])\n",
|
90 |
"test[\"text\"] = test[\"text\"].map(lambda r: [re.sub(number, \"\", line) for line in r])\n",
|
91 |
"dev[\"text\"] = dev[\"text\"].map(lambda r: [re.sub(number, \"\", line) for line in r])"
|