Datasets:
Update files from the datasets library (from 1.16.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.16.0
README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
annotations_creators:
|
| 3 |
- expert-generated
|
| 4 |
language_creators:
|
|
|
|
| 1 |
---
|
| 2 |
+
pretty_name: ASSIN
|
| 3 |
annotations_creators:
|
| 4 |
- expert-generated
|
| 5 |
language_creators:
|
assin.py
CHANGED
|
@@ -15,7 +15,6 @@
|
|
| 15 |
"""ASSIN dataset."""
|
| 16 |
|
| 17 |
|
| 18 |
-
import os
|
| 19 |
import xml.etree.ElementTree as ET
|
| 20 |
|
| 21 |
import datasets
|
|
@@ -110,54 +109,53 @@ class Assin(datasets.GeneratorBasedBuilder):
|
|
| 110 |
|
| 111 |
def _split_generators(self, dl_manager):
|
| 112 |
"""Returns SplitGenerators."""
|
| 113 |
-
|
| 114 |
|
| 115 |
train_paths = []
|
| 116 |
dev_paths = []
|
| 117 |
test_paths = []
|
| 118 |
|
| 119 |
if self.config.name == "full" or self.config.name == "ptpt":
|
| 120 |
-
train_paths.append(
|
| 121 |
-
dev_paths.append(
|
| 122 |
-
test_paths.append(
|
| 123 |
|
| 124 |
if self.config.name == "full" or self.config.name == "ptbr":
|
| 125 |
-
train_paths.append(
|
| 126 |
-
dev_paths.append(
|
| 127 |
-
test_paths.append(
|
| 128 |
|
| 129 |
return [
|
| 130 |
datasets.SplitGenerator(
|
| 131 |
name=datasets.Split.TRAIN,
|
| 132 |
gen_kwargs={
|
| 133 |
"filepaths": train_paths,
|
| 134 |
-
"
|
| 135 |
},
|
| 136 |
),
|
| 137 |
datasets.SplitGenerator(
|
| 138 |
name=datasets.Split.TEST,
|
| 139 |
gen_kwargs={
|
| 140 |
"filepaths": test_paths,
|
| 141 |
-
"
|
| 142 |
},
|
| 143 |
),
|
| 144 |
datasets.SplitGenerator(
|
| 145 |
name=datasets.Split.VALIDATION,
|
| 146 |
gen_kwargs={
|
| 147 |
"filepaths": dev_paths,
|
| 148 |
-
"
|
| 149 |
},
|
| 150 |
),
|
| 151 |
]
|
| 152 |
|
| 153 |
-
def _generate_examples(self, filepaths,
|
| 154 |
"""Yields examples."""
|
| 155 |
|
| 156 |
id_ = 0
|
| 157 |
|
| 158 |
-
for
|
| 159 |
-
|
| 160 |
-
with open(filepath, "rb") as f:
|
| 161 |
|
| 162 |
tree = ET.parse(f)
|
| 163 |
root = tree.getroot()
|
|
|
|
| 15 |
"""ASSIN dataset."""
|
| 16 |
|
| 17 |
|
|
|
|
| 18 |
import xml.etree.ElementTree as ET
|
| 19 |
|
| 20 |
import datasets
|
|
|
|
| 109 |
|
| 110 |
def _split_generators(self, dl_manager):
|
| 111 |
"""Returns SplitGenerators."""
|
| 112 |
+
archive = dl_manager.download(_URL)
|
| 113 |
|
| 114 |
train_paths = []
|
| 115 |
dev_paths = []
|
| 116 |
test_paths = []
|
| 117 |
|
| 118 |
if self.config.name == "full" or self.config.name == "ptpt":
|
| 119 |
+
train_paths.append("assin-ptpt-train.xml")
|
| 120 |
+
dev_paths.append("assin-ptpt-dev.xml")
|
| 121 |
+
test_paths.append("assin-ptpt-test.xml")
|
| 122 |
|
| 123 |
if self.config.name == "full" or self.config.name == "ptbr":
|
| 124 |
+
train_paths.append("assin-ptbr-train.xml")
|
| 125 |
+
dev_paths.append("assin-ptbr-dev.xml")
|
| 126 |
+
test_paths.append("assin-ptbr-test.xml")
|
| 127 |
|
| 128 |
return [
|
| 129 |
datasets.SplitGenerator(
|
| 130 |
name=datasets.Split.TRAIN,
|
| 131 |
gen_kwargs={
|
| 132 |
"filepaths": train_paths,
|
| 133 |
+
"files": dl_manager.iter_archive(archive),
|
| 134 |
},
|
| 135 |
),
|
| 136 |
datasets.SplitGenerator(
|
| 137 |
name=datasets.Split.TEST,
|
| 138 |
gen_kwargs={
|
| 139 |
"filepaths": test_paths,
|
| 140 |
+
"files": dl_manager.iter_archive(archive),
|
| 141 |
},
|
| 142 |
),
|
| 143 |
datasets.SplitGenerator(
|
| 144 |
name=datasets.Split.VALIDATION,
|
| 145 |
gen_kwargs={
|
| 146 |
"filepaths": dev_paths,
|
| 147 |
+
"files": dl_manager.iter_archive(archive),
|
| 148 |
},
|
| 149 |
),
|
| 150 |
]
|
| 151 |
|
| 152 |
+
def _generate_examples(self, filepaths, files):
|
| 153 |
"""Yields examples."""
|
| 154 |
|
| 155 |
id_ = 0
|
| 156 |
|
| 157 |
+
for path, f in files:
|
| 158 |
+
if path in filepaths:
|
|
|
|
| 159 |
|
| 160 |
tree = ET.parse(f)
|
| 161 |
root = tree.getroot()
|