Update E3C.py
Browse files
E3C.py
CHANGED
|
@@ -39,17 +39,21 @@ _LANGUAGES = ["English","Spanish","Basque","French","Italian"]
|
|
| 39 |
class E3C(datasets.GeneratorBasedBuilder):
|
| 40 |
|
| 41 |
BUILDER_CONFIGS = [
|
| 42 |
-
datasets.BuilderConfig(name=f"{lang}", version="1.0.0", description=f"The {lang} subset of the E3C corpus") for lang in _LANGUAGES
|
| 43 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
-
DEFAULT_CONFIG_NAME = "
|
| 46 |
|
| 47 |
def _info(self):
|
| 48 |
|
| 49 |
if self.config.name == "default":
|
| 50 |
self.config.name = self.DEFAULT_CONFIG_NAME
|
| 51 |
|
| 52 |
-
if self.config.name
|
| 53 |
|
| 54 |
features = datasets.Features(
|
| 55 |
{
|
|
@@ -64,7 +68,7 @@ class E3C(datasets.GeneratorBasedBuilder):
|
|
| 64 |
}
|
| 65 |
)
|
| 66 |
|
| 67 |
-
elif self.config.name
|
| 68 |
|
| 69 |
features = datasets.Features(
|
| 70 |
{
|
|
@@ -79,8 +83,6 @@ class E3C(datasets.GeneratorBasedBuilder):
|
|
| 79 |
}
|
| 80 |
)
|
| 81 |
|
| 82 |
-
|
| 83 |
-
|
| 84 |
return datasets.DatasetInfo(
|
| 85 |
description=_DESCRIPTION,
|
| 86 |
features=features,
|
|
@@ -92,7 +94,7 @@ class E3C(datasets.GeneratorBasedBuilder):
|
|
| 92 |
|
| 93 |
data_dir = dl_manager.download_and_extract(_URL)
|
| 94 |
|
| 95 |
-
if self.config.name
|
| 96 |
|
| 97 |
return [
|
| 98 |
datasets.SplitGenerator(
|
|
@@ -118,7 +120,7 @@ class E3C(datasets.GeneratorBasedBuilder):
|
|
| 118 |
),
|
| 119 |
]
|
| 120 |
|
| 121 |
-
elif self.config.name
|
| 122 |
|
| 123 |
return [
|
| 124 |
datasets.SplitGenerator(
|
|
@@ -251,7 +253,7 @@ class E3C(datasets.GeneratorBasedBuilder):
|
|
| 251 |
|
| 252 |
key += 1
|
| 253 |
|
| 254 |
-
if self.config.name
|
| 255 |
|
| 256 |
if split != "test":
|
| 257 |
|
|
@@ -277,7 +279,7 @@ class E3C(datasets.GeneratorBasedBuilder):
|
|
| 277 |
for r in all_res:
|
| 278 |
yield r["id"], r
|
| 279 |
|
| 280 |
-
elif self.config.name
|
| 281 |
|
| 282 |
ids = [r["id"] for r in all_res]
|
| 283 |
|
|
|
|
| 39 |
class E3C(datasets.GeneratorBasedBuilder):
|
| 40 |
|
| 41 |
BUILDER_CONFIGS = [
|
| 42 |
+
datasets.BuilderConfig(name=f"{lang}_clinical", version="1.0.0", description=f"The {lang} subset of the E3C corpus") for lang in _LANGUAGES
|
| 43 |
]
|
| 44 |
+
|
| 45 |
+
BUILDER_CONFIGS += [
|
| 46 |
+
datasets.BuilderConfig(name=f"{lang}_temporal", version="1.0.0", description=f"The {lang} subset of the E3C corpus") for lang in _LANGUAGES
|
| 47 |
+
]
|
| 48 |
|
| 49 |
+
DEFAULT_CONFIG_NAME = "French_clinical"
|
| 50 |
|
| 51 |
def _info(self):
|
| 52 |
|
| 53 |
if self.config.name == "default":
|
| 54 |
self.config.name = self.DEFAULT_CONFIG_NAME
|
| 55 |
|
| 56 |
+
if self.config.name.endswith("clinical"):
|
| 57 |
|
| 58 |
features = datasets.Features(
|
| 59 |
{
|
|
|
|
| 68 |
}
|
| 69 |
)
|
| 70 |
|
| 71 |
+
elif self.config.name.endswith("temporal"):
|
| 72 |
|
| 73 |
features = datasets.Features(
|
| 74 |
{
|
|
|
|
| 83 |
}
|
| 84 |
)
|
| 85 |
|
|
|
|
|
|
|
| 86 |
return datasets.DatasetInfo(
|
| 87 |
description=_DESCRIPTION,
|
| 88 |
features=features,
|
|
|
|
| 94 |
|
| 95 |
data_dir = dl_manager.download_and_extract(_URL)
|
| 96 |
|
| 97 |
+
if self.config.name.endswith("clinical"):
|
| 98 |
|
| 99 |
return [
|
| 100 |
datasets.SplitGenerator(
|
|
|
|
| 120 |
),
|
| 121 |
]
|
| 122 |
|
| 123 |
+
elif self.config.name.endswith("temporal"):
|
| 124 |
|
| 125 |
return [
|
| 126 |
datasets.SplitGenerator(
|
|
|
|
| 253 |
|
| 254 |
key += 1
|
| 255 |
|
| 256 |
+
if self.config.name.endswith("clinical"):
|
| 257 |
|
| 258 |
if split != "test":
|
| 259 |
|
|
|
|
| 279 |
for r in all_res:
|
| 280 |
yield r["id"], r
|
| 281 |
|
| 282 |
+
elif self.config.name.endswith("temporal"):
|
| 283 |
|
| 284 |
ids = [r["id"] for r in all_res]
|
| 285 |
|