fernando-peres
commited on
Commit
·
e7a615a
1
Parent(s):
7d22591
resolving card bugs
Browse files- py_legislation.py +15 -5
py_legislation.py
CHANGED
|
@@ -215,7 +215,8 @@ class PY_legislation(datasets.GeneratorBasedBuilder):
|
|
| 215 |
),
|
| 216 |
]
|
| 217 |
|
| 218 |
-
|
|
|
|
| 219 |
|
| 220 |
# [i] Info
|
| 221 |
def _info(self):
|
|
@@ -228,7 +229,16 @@ class PY_legislation(datasets.GeneratorBasedBuilder):
|
|
| 228 |
|
| 229 |
if self.config.name == "text_raw":
|
| 230 |
description = _metadata["text_raw"]["description"]
|
| 231 |
-
features = datasets.Features(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
|
| 233 |
if self.config.name == "sentences_unlabeled":
|
| 234 |
description = _metadata["sentences_unlabeled"]["description"]
|
|
@@ -284,9 +294,9 @@ class PY_legislation(datasets.GeneratorBasedBuilder):
|
|
| 284 |
# ]
|
| 285 |
|
| 286 |
return datasets.SplitGenerator(
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
|
| 291 |
def _generate_examples(self, filepath):
|
| 292 |
"""
|
|
|
|
| 215 |
),
|
| 216 |
]
|
| 217 |
|
| 218 |
+
# It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 219 |
+
DEFAULT_CONFIG_NAME = "text_raw"
|
| 220 |
|
| 221 |
# [i] Info
|
| 222 |
def _info(self):
|
|
|
|
| 229 |
|
| 230 |
if self.config.name == "text_raw":
|
| 231 |
description = _metadata["text_raw"]["description"]
|
| 232 |
+
features = datasets.Features(
|
| 233 |
+
{
|
| 234 |
+
"source_id": datasets.Value(dtype="int64"),
|
| 235 |
+
"source_name": datasets.Value(dtype="string"),
|
| 236 |
+
"text_id": datasets.Value(dtype="int64"),
|
| 237 |
+
"text": datasets.Value(dtype="string"),
|
| 238 |
+
"extension": datasets.Sequence(
|
| 239 |
+
datasets.ClassLabel(names=["docx", "pdf", "html", "txt", "doc"],)),
|
| 240 |
+
}
|
| 241 |
+
)
|
| 242 |
|
| 243 |
if self.config.name == "sentences_unlabeled":
|
| 244 |
description = _metadata["sentences_unlabeled"]["description"]
|
|
|
|
| 294 |
# ]
|
| 295 |
|
| 296 |
return datasets.SplitGenerator(
|
| 297 |
+
name=datasets.Split.TRAIN,
|
| 298 |
+
gen_kwargs={"filepath": downloaded_files},
|
| 299 |
+
)
|
| 300 |
|
| 301 |
def _generate_examples(self, filepath):
|
| 302 |
"""
|