Valahaar commited on
Commit
986bcac
1 Parent(s): 88e5b61

working now?

Browse files
Files changed (2) hide show
  1. data/wmt/splits.txt +4 -0
  2. wsdmt.py +16 -17
data/wmt/splits.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ train
2
+ dev
3
+ test_2014
4
+ test_2019
wsdmt.py CHANGED
@@ -70,26 +70,25 @@ class WSDMTDataset(datasets.GeneratorBasedBuilder):
70
  )
71
 
72
  def _split_generators(self, dl_manager: DownloadManager):
 
 
 
 
 
73
  urls = {
74
  split: {
75
- self.config.lang1: f"data/{self.config.corpus}/{split}/{self.config.lang1}.jsonl",
76
- self.config.lang2: f"data/{self.config.corpus}/{split}/{self.config.lang2}.jsonl",
77
  }
78
- for split in ['dev']
79
  }
80
- x = dl_manager.download_and_extract(urls)
81
- print(x)
82
-
83
- splits = [
84
- (datasets.Split.TRAIN, 'train'),
85
- (datasets.Split.VALIDATION, 'dev'),
86
- (datasets.Split('test_2014'), 'test_2014'),
87
- (datasets.Split('test_2019'), 'test_2019'),
88
- ]
89
  return [
90
- datasets.SplitGenerator(name=split, gen_kwargs=dict(
91
- path_lang1=self.config.path_for(path, self.config.lang1),
92
- path_lang2=self.config.path_for(path, self.config.lang2),
93
- ))
94
- for split, path in splits
 
95
  ]
 
70
  )
71
 
72
  def _split_generators(self, dl_manager: DownloadManager):
73
+ splits_file = dl_manager.download(f'data/{self.config.corpus}/splits.txt')
74
+
75
+ with open(splits_file) as f:
76
+ split_names = [line.rstrip() for line in f]
77
+
78
  urls = {
79
  split: {
80
+ self.config.lang1: self.config.path_for(split, self.config.lang1),
81
+ self.config.lang2: self.config.path_for(split, self.config.lang2),
82
  }
83
+ for split in split_names
84
  }
85
+ downloaded = dl_manager.download_and_extract(urls)
86
+
 
 
 
 
 
 
 
87
  return [
88
+ datasets.SplitGenerator(name=split,
89
+ gen_kwargs=dict(
90
+ path_lang1=paths[self.config.lang1],
91
+ path_lang2=paths[self.config.lang2],
92
+ ))
93
+ for split, paths in downloaded.items()
94
  ]