Datasets:
Fix?
Browse files- multipl_e.py +23 -7
multipl_e.py
CHANGED
|
@@ -34,18 +34,34 @@ _LANGUAGES = [
|
|
| 34 |
|
| 35 |
_VARIATIONS = [ "keep", "transform", "reworded", "remove" ]
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
class MultiPLE(datasets.GeneratorBasedBuilder):
|
|
|
|
| 39 |
|
| 40 |
BUILDER_CONFIGS = [
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
for language in _LANGUAGES
|
|
|
|
| 46 |
]
|
| 47 |
|
| 48 |
-
DEFAULT_CONFIG_NAME = "cpp-
|
| 49 |
|
| 50 |
def _info(self):
|
| 51 |
return datasets.DatasetInfo(
|
|
@@ -79,7 +95,7 @@ class MultiPLE(datasets.GeneratorBasedBuilder):
|
|
| 79 |
)
|
| 80 |
]
|
| 81 |
|
| 82 |
-
def _generate_examples(self, filepath
|
| 83 |
with open(filepath, encoding="utf-8") as f:
|
| 84 |
data = json.load(f)
|
| 85 |
for id_, row in enumerate(data):
|
|
|
|
| 34 |
|
| 35 |
_VARIATIONS = [ "keep", "transform", "reworded", "remove" ]
|
| 36 |
|
| 37 |
+
class MultiPLEBuilderConfig(datasets.BuilderConfig):
|
| 38 |
+
"""BuilderConfig for MultiPLEBuilderConfig."""
|
| 39 |
+
|
| 40 |
+
def __init__(
|
| 41 |
+
self,
|
| 42 |
+
language,
|
| 43 |
+
variation,
|
| 44 |
+
**kwargs,
|
| 45 |
+
):
|
| 46 |
+
self.language = language
|
| 47 |
+
self.variation = variation
|
| 48 |
+
name = f"{language}-{variation}"
|
| 49 |
+
kwargs["name"] = name
|
| 50 |
+
super(MultiPLEBuilderConfig, self).__init__(**kwargs)
|
| 51 |
|
| 52 |
class MultiPLE(datasets.GeneratorBasedBuilder):
|
| 53 |
+
BUILDER_CONFIG_CLASS = MultiPLEBuilderConfig
|
| 54 |
|
| 55 |
BUILDER_CONFIGS = [
|
| 56 |
+
MultiPLEBuilderConfig(
|
| 57 |
+
language=language,
|
| 58 |
+
variation=variation,
|
| 59 |
+
version=datasets.Version("1.0.0"))
|
| 60 |
+
for language in _LANGUAGES
|
| 61 |
+
for variation in _VARIATIONS
|
| 62 |
]
|
| 63 |
|
| 64 |
+
DEFAULT_CONFIG_NAME = "cpp-reworded"
|
| 65 |
|
| 66 |
def _info(self):
|
| 67 |
return datasets.DatasetInfo(
|
|
|
|
| 95 |
)
|
| 96 |
]
|
| 97 |
|
| 98 |
+
def _generate_examples(self, filepath):
|
| 99 |
with open(filepath, encoding="utf-8") as f:
|
| 100 |
data = json.load(f)
|
| 101 |
for id_, row in enumerate(data):
|