zeusfsx commited on
Commit
858f2b4
1 Parent(s): 153ed5d

fix generate examples

Browse files
Files changed (1) hide show
  1. ukrainian-news.py +7 -7
ukrainian-news.py CHANGED
@@ -12,7 +12,6 @@ Ukrainian News Dataset
12
  This is a dataset of news articles downloaded from various Ukrainian websites. The dataset contains approximately 10 569 428 JSON objects (news)
13
  """
14
 
15
- _URL = "ukrainian-news-1.json" # get first part of data
16
 
17
  _URLS = [
18
  "ukrainian-news-1.json",
@@ -54,10 +53,11 @@ class UkrainianNews(datasets.GeneratorBasedBuilder):
54
 
55
  def _generate_examples(self, filepath):
56
  """This function returns the examples in the raw (text) form."""
57
-
58
  key = 0
59
- with open(filepath, encoding="utf-8") as f:
60
- news = json.load(f)
61
- for article in news:
62
- yield key, article
63
- key += 1
 
 
12
  This is a dataset of news articles downloaded from various Ukrainian websites. The dataset contains approximately 10 569 428 JSON objects (news)
13
  """
14
 
 
15
 
16
  _URLS = [
17
  "ukrainian-news-1.json",
 
53
 
54
  def _generate_examples(self, filepath):
55
  """This function returns the examples in the raw (text) form."""
56
+ logger.info("generating examples from = %s", filepath)
57
  key = 0
58
+ for path in filepath:
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