jslin09 commited on
Commit
f1f53f0
1 Parent(s): 5311ca9

Upload wikipedia_tw.py

Browse files
Files changed (1) hide show
  1. wikipedia_tw.py +4 -4
wikipedia_tw.py CHANGED
@@ -89,11 +89,11 @@ class Wikipedia_tw(datasets.GeneratorBasedBuilder):
89
  key = 0
90
  with open(filepath, 'r', encoding='UTF-8') as f:
91
  wikipedia = json.load(f, strict=False,)
92
- for page in wikipedia:
93
- title = page.get("title", "")
94
- article = page.get("article", "")
95
  yield key, {
96
  "title": title,
97
  "article": article,
98
  }
99
- k=k+1
 
89
  key = 0
90
  with open(filepath, 'r', encoding='UTF-8') as f:
91
  wikipedia = json.load(f, strict=False,)
92
+ for page_index in len(wikipedia):
93
+ title = wikipedia[page_index]["title"]
94
+ article = wikipedia[page_index]["article"]
95
  yield key, {
96
  "title": title,
97
  "article": article,
98
  }
99
+ key=key+1