zeusfsx commited on
Commit
324dec7
1 Parent(s): 91b4614

update script to jsonl

Browse files
Files changed (1) hide show
  1. 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-news-1.json",
18
- "ukrainian-news-2.json",
19
- "ukrainian-news-3.json",
20
- "ukrainian-news-4.json",
21
- "ukrainian-news-5.json"
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
- news = json.load(f)
61
- for article in news:
62
- yield key, article
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