Datasets:

Modalities:
Text
Languages:
English
ArXiv:
Libraries:
Datasets
License:
StefanH commited on
Commit
df2a6a4
·
1 Parent(s): a32ce65

Update: loading script TODO test

Browse files
Files changed (1) hide show
  1. utcd.py +10 -11
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={"filepath": split2paths[s]}) for s in splits
142
  ]
143
 
144
- def _generate_examples(self, filepath: str):
145
- # each call is for one split of one dataset
146
- mic(filepath, type(filepath))
147
- dnm = filepath.split(os.sep)[-2]
148
- id_ = 0
149
- with open(filepath, encoding='utf-8') as f:
150
- dset = json.load(f)
151
- for txt, labels in dset.items():
152
- yield id_, dict(text=txt, labels=labels, dataset_name=dnm)
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