mathiascreutz
commited on
Commit
·
d98fbce
1
Parent(s):
7bdaba4
Testing configs
Browse files- opusparcus.py +8 -4
opusparcus.py
CHANGED
|
@@ -56,7 +56,7 @@ _VERSION = datasets.Version("1.0.0", "")
|
|
| 56 |
class OpusparcusConfig(datasets.BuilderConfig):
|
| 57 |
"""BuilderConfig for Opusparcus."""
|
| 58 |
|
| 59 |
-
def __init__(self, lang=None, **kwargs):
|
| 60 |
"""BuilderConfig for Wikipedia.
|
| 61 |
Args:
|
| 62 |
language: string, the language code for the Wikipedia dump to use.
|
|
@@ -65,17 +65,20 @@ class OpusparcusConfig(datasets.BuilderConfig):
|
|
| 65 |
**kwargs: keyword arguments forwarded to super.
|
| 66 |
"""
|
| 67 |
super(OpusparcusConfig, self).__init__(
|
| 68 |
-
name="{0}".format(lang),
|
| 69 |
description="Opusparcus dataset for {0}".format(lang),
|
| 70 |
**kwargs,
|
| 71 |
)
|
| 72 |
self.lang = lang
|
|
|
|
| 73 |
|
| 74 |
class Opusparcus(datasets.GeneratorBasedBuilder):
|
| 75 |
|
| 76 |
"""TODO: Short description of my dataset."""
|
| 77 |
|
| 78 |
LANGS = [ "de", "en", "fi", "fr", "ru", "sv" ]
|
|
|
|
|
|
|
| 79 |
|
| 80 |
# This is an example of a dataset with multiple configurations.
|
| 81 |
# If you don't want/need to define several sub-sets in your dataset,
|
|
@@ -89,7 +92,8 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
|
|
| 89 |
BUILDER_CONFIGS = [
|
| 90 |
OpusparcusConfig(lang=lang, version=_VERSION) for lang in LANGS
|
| 91 |
]
|
| 92 |
-
|
|
|
|
| 93 |
#DEFAULT_CONFIG_NAME = "test" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 94 |
|
| 95 |
def _info(self):
|
|
@@ -161,7 +165,7 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
|
|
| 161 |
]
|
| 162 |
|
| 163 |
def _generate_examples(
|
| 164 |
-
self, lang, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 165 |
):
|
| 166 |
|
| 167 |
""" Yields examples as (key, example) tuples. """
|
|
|
|
| 56 |
class OpusparcusConfig(datasets.BuilderConfig):
|
| 57 |
"""BuilderConfig for Opusparcus."""
|
| 58 |
|
| 59 |
+
def __init__(self, lang=None, quality=100, **kwargs):
|
| 60 |
"""BuilderConfig for Wikipedia.
|
| 61 |
Args:
|
| 62 |
language: string, the language code for the Wikipedia dump to use.
|
|
|
|
| 65 |
**kwargs: keyword arguments forwarded to super.
|
| 66 |
"""
|
| 67 |
super(OpusparcusConfig, self).__init__(
|
| 68 |
+
name="{0}.{1}".format(lang, quality),
|
| 69 |
description="Opusparcus dataset for {0}".format(lang),
|
| 70 |
**kwargs,
|
| 71 |
)
|
| 72 |
self.lang = lang
|
| 73 |
+
self.quality = quality
|
| 74 |
|
| 75 |
class Opusparcus(datasets.GeneratorBasedBuilder):
|
| 76 |
|
| 77 |
"""TODO: Short description of my dataset."""
|
| 78 |
|
| 79 |
LANGS = [ "de", "en", "fi", "fr", "ru", "sv" ]
|
| 80 |
+
|
| 81 |
+
QUALITIES = [ 95, 90, 85, 80, 75, 70, 65, 60 ]
|
| 82 |
|
| 83 |
# This is an example of a dataset with multiple configurations.
|
| 84 |
# If you don't want/need to define several sub-sets in your dataset,
|
|
|
|
| 92 |
BUILDER_CONFIGS = [
|
| 93 |
OpusparcusConfig(lang=lang, version=_VERSION) for lang in LANGS
|
| 94 |
]
|
| 95 |
+
BUILDER_CONFIGS.extend(OpusparcusConfig(lang=lang, quality=quality, version=_VERSION) for lang in LANGS for quality in QUALITIES))
|
| 96 |
+
|
| 97 |
#DEFAULT_CONFIG_NAME = "test" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 98 |
|
| 99 |
def _info(self):
|
|
|
|
| 165 |
]
|
| 166 |
|
| 167 |
def _generate_examples(
|
| 168 |
+
self, lang, quality, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 169 |
):
|
| 170 |
|
| 171 |
""" Yields examples as (key, example) tuples. """
|