Datasets:

Modalities:
Text
Languages:
Icelandic
Libraries:
Datasets
License:
vesteinn commited on
Commit
7d8f434
·
1 Parent(s): 4d7fde2

Corrected index handling

Browse files
Files changed (1) hide show
  1. icelandic-error-corpus-IceEC.py +2 -4
icelandic-error-corpus-IceEC.py CHANGED
@@ -816,7 +816,7 @@ class IceEC(datasets.GeneratorBasedBuilder):
816
  description=_DESCRIPTION,
817
  features=datasets.Features(
818
  {
819
- "id": datasets.Value("string"),
820
  "sentence": datasets.Sequence(datasets.Value("string")),
821
  "errors": datasets.Sequence(datasets.Value("string"))
822
  }
@@ -838,11 +838,9 @@ class IceEC(datasets.GeneratorBasedBuilder):
838
 
839
  def _generate_examples(self, filepath):
840
  with open(filepath, encoding="utf-8") as f:
841
- guid = 0
842
  for line in f:
843
  data = json.loads(line.strip())
844
  if self.config.level is not None:
845
  errors = [ERROR_INFORMATION[e][self.config.level] for e in data["errors"]]
846
  data["errors"] = errors
847
- yield guid, data
848
- guid += 1
 
816
  description=_DESCRIPTION,
817
  features=datasets.Features(
818
  {
819
+ "idx": datasets.Value("string"),
820
  "sentence": datasets.Sequence(datasets.Value("string")),
821
  "errors": datasets.Sequence(datasets.Value("string"))
822
  }
 
838
 
839
  def _generate_examples(self, filepath):
840
  with open(filepath, encoding="utf-8") as f:
 
841
  for line in f:
842
  data = json.loads(line.strip())
843
  if self.config.level is not None:
844
  errors = [ERROR_INFORMATION[e][self.config.level] for e in data["errors"]]
845
  data["errors"] = errors
846
+ yield data["idx"], data