fernando-peres
commited on
Commit
·
7cacf65
1
Parent(s):
dd3d8ed
adjustments
Browse files- py_legislation.py +9 -13
py_legislation.py
CHANGED
|
@@ -20,14 +20,6 @@ from textwrap import TextWrapper
|
|
| 20 |
import datasets
|
| 21 |
import pyarrow.parquet as pq
|
| 22 |
|
| 23 |
-
# URL_BASE = "https://huggingface.co/datasets/fernandoperes/py_legislation/tree/main"
|
| 24 |
-
|
| 25 |
-
# _URLS = {
|
| 26 |
-
# # "ria_ground_truth": "data/pt_legislation/ria_ground_truth/train.parquet",
|
| 27 |
-
# "ria_ground_truth": "./ria_ground_truth/train.parquet",
|
| 28 |
-
# "unlabeled": "./unlabeled/train.parquet",
|
| 29 |
-
# "proems__ria_ground_truth": "./proems__ria_ground_truth/train.parquet",
|
| 30 |
-
# }
|
| 31 |
|
| 32 |
# [>] URLS:
|
| 33 |
|
|
@@ -244,9 +236,11 @@ class PYLegislation(datasets.GeneratorBasedBuilder):
|
|
| 244 |
"""
|
| 245 |
features = None
|
| 246 |
description = None
|
|
|
|
| 247 |
if self.config.name in _CONFIGS.keys():
|
| 248 |
features = datasets.Features(
|
| 249 |
_CONFIGS[self.config.name]["features"])
|
|
|
|
| 250 |
description = _CONFIGS[self.config.name]["description"]
|
| 251 |
|
| 252 |
# if self.config.name == "raw_text":
|
|
@@ -287,6 +281,12 @@ class PYLegislation(datasets.GeneratorBasedBuilder):
|
|
| 287 |
urls_to_download = _URLS[self.config.name]
|
| 288 |
filepaths = dl_manager.download_and_extract(urls_to_download)
|
| 289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
# for k in urls_to_download:
|
| 291 |
# fp = dl_manager.download_and_extract(urls_to_download[k])
|
| 292 |
# print(f"***************>>>> filepath = {fp}")
|
|
@@ -324,11 +324,7 @@ class PYLegislation(datasets.GeneratorBasedBuilder):
|
|
| 324 |
# ]
|
| 325 |
|
| 326 |
# return generators
|
| 327 |
-
|
| 328 |
-
return datasets.SplitGenerator(
|
| 329 |
-
name=datasets.Split.TRAIN,
|
| 330 |
-
gen_kwargs={"filepath": filepaths},
|
| 331 |
-
)
|
| 332 |
|
| 333 |
def _generate_examples(self, filepath):
|
| 334 |
"""
|
|
|
|
| 20 |
import datasets
|
| 21 |
import pyarrow.parquet as pq
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# [>] URLS:
|
| 25 |
|
|
|
|
| 236 |
"""
|
| 237 |
features = None
|
| 238 |
description = None
|
| 239 |
+
|
| 240 |
if self.config.name in _CONFIGS.keys():
|
| 241 |
features = datasets.Features(
|
| 242 |
_CONFIGS[self.config.name]["features"])
|
| 243 |
+
|
| 244 |
description = _CONFIGS[self.config.name]["description"]
|
| 245 |
|
| 246 |
# if self.config.name == "raw_text":
|
|
|
|
| 281 |
urls_to_download = _URLS[self.config.name]
|
| 282 |
filepaths = dl_manager.download_and_extract(urls_to_download)
|
| 283 |
|
| 284 |
+
return datasets.SplitGenerator(
|
| 285 |
+
name=datasets.Split.TRAIN,
|
| 286 |
+
gen_kwargs={"filepath": filepaths}
|
| 287 |
+
)
|
| 288 |
+
|
| 289 |
+
# region old code
|
| 290 |
# for k in urls_to_download:
|
| 291 |
# fp = dl_manager.download_and_extract(urls_to_download[k])
|
| 292 |
# print(f"***************>>>> filepath = {fp}")
|
|
|
|
| 324 |
# ]
|
| 325 |
|
| 326 |
# return generators
|
| 327 |
+
# endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
|
| 329 |
def _generate_examples(self, filepath):
|
| 330 |
"""
|