gpucce commited on
Commit
dd1e8fe
1 Parent(s): 4f492f1
Files changed (1) hide show
  1. Invalsi.py +5 -17
Invalsi.py CHANGED
@@ -63,11 +63,12 @@ class invalsi(datasets.GeneratorBasedBuilder):
63
  def _info(self):
64
  if self.config.name == "mate":
65
  features = datasets.Features(
 
66
  {
67
  "domanda": datasets.Value("string"),
68
  "risposta": datasets.Value("string"),
69
- "immagine": datasets.Value("string"),
70
  "test_id": datasets.Value("string"),
 
71
  }
72
  )
73
  elif self.config.name == "ita":
@@ -78,6 +79,7 @@ class invalsi(datasets.GeneratorBasedBuilder):
78
  "risposta": datasets.Value("string"),
79
  "immagine": datasets.Value("string"),
80
  "test_id": datasets.Value("string"),
 
81
  }
82
  )
83
 
@@ -90,15 +92,9 @@ class invalsi(datasets.GeneratorBasedBuilder):
90
  )
91
 
92
  def _split_generators(self, dl_manager):
93
- # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
94
- # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
95
 
96
- # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
97
- # 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.
98
- # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
99
  urls = _URLS[self.config.name]
100
  data_dir = dl_manager.extract(urls)
101
- # data_dir = "./"
102
  if self.config.name == "mate":
103
  data_file = "invalsi_mate_data/invalsi_mate_clean.csv"
104
  elif self.config.name == "ita":
@@ -121,14 +117,10 @@ class invalsi(datasets.GeneratorBasedBuilder):
121
  if self.config.name == "mate":
122
  # Yields examples as (key, example) tuples
123
  out = {
124
- # "domanda": datasets.Value("string"),
125
- # "risposta": datasets.Value("string"),
126
- # "immagine": datasets.Value("string"),
127
- # "test_id": datasets.Value("string"),
128
  "domanda": row["domanda"],
129
  "risposta": row["risposta"],
130
-
131
  "test_id": row["test_id"],
 
132
  }
133
  if "image_file_names" in row:
134
  out["immagine"] = row["image_file_names"]
@@ -136,14 +128,10 @@ class invalsi(datasets.GeneratorBasedBuilder):
136
  yield key, out
137
  elif self.config.name == "ita":
138
  yield key, {
139
- # "testo": datasets.Value("string"),
140
- # "domanda": datasets.Value("string"),
141
- # "risposta": datasets.Value("string"),
142
- # "immagine": datasets.Value("string"),
143
- # "test_id": datasets.Value("string"),
144
  "testo": row["testo"],
145
  "domanda": row["domanda"],
146
  "risposta": row["risposta"],
147
  "immagine": row["image_file_names"],
148
  "test_id": row["test_id"],
 
149
  }
 
63
  def _info(self):
64
  if self.config.name == "mate":
65
  features = datasets.Features(
66
+ # "immagine": datasets.Value("string"),
67
  {
68
  "domanda": datasets.Value("string"),
69
  "risposta": datasets.Value("string"),
 
70
  "test_id": datasets.Value("string"),
71
+ "tipo": datasets.Value("string"),
72
  }
73
  )
74
  elif self.config.name == "ita":
 
79
  "risposta": datasets.Value("string"),
80
  "immagine": datasets.Value("string"),
81
  "test_id": datasets.Value("string"),
82
+ "tipo": datasets.Value("string"),
83
  }
84
  )
85
 
 
92
  )
93
 
94
  def _split_generators(self, dl_manager):
 
 
95
 
 
 
 
96
  urls = _URLS[self.config.name]
97
  data_dir = dl_manager.extract(urls)
 
98
  if self.config.name == "mate":
99
  data_file = "invalsi_mate_data/invalsi_mate_clean.csv"
100
  elif self.config.name == "ita":
 
117
  if self.config.name == "mate":
118
  # Yields examples as (key, example) tuples
119
  out = {
 
 
 
 
120
  "domanda": row["domanda"],
121
  "risposta": row["risposta"],
 
122
  "test_id": row["test_id"],
123
+ "tipo": row["tipo"],
124
  }
125
  if "image_file_names" in row:
126
  out["immagine"] = row["image_file_names"]
 
128
  yield key, out
129
  elif self.config.name == "ita":
130
  yield key, {
 
 
 
 
 
131
  "testo": row["testo"],
132
  "domanda": row["domanda"],
133
  "risposta": row["risposta"],
134
  "immagine": row["image_file_names"],
135
  "test_id": row["test_id"],
136
+ "tipo": row["tipo"],
137
  }