Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
sentiment-classification
Size:
10K - 100K
License:
Update script
Browse files- imdb_dutch.py +4 -4
- test_imdb_dutch.py +39 -0
imdb_dutch.py
CHANGED
@@ -45,7 +45,7 @@ _CITATION = """\
|
|
45 |
}
|
46 |
"""
|
47 |
|
48 |
-
_DOWNLOAD_URL = "https://huggingface.co/datasets/yhavinga/imdb_dutch/resolve/main/dataset/{split}.gz"
|
49 |
|
50 |
|
51 |
class IMDBReviewsConfig(datasets.BuilderConfig):
|
@@ -95,14 +95,14 @@ class Imdb(datasets.GeneratorBasedBuilder):
|
|
95 |
datasets.SplitGenerator(
|
96 |
name=datasets.Split.TRAIN,
|
97 |
gen_kwargs={
|
98 |
-
"files": dl_manager.download(_DOWNLOAD_URL.format(split="train")),
|
99 |
"split": "train",
|
100 |
},
|
101 |
),
|
102 |
datasets.SplitGenerator(
|
103 |
name=datasets.Split.TEST,
|
104 |
gen_kwargs={
|
105 |
-
"files": dl_manager.download(_DOWNLOAD_URL.format(split="test")),
|
106 |
"split": "test",
|
107 |
},
|
108 |
),
|
@@ -110,7 +110,7 @@ class Imdb(datasets.GeneratorBasedBuilder):
|
|
110 |
name=datasets.Split("unsupervised"),
|
111 |
gen_kwargs={
|
112 |
"files": dl_manager.download(
|
113 |
-
_DOWNLOAD_URL.format(split="unsupervised")
|
114 |
),
|
115 |
"split": "unsupervised",
|
116 |
"labeled": False,
|
|
|
45 |
}
|
46 |
"""
|
47 |
|
48 |
+
_DOWNLOAD_URL = "https://huggingface.co/datasets/yhavinga/imdb_dutch/resolve/main/dataset/{split}.jsonl.gz"
|
49 |
|
50 |
|
51 |
class IMDBReviewsConfig(datasets.BuilderConfig):
|
|
|
95 |
datasets.SplitGenerator(
|
96 |
name=datasets.Split.TRAIN,
|
97 |
gen_kwargs={
|
98 |
+
"files": dl_manager.download([_DOWNLOAD_URL.format(split="train")]),
|
99 |
"split": "train",
|
100 |
},
|
101 |
),
|
102 |
datasets.SplitGenerator(
|
103 |
name=datasets.Split.TEST,
|
104 |
gen_kwargs={
|
105 |
+
"files": dl_manager.download([_DOWNLOAD_URL.format(split="test")]),
|
106 |
"split": "test",
|
107 |
},
|
108 |
),
|
|
|
110 |
name=datasets.Split("unsupervised"),
|
111 |
gen_kwargs={
|
112 |
"files": dl_manager.download(
|
113 |
+
[_DOWNLOAD_URL.format(split="unsupervised")]
|
114 |
),
|
115 |
"split": "unsupervised",
|
116 |
"labeled": False,
|
test_imdb_dutch.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datasets import (
|
2 |
+
load_dataset,
|
3 |
+
disable_caching,
|
4 |
+
get_dataset_split_names,
|
5 |
+
get_dataset_config_names,
|
6 |
+
)
|
7 |
+
from transformers import AutoTokenizer
|
8 |
+
|
9 |
+
disable_caching()
|
10 |
+
|
11 |
+
SCRIPT = "./imdb_dutch.py"
|
12 |
+
|
13 |
+
|
14 |
+
def test_get_split_names():
|
15 |
+
splits = get_dataset_split_names(SCRIPT, "plain_text")
|
16 |
+
assert splits == ["train", "test", "unsupervised"]
|
17 |
+
|
18 |
+
|
19 |
+
def test_get_config_names():
|
20 |
+
configs = get_dataset_config_names(SCRIPT)
|
21 |
+
assert configs == ["plain_text"]
|
22 |
+
|
23 |
+
|
24 |
+
def test_streaming_dataset():
|
25 |
+
datasets = load_dataset(SCRIPT, streaming=True)
|
26 |
+
train_ds = datasets["train"]
|
27 |
+
|
28 |
+
i = iter(train_ds)
|
29 |
+
e = next(i)
|
30 |
+
|
31 |
+
val_ds = datasets["test"]
|
32 |
+
|
33 |
+
i = iter(val_ds)
|
34 |
+
e = next(i)
|
35 |
+
|
36 |
+
unsup_ds = datasets["unsupervised"]
|
37 |
+
|
38 |
+
i = iter(unsup_ds)
|
39 |
+
e = next(i)
|