Datasets:
vr
commited on
Commit
•
adea3e3
1
Parent(s):
03f0287
little change loading script and updated README.md
Browse files- README.md +40 -2
- law_area_prediction.py +6 -6
README.md
CHANGED
@@ -1,18 +1,56 @@
|
|
1 |
---
|
2 |
license: cc-by-sa-4.0
|
3 |
---
|
4 |
-
|
5 |
# Law Area Prediction
|
6 |
|
7 |
## Introduction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
## Size
|
10 |
|
11 |
|
12 |
## Load datasets
|
13 |
-
|
14 |
```python
|
15 |
dataset = load_dataset("rcds/law_area_prediction")
|
16 |
```
|
|
|
|
|
|
|
|
|
17 |
|
18 |
## Columns
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: cc-by-sa-4.0
|
3 |
---
|
4 |
+
Only a small part of the actual dataset for testing purposes uploaded at the moment.
|
5 |
# Law Area Prediction
|
6 |
|
7 |
## Introduction
|
8 |
+
The main subset contains cases to be classified into the four main areas of law: Public, Civil, Criminal and Social
|
9 |
+
|
10 |
+
A portion of the cases from the main areas Public, Civil and Criminal can be classified further into sub-areas:
|
11 |
+
```
|
12 |
+
"public": ['Tax', 'Urban Planning and Environmental', 'Expropriation', 'Public Administration', 'Other Fiscal'],
|
13 |
+
"civil": ['Rental and Lease', 'Employment Contract', 'Bankruptcy', 'Family', 'Competition and Antitrust', 'Intellectual Property'],
|
14 |
+
'criminal': ['Substantive Criminal', 'Criminal Procedure']
|
15 |
+
```
|
16 |
+
|
17 |
|
18 |
## Size
|
19 |
|
20 |
|
21 |
## Load datasets
|
22 |
+
Load the main dataset:
|
23 |
```python
|
24 |
dataset = load_dataset("rcds/law_area_prediction")
|
25 |
```
|
26 |
+
Load the dataset with the sub-areas of Civil law:
|
27 |
+
```python
|
28 |
+
dataset = load_dataset("rcds/law_area_prediction", "civil")
|
29 |
+
```
|
30 |
|
31 |
## Columns
|
32 |
+
### Main dataset
|
33 |
+
- decision_id: unique identifier for the decision
|
34 |
+
- facts: facts section of the decision
|
35 |
+
- considerations: considerations section of the decision
|
36 |
+
- label: label of the decision (main area of law)
|
37 |
+
- law_sub_area: sub area of law of the decision
|
38 |
+
- language: language of the decision
|
39 |
+
- year: year of the decision
|
40 |
+
- court: court of the decision
|
41 |
+
- chamber: chamber of the decision
|
42 |
+
- canton: canton of the decision
|
43 |
+
- region: region of the decision
|
44 |
+
|
45 |
+
### Sub-area dataset
|
46 |
+
- decision_id: unique identifier for the decision
|
47 |
+
- facts: facts section of the decision
|
48 |
+
- considerations: considerations section of the decision
|
49 |
+
- law_area: label of the decision (main area of law)
|
50 |
+
- label: sub area of law of the decision
|
51 |
+
- language: language of the decision
|
52 |
+
- year: year of the decision
|
53 |
+
- court: court of the decision
|
54 |
+
- chamber: chamber of the decision
|
55 |
+
- canton: canton of the decision
|
56 |
+
- region: region of the decision
|
law_area_prediction.py
CHANGED
@@ -42,7 +42,7 @@ _URLS = {
|
|
42 |
def get_url(config_name):
|
43 |
if config_name == "main":
|
44 |
return _URLS["main"]
|
45 |
-
if config_name == "
|
46 |
return _URLS["sub"]
|
47 |
|
48 |
|
@@ -64,8 +64,8 @@ class CourtViewGeneration(datasets.GeneratorBasedBuilder):
|
|
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="
|
68 |
-
datasets.BuilderConfig(name="
|
69 |
datasets.BuilderConfig(name="criminal", version=VERSION, description="This dataset is for predicting the sub law areas of the criminal law"),
|
70 |
]
|
71 |
|
@@ -162,8 +162,8 @@ class CourtViewGeneration(datasets.GeneratorBasedBuilder):
|
|
162 |
|
163 |
def belongs_to_law_area(self, law_sub_area):
|
164 |
area_map = {
|
165 |
-
"
|
166 |
-
"
|
167 |
'criminal': ['Substantive Criminal', 'Criminal Procedure']
|
168 |
}
|
169 |
if law_sub_area in area_map[self.config.name]:
|
@@ -199,7 +199,7 @@ class CourtViewGeneration(datasets.GeneratorBasedBuilder):
|
|
199 |
"canton": data["canton"],
|
200 |
"region": data["region"]
|
201 |
}
|
202 |
-
if self.config.name == "
|
203 |
if self.belongs_to_law_area(data["label"]):
|
204 |
yield id, {
|
205 |
"decision_id": data["decision_id"],
|
|
|
42 |
def get_url(config_name):
|
43 |
if config_name == "main":
|
44 |
return _URLS["main"]
|
45 |
+
if config_name == "public" or config_name == "civil" or config_name == "criminal":
|
46 |
return _URLS["sub"]
|
47 |
|
48 |
|
|
|
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="public", version=VERSION, description="This dataset is for predicting the sub law areas of the public law"),
|
68 |
+
datasets.BuilderConfig(name="civil", version=VERSION, description="This dataset is for predicting the sub law areas of the civil law"),
|
69 |
datasets.BuilderConfig(name="criminal", version=VERSION, description="This dataset is for predicting the sub law areas of the criminal law"),
|
70 |
]
|
71 |
|
|
|
162 |
|
163 |
def belongs_to_law_area(self, law_sub_area):
|
164 |
area_map = {
|
165 |
+
"public": ['Tax', 'Urban Planning and Environmental', 'Expropriation', 'Public Administration', 'Other Fiscal'],
|
166 |
+
"civil": ['Rental and Lease', 'Employment Contract', 'Bankruptcy', 'Family', 'Competition and Antitrust', 'Intellectual Property'],
|
167 |
'criminal': ['Substantive Criminal', 'Criminal Procedure']
|
168 |
}
|
169 |
if law_sub_area in area_map[self.config.name]:
|
|
|
199 |
"canton": data["canton"],
|
200 |
"region": data["region"]
|
201 |
}
|
202 |
+
if self.config.name == "public" or self.config.name == "civil" or self.config.name == "criminal":
|
203 |
if self.belongs_to_law_area(data["label"]):
|
204 |
yield id, {
|
205 |
"decision_id": data["decision_id"],
|