Datasets:
ToluClassics
commited on
Commit
·
9c28f33
1
Parent(s):
a4effa6
Update afriqa.py
Browse files
afriqa.py
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
|
3 |
|
4 |
import json
|
|
|
5 |
import os
|
6 |
from textwrap import dedent
|
7 |
|
@@ -100,9 +101,8 @@ class AfriQA(datasets.GeneratorBasedBuilder):
|
|
100 |
|
101 |
def _generate_examples(self, filepath):
|
102 |
"""Yields examples."""
|
103 |
-
with open(filepath, encoding="utf-8") as f:
|
104 |
-
|
105 |
-
for _, example in enumerate(data):
|
106 |
_id = example["id"]
|
107 |
|
108 |
yield _id, {
|
|
|
2 |
|
3 |
|
4 |
import json
|
5 |
+
import jsonlines
|
6 |
import os
|
7 |
from textwrap import dedent
|
8 |
|
|
|
101 |
|
102 |
def _generate_examples(self, filepath):
|
103 |
"""Yields examples."""
|
104 |
+
with jsonlines.open(filepath, encoding="utf-8") as f:
|
105 |
+
for _, example in enumerate(f):
|
|
|
106 |
_id = example["id"]
|
107 |
|
108 |
yield _id, {
|