Seosnaps commited on
Commit
9365ecc
1 Parent(s): a5d0faa

Update hausa_2_eng_2.py

Browse files
Files changed (1) hide show
  1. hausa_2_eng_2.py +6 -6
hausa_2_eng_2.py CHANGED
@@ -20,9 +20,9 @@ from .release_stats import STATS
20
 
21
  _BASE_URL = "https://huggingface.co/datasets/Seon25/hausa_2_eng_2/resolve/main"
22
 
23
- _AUDIO_URL = _BASE_URL + "audio/ha/{split}/ha_{split}_0.tar"
24
 
25
- _TRANSCRIPT_URL = _BASE_URL + "transcript/ha/{split}.tsv"
26
  _N_SHARDS_URL ="n_shards.json"
27
 
28
 
@@ -77,7 +77,7 @@ class Hausa2Eng(datasets.GeneratorBasedBuilder):
77
  )
78
 
79
  def _split_generators(self, dl_manager):
80
- lang = "ha"
81
  n_shards_path = dl_manager.download_and_extract(_N_SHARDS_URL)
82
  with open(n_shards_path, encoding="utf-8") as f:
83
  n_shards = json.load(f)
@@ -86,12 +86,12 @@ class Hausa2Eng(datasets.GeneratorBasedBuilder):
86
  splits = ("train", "dev", "test", "other", "invalidated")
87
  for split in splits:
88
  audio_urls[split] = [
89
- _AUDIO_URL.format(lang="ha", split=split, 0)
90
  ]
91
  archive_paths = dl_manager.download(audio_urls)
92
  local_extracted_archive_paths = dl_manager.extract(archive_paths) if not dl_manager.is_streaming else {}
93
 
94
- meta_urls = {split: _TRANSCRIPT_URL.format(lang="ha", split=split) for split in splits}
95
  meta_paths = dl_manager.download_and_extract(meta_urls)
96
 
97
  split_generators = []
@@ -115,7 +115,7 @@ class Hausa2Eng(datasets.GeneratorBasedBuilder):
115
  return split_generators
116
 
117
  def _generate_examples(self, local_extracted_archive_paths, archives, meta_path):
118
- data_fields = list(self._info().features.keys())
119
  metadata = {}
120
  with open(meta_path, encoding="utf-8") as f:
121
  reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
 
20
 
21
  _BASE_URL = "https://huggingface.co/datasets/Seon25/hausa_2_eng_2/resolve/main"
22
 
23
+ _AUDIO_URL = _BASE_URL + "audio/ha/{split}/ha_{split}_{shard_idx}.tar"
24
 
25
+ _TRANSCRIPT_URL = _BASE_URL + "transcript/{lang}/{split}.tsv"
26
  _N_SHARDS_URL ="n_shards.json"
27
 
28
 
 
77
  )
78
 
79
  def _split_generators(self, dl_manager):
80
+ lang = self.config.name
81
  n_shards_path = dl_manager.download_and_extract(_N_SHARDS_URL)
82
  with open(n_shards_path, encoding="utf-8") as f:
83
  n_shards = json.load(f)
 
86
  splits = ("train", "dev", "test", "other", "invalidated")
87
  for split in splits:
88
  audio_urls[split] = [
89
+ _AUDIO_URL.format(lang= lang, split=split, shard_idx=i) for i in range(n_shards[lang][split])
90
  ]
91
  archive_paths = dl_manager.download(audio_urls)
92
  local_extracted_archive_paths = dl_manager.extract(archive_paths) if not dl_manager.is_streaming else {}
93
 
94
+ meta_urls = {split: _TRANSCRIPT_URL.format(lang=lang, split=split) for split in splits}
95
  meta_paths = dl_manager.download_and_extract(meta_urls)
96
 
97
  split_generators = []
 
115
  return split_generators
116
 
117
  def _generate_examples(self, local_extracted_archive_paths, archives, meta_path):
118
+ data_fields = list (self._info().features.keys())
119
  metadata = {}
120
  with open(meta_path, encoding="utf-8") as f:
121
  reader = csv.DictReader(f, delimiter="\t", quoting=csv.QUOTE_NONE)