Datasets:
Sub-tasks:
multi-class-classification
Languages:
English
Size:
1K<n<10K
Tags:
natural-language-understanding
ideology classification
text classification
natural language processing
License:
EricR401S
commited on
Commit
·
c2aa0a6
1
Parent(s):
ceff78e
testing push
Browse files
Pill_Ideologies-Post_Titles.py
CHANGED
@@ -46,7 +46,7 @@ which have risen in response to the clashes between traditional gender roles and
|
|
46 |
_HOMEPAGE = "https://huggingface.co/datasets/steamcyclone/Pill_Ideologies-Post_Titles"
|
47 |
|
48 |
# TODO: Add the licence for the dataset here if you can find it
|
49 |
-
_LICENSE = "cc"
|
50 |
|
51 |
# TODO: Add link to the official dataset URLs here
|
52 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
@@ -79,15 +79,25 @@ class SubRedditPosts(datasets.GeneratorBasedBuilder):
|
|
79 |
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
80 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
81 |
BUILDER_CONFIGS = [
|
82 |
-
datasets.BuilderConfig(
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
]
|
85 |
|
86 |
DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
87 |
|
88 |
def _info(self):
|
89 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
90 |
-
if
|
|
|
|
|
91 |
features = datasets.Features(
|
92 |
{
|
93 |
"subreddit": datasets.Value("string"),
|
@@ -163,7 +173,7 @@ class SubRedditPosts(datasets.GeneratorBasedBuilder):
|
|
163 |
# These kwargs will be passed to _generate_examples
|
164 |
gen_kwargs={
|
165 |
"filepath": os.path.join(data_dir, "test.jsonl"),
|
166 |
-
"split": "test"
|
167 |
},
|
168 |
),
|
169 |
]
|
@@ -186,4 +196,7 @@ class SubRedditPosts(datasets.GeneratorBasedBuilder):
|
|
186 |
yield key, {
|
187 |
"sentence": data["sentence"],
|
188 |
"option2": data["option2"],
|
189 |
-
"second_domain_answer":
|
|
|
|
|
|
|
|
46 |
_HOMEPAGE = "https://huggingface.co/datasets/steamcyclone/Pill_Ideologies-Post_Titles"
|
47 |
|
48 |
# TODO: Add the licence for the dataset here if you can find it
|
49 |
+
_LICENSE = "cc" # cc-by-4.0
|
50 |
|
51 |
# TODO: Add link to the official dataset URLs here
|
52 |
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
|
|
79 |
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
80 |
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
81 |
BUILDER_CONFIGS = [
|
82 |
+
datasets.BuilderConfig(
|
83 |
+
name="first_domain",
|
84 |
+
version=VERSION,
|
85 |
+
description="This part of my dataset covers a first domain",
|
86 |
+
),
|
87 |
+
datasets.BuilderConfig(
|
88 |
+
name="second_domain",
|
89 |
+
version=VERSION,
|
90 |
+
description="This part of my dataset covers a second domain",
|
91 |
+
),
|
92 |
]
|
93 |
|
94 |
DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
95 |
|
96 |
def _info(self):
|
97 |
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
98 |
+
if (
|
99 |
+
self.config.name == "first_domain"
|
100 |
+
): # This is the name of the configuration selected in BUILDER_CONFIGS above
|
101 |
features = datasets.Features(
|
102 |
{
|
103 |
"subreddit": datasets.Value("string"),
|
|
|
173 |
# These kwargs will be passed to _generate_examples
|
174 |
gen_kwargs={
|
175 |
"filepath": os.path.join(data_dir, "test.jsonl"),
|
176 |
+
"split": "test",
|
177 |
},
|
178 |
),
|
179 |
]
|
|
|
196 |
yield key, {
|
197 |
"sentence": data["sentence"],
|
198 |
"option2": data["option2"],
|
199 |
+
"second_domain_answer": (
|
200 |
+
"" if split == "test" else data["second_domain_answer"]
|
201 |
+
),
|
202 |
+
}
|