Datasets:
MLRS
/

Modalities:
Text
Languages:
Maltese
Libraries:
Datasets
License:
KurtMica commited on
Commit
0d61e8e
1 Parent(s): 61bb44d

Data subset remote file download fix.

Browse files
Files changed (1) hide show
  1. korpus_malti.py +6 -2
korpus_malti.py CHANGED
@@ -1,5 +1,6 @@
1
  import json
2
  import os
 
3
  from pathlib import Path
4
 
5
  import datasets
@@ -174,8 +175,11 @@ class KorpusMalti(datasets.GeneratorBasedBuilder):
174
  else:
175
  file_pattern = _SUBSET_URL_PATTERN.format(self.config.name)
176
  base_path = self.base_path or ""
177
- file_paths = [path.relative_to(base_path)
178
- for path in Path(os.path.join(base_path, _URL)).glob(file_pattern)]
 
 
 
179
 
180
  data_files = dl_manager.download_and_extract(file_paths)
181
  data_split = [
 
1
  import json
2
  import os
3
+ import urllib
4
  from pathlib import Path
5
 
6
  import datasets
 
175
  else:
176
  file_pattern = _SUBSET_URL_PATTERN.format(self.config.name)
177
  base_path = self.base_path or ""
178
+ if urllib.parse.urlparse(base_path).scheme in ("http", "https"): # pre-determined files
179
+ file_paths = list(self.info.download_checksums.keys())
180
+ else: # dynamically change depending on locally available files.
181
+ file_paths = [path.relative_to(base_path)
182
+ for path in Path(os.path.join(base_path, _URL)).glob(file_pattern)]
183
 
184
  data_files = dl_manager.download_and_extract(file_paths)
185
  data_split = [