visualjoyce
commited on
Commit
•
a70439a
1
Parent(s):
3422e53
Add zh, en, xl
Browse files
ipquiz.py
CHANGED
@@ -45,6 +45,12 @@ _HOMEPAGE = ""
|
|
45 |
# TODO: Add the licence for the dataset here if you can find it
|
46 |
_LICENSE = ""
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
50 |
class IPQuizDataset(datasets.GeneratorBasedBuilder):
|
@@ -105,13 +111,14 @@ class IPQuizDataset(datasets.GeneratorBasedBuilder):
|
|
105 |
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
106 |
# 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.
|
107 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
108 |
-
|
|
|
109 |
return [
|
110 |
datasets.SplitGenerator(
|
111 |
name=datasets.Split.TEST,
|
112 |
# These kwargs will be passed to _generate_examples
|
113 |
gen_kwargs={
|
114 |
-
"filepath": f"{self.config.name}.jsonl",
|
115 |
"split": "test"
|
116 |
},
|
117 |
),
|
|
|
45 |
# TODO: Add the licence for the dataset here if you can find it
|
46 |
_LICENSE = ""
|
47 |
|
48 |
+
_URLS = {
|
49 |
+
"zh": "https://huggingface.co/datasets/BNNT/IPQuiz/raw/main/zh.json",
|
50 |
+
"en": "https://huggingface.co/datasets/BNNT/IPQuiz/raw/main/en.json",
|
51 |
+
"xl": "https://huggingface.co/datasets/BNNT/IPQuiz/raw/main/xl.json",
|
52 |
+
}
|
53 |
+
|
54 |
|
55 |
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
56 |
class IPQuizDataset(datasets.GeneratorBasedBuilder):
|
|
|
111 |
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
112 |
# 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.
|
113 |
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
114 |
+
urls = _URLS[self.config.name]
|
115 |
+
data_dir = dl_manager.download_and_extract(urls)
|
116 |
return [
|
117 |
datasets.SplitGenerator(
|
118 |
name=datasets.Split.TEST,
|
119 |
# These kwargs will be passed to _generate_examples
|
120 |
gen_kwargs={
|
121 |
+
"filepath": os.path.join(data_dir, f"{self.config.name}.jsonl"),
|
122 |
"split": "test"
|
123 |
},
|
124 |
),
|