Datasets:

Modalities:
Text
Formats:
parquet
Libraries:
Datasets
pandas
License:
albertvillanova HF staff commited on
Commit
9b29e75
1 Parent(s): 889ed53

Fix id field to avoid duplicate keys error

Browse files

Fix id field to avoid duplicate keys error.

Fix #7.

Files changed (1) hide show
  1. um005.py +5 -9
um005.py CHANGED
@@ -138,12 +138,8 @@ class UM005(datasets.GeneratorBasedBuilder):
138
  for sentence_counter, (x, y) in enumerate(zip(u, e)):
139
  x = x.strip()
140
  y = y.strip()
141
- result = (
142
- sentence_counter,
143
- {
144
- "id": str(sentence_counter),
145
- "translation": {"ur": x, "en": y},
146
- },
147
- )
148
- sentence_counter += 1
149
- yield result
 
138
  for sentence_counter, (x, y) in enumerate(zip(u, e)):
139
  x = x.strip()
140
  y = y.strip()
141
+ id_ = f"{source}-{sentence_counter}"
142
+ yield id_, {
143
+ "id": id_,
144
+ "translation": {"ur": x, "en": y},
145
+ }