Datasets:
Update loading script
Browse files- senti_lex.py +3 -17
senti_lex.py
CHANGED
@@ -41,7 +41,8 @@ _HOMEPAGE = "https://sites.google.com/site/datascienceslab/projects/multilingual
|
|
41 |
|
42 |
_LICENSE = "GNU General Public License v3"
|
43 |
|
44 |
-
|
|
|
45 |
|
46 |
LANGS = [
|
47 |
"af",
|
@@ -135,17 +136,6 @@ class SentiLex(datasets.GeneratorBasedBuilder):
|
|
135 |
|
136 |
VERSION = datasets.Version("1.1.0")
|
137 |
|
138 |
-
@property
|
139 |
-
def manual_download_instructions(self):
|
140 |
-
return """\
|
141 |
-
You should download the dataset from https://www.kaggle.com/rtatman/sentiment-lexicons-for-81-languages
|
142 |
-
The webpage requires registration.
|
143 |
-
After downloading, please put the files in a dir of your choice,
|
144 |
-
which will be used as a manual_dir, e.g. `~/.manual_dirs/senti_lex`
|
145 |
-
SentiLex can then be loaded via:
|
146 |
-
`datasets.load_dataset("newsroom", data_dir="~/.manual_dirs/senti_lex")`.
|
147 |
-
"""
|
148 |
-
|
149 |
BUILDER_CONFIGS = [
|
150 |
datasets.BuilderConfig(
|
151 |
name=i,
|
@@ -180,11 +170,7 @@ class SentiLex(datasets.GeneratorBasedBuilder):
|
|
180 |
|
181 |
def _split_generators(self, dl_manager):
|
182 |
"""Returns SplitGenerators."""
|
183 |
-
data_dir =
|
184 |
-
if not os.path.exists(data_dir):
|
185 |
-
raise FileNotFoundError(
|
186 |
-
f"{data_dir} does not exist. Make sure you insert a manual dir via `datasets.load_dataset('newsroom', data_dir=...)` that includes files unzipped from the reclor zip. Manual download instructions: {self.manual_download_instructions}"
|
187 |
-
)
|
188 |
return [
|
189 |
datasets.SplitGenerator(
|
190 |
name=datasets.Split.TRAIN,
|
|
|
41 |
|
42 |
_LICENSE = "GNU General Public License v3"
|
43 |
|
44 |
+
# Origin data from: "https://www.kaggle.com/rtatman/sentiment-lexicons-for-81-languages"
|
45 |
+
_URL = "data.zip"
|
46 |
|
47 |
LANGS = [
|
48 |
"af",
|
|
|
136 |
|
137 |
VERSION = datasets.Version("1.1.0")
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
BUILDER_CONFIGS = [
|
140 |
datasets.BuilderConfig(
|
141 |
name=i,
|
|
|
170 |
|
171 |
def _split_generators(self, dl_manager):
|
172 |
"""Returns SplitGenerators."""
|
173 |
+
data_dir = dl_manager.download_and_extract(_URL)
|
|
|
|
|
|
|
|
|
174 |
return [
|
175 |
datasets.SplitGenerator(
|
176 |
name=datasets.Split.TRAIN,
|