Datasets:
Tasks:
Text Classification
Sub-tasks:
multi-label-classification
Languages:
English
Size:
10K<n<100K
License:
Peixian Wang
commited on
Commit
·
194a098
1
Parent(s):
1826f48
update with better config options
Browse files- rtGender.py +11 -11
rtGender.py
CHANGED
|
@@ -80,22 +80,22 @@ class rtGender(datasets.GeneratorBasedBuilder):
|
|
| 80 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 81 |
BUILDER_CONFIGS = [
|
| 82 |
datasets.BuilderConfig(
|
| 83 |
-
name=
|
| 84 |
version=VERSION,
|
| 85 |
-
description="
|
| 86 |
),
|
| 87 |
datasets.BuilderConfig(
|
| 88 |
-
name=
|
| 89 |
version=VERSION,
|
| 90 |
-
description="
|
| 91 |
),
|
| 92 |
datasets.BuilderConfig(
|
| 93 |
-
name=
|
| 94 |
version=VERSION,
|
| 95 |
-
description="
|
| 96 |
)
|
| 97 |
]
|
| 98 |
-
DEFAULT_CONFIG_NAME =
|
| 99 |
|
| 100 |
POSTS_FEATURES = {
|
| 101 |
"source": datasets.Value("string"),
|
|
@@ -134,10 +134,10 @@ class rtGender(datasets.GeneratorBasedBuilder):
|
|
| 134 |
def _info(self):
|
| 135 |
|
| 136 |
if (
|
| 137 |
-
self.config.name == Config.ANNOTATIONS
|
| 138 |
): # This is the name of the configuration selected in BUILDER_CONFIGS above
|
| 139 |
features = datasets.Features(self.ANNOTATION_FEATURES)
|
| 140 |
-
elif self.config.name == Config.POSTS:
|
| 141 |
features = datasets.Features(self.POSTS_FEATURES)
|
| 142 |
else:
|
| 143 |
features = datasets.Features(self.RESPONSES_FEATURES)
|
|
@@ -166,9 +166,9 @@ class rtGender(datasets.GeneratorBasedBuilder):
|
|
| 166 |
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 167 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 168 |
data_dir = dl_manager.download_and_extract(_URL)
|
| 169 |
-
if self.config.name == Config.ANNOTATIONS:
|
| 170 |
files = ["annotations.csv"]
|
| 171 |
-
elif self.config.name == Config.POSTS:
|
| 172 |
files = [
|
| 173 |
"facebook_congress_posts.csv",
|
| 174 |
"facebook_wiki_posts.csv",
|
|
|
|
| 80 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 81 |
BUILDER_CONFIGS = [
|
| 82 |
datasets.BuilderConfig(
|
| 83 |
+
name=Config.ANNOTATIONS.value,
|
| 84 |
version=VERSION,
|
| 85 |
+
description="Retrieves only the annotations.",
|
| 86 |
),
|
| 87 |
datasets.BuilderConfig(
|
| 88 |
+
name=Config.POSTS.value,
|
| 89 |
version=VERSION,
|
| 90 |
+
description="Retrieves all posts.",
|
| 91 |
),
|
| 92 |
datasets.BuilderConfig(
|
| 93 |
+
name=Config.RESPONSES.value,
|
| 94 |
version=VERSION,
|
| 95 |
+
description="Retrieves all responses.",
|
| 96 |
)
|
| 97 |
]
|
| 98 |
+
DEFAULT_CONFIG_NAME = Config.ANNOTATIONS.value # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 99 |
|
| 100 |
POSTS_FEATURES = {
|
| 101 |
"source": datasets.Value("string"),
|
|
|
|
| 134 |
def _info(self):
|
| 135 |
|
| 136 |
if (
|
| 137 |
+
self.config.name == Config.ANNOTATIONS.value
|
| 138 |
): # This is the name of the configuration selected in BUILDER_CONFIGS above
|
| 139 |
features = datasets.Features(self.ANNOTATION_FEATURES)
|
| 140 |
+
elif self.config.name == Config.POSTS.value:
|
| 141 |
features = datasets.Features(self.POSTS_FEATURES)
|
| 142 |
else:
|
| 143 |
features = datasets.Features(self.RESPONSES_FEATURES)
|
|
|
|
| 166 |
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 167 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 168 |
data_dir = dl_manager.download_and_extract(_URL)
|
| 169 |
+
if self.config.name == Config.ANNOTATIONS.value:
|
| 170 |
files = ["annotations.csv"]
|
| 171 |
+
elif self.config.name == Config.POSTS.value:
|
| 172 |
files = [
|
| 173 |
"facebook_congress_posts.csv",
|
| 174 |
"facebook_wiki_posts.csv",
|