StanBienaives
commited on
Commit
•
a6c12ae
1
Parent(s):
bcf9606
create loading file
Browse files
jade.py
ADDED
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
2 |
+
#
|
3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4 |
+
# you may not use this file except in compliance with the License.
|
5 |
+
# You may obtain a copy of the License at
|
6 |
+
#
|
7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
#
|
9 |
+
# Unless required by applicable law or agreed to in writing, software
|
10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12 |
+
# See the License for the specific language governing permissions and
|
13 |
+
# limitations under the License.
|
14 |
+
# TODO: Address all TODOs and remove all explanatory comments
|
15 |
+
|
16 |
+
|
17 |
+
import pandas as pd
|
18 |
+
import json
|
19 |
+
import os
|
20 |
+
import shutil
|
21 |
+
|
22 |
+
import datasets
|
23 |
+
|
24 |
+
|
25 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
26 |
+
_CITATION = """\
|
27 |
+
@InProceedings{huggingface:dataset,
|
28 |
+
title = {French Fiscal texts},
|
29 |
+
author={Stan Bienaives
|
30 |
+
},
|
31 |
+
year={2022}
|
32 |
+
}
|
33 |
+
"""
|
34 |
+
|
35 |
+
|
36 |
+
_DESCRIPTION = """\
|
37 |
+
This dataset is an extraction from the OPENDATA/JADE. A list of case laws from the French court "Conseil d'Etat".
|
38 |
+
"""
|
39 |
+
|
40 |
+
_HOMEPAGE = "echanges.dila.gouv.fr"
|
41 |
+
|
42 |
+
|
43 |
+
_LICENSE = """/
|
44 |
+
This dataset is licensed under Creative Commons Attribution 4.0 International License.
|
45 |
+
"""
|
46 |
+
|
47 |
+
|
48 |
+
_URLS = {
|
49 |
+
"jade": "https://wisenlp.s3.eu-west-1.amazonaws.com/jade.parquet"
|
50 |
+
}
|
51 |
+
|
52 |
+
|
53 |
+
_SEED = 42
|
54 |
+
|
55 |
+
class FrenchOpenFiscalTexts(datasets.GeneratorBasedBuilder):
|
56 |
+
"""
|
57 |
+
This is the main class for the dataset.
|
58 |
+
"""
|
59 |
+
VERSION = datasets.Version("1.1.0")
|
60 |
+
|
61 |
+
def _info(self):
|
62 |
+
features = datasets.Features(
|
63 |
+
{
|
64 |
+
# "file": datasets.Value("string"),
|
65 |
+
"title": datasets.Value("string"),
|
66 |
+
"content": datasets.Value("string"),
|
67 |
+
"summary": datasets.Value("string"),
|
68 |
+
"solution": datasets.Value("string"),
|
69 |
+
"numero": datasets.Value("string"),
|
70 |
+
"publi_receuil": datasets.Value("string"),
|
71 |
+
"date": datasets.Value("string"),
|
72 |
+
}
|
73 |
+
)
|
74 |
+
|
75 |
+
return datasets.DatasetInfo(
|
76 |
+
# This is the description that will appear on the datasets page.
|
77 |
+
description=_DESCRIPTION,
|
78 |
+
features=features,
|
79 |
+
homepage=_HOMEPAGE,
|
80 |
+
license=_LICENSE,
|
81 |
+
)
|
82 |
+
|
83 |
+
def _split_generators(self, dl_manager):
|
84 |
+
self.data_dir = dl_manager.download_and_extract(_URLS["jade"])
|
85 |
+
|
86 |
+
df = pd.read_parquet(self.data_dir)
|
87 |
+
|
88 |
+
train = df.sample(frac=0.8,random_state=_SEED)
|
89 |
+
test = df.drop(train.index)
|
90 |
+
|
91 |
+
|
92 |
+
return [
|
93 |
+
datasets.SplitGenerator(
|
94 |
+
name=datasets.Split.TRAIN,
|
95 |
+
gen_kwargs={"dataframe": train},
|
96 |
+
),
|
97 |
+
datasets.SplitGenerator(
|
98 |
+
name=datasets.Split.TEST,
|
99 |
+
gen_kwargs={"dataframe": test},
|
100 |
+
),
|
101 |
+
]
|
102 |
+
|
103 |
+
def _generate_examples(self, dataframe):
|
104 |
+
"""
|
105 |
+
This function returns the examples in the raw (text) form.
|
106 |
+
"""
|
107 |
+
for index, row in dataframe.iterrows():
|
108 |
+
yield index, {
|
109 |
+
# "file": row["file"],
|
110 |
+
"title": row["title"],
|
111 |
+
"content": row["content"],
|
112 |
+
"summary": row["summary"],
|
113 |
+
"solution": row["solution"],
|
114 |
+
"numero": row["numero"],
|
115 |
+
"publi_receuil": row["publi_receuil"],
|
116 |
+
"date": row["date"],
|
117 |
+
}
|
118 |
+
|
119 |
+
|
120 |
+
|
121 |
+
|
122 |
+
|
123 |
+
|
124 |
+
|