EricR401S commited on
Commit
c8a232a
·
1 Parent(s): 437cdca
Files changed (1) hide show
  1. reddit_dataset_loader.py +37 -38
reddit_dataset_loader.py CHANGED
@@ -44,9 +44,7 @@ which have risen in response to the clashes between traditional gender roles and
44
  """
45
 
46
  # TODO: Add a link to an official homepage for the dataset here
47
- _HOMEPAGE = (
48
- "https://huggingface.co/datasets/steamcyclone/Pill-Ideologies-New-Test/tree/main"
49
- )
50
 
51
  # TODO: Add the licence for the dataset here if you can find it
52
  _LICENSE = "Creative Commons" # cc
@@ -144,41 +142,42 @@ class SubRedditPosts(datasets.GeneratorBasedBuilder):
144
  citation=_CITATION,
145
  )
146
 
147
- # def _split_generators(self, dl_manager):
148
- # # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
149
- # # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
150
-
151
- # # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
152
- # # 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.
153
- # # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
154
- # urls = _URLS[self.config.name]
155
- # data_dir = dl_manager.download_and_extract(urls)
156
- # return [
157
- # datasets.SplitGenerator(
158
- # name=datasets.Split.TRAIN,
159
- # # These kwargs will be passed to _generate_examples
160
- # gen_kwargs={
161
- # "filepath": os.path.join(data_dir, "train.jsonl"),
162
- # "split": "train",
163
- # },
164
- # ),
165
- # datasets.SplitGenerator(
166
- # name=datasets.Split.VALIDATION,
167
- # # These kwargs will be passed to _generate_examples
168
- # gen_kwargs={
169
- # "filepath": os.path.join(data_dir, "dev.jsonl"),
170
- # "split": "dev",
171
- # },
172
- # ),
173
- # datasets.SplitGenerator(
174
- # name=datasets.Split.TEST,
175
- # # These kwargs will be passed to _generate_examples
176
- # gen_kwargs={
177
- # "filepath": os.path.join(data_dir, "test.jsonl"),
178
- # "split": "test",
179
- # },
180
- # ),
181
- # ]
 
182
 
183
  # # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
184
  # def _generate_examples(self, filepath, split):
 
44
  """
45
 
46
  # TODO: Add a link to an official homepage for the dataset here
47
+ _HOMEPAGE = "https://huggingface.co/datasets/steamcyclone/Pill-Ideologies-New-Test"
 
 
48
 
49
  # TODO: Add the licence for the dataset here if you can find it
50
  _LICENSE = "Creative Commons" # cc
 
142
  citation=_CITATION,
143
  )
144
 
145
+ def _split_generators(self, dl_manager):
146
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
147
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
148
+
149
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
150
+ # 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.
151
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
152
+ urls = _URLS[self.config.name]
153
+ data_dir = dl_manager.download_and_extract(urls)
154
+ print(data_dir, "is the data_dir")
155
+ return [
156
+ datasets.SplitGenerator(
157
+ name=datasets.Split.TRAIN,
158
+ # These kwargs will be passed to _generate_examples
159
+ gen_kwargs={
160
+ "filepath": os.path.join(data_dir, "train.jsonl"),
161
+ "split": "train",
162
+ },
163
+ ),
164
+ datasets.SplitGenerator(
165
+ name=datasets.Split.VALIDATION,
166
+ # These kwargs will be passed to _generate_examples
167
+ gen_kwargs={
168
+ "filepath": os.path.join(data_dir, "dev.jsonl"),
169
+ "split": "dev",
170
+ },
171
+ ),
172
+ datasets.SplitGenerator(
173
+ name=datasets.Split.TEST,
174
+ # These kwargs will be passed to _generate_examples
175
+ gen_kwargs={
176
+ "filepath": os.path.join(data_dir, "test.jsonl"),
177
+ "split": "test",
178
+ },
179
+ ),
180
+ ]
181
 
182
  # # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
183
  # def _generate_examples(self, filepath, split):