qanastek commited on
Commit
3ed37b1
1 Parent(s): 7e63be7
Files changed (1) hide show
  1. WMT-16-PubMed.py +28 -4
WMT-16-PubMed.py CHANGED
@@ -46,6 +46,7 @@ _CITATION = """
46
  """
47
 
48
  _LANGUAGE_PAIRS = ['en-pt', 'en-es', 'en-fr']
 
49
 
50
  _LICENSE = """
51
  This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">Attribution 4.0 International (CC BY 4.0) License</a>.
@@ -58,15 +59,38 @@ http://www.statmt.org/wmt16/biomedical-translation-task.html
58
 
59
  _URL = "https://huggingface.co/datasets/qanastek/WMT-16-PubMed/resolve/main/WMT16.csv.gz"
60
 
 
 
 
 
 
 
 
 
 
 
 
61
  class WMT_16_PubMed(datasets.GeneratorBasedBuilder):
62
  """WMT-16-PubMed dataset."""
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  # BUILDER_CONFIGS = [
65
- # datasets.BuilderConfig(name=name, version=datasets.Version("16.0.0"), description=_DESCRIPTION, citation=_CITATION) for name in _LANGUAGE_PAIRS
66
  # ]
67
 
68
- DEFAULT_CONFIG_NAME = "en-fr"
69
-
70
  def _info(self):
71
  src, target = self.config.name.split("-")
72
  pair = (src, target)
@@ -78,7 +102,7 @@ class WMT_16_PubMed(datasets.GeneratorBasedBuilder):
78
  supervised_keys=(src, target),
79
  homepage="https://www.statmt.org/wmt16/biomedical-translation-task.html",
80
  citation=_CITATION,
81
- license=_LICENSE,
82
  )
83
 
84
  def _split_generators(self, dl_manager):
 
46
  """
47
 
48
  _LANGUAGE_PAIRS = ['en-pt', 'en-es', 'en-fr']
49
+ _LANGUAGE_PAIRS_TUPLES = [('en','pt'), ('en','es'), ('en','fr')]
50
 
51
  _LICENSE = """
52
  This work is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">Attribution 4.0 International (CC BY 4.0) License</a>.
 
59
 
60
  _URL = "https://huggingface.co/datasets/qanastek/WMT-16-PubMed/resolve/main/WMT16.csv.gz"
61
 
62
+
63
+ class WMT_16_CONFIG(datasets.BuilderConfig):
64
+ def __init__(self, *args, lang1=None, lang2=None, **kwargs):
65
+ super().__init__(
66
+ *args,
67
+ name=f"{lang1}-{lang2}",
68
+ **kwargs,
69
+ )
70
+ self.lang1 = lang1
71
+ self.lang2 = lang2
72
+
73
  class WMT_16_PubMed(datasets.GeneratorBasedBuilder):
74
  """WMT-16-PubMed dataset."""
75
 
76
+ DEFAULT_CONFIG_NAME = "en-fr"
77
+
78
+
79
+ BUILDER_CONFIGS = [
80
+ WMT_16_CONFIG(
81
+ lang1=lang1,
82
+ lang2=lang2,
83
+ description=f"Translating {lang1} to {lang2} or vice versa",
84
+ version=datasets.Version("16.0.0"),
85
+ )
86
+ for lang1, lang2 in _LANGUAGE_PAIRS_TUPLES
87
+ ]
88
+ BUILDER_CONFIG_CLASS = WMT_16_CONFIG
89
+
90
  # BUILDER_CONFIGS = [
91
+ # datasets.BuilderConfig(name=name, version=datasets.Version("16.0.0"), description=_DESCRIPTION) for name in _LANGUAGE_PAIRS
92
  # ]
93
 
 
 
94
  def _info(self):
95
  src, target = self.config.name.split("-")
96
  pair = (src, target)
 
102
  supervised_keys=(src, target),
103
  homepage="https://www.statmt.org/wmt16/biomedical-translation-task.html",
104
  citation=_CITATION,
105
+ # license=_LICENSE,
106
  )
107
 
108
  def _split_generators(self, dl_manager):