Datasets:
License:
Matīss
commited on
Commit
•
aa8d74b
1
Parent(s):
22afb0e
Upload liv4ever.py
Browse files- liv4ever.py +4 -3
liv4ever.py
CHANGED
@@ -169,15 +169,16 @@ class liv4ever(datasets.GeneratorBasedBuilder):
|
|
169 |
]
|
170 |
|
171 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
172 |
-
def _generate_examples(self, filepath
|
173 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
174 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
175 |
with open(filepath, encoding="utf-8") as f:
|
176 |
jsondata = json.load(f)
|
177 |
-
|
178 |
for sentence in jsondata:
|
179 |
# Yields examples as (key, example) tuples
|
180 |
-
|
|
|
181 |
"source": sentence["source"],
|
182 |
"en": sentence["en"],
|
183 |
"liv": sentence["liv"],
|
|
|
169 |
]
|
170 |
|
171 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
172 |
+
def _generate_examples(self, filepath):
|
173 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
174 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
175 |
with open(filepath, encoding="utf-8") as f:
|
176 |
jsondata = json.load(f)
|
177 |
+
n = 0
|
178 |
for sentence in jsondata:
|
179 |
# Yields examples as (key, example) tuples
|
180 |
+
n=n+1
|
181 |
+
yield n, {
|
182 |
"source": sentence["source"],
|
183 |
"en": sentence["en"],
|
184 |
"liv": sentence["liv"],
|