Fix DuplicatedKeysError while loading multiple corpora

#2
by albertvillanova HF staff - opened
Files changed (1) hide show
  1. large_spanish_corpus.py +1 -1
large_spanish_corpus.py CHANGED
@@ -113,9 +113,9 @@ class LargeSpanishCorpus(datasets.GeneratorBasedBuilder):
113
  return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"data_dir": data_dir})]
114
 
115
  def _generate_examples(self, data_dir):
 
116
  for filepath in self.config.filepaths:
117
  filepath = os.path.join(data_dir, filepath)
118
- _id = 0
119
  with open(filepath, mode="r", encoding="utf-8") as f:
120
  for line in f:
121
  yield _id, {"text": line.strip()},
 
113
  return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"data_dir": data_dir})]
114
 
115
  def _generate_examples(self, data_dir):
116
+ _id = 0
117
  for filepath in self.config.filepaths:
118
  filepath = os.path.join(data_dir, filepath)
 
119
  with open(filepath, mode="r", encoding="utf-8") as f:
120
  for line in f:
121
  yield _id, {"text": line.strip()},