laugustyniak commited on
Commit
33c569c
1 Parent(s): 4f755b9

add downloading

Browse files
Files changed (1) hide show
  1. political-advertising-pl.py +13 -7
political-advertising-pl.py CHANGED
@@ -26,6 +26,12 @@ _DESCRIPTION = "Polish Political Advertising Dataset"
26
 
27
  _HOMEPAGE = "https://github.com/laugustyniak/misinformation"
28
 
 
 
 
 
 
 
29
  DATA_PATH = Path(".")
30
 
31
 
@@ -37,10 +43,6 @@ class PoliticalAdvertisingConfig(datasets.BuilderConfig):
37
  class PoliticalAdvertisingDataset(datasets.GeneratorBasedBuilder):
38
  VERSION = datasets.Version("1.0.0")
39
 
40
- TRAIN_FILE = DATA_PATH / "train.parquet"
41
- VAL_FILE = DATA_PATH / "dev.parquet"
42
- TEST_FILE = DATA_PATH / "test.parquet"
43
-
44
  BUILDER_CONFIGS = [
45
  datasets.BuilderConfig(name="political-advertising-pl", version=VERSION)
46
  ]
@@ -87,16 +89,20 @@ class PoliticalAdvertisingDataset(datasets.GeneratorBasedBuilder):
87
  )
88
 
89
  def _split_generators(self, dl_manager):
 
 
90
  return [
91
  datasets.SplitGenerator(
92
- name=datasets.Split.TRAIN, gen_kwargs={"filepath": str(self.TRAIN_FILE)}
 
93
  ),
94
  datasets.SplitGenerator(
95
- name=datasets.Split.TEST, gen_kwargs={"filepath": str(self.TEST_FILE)}
 
96
  ),
97
  datasets.SplitGenerator(
98
  name=datasets.Split.VALIDATION,
99
- gen_kwargs={"filepath": str(self.VAL_FILE)},
100
  ),
101
  ]
102
 
 
26
 
27
  _HOMEPAGE = "https://github.com/laugustyniak/misinformation"
28
 
29
+ _URLS = {
30
+ "train": "https://huggingface.co/datasets/laugustyniak/political-advertising-pl/blob/main/train.parquet",
31
+ "test": "https://huggingface.co/datasets/laugustyniak/political-advertising-pl/blob/main/test.parquet",
32
+ "validation": "https://huggingface.co/datasets/laugustyniak/political-advertising-pl/blob/main/dev.parquet",
33
+ }
34
+
35
  DATA_PATH = Path(".")
36
 
37
 
 
43
  class PoliticalAdvertisingDataset(datasets.GeneratorBasedBuilder):
44
  VERSION = datasets.Version("1.0.0")
45
 
 
 
 
 
46
  BUILDER_CONFIGS = [
47
  datasets.BuilderConfig(name="political-advertising-pl", version=VERSION)
48
  ]
 
89
  )
90
 
91
  def _split_generators(self, dl_manager):
92
+ downloaded_files = dl_manager.download_and_extract(_URLS)
93
+
94
  return [
95
  datasets.SplitGenerator(
96
+ name=datasets.Split.TRAIN,
97
+ gen_kwargs={"filepath": downloaded_files["train"]},
98
  ),
99
  datasets.SplitGenerator(
100
+ name=datasets.Split.TEST,
101
+ gen_kwargs={"filepath": downloaded_files["test"]},
102
  ),
103
  datasets.SplitGenerator(
104
  name=datasets.Split.VALIDATION,
105
+ gen_kwargs={"filepath": downloaded_files["validation"]},
106
  ),
107
  ]
108