update script to jsonl
Browse files- ukrainian-news.py +8 -10
ukrainian-news.py
CHANGED
@@ -14,11 +14,11 @@ This is a dataset of news articles downloaded from various Ukrainian websites. T
|
|
14 |
|
15 |
|
16 |
_URLS = [
|
17 |
-
"ukrainian-
|
18 |
-
"ukrainian-
|
19 |
-
"ukrainian-
|
20 |
-
"ukrainian-
|
21 |
-
"ukrainian-
|
22 |
]
|
23 |
|
24 |
|
@@ -54,10 +54,8 @@ class UkrainianNews(datasets.GeneratorBasedBuilder):
|
|
54 |
def _generate_examples(self, filepaths):
|
55 |
"""This function returns the examples in the raw (text) form."""
|
56 |
logger.info("generating examples from = %s", filepaths)
|
57 |
-
key = 0
|
58 |
for path in filepaths:
|
59 |
with open(path, encoding="utf-8") as f:
|
60 |
-
|
61 |
-
|
62 |
-
yield
|
63 |
-
key += 1
|
|
|
14 |
|
15 |
|
16 |
_URLS = [
|
17 |
+
"ukrainian-news1.jsonl",
|
18 |
+
"ukrainian-news2.jsonl",
|
19 |
+
"ukrainian-news3.jsonl",
|
20 |
+
"ukrainian-news4.jsonl",
|
21 |
+
"ukrainian-news5.jsonl"
|
22 |
]
|
23 |
|
24 |
|
|
|
54 |
def _generate_examples(self, filepaths):
|
55 |
"""This function returns the examples in the raw (text) form."""
|
56 |
logger.info("generating examples from = %s", filepaths)
|
|
|
57 |
for path in filepaths:
|
58 |
with open(path, encoding="utf-8") as f:
|
59 |
+
for news_str in f:
|
60 |
+
news = json.load(news_str)
|
61 |
+
yield news['id'], news
|
|