Datasets:
rcds
/

Modalities:
Text
ArXiv:
Libraries:
Datasets
License:
vr commited on
Commit
d637f98
1 Parent(s): e95f34e

changing 'label' to 'sub_law_area'

Browse files
Files changed (2) hide show
  1. README.md +3 -28
  2. swiss_law_area_prediction.py +5 -39
README.md CHANGED
@@ -4,9 +4,9 @@ license: cc-by-sa-4.0
4
  # Swiss Law Area Prediction
5
 
6
  ## Introduction
7
- The main subset contains cases to be classified into the four main areas of law: Public, Civil, Criminal and Social
8
 
9
- A portion of the cases can be classified further into sub-areas:
10
  ```
11
  "public": ['Tax', 'Urban Planning and Environmental', 'Expropriation', 'Public Administration', 'Other Fiscal'],
12
  "civil": ['Rental and Lease', 'Employment Contract', 'Bankruptcy', 'Family', 'Competition and Antitrust', 'Intellectual Property'],
@@ -15,47 +15,22 @@ A portion of the cases can be classified further into sub-areas:
15
 
16
 
17
  ## Size
18
- ### Main dataset
19
- * train: 194'768
20
- * validation: 36'882
21
- * test: 97'676
22
-
23
- ### Sub-area dataset
24
  * train: 10'475
25
  * validation: 3194
26
  * test: 8587
27
 
28
 
29
  ## Load datasets
30
- Load the main dataset:
31
  ```python
32
  dataset = load_dataset("rcds/swiss_law_area_prediction")
33
  ```
34
- Load the dataset with the sub-areas:
35
- ```python
36
- dataset = load_dataset("rcds/swiss_law_area_prediction", "sub_area")
37
- ```
38
 
39
  ## Columns
40
- ### Main dataset
41
- - decision_id: unique identifier for the decision
42
- - facts: facts section of the decision
43
- - considerations: considerations section of the decision
44
- - label: label of the decision (main area of law)
45
- - law_sub_area: sub area of law of the decision
46
- - language: language of the decision
47
- - year: year of the decision
48
- - court: court of the decision
49
- - chamber: chamber of the decision
50
- - canton: canton of the decision
51
- - region: region of the decision
52
-
53
- ### Sub-area dataset
54
  - decision_id: unique identifier for the decision
55
  - facts: facts section of the decision
56
  - considerations: considerations section of the decision
57
  - law_area: label of the decision (main area of law)
58
- - label: sub area of law of the decision
59
  - language: language of the decision
60
  - year: year of the decision
61
  - court: court of the decision
 
4
  # Swiss Law Area Prediction
5
 
6
  ## Introduction
7
+ The dataset contains cases to be classified into the four main areas of law: Public, Civil, Criminal and Social
8
 
9
+ These can be classified further into sub-areas:
10
  ```
11
  "public": ['Tax', 'Urban Planning and Environmental', 'Expropriation', 'Public Administration', 'Other Fiscal'],
12
  "civil": ['Rental and Lease', 'Employment Contract', 'Bankruptcy', 'Family', 'Competition and Antitrust', 'Intellectual Property'],
 
15
 
16
 
17
  ## Size
 
 
 
 
 
 
18
  * train: 10'475
19
  * validation: 3194
20
  * test: 8587
21
 
22
 
23
  ## Load datasets
 
24
  ```python
25
  dataset = load_dataset("rcds/swiss_law_area_prediction")
26
  ```
 
 
 
 
27
 
28
  ## Columns
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  - decision_id: unique identifier for the decision
30
  - facts: facts section of the decision
31
  - considerations: considerations section of the decision
32
  - law_area: label of the decision (main area of law)
33
+ - law_sub_area: sub area of law of the decision
34
  - language: language of the decision
35
  - year: year of the decision
36
  - court: court of the decision
swiss_law_area_prediction.py CHANGED
@@ -35,15 +35,12 @@ _LICENSE = ""
35
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
36
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
37
  _URLS = {
38
- "main": "https://huggingface.co/datasets/rcds/law_area_prediction/resolve/main/data/areas/huggingface",
39
- "sub": "https://huggingface.co/datasets/rcds/law_area_prediction/resolve/main/data/sub_areas/huggingface"
40
  }
41
 
42
  def get_url(config_name):
43
  if config_name == "main":
44
  return _URLS["main"]
45
- if config_name == "sub_area":
46
- return _URLS["sub"]
47
 
48
 
49
  class LawAreaPrediction(datasets.GeneratorBasedBuilder):
@@ -63,8 +60,7 @@ class LawAreaPrediction(datasets.GeneratorBasedBuilder):
63
  # data = datasets.load_dataset('my_dataset', 'first_domain')
64
  # data = datasets.load_dataset('my_dataset', 'second_domain')
