nlp to datasets
Browse files
ornl.py
CHANGED
@@ -20,7 +20,7 @@ from __future__ import absolute_import, division, print_function
|
|
20 |
|
21 |
import csv
|
22 |
|
23 |
-
import nlp
|
24 |
import datasets
|
25 |
from datasets.tasks import TextClassification
|
26 |
|
@@ -33,16 +33,16 @@ _TRAIN_DOWNLOAD_URL = "https://huggingface.co/datasets/Rodekool/ornl/resolve/mai
|
|
33 |
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/Rodekool/ornl/resolve/main/test.csv"
|
34 |
|
35 |
|
36 |
-
class ORnl(
|
37 |
"""Open Data van de Rechtspraak dutch topic classification dataset."""
|
38 |
|
39 |
def _info(self):
|
40 |
-
return
|
41 |
description=_DESCRIPTION,
|
42 |
-
features=
|
43 |
{
|
44 |
-
"text":
|
45 |
-
"label":
|
46 |
}
|
47 |
),
|
48 |
homepage="https://www.rechtspraak.nl/Uitspraken/paginas/open-data.aspx",
|
@@ -52,8 +52,8 @@ class ORnl(nlp.GeneratorBasedBuilder):
|
|
52 |
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
53 |
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
54 |
return [
|
55 |
-
|
56 |
-
|
57 |
]
|
58 |
|
59 |
def _generate_examples(self, filepath):
|
|
|
20 |
|
21 |
import csv
|
22 |
|
23 |
+
# import nlp # old loader
|
24 |
import datasets
|
25 |
from datasets.tasks import TextClassification
|
26 |
|
|
|
33 |
_TEST_DOWNLOAD_URL = "https://huggingface.co/datasets/Rodekool/ornl/resolve/main/test.csv"
|
34 |
|
35 |
|
36 |
+
class ORnl(datasets.GeneratorBasedBuilder):
|
37 |
"""Open Data van de Rechtspraak dutch topic classification dataset."""
|
38 |
|
39 |
def _info(self):
|
40 |
+
return datasets.DatasetInfo(
|
41 |
description=_DESCRIPTION,
|
42 |
+
features=datasets.Features(
|
43 |
{
|
44 |
+
"text": datasets.Value("string"),
|
45 |
+
"label": datasets.features.ClassLabel(names=['Ambtenarenrecht', 'Arbeidsrecht', 'Belastingrecht', 'Omgevingsrecht', 'Personen- en familierecht', 'Socialezekerheidsrecht', 'Verbintenissenrecht', 'Vreemdelingenrecht']),
|
46 |
}
|
47 |
),
|
48 |
homepage="https://www.rechtspraak.nl/Uitspraken/paginas/open-data.aspx",
|
|
|
52 |
train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL)
|
53 |
test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL)
|
54 |
return [
|
55 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}),
|
56 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}),
|
57 |
]
|
58 |
|
59 |
def _generate_examples(self, filepath):
|