mathiascreutz
commited on
Commit
•
fe67c05
1
Parent(s):
aa5615d
Testing configs
Browse files- opusparcus.py +5 -5
opusparcus.py
CHANGED
@@ -63,7 +63,7 @@ class OpusparcusConfig(datasets.BuilderConfig):
|
|
63 |
**kwargs: keyword arguments forwarded to super.
|
64 |
"""
|
65 |
super(OpusparcusConfig, self).__init__(
|
66 |
-
|
67 |
description="Opusparcus dataset for {0}".format(lang),
|
68 |
**kwargs,
|
69 |
)
|
@@ -85,7 +85,7 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
|
|
85 |
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
86 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
87 |
BUILDER_CONFIGS = [
|
88 |
-
OpusparcusConfig(
|
89 |
]
|
90 |
|
91 |
#DEFAULT_CONFIG_NAME = "test" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
@@ -142,7 +142,7 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
|
|
142 |
name=datasets.Split.TEST,
|
143 |
# These kwargs will be passed to _generate_examples
|
144 |
gen_kwargs={
|
145 |
-
"
|
146 |
"filepath": data_dir["test"],
|
147 |
"split": "test"
|
148 |
},
|
@@ -151,7 +151,7 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
|
|
151 |
name=datasets.Split.VALIDATION,
|
152 |
# These kwargs will be passed to _generate_examples
|
153 |
gen_kwargs={
|
154 |
-
"
|
155 |
"filepath": data_dir["validation"],
|
156 |
"split": "validation",
|
157 |
},
|
@@ -159,7 +159,7 @@ class Opusparcus(datasets.GeneratorBasedBuilder):
|
|
159 |
]
|
160 |
|
161 |
def _generate_examples(
|
162 |
-
self,
|
163 |
):
|
164 |
|
165 |
""" Yields examples as (key, example) tuples. """
|
|
|
63 |
**kwargs: keyword arguments forwarded to super.
|
64 |
"""
|
65 |
super(OpusparcusConfig, self).__init__(
|
66 |
+
lang="{0}".format(lang),
|
67 |
description="Opusparcus dataset for {0}".format(lang),
|
68 |
**kwargs,
|
69 |
)
|
|
|
85 |
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
86 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
87 |
BUILDER_CONFIGS = [
|
88 |
+
OpusparcusConfig(lang="de", version=VERSION, description="This part of my dataset covers a first domain"),
|
89 |
]
|
90 |
|
91 |
#DEFAULT_CONFIG_NAME = "test" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
|
|
142 |
name=datasets.Split.TEST,
|
143 |
# These kwargs will be passed to _generate_examples
|
144 |
gen_kwargs={
|
145 |
+
"lang": self.config.lang,
|
146 |
"filepath": data_dir["test"],
|
147 |
"split": "test"
|
148 |
},
|
|
|
151 |
name=datasets.Split.VALIDATION,
|
152 |
# These kwargs will be passed to _generate_examples
|
153 |
gen_kwargs={
|
154 |
+
"lang": self.config.lang,
|
155 |
"filepath": data_dir["validation"],
|
156 |
"split": "validation",
|
157 |
},
|
|
|
159 |
]
|
160 |
|
161 |
def _generate_examples(
|
162 |
+
self, lang, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
163 |
):
|
164 |
|
165 |
""" Yields examples as (key, example) tuples. """
|