Datasets:

Languages:
English
ArXiv:
License:
system HF staff commited on
Commit
6dfa57d
0 Parent(s):

Update files from the datasets library (from 1.6.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.6.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ - found
5
+ language_creators:
6
+ - found
7
+ languages:
8
+ - en
9
+ licenses:
10
+ - cc-by-nc-sa-4-0
11
+ multilinguality:
12
+ - monolingual
13
+ size_categories:
14
+ - 10K<n<100K
15
+ source_datasets:
16
+ - original
17
+ task_categories:
18
+ - text-classification
19
+ task_ids:
20
+ - multi-label-classification
21
+ - text-classification-other-rationale-extraction
22
+ - text-classification-other-legal-judgment-prediction
23
+ ---
24
+
25
+ # Dataset Card for the ECtHR cases dataset
26
+
27
+ ## Table of Contents
28
+ - [Dataset Card the ECtHR cases dataset](#dataset-card-for-ecthr-cases)
29
+ - [Table of Contents](#table-of-contents)
30
+ - [Dataset Description](#dataset-description)
31
+ - [Dataset Summary](#dataset-summary)
32
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
33
+ - [Languages](#languages)
34
+ - [Dataset Structure](#dataset-structure)
35
+ - [Data Instances](#data-instances)
36
+ - [Data Fields](#data-fields)
37
+ - [Data Splits](#data-splits)
38
+ - [Dataset Creation](#dataset-creation)
39
+ - [Curation Rationale](#curation-rationale)
40
+ - [Source Data](#source-data)
41
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
42
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
43
+ - [Annotations](#annotations)
44
+ - [Annotation process](#annotation-process)
45
+ - [Who are the annotators?](#who-are-the-annotators)
46
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
47
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
48
+ - [Social Impact of Dataset](#social-impact-of-dataset)
49
+ - [Discussion of Biases](#discussion-of-biases)
50
+ - [Other Known Limitations](#other-known-limitations)
51
+ - [Additional Information](#additional-information)
52
+ - [Dataset Curators](#dataset-curators)
53
+ - [Licensing Information](#licensing-information)
54
+ - [Citation Information](#citation-information)
55
+ - [Contributions](#contributions)
56
+
57
+ ## Dataset Description
58
+
59
+ - **Homepage:** http://archive.org/details/ECtHR-NAACL2021/
60
+ - **Repository:** http://archive.org/details/ECtHR-NAACL2021/
61
+ - **Paper:** https://arxiv.org/abs/2103.13084
62
+ - **Leaderboard:** TBA
63
+ - **Point of Contact:** [Ilias Chalkidis](mailto:[email protected])
64
+
65
+ ### Dataset Summary
66
+
67
+ The European Court of Human Rights (ECtHR) hears allegations regarding breaches in human rights provisions of the European Convention of Human Rights (ECHR) by European states. The Convention is available at https://www.echr.coe.int/Documents/Convention_ENG.pdf.
68
+ The court rules on a subset of all ECHR articles, which are predefined (alleged) by the applicants (*plaintiffs*).
69
+
70
+ Our dataset comprises 11k ECtHR cases and can be viewed as an enriched version of the ECtHR dataset of Chalkidis et al. (2019), which did not provide ground truth for alleged article violations (articles discussed) and rationales. The new dataset includes the following:
71
+
72
+ **Facts:** Each judgment includes a list of paragraphs that represent the facts of the case, i.e., they describe the main events that are relevant to the case, in numbered paragraphs. We hereafter call these paragraphs *facts* for simplicity. Note that the facts are presented in chronological order. Not all facts have the same impact or hold crucial information with respect to alleged article violations and the court's assessment; i.e., facts may refer to information that is trivial or otherwise irrelevant to the legally crucial allegations against *defendant* states.
73
+
74
+ **Allegedly violated articles:** Judges rule on specific accusations (allegations) made by the applicants (Harris, 2018). In ECtHR cases, the judges discuss and rule on the violation, or not, of specific articles of the Convention. The articles to be discussed (and ruled on) are put forward (as alleged article violations) by the applicants and are included in the dataset as ground truth; we identify 40 violable articles in total. The rest of the articles are procedural, i.e., the number of judges, criteria for office, election of judges, etc. In our experiments, however, the models are not aware of the allegations. They predict the Convention articles that will be discussed (the allegations) based on the case's facts, and they also produce rationales for their predictions. Models of this kind could be used by potential applicants to help them formulate future allegations (articles they could claim to have been violated), as already noted, but here we mainly use the task as a test-bed for rationale extraction.
75
+
76
+ **Violated articles:** The court decides which allegedly violated articles have indeed been violated. These decisions are also included in our dataset and could be used for full legal judgment prediction experiments (Chalkidis et al., 2019). However, they are not used in the experiments of this work.
77
+
78
+ **Silver allegation rationales:** Each decision of the ECtHR includes references to facts of the case (e.g., *"See paragraphs 2 and 4."*) and case law (e.g., *"See Draci vs. Russia (2010)"*.). We identified references to each case's facts and retrieved the corresponding paragraphs using regular expressions. These are included in the dataset as silver allegation rationales, on the grounds that the judges refer to these paragraphs when ruling on the allegations.
79
+
80
+ **Gold allegation rationales:** A legal expert with experience in ECtHR cases annotated a subset of 50 test cases to identify the relevant facts (paragraphs) of the case that support the allegations (alleged article violations). In other words, each identified fact justifies (hints) one or more alleged violations.
81
+
82
+ ### Supported Tasks and Leaderboards
83
+
84
+ The dataset supports:
85
+
86
+ **Alleged violation prediction** (`alleged-violation-prediction`): A multi-label text classification task where, given the facts of a ECtHR case, a model predicts which of the 40 violable ECHR articles were allegedly violated according to the applicant(s). Consult Chalkidis et al. (2021), for details.
87
+
88
+ **Violation prediction** (`violation-prediction`): A multi-label text classification task where, given the facts of a ECtHR case, a model predicts which of the allegedly violated ECHR articles were violated, as decided (ruled) by the ECtHR court. Consult Chalkidis et al. (2019), for details.
89
+
90
+ **Rationale extraction:** A model can also predict the facts of the case that most prominently support its decision with respect to a classification task. Silver rationales can be used for both classification tasks, while gold rationales are only focused on the *alleged violation prediction* task.
91
+
92
+ ### Languages
93
+
94
+ All documents are written in English.
95
+
96
+ ## Dataset Structure
97
+
98
+ ### Data Instances
99
+
100
+ This example was too long and was cropped:
101
+
102
+ ```json
103
+ {
104
+ "facts": [
105
+ "8. In 1991 Mr Dusan Slobodnik, a research worker in the field of literature, ...",
106
+ "9. On 20 July 1992 the newspaper Telegraf published a poem by the applicant.",
107
+ "10. The poem was later published in another newspaper.",
108
+ "...",
109
+ "39. The City Court further dismissed the claim in respect of non-pecuniary damage ... ",
110
+ "40. The City Court ordered the plaintiff to pay SKK 56,780 to the applicant ...",
111
+ "41. On 25 November 1998 the Supreme Court upheld the decision of the Bratislava City Court ..."
112
+ ],
113
+ "labels": ["14", "10", "9", "36"],
114
+ "silver_rationales": [27],
115
+ "gold_rationales": []
116
+ }
117
+ ```
118
+
119
+ ### Data Fields
120
+
121
+ `facts`: (**List[str]**) The paragraphs (facts) of the case.\
122
+ `labels`: (**List[str]**) The ECHR articles under discussion (*Allegedly violated articles*); or the allegedly violated ECHR articles that found to be violated by the court (judges).\
123
+ `silver_rationales`: (**List[int]**) Indices of the paragraphs (facts) that are present in the court's assessment.\
124
+ `gold_rationales`: (**List[int]**) Indices of the paragraphs (facts) that support alleged violations, according to a legal expert.
125
+
126
+ ### Data Splits
127
+
128
+ | Split | No of ECtHR cases | Silver rationales ratio | Avg. allegations / case |
129
+ | ------------------- | ------------------------------------ | --- | --- |
130
+ | Train | 9,000 | 24% | 1.8 |
131
+ |Development | 1,000 | 30% | 1.7 |
132
+ |Test | 1,000 | 31% | 1.7 |
133
+
134
+ ## Dataset Creation
135
+
136
+ ### Curation Rationale
137
+
138
+ The dataset was curated by Chalkidis et al. (2021).\
139
+ The annotations for the gold rationales are available thanks to Dimitris Tsarapatsanis (Lecturer, York Law School).
140
+
141
+ ### Source Data
142
+
143
+ #### Initial Data Collection and Normalization
144
+
145
+ The original data are available at HUDOC database (https://hudoc.echr.coe.int/eng) in an unprocessed format. The data were downloaded and all information was extracted from the HTML files and several JSON metadata files.
146
+
147
+ #### Who are the source language producers?
148
+
149
+ [More Information Needed]
150
+
151
+ ### Annotations
152
+
153
+ #### Annotation process
154
+
155
+ * The original documents are available in HTML format at HUDOC database (https://hudoc.echr.coe.int/eng), except the gold rationales. The metadata are provided by additional JSON files, produced by REST services.
156
+ * The annotations for the gold rationales are available thanks to Dimitris Tsarapatsanis (Lecturer, York Law School).
157
+
158
+
159
+ #### Who are the annotators?
160
+
161
+ Dimitris Tsarapatsanis (Lecturer, York Law School).
162
+
163
+ ### Personal and Sensitive Information
164
+
165
+ Privacy statement / Protection of personal data from HUDOC (https://www.echr.coe.int/Pages/home.aspx?p=privacy)
166
+
167
+ ```
168
+ The Court complies with the Council of Europe's policy on protection of personal data, in so far as this is consistent with exercising its functions under the European Convention on Human Rights.
169
+
170
+ The Council of Europe is committed to respect for private life. Its policy on protection of personal data is founded on the Secretary General’s Regulation of 17 April 1989 outlining a data protection system for personal data files in the Council of Europe.
171
+
172
+ Most pages of the Council of Europe site require no personal information except in certain cases to allow requests for on-line services to be met. In such cases, the information is processed in accordance with the Confidentiality policy described below.
173
+ ```
174
+
175
+ ## Considerations for Using the Data
176
+
177
+ ### Social Impact of the Dataset
178
+
179
+ The publication of this dataset complies with the ECtHR data policy (https://www.echr.coe.int/Pages/home.aspx?p=privacy).
180
+
181
+ By no means do we aim to build a 'robot' lawyer or judge, and we acknowledge the possible harmful impact (Angwin et al., 2016, Dressel et al., 2018) of irresponsible deployment.
182
+ Instead, we aim to support fair and explainable AI-assisted judicial decision making and empirical legal studies.
183
+
184
+ For example, automated services can help applicants (plaintiffs) identify alleged violations that are supported by the facts of a case. They can help judges identify more quickly facts that support the alleged violations, contributing towards more informed judicial decision making (Zhong et al., 2020). They can also help legal experts identify previous cases related to particular allegations, helping analyze case law (Katz et al., 2012).
185
+
186
+ Also, consider ongoing critical research on responsible AI (Elish et al., 2021) that aims to provide explainable and fair systems to support human experts.
187
+
188
+ ### Discussion of Biases
189
+
190
+ Consider the work of Chalkidis et al. (2019) for the identification of demographic bias by models.
191
+
192
+ ### Other Known Limitations
193
+
194
+ N/A
195
+
196
+ ## Additional Information
197
+
198
+ ### Dataset Curators
199
+
200
+ Ilias Chalkidis and Dimitris Tsarapatsanis
201
+
202
+ ### Licensing Information
203
+
204
+ **CC BY-NC-SA (Creative Commons / Attribution-NonCommercial-ShareAlike)**
205
+
206
+ Read more: https://creativecommons.org/licenses/by-nc-sa/4.0/.
207
+
208
+ ### Citation Information
209
+
210
+ *Ilias Chalkidis, Manos Fergadiotis, Dimitrios Tsarapatsanis, Nikolaos Aletras, Ion Androutsopoulos and Prodromos Malakasiotis. Paragraph-level Rationale Extraction through Regularization: A case study on European Court of Human Rights Cases.*
211
+ *Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics (NAACL 2021). Mexico City, Mexico. 2021.*
212
+
213
+ ```
214
+ @InProceedings{chalkidis-et-al-2021-ecthr,
215
+ title = "Paragraph-level Rationale Extraction through Regularization: A case study on European Court of Human Rights Cases",
216
+ author = "Chalkidis, Ilias and Fergadiotis, Manos and Tsarapatsanis, Dimitrios and Aletras, Nikolaos and Androutsopoulos, Ion and Malakasiotis, Prodromos",
217
+ booktitle = "Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics",
218
+ year = "2021",
219
+ address = "Mexico City, Mexico",
220
+ publisher = "Association for Computational Linguistics"
221
+ }
222
+ ```
223
+
224
+ *Ilias Chalkidis, Ion Androutsopoulos and Nikolaos Aletras. Neural Legal Judgment Prediction in English.*
225
+ *Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (ACL 2019). Florence, Italy. 2019.*
226
+
227
+ ```
228
+ @InProceedings{chalkidis-etal-2019-neural,
229
+ title = "Neural Legal Judgment Prediction in {E}nglish",
230
+ author = "Chalkidis, Ilias and Androutsopoulos, Ion and Aletras, Nikolaos",
231
+ booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
232
+ year = "2019",
233
+ address = "Florence, Italy",
234
+ publisher = "Association for Computational Linguistics",
235
+ url = "https://www.aclweb.org/anthology/P19-1424",
236
+ doi = "10.18653/v1/P19-1424",
237
+ pages = "4317--4323"
238
+ }
239
+ ```
240
+
241
+ ### Contributions
242
+
243
+ Thanks to [@iliaschalkidis](https://github.com/iliaschalkidis) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"alleged-violation-prediction": {"description": "The ECtHR Cases dataset is designed for experimentation of neural judgment prediction and rationale extraction considering ECtHR cases.\n", "citation": "@InProceedings{chalkidis-et-al-2021-ecthr,\n title = \"Paragraph-level Rationale Extraction through Regularization: A case study on European Court of Human Rights Cases\",\n author = \"Chalkidis, Ilias and Fergadiotis, Manos and Tsarapatsanis, Dimitrios and Aletras, Nikolaos and Androutsopoulos, Ion and Malakasiotis, Prodromos\",\n booktitle = \"Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics\",\n year = \"2021\",\n address = \"Mexico City, Mexico\",\n publisher = \"Association for Computational Linguistics\"\n}\n", "homepage": "http://archive.org/details/ECtHR-NAACL2021/", "license": "CC BY-NC-SA (Creative Commons / Attribution-NonCommercial-ShareAlike)", "features": {"facts": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "labels": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "silver_rationales": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "gold_rationales": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": {"input": "facts", "output": "label"}, "builder_name": "ecthr_cases", "config_name": "alleged-violation-prediction", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 89835266, "num_examples": 9000, "dataset_name": "ecthr_cases"}, "test": {"name": "test", "num_bytes": 11917598, "num_examples": 1000, "dataset_name": "ecthr_cases"}, "validation": {"name": "validation", "num_bytes": 11015998, "num_examples": 1000, "dataset_name": "ecthr_cases"}}, "download_checksums": {"http://archive.org/download/ECtHR-NAACL2021/dataset.zip": {"num_bytes": 32815448, "checksum": "f3b6d100d209fe8790f328cc7f2ea548bf7552953a50cf696bcfe02097894617"}}, "download_size": 32815448, "post_processing_size": null, "dataset_size": 112768862, "size_in_bytes": 145584310}, "violation-prediction": {"description": "The ECtHR Cases dataset is designed for experimentation of neural judgment prediction and rationale extraction considering ECtHR cases.\n", "citation": "@InProceedings{chalkidis-et-al-2021-ecthr,\n title = \"Paragraph-level Rationale Extraction through Regularization: A case study on European Court of Human Rights Cases\",\n author = \"Chalkidis, Ilias and Fergadiotis, Manos and Tsarapatsanis, Dimitrios and Aletras, Nikolaos and Androutsopoulos, Ion and Malakasiotis, Prodromos\",\n booktitle = \"Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics\",\n year = \"2021\",\n address = \"Mexico City, Mexico\",\n publisher = \"Association for Computational Linguistics\"\n}\n", "homepage": "http://archive.org/details/ECtHR-NAACL2021/", "license": "CC BY-NC-SA (Creative Commons / Attribution-NonCommercial-ShareAlike)", "features": {"facts": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "labels": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "silver_rationales": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": {"input": "facts", "output": "label"}, "builder_name": "ecthr_cases", "config_name": "violation-prediction", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 89776410, "num_examples": 9000, "dataset_name": "ecthr_cases"}, "test": {"name": "test", "num_bytes": 11909314, "num_examples": 1000, "dataset_name": "ecthr_cases"}, "validation": {"name": "validation", "num_bytes": 11009350, "num_examples": 1000, "dataset_name": "ecthr_cases"}}, "download_checksums": {"http://archive.org/download/ECtHR-NAACL2021/dataset.zip": {"num_bytes": 32815448, "checksum": "f3b6d100d209fe8790f328cc7f2ea548bf7552953a50cf696bcfe02097894617"}}, "download_size": 32815448, "post_processing_size": null, "dataset_size": 112695074, "size_in_bytes": 145510522}}
dummy/alleged-violation-prediction/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33502c131d1ac719845f7a9b002e67227c0c501b73a01695486177d58b95fa6a
3
+ size 35424
dummy/violation-prediction/1.1.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc7952de12670945ba0426bd167b67b00a8d9dffff06557d5d830fb6c7809972
3
+ size 35424
ecthr_cases.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ """The ECtHR Cases dataset is designed for experimentation of neural judgment prediction and rationale extraction considering ECtHR cases."""
16
+
17
+
18
+ import json
19
+ import os
20
+
21
+ import datasets
22
+
23
+
24
+ _CITATION = """\
25
+ @InProceedings{chalkidis-et-al-2021-ecthr,
26
+ title = "Paragraph-level Rationale Extraction through Regularization: A case study on European Court of Human Rights Cases",
27
+ author = "Chalkidis, Ilias and Fergadiotis, Manos and Tsarapatsanis, Dimitrios and Aletras, Nikolaos and Androutsopoulos, Ion and Malakasiotis, Prodromos",
28
+ booktitle = "Proceedings of the Annual Conference of the North American Chapter of the Association for Computational Linguistics",
29
+ year = "2021",
30
+ address = "Mexico City, Mexico",
31
+ publisher = "Association for Computational Linguistics"
32
+ }
33
+ """
34
+
35
+ _DESCRIPTION = """\
36
+ The ECtHR Cases dataset is designed for experimentation of neural judgment prediction and rationale extraction considering ECtHR cases.
37
+ """
38
+
39
+ _HOMEPAGE = "http://archive.org/details/ECtHR-NAACL2021/"
40
+
41
+ _LICENSE = "CC BY-NC-SA (Creative Commons / Attribution-NonCommercial-ShareAlike)"
42
+
43
+ _URLs = {
44
+ "alleged-violation-prediction": "http://archive.org/download/ECtHR-NAACL2021/dataset.zip",
45
+ "violation-prediction": "http://archive.org/download/ECtHR-NAACL2021/dataset.zip",
46
+ }
47
+
48
+ ARTICLES = {
49
+ "2": "Right to life",
50
+ "3": "Prohibition of torture",
51
+ "4": "Prohibition of slavery and forced labour",
52
+ "5": "Right to liberty and security",
53
+ "6": "Right to a fair trial",
54
+ "7": "No punishment without law",
55
+ "8": "Right to respect for private and family life",
56
+ "9": "Freedom of thought, conscience and religion",
57
+ "10": "Freedom of expression",
58
+ "11": "Freedom of assembly and association",
59
+ "12": "Right to marry",
60
+ "13": "Right to an effective remedy",
61
+ "14": "Prohibition of discrimination",
62
+ "15": "Derogation in time of emergency",
63
+ "16": "Restrictions on political activity of aliens",
64
+ "17": "Prohibition of abuse of rights",
65
+ "18": "Limitation on use of restrictions on rights",
66
+ "34": "Individual applications",
67
+ "38": "Examination of the case",
68
+ "39": "Friendly settlements",
69
+ "46": "Binding force and execution of judgments",
70
+ "P1-1": "Protection of property",
71
+ "P1-2": "Right to education",
72
+ "P1-3": "Right to free elections",
73
+ "P3-1": "Right to free elections",
74
+ "P4-1": "Prohibition of imprisonment for debt",
75
+ "P4-2": "Freedom of movement",
76
+ "P4-3": "Prohibition of expulsion of nationals",
77
+ "P4-4": "Prohibition of collective expulsion of aliens",
78
+ "P6-1": "Abolition of the death penalty",
79
+ "P6-2": "Death penalty in time of war",
80
+ "P6-3": "Prohibition of derogations",
81
+ "P7-1": "Procedural safeguards relating to expulsion of aliens",
82
+ "P7-2": "Right of appeal in criminal matters",
83
+ "P7-3": "Compensation for wrongful conviction",
84
+ "P7-4": "Right not to be tried or punished twice",
85
+ "P7-5": "Equality between spouses",
86
+ "P12-1": "General prohibition of discrimination",
87
+ "P13-1": "Abolition of the death penalty",
88
+ "P13-2": "Prohibition of derogations",
89
+ "P13-3": "Prohibition of reservations",
90
+ }
91
+
92
+
93
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
94
+ class EcthrCases(datasets.GeneratorBasedBuilder):
95
+ """The ECtHR Cases dataset is designed for experimentation of neural judgment prediction and rationale extraction considering ECtHR cases."""
96
+
97
+ VERSION = datasets.Version("1.1.0")
98
+
99
+ BUILDER_CONFIGS = [
100
+ datasets.BuilderConfig(
101
+ name="alleged-violation-prediction",
102
+ version=VERSION,
103
+ description="This part of the dataset covers alleged violation prediction",
104
+ ),
105
+ datasets.BuilderConfig(
106
+ name="violation-prediction",
107
+ version=VERSION,
108
+ description="This part of the dataset covers violation prediction",
109
+ ),
110
+ ]
111
+
112
+ DEFAULT_CONFIG_NAME = "alleged-violation-prediction"
113
+
114
+ def _info(self):
115
+ if self.config.name == "alleged-violation-prediction":
116
+ features = datasets.Features(
117
+ {
118
+ "facts": datasets.features.Sequence(datasets.Value("string")),
119
+ "labels": datasets.features.Sequence(datasets.Value("string")),
120
+ "silver_rationales": datasets.features.Sequence(datasets.Value("int32")),
121
+ "gold_rationales": datasets.features.Sequence(datasets.Value("int32"))
122
+ # These are the features of your dataset like images, labels ...
123
+ }
124
+ )
125
+ else:
126
+ features = datasets.Features(
127
+ {
128
+ "facts": datasets.features.Sequence(datasets.Value("string")),
129
+ "labels": datasets.features.Sequence(datasets.Value("string")),
130
+ "silver_rationales": datasets.features.Sequence(datasets.Value("int32"))
131
+ # These are the features of your dataset like images, labels ...
132
+ }
133
+ )
134
+ return datasets.DatasetInfo(
135
+ # This is the description that will appear on the datasets page.
136
+ description=_DESCRIPTION,
137
+ # This defines the different columns of the dataset and their types
138
+ features=features, # Here we define them above because they are different between the two configurations
139
+ # If there's a common (input, target) tuple from the features,
140
+ # specify them here. They'll be used if as_supervised=True in
141
+ # builder.as_dataset.
142
+ supervised_keys=None,
143
+ # Homepage of the dataset for documentation
144
+ homepage=_HOMEPAGE,
145
+ # License for the dataset if available
146
+ license=_LICENSE,
147
+ # Citation for the dataset
148
+ citation=_CITATION,
149
+ )
150
+
151
+ def _split_generators(self, dl_manager):
152
+ """Returns SplitGenerators."""
153
+ my_urls = _URLs[self.config.name]
154
+ data_dir = dl_manager.download_and_extract(my_urls)
155
+ return [
156
+ datasets.SplitGenerator(
157
+ name=datasets.Split.TRAIN,
158
+ # These kwargs will be passed to _generate_examples
159
+ gen_kwargs={
160
+ "filepath": os.path.join(data_dir, "train.jsonl"),
161
+ "split": "train",
162
+ },
163
+ ),
164
+ datasets.SplitGenerator(
165
+ name=datasets.Split.TEST,
166
+ # These kwargs will be passed to _generate_examples
167
+ gen_kwargs={"filepath": os.path.join(data_dir, "test.jsonl"), "split": "test"},
168
+ ),
169
+ datasets.SplitGenerator(
170
+ name=datasets.Split.VALIDATION,
171
+ # These kwargs will be passed to _generate_examples
172
+ gen_kwargs={
173
+ "filepath": os.path.join(data_dir, "dev.jsonl"),
174
+ "split": "dev",
175
+ },
176
+ ),
177
+ ]
178
+
179
+ def _generate_examples(
180
+ self, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
181
+ ):
182
+ """ Yields examples as (key, example) tuples. """
183
+
184
+ with open(filepath, encoding="utf-8") as f:
185
+ for id_, row in enumerate(f):
186
+ data = json.loads(row)
187
+ if self.config.name == "alleged-violation-prediction":
188
+ yield id_, {
189
+ "facts": data["facts"],
190
+ "labels": data["allegedly_violated_articles"],
191
+ "silver_rationales": data["silver_rationales"],
192
+ "gold_rationales": data["gold_rationales"],
193
+ }
194
+ else:
195
+ yield id_, {
196
+ "facts": data["facts"],
197
+ "labels": data["violated_articles"],
198
+ "silver_rationales": data["silver_rationales"],
199
+ }