65
  BUILDER_CONFIGS = [
66
- datasets.BuilderConfig(name="main", version=VERSION, description="This part of my dataset covers the whole dataset"),
67
- datasets.BuilderConfig(name="sub_area", version=VERSION, description="This dataset is for predicting sub law areas"),
68
  ]
69
 
70
  DEFAULT_CONFIG_NAME = "main" # It's not mandatory to have a default configuration. Just use one if it make sense.
@@ -76,7 +72,7 @@ class LawAreaPrediction(datasets.GeneratorBasedBuilder):
76
  "decision_id": datasets.Value("string"),
77
  "facts": datasets.Value("string"),
78
  "considerations": datasets.Value("string"),
79
- "label": datasets.Value("string"),
80
  "law_sub_area": datasets.Value("string"),
81
  "language": datasets.Value("string"),
82
  "year": datasets.Value("int32"),
@@ -88,22 +84,6 @@ class LawAreaPrediction(datasets.GeneratorBasedBuilder):
88
  # These are the features of your dataset like images, labels ...
89
  }
90
  )
91
- if self.config.name != "main": # for law sub area prediction
92
- features = datasets.Features(
93
- {
94
- "decision_id": datasets.Value("string"),
95
- "facts": datasets.Value("string"),
96
- "considerations": datasets.Value("string"),
97
- "law_area": datasets.Value("string"),
98
- "label": datasets.Value("string"),
99
- "language": datasets.Value("string"),
100
- "year": datasets.Value("int32"),
101
- "court": datasets.Value("string"),
102
- "chamber": datasets.Value("string"),
103
- "canton": datasets.Value("string"),
104
- "region": datasets.Value("string")
105
- }
106
- )
107
  return datasets.DatasetInfo(
108
  # This is the description that will appear on the datasets page.
109
  description=_DESCRIPTION,
@@ -188,8 +168,8 @@ class LawAreaPrediction(datasets.GeneratorBasedBuilder):
188
  "decision_id": data["decision_id"],
189
  "facts": data["facts"],
190
  "considerations": data["considerations"],
191
- "label": data["label"],
192
- "law_sub_area": data["law_sub_area"],
193
  "language": data["language"],
194
  "year": data["year"],
195
  "court": data["court"],
@@ -197,20 +177,6 @@ class LawAreaPrediction(datasets.GeneratorBasedBuilder):
197
  "canton": data["canton"],
198
  "region": data["region"]
199
  }
200
- if self.config.name == "sub_area":
201
- yield id, {
202
- "decision_id": data["decision_id"],
203
- "facts": data["facts"],
204
- "considerations": data["considerations"],
205
- "law_area": data["law_area"],
206
- "label": data["label"],
207
- "language": data["language"],
208
- "year": data["year"],
209
- "court": data["court"],
210
- "chamber": data["chamber"],
211
- "canton": data["canton"],
212
- "region": data["region"]
213
- }
214
  except lzma.LZMAError as e:
215
  print(split, e)
216
  if line_counter == 0:
 
35
  # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
36
  # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
37
  _URLS = {
38
+ "main": "https://huggingface.co/datasets/rcds/law_area_prediction/resolve/main/data/sub_areas/huggingface"
 
39
  }
40
 
41
  def get_url(config_name):
42
  if config_name == "main":
43
  return _URLS["main"]
 
 
44
 
45
 
46
  class LawAreaPrediction(datasets.GeneratorBasedBuilder):
 
60
  # data = datasets.load_dataset('my_dataset', 'first_domain')
61
  # data = datasets.load_dataset('my_dataset', 'second_domain')
62
  BUILDER_CONFIGS = [
63
+ datasets.BuilderConfig(name="main", version=VERSION, description="Whole dataset"),
 
64
  ]
65
 
66
  DEFAULT_CONFIG_NAME = "main" # It's not mandatory to have a default configuration. Just use one if it make sense.
 
72
  "decision_id": datasets.Value("string"),
73
  "facts": datasets.Value("string"),
74
  "considerations": datasets.Value("string"),
75
+ "law_area": datasets.Value("string"),
76
  "law_sub_area": datasets.Value("string"),
77
  "language": datasets.Value("string"),
78
  "year": datasets.Value("int32"),
 
84
  # These are the features of your dataset like images, labels ...
85
  }
86
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  return datasets.DatasetInfo(
88
  # This is the description that will appear on the datasets page.
89
  description=_DESCRIPTION,
 
168
  "decision_id": data["decision_id"],
169
  "facts": data["facts"],
170
  "considerations": data["considerations"],
171
+ "law_area": data["law_area"],
172
+ "law_sub_area": data["label"],
173
  "language": data["language"],
174
  "year": data["year"],
175
  "court": data["court"],
 
177
  "canton": data["canton"],
178
  "region": data["region"]
179
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  except lzma.LZMAError as e:
181
  print(split, e)
182
  if line_counter == 0: