Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
hate-speech-detection
Languages:
English
Size:
100K - 1M
License:
Commit
·
2a16c9a
1
Parent(s):
e2317de
Update wiki_toxic.py
Browse files- wiki_toxic.py +7 -4
wiki_toxic.py
CHANGED
|
@@ -34,6 +34,8 @@ _HOMEPAGE = "https://www.kaggle.com/competitions/jigsaw-toxic-comment-classifica
|
|
| 34 |
# TODO: Add the licence for the dataset here if you can find it
|
| 35 |
_LICENSE = ""
|
| 36 |
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
| 39 |
class WikiToxic(datasets.GeneratorBasedBuilder):
|
|
@@ -70,12 +72,13 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
|
|
| 70 |
)
|
| 71 |
|
| 72 |
def _split_generators(self, dl_manager):
|
|
|
|
| 73 |
return [
|
| 74 |
datasets.SplitGenerator(
|
| 75 |
name=datasets.Split.TRAIN,
|
| 76 |
# These kwargs will be passed to _generate_examples
|
| 77 |
gen_kwargs={
|
| 78 |
-
"filepath": "train.csv",
|
| 79 |
"split": "train",
|
| 80 |
},
|
| 81 |
),
|
|
@@ -83,7 +86,7 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
|
|
| 83 |
name=datasets.Split.VALIDATION,
|
| 84 |
# These kwargs will be passed to _generate_examples
|
| 85 |
gen_kwargs={
|
| 86 |
-
"filepath": "validation.csv",
|
| 87 |
"split": "validation",
|
| 88 |
},
|
| 89 |
),
|
|
@@ -91,7 +94,7 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
|
|
| 91 |
name=datasets.Split.TEST,
|
| 92 |
# These kwargs will be passed to _generate_examples
|
| 93 |
gen_kwargs={
|
| 94 |
-
"filepath": "test.csv",
|
| 95 |
"split": "test"
|
| 96 |
},
|
| 97 |
),
|
|
@@ -99,7 +102,7 @@ class WikiToxic(datasets.GeneratorBasedBuilder):
|
|
| 99 |
name="balanced_train",
|
| 100 |
# These kwargs will be passed to _generate_examples
|
| 101 |
gen_kwargs={
|
| 102 |
-
"filepath": "balanced_train.csv",
|
| 103 |
"split": "balanced_train"
|
| 104 |
},
|
| 105 |
),
|
|
|
|
| 34 |
# TODO: Add the licence for the dataset here if you can find it
|
| 35 |
_LICENSE = ""
|
| 36 |
|
| 37 |
+
_URL = "https://huggingface.co/datasets/OxAISH-AL-LLM/wiki_toxic/resolve/main/"
|
| 38 |
+
|
| 39 |
|
| 40 |
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
| 41 |
class WikiToxic(datasets.GeneratorBasedBuilder):
|
|
|
|
| 72 |
)
|
| 73 |
|
| 74 |
def _split_generators(self, dl_manager):
|
| 75 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
| 76 |
return [
|
| 77 |
datasets.SplitGenerator(
|
| 78 |
name=datasets.Split.TRAIN,
|
| 79 |
# These kwargs will be passed to _generate_examples
|
| 80 |
gen_kwargs={
|
| 81 |
+
"filepath": os.path.join(data_dir, "train.csv"),
|
| 82 |
"split": "train",
|
| 83 |
},
|
| 84 |
),
|
|
|
|
| 86 |
name=datasets.Split.VALIDATION,
|
| 87 |
# These kwargs will be passed to _generate_examples
|
| 88 |
gen_kwargs={
|
| 89 |
+
"filepath": os.path.join(data_dir, "validation.csv"),
|
| 90 |
"split": "validation",
|
| 91 |
},
|
| 92 |
),
|
|
|
|
| 94 |
name=datasets.Split.TEST,
|
| 95 |
# These kwargs will be passed to _generate_examples
|
| 96 |
gen_kwargs={
|
| 97 |
+
"filepath": os.path.join(data_dir, "test.csv"),
|
| 98 |
"split": "test"
|
| 99 |
},
|
| 100 |
),
|
|
|
|
| 102 |
name="balanced_train",
|
| 103 |
# These kwargs will be passed to _generate_examples
|
| 104 |
gen_kwargs={
|
| 105 |
+
"filepath": os.path.join(data_dir, "balanced_train.csv"),
|
| 106 |
"split": "balanced_train"
|
| 107 |
},
|
| 108 |
),
|