lara-martin
commited on
Update FIREBALL.py
Browse files- FIREBALL.py +24 -21
FIREBALL.py
CHANGED
@@ -79,7 +79,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
79 |
datasets.BuilderConfig(name="first_domain", version=VERSION, description="This part of my dataset covers a first domain"),
|
80 |
]
|
81 |
|
82 |
-
DEFAULT_CONFIG_NAME = "
|
83 |
|
84 |
def _info(self):
|
85 |
|
@@ -181,25 +181,28 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
181 |
citation=_CITATION,
|
182 |
)
|
183 |
|
184 |
-
def _split_generators(self, dl_manager):
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
|
|
|
|
|
|
203 |
|
204 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
205 |
def _generate_examples(self, filepath, split):
|
@@ -208,7 +211,7 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
208 |
key = 0
|
209 |
for root,dirs,files in os.walk(filepath):
|
210 |
for file in files:
|
211 |
-
with jsonlines.open(file) as f:
|
212 |
for data in f:
|
213 |
# Yields examples as (key, example) tuples
|
214 |
yield key, {
|
|
|
79 |
datasets.BuilderConfig(name="first_domain", version=VERSION, description="This part of my dataset covers a first domain"),
|
80 |
]
|
81 |
|
82 |
+
DEFAULT_CONFIG_NAME = "FIREBALL" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
83 |
|
84 |
def _info(self):
|
85 |
|
|
|
181 |
citation=_CITATION,
|
182 |
)
|
183 |
|
184 |
+
# def _split_generators(self, dl_manager):
|
185 |
+
# # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
186 |
+
# # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
187 |
+
|
188 |
+
# # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
189 |
+
# # 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.
|
190 |
+
# # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
191 |
+
# urls = _URLS[self.config.name]
|
192 |
+
# data_dir = dl_manager.download_and_extract(urls)
|
193 |
+
# for root,dirs,files in os.walk(data_dir):
|
194 |
+
# for f in files:
|
195 |
+
# data = os.path.join()
|
196 |
+
# return [
|
197 |
+
# datasets.SplitGenerator(
|
198 |
+
# name=datasets.Split.TRAIN,
|
199 |
+
# # These kwargs will be passed to _generate_examples
|
200 |
+
# gen_kwargs={
|
201 |
+
# "filepath": os.path.join(data_dir, "train.jsonl"),
|
202 |
+
# "split": "train",
|
203 |
+
# },
|
204 |
+
# ),
|
205 |
+
# ]
|
206 |
|
207 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
208 |
def _generate_examples(self, filepath, split):
|
|
|
211 |
key = 0
|
212 |
for root,dirs,files in os.walk(filepath):
|
213 |
for file in files:
|
214 |
+
with jsonlines.open(os.path.join(root,file)) as f:
|
215 |
for data in f:
|
216 |
# Yields examples as (key, example) tuples
|
217 |
yield key, {
|