shuffle files
Browse files- masader.py +4 -1
masader.py
CHANGED
|
@@ -2,6 +2,7 @@ import datasets
|
|
| 2 |
from glob import glob
|
| 3 |
import json
|
| 4 |
import zipfile
|
|
|
|
| 5 |
|
| 6 |
_DESCRIPTION = """\
|
| 7 |
Masader is the largest public catalogue for Arabic NLP datasets, which consists of more than 200 datasets annotated with 25 attributes.
|
|
@@ -100,7 +101,9 @@ class Masader(datasets.GeneratorBasedBuilder):
|
|
| 100 |
url = ['https://github.com/ARBML/masader/archive/main.zip']
|
| 101 |
downloaded_files = dl_manager.download_and_extract(url)
|
| 102 |
self.extract_all(downloaded_files[0])
|
| 103 |
-
|
|
|
|
|
|
|
| 104 |
|
| 105 |
def _generate_examples(self, filepaths):
|
| 106 |
for idx,filepath in enumerate(filepaths['inputs']):
|
|
|
|
| 2 |
from glob import glob
|
| 3 |
import json
|
| 4 |
import zipfile
|
| 5 |
+
from random import shuffle
|
| 6 |
|
| 7 |
_DESCRIPTION = """\
|
| 8 |
Masader is the largest public catalogue for Arabic NLP datasets, which consists of more than 200 datasets annotated with 25 attributes.
|
|
|
|
| 101 |
url = ['https://github.com/ARBML/masader/archive/main.zip']
|
| 102 |
downloaded_files = dl_manager.download_and_extract(url)
|
| 103 |
self.extract_all(downloaded_files[0])
|
| 104 |
+
all_files = sorted(glob(downloaded_files[0]+'/masader-main/datasets/**.json'))
|
| 105 |
+
shuffle(all_files)
|
| 106 |
+
return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={'filepaths':{'inputs':all_files} })]
|
| 107 |
|
| 108 |
def _generate_examples(self, filepaths):
|
| 109 |
for idx,filepath in enumerate(filepaths['inputs']):
|