Datasets:

Multilinguality:
translation
Size Categories:
1K<n<10K
Language Creators:
found
Annotations Creators:
found
ArXiv:
License:
system HF staff commited on
Commit
18a2e27
1 Parent(s): 792080d

Update files from the datasets library (from 1.16.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.16.0

Files changed (3) hide show
  1. README.md +1 -0
  2. dataset_infos.json +1 -1
  3. flores.py +15 -10
README.md CHANGED
@@ -1,4 +1,5 @@
1
  ---
 
2
  annotations_creators:
3
  - found
4
  language_creators:
1
  ---
2
+ pretty_name: Flores
3
  annotations_creators:
4
  - found
5
  language_creators:
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"neen": {"description": "Evaluation datasets for low-resource machine translation: Nepali-English and Sinhala-English.\n", "citation": "@misc{guzmn2019new,\n title={Two New Evaluation Datasets for Low-Resource Machine Translation: Nepali-English and Sinhala-English},\n author={Francisco Guzman and Peng-Jen Chen and Myle Ott and Juan Pino and Guillaume Lample and Philipp Koehn and Vishrav Chaudhary and Marc'Aurelio Ranzato},\n year={2019},\n eprint={1902.01382},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/facebookresearch/flores/", "license": "", "features": {"translation": {"languages": ["ne", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "ne", "output": "en"}, "task_templates": null, "builder_name": "flores", "config_name": "neen", "version": {"version_str": "1.1.0", "description": "", "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 849380, "num_examples": 2560, "dataset_name": "flores"}, "test": {"name": "test", "num_bytes": 999063, "num_examples": 2836, "dataset_name": "flores"}}, "download_checksums": {"https://github.com/facebookresearch/flores/raw/master/floresv1/data/wikipedia_en_ne_si_test_sets.tgz": {"num_bytes": 1542781, "checksum": "7a0245bb29fd03b46a1129831c183dfba0efc8452a9739d962759f25141aa648"}}, "download_size": 1542781, "post_processing_size": null, "dataset_size": 1848443, "size_in_bytes": 3391224}, "sien": {"description": "Evaluation datasets for low-resource machine translation: Nepali-English and Sinhala-English.\n", "citation": "@misc{guzmn2019new,\n title={Two New Evaluation Datasets for Low-Resource Machine Translation: Nepali-English and Sinhala-English},\n author={Francisco Guzman and Peng-Jen Chen and Myle Ott and Juan Pino and Guillaume Lample and Philipp Koehn and Vishrav Chaudhary and Marc'Aurelio Ranzato},\n year={2019},\n eprint={1902.01382},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/facebookresearch/flores/", "license": "", "features": {"translation": {"languages": ["si", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "si", "output": "en"}, "task_templates": null, "builder_name": "flores", "config_name": "sien", "version": {"version_str": "1.1.0", "description": "", "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 1031158, "num_examples": 2899, "dataset_name": "flores"}, "test": {"name": "test", "num_bytes": 983563, "num_examples": 2767, "dataset_name": "flores"}}, "download_checksums": {"https://github.com/facebookresearch/flores/raw/master/floresv1/data/wikipedia_en_ne_si_test_sets.tgz": {"num_bytes": 1542781, "checksum": "7a0245bb29fd03b46a1129831c183dfba0efc8452a9739d962759f25141aa648"}}, "download_size": 1542781, "post_processing_size": null, "dataset_size": 2014721, "size_in_bytes": 3557502}}
1
+ {"neen": {"description": "Evaluation datasets for low-resource machine translation: Nepali-English and Sinhala-English.\n", "citation": "@misc{guzmn2019new,\n title={Two New Evaluation Datasets for Low-Resource Machine Translation: Nepali-English and Sinhala-English},\n author={Francisco Guzman and Peng-Jen Chen and Myle Ott and Juan Pino and Guillaume Lample and Philipp Koehn and Vishrav Chaudhary and Marc'Aurelio Ranzato},\n year={2019},\n eprint={1902.01382},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/facebookresearch/flores/", "license": "", "features": {"translation": {"languages": ["ne", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "ne", "output": "en"}, "task_templates": null, "builder_name": "flores", "config_name": "neen", "version": {"version_str": "1.1.0", "description": "", "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 849380, "num_examples": 2560, "dataset_name": "flores"}, "test": {"name": "test", "num_bytes": 999063, "num_examples": 2836, "dataset_name": "flores"}}, "download_checksums": {"https://github.com/facebookresearch/flores/raw/main/floresv1/data/wikipedia_en_ne_si_test_sets.tgz": {"num_bytes": 1542781, "checksum": "7a0245bb29fd03b46a1129831c183dfba0efc8452a9739d962759f25141aa648"}}, "download_size": 1542781, "post_processing_size": null, "dataset_size": 1848443, "size_in_bytes": 3391224}, "sien": {"description": "Evaluation datasets for low-resource machine translation: Nepali-English and Sinhala-English.\n", "citation": "@misc{guzmn2019new,\n title={Two New Evaluation Datasets for Low-Resource Machine Translation: Nepali-English and Sinhala-English},\n author={Francisco Guzman and Peng-Jen Chen and Myle Ott and Juan Pino and Guillaume Lample and Philipp Koehn and Vishrav Chaudhary and Marc'Aurelio Ranzato},\n year={2019},\n eprint={1902.01382},\n archivePrefix={arXiv},\n primaryClass={cs.CL}\n}\n", "homepage": "https://github.com/facebookresearch/flores/", "license": "", "features": {"translation": {"languages": ["si", "en"], "id": null, "_type": "Translation"}}, "post_processed": null, "supervised_keys": {"input": "si", "output": "en"}, "task_templates": null, "builder_name": "flores", "config_name": "sien", "version": {"version_str": "1.1.0", "description": "", "major": 1, "minor": 1, "patch": 0}, "splits": {"validation": {"name": "validation", "num_bytes": 1031158, "num_examples": 2899, "dataset_name": "flores"}, "test": {"name": "test", "num_bytes": 983563, "num_examples": 2767, "dataset_name": "flores"}}, "download_checksums": {"https://github.com/facebookresearch/flores/raw/main/floresv1/data/wikipedia_en_ne_si_test_sets.tgz": {"num_bytes": 1542781, "checksum": "7a0245bb29fd03b46a1129831c183dfba0efc8452a9739d962759f25141aa648"}}, "download_size": 1542781, "post_processing_size": null, "dataset_size": 2014721, "size_in_bytes": 3557502}}
flores.py CHANGED
@@ -37,7 +37,7 @@ _CITATION = """\
37
  }
38
  """
39
 
40
- _DATA_URL = "https://github.com/facebookresearch/flores/raw/master/floresv1/data/wikipedia_en_ne_si_test_sets.tgz"
41
 
42
  # Tuple that describes a single pair of files with matching translations.
43
  # language_to_file is the map from language (2 letter string: example 'en')
@@ -102,17 +102,18 @@ class Flores(datasets.GeneratorBasedBuilder):
102
  )
103
 
104
  def _split_generators(self, dl_manager):
105
- dl_dir = dl_manager.download_and_extract(_DATA_URL)
106
 
107
  source, target = self.config.language_pair
108
  non_en = source if target == "en" else target
109
- path_tmpl = "{dl_dir}/wikipedia_en_ne_si_test_sets/wikipedia.{split}.{non_en}-en." "{lang}"
110
 
111
  files = {}
112
  for split in ("dev", "devtest"):
113
  files[split] = {
114
- "source_file": path_tmpl.format(dl_dir=dl_dir, split=split, non_en=non_en, lang=source),
115
- "target_file": path_tmpl.format(dl_dir=dl_dir, split=split, non_en=non_en, lang=target),
 
116
  }
117
 
118
  return [
@@ -120,12 +121,16 @@ class Flores(datasets.GeneratorBasedBuilder):
120
  datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs=files["devtest"]),
121
  ]
122
 
123
- def _generate_examples(self, source_file, target_file):
124
  """This function returns the examples in the raw (text) form."""
125
- with open(source_file, encoding="utf-8") as f:
126
- source_sentences = f.read().split("\n")
127
- with open(target_file, encoding="utf-8") as f:
128
- target_sentences = f.read().split("\n")
 
 
 
 
129
 
130
  assert len(target_sentences) == len(source_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
131
  len(source_sentences),
37
  }
38
  """
39
 
40
+ _DATA_URL = "https://github.com/facebookresearch/flores/raw/main/floresv1/data/wikipedia_en_ne_si_test_sets.tgz"
41
 
42
  # Tuple that describes a single pair of files with matching translations.
43
  # language_to_file is the map from language (2 letter string: example 'en')
102
  )
103
 
104
  def _split_generators(self, dl_manager):
105
+ archive = dl_manager.download(_DATA_URL)
106
 
107
  source, target = self.config.language_pair
108
  non_en = source if target == "en" else target
109
+ path_tmpl = "wikipedia_en_ne_si_test_sets/wikipedia.{split}.{non_en}-en." "{lang}"
110
 
111
  files = {}
112
  for split in ("dev", "devtest"):
113
  files[split] = {
114
+ "source_file": path_tmpl.format(split=split, non_en=non_en, lang=source),
115
+ "target_file": path_tmpl.format(split=split, non_en=non_en, lang=target),
116
+ "files": dl_manager.iter_archive(archive),
117
  }
118
 
119
  return [
121
  datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs=files["devtest"]),
122
  ]
123
 
124
+ def _generate_examples(self, files, source_file, target_file):
125
  """This function returns the examples in the raw (text) form."""
126
+ source_sentences, target_sentences = None, None
127
+ for path, f in files:
128
+ if path == source_file:
129
+ source_sentences = f.read().decode("utf-8").split("\n")
130
+ elif path == target_file:
131
+ target_sentences = f.read().decode("utf-8").split("\n")
132
+ if source_sentences is not None and target_sentences is not None:
133
+ break
134
 
135
  assert len(target_sentences) == len(source_sentences), "Sizes do not match: %d vs %d for %s vs %s." % (
136
  len(source_sentences),