Datasets:
sadrasabouri
commited on
Commit
•
1aa031b
1
Parent(s):
a5ae8a0
Update naab.py
Browse files
naab.py
CHANGED
@@ -106,24 +106,25 @@ class Naab(datasets.GeneratorBasedBuilder):
|
|
106 |
datasets.SplitGenerator(
|
107 |
name=datasets.Split.TRAIN,
|
108 |
gen_kwargs={
|
109 |
-
"
|
110 |
"split": "train"
|
111 |
}
|
112 |
),
|
113 |
datasets.SplitGenerator(
|
114 |
name=datasets.Split.TEST,
|
115 |
gen_kwargs={
|
116 |
-
"
|
117 |
"split": "test"
|
118 |
}
|
119 |
),
|
120 |
]
|
121 |
|
122 |
|
123 |
-
def _generate_examples(self,
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
106 |
datasets.SplitGenerator(
|
107 |
name=datasets.Split.TRAIN,
|
108 |
gen_kwargs={
|
109 |
+
"filepaths": train_downloaded_files,
|
110 |
"split": "train"
|
111 |
}
|
112 |
),
|
113 |
datasets.SplitGenerator(
|
114 |
name=datasets.Split.TEST,
|
115 |
gen_kwargs={
|
116 |
+
"filepaths": test_downloaded_files,
|
117 |
"split": "test"
|
118 |
}
|
119 |
),
|
120 |
]
|
121 |
|
122 |
|
123 |
+
def _generate_examples(self, filepaths, split):
|
124 |
+
for filepath in filepaths:
|
125 |
+
with open(filepath, encoding="utf-8") as f:
|
126 |
+
for key, row in enumerate(f):
|
127 |
+
if row.strip():
|
128 |
+
yield key, {"text": row}
|
129 |
+
else:
|
130 |
+
yield key, {"text": ""}
|