Datasets:
Commit
·
42fc434
1
Parent(s):
8e3ed61
Update humsetbias.py
Browse files- humsetbias.py +4 -4
humsetbias.py
CHANGED
@@ -210,7 +210,7 @@ class Humset(datasets.GeneratorBasedBuilder):
|
|
210 |
|
211 |
return splits
|
212 |
|
213 |
-
def _generate_examples(self, filepath
|
214 |
|
215 |
"""This function returns the examples in the raw (text) form."""
|
216 |
with open(filepath, encoding="utf-8") as f:
|
@@ -218,11 +218,11 @@ class Humset(datasets.GeneratorBasedBuilder):
|
|
218 |
idx = 0
|
219 |
for line in data:
|
220 |
row = json.loads(line)
|
221 |
-
if
|
222 |
row = {k: v for k, v in row if k in HUMSETBIAS_GENERAL}
|
223 |
-
elif
|
224 |
row = {k: v for k, v in row if k in HUMSETBIAS_FEATURES_GENDER}
|
225 |
-
elif
|
226 |
row = {k: v for k, v in row if k in HUMSETBIAS_FEATURES_COUNTRY}
|
227 |
#if self.config.name == "1.0.0":
|
228 |
yield idx, row
|
|
|
210 |
|
211 |
return splits
|
212 |
|
213 |
+
def _generate_examples(self, filepath):
|
214 |
|
215 |
"""This function returns the examples in the raw (text) form."""
|
216 |
with open(filepath, encoding="utf-8") as f:
|
|
|
218 |
idx = 0
|
219 |
for line in data:
|
220 |
row = json.loads(line)
|
221 |
+
if "train" in filepath:
|
222 |
row = {k: v for k, v in row if k in HUMSETBIAS_GENERAL}
|
223 |
+
elif "gender" in filepath:
|
224 |
row = {k: v for k, v in row if k in HUMSETBIAS_FEATURES_GENDER}
|
225 |
+
elif "country" in filepath:
|
226 |
row = {k: v for k, v in row if k in HUMSETBIAS_FEATURES_COUNTRY}
|
227 |
#if self.config.name == "1.0.0":
|
228 |
yield idx, row
|