Datasets:
Update: loading script TODO test
Browse files
utcd.py
CHANGED
@@ -138,16 +138,15 @@ class Utcd(datasets.GeneratorBasedBuilder):
|
|
138 |
|
139 |
dl_manager.download_and_extract('datasets.zip')
|
140 |
return [
|
141 |
-
datasets.SplitGenerator(name=_split2hf_split[s], gen_kwargs=
|
142 |
]
|
143 |
|
144 |
-
def _generate_examples(self, filepath: str):
|
145 |
-
# each
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
id_ += 1
|
|
|
138 |
|
139 |
dl_manager.download_and_extract('datasets.zip')
|
140 |
return [
|
141 |
+
datasets.SplitGenerator(name=_split2hf_split[s], gen_kwargs=dict(filepath=split2paths[s])) for s in splits
|
142 |
]
|
143 |
|
144 |
+
def _generate_examples(self, filepath: List[str]):
|
145 |
+
for path in filepath: # each file for one split of one dataset
|
146 |
+
dnm = path.split(os.sep)[-2]
|
147 |
+
id_ = 0
|
148 |
+
with open(path, encoding='utf-8') as fl:
|
149 |
+
dset = json.load(fl)
|
150 |
+
for txt, labels in dset.items():
|
151 |
+
yield id_, dict(text=txt, labels=labels, dataset_name=dnm)
|
152 |
+
id_ += 1
|
|