Upload knessetCorpus.py
Browse files- knessetCorpus.py +4 -1
knessetCorpus.py
CHANGED
@@ -273,6 +273,7 @@ class KnessetCorpus(datasets.GeneratorBasedBuilder):
|
|
273 |
|
274 |
with open(filepath, encoding="utf-8") as f:
|
275 |
for line in f:
|
|
|
276 |
print(f'line: {line}')
|
277 |
try:
|
278 |
row = json.loads(line)
|
@@ -283,7 +284,9 @@ class KnessetCorpus(datasets.GeneratorBasedBuilder):
|
|
283 |
print(f"Key '{id_field_name}' not found in row. Skipping this row.")
|
284 |
continue
|
285 |
print(f'here')
|
286 |
-
|
|
|
|
|
287 |
print(f'and here')
|
288 |
|
289 |
except Exception as e:
|
|
|
273 |
|
274 |
with open(filepath, encoding="utf-8") as f:
|
275 |
for line in f:
|
276 |
+
sample = {}
|
277 |
print(f'line: {line}')
|
278 |
try:
|
279 |
row = json.loads(line)
|
|
|
284 |
print(f"Key '{id_field_name}' not found in row. Skipping this row.")
|
285 |
continue
|
286 |
print(f'here')
|
287 |
+
for feature in self._info().features:
|
288 |
+
sample[feature] = row[feature]
|
289 |
+
yield id_, sample
|
290 |
print(f'and here')
|
291 |
|
292 |
except Exception as e:
|