psyche commited on
Commit
7501298
1 Parent(s): 05163cf
Files changed (2) hide show
  1. .idea/misc.xml +1 -1
  2. kowiki.py +13 -13
.idea/misc.xml CHANGED
@@ -1,4 +1,4 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <project version="4">
3
- <component name="ProjectRootManager" version="2" project-jdk-name="D:\anaconda3" project-jdk-type="Python SDK" />
4
  </project>
 
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
4
  </project>
kowiki.py CHANGED
@@ -144,19 +144,19 @@ class KoWiki(datasets.GeneratorBasedBuilder):
144
 
145
  def _generate_examples(self, files):
146
  n = 0
147
- output, text = {}, ""
148
- for event, node in ET.iterparse('data/kowiki-20230420-pages-articles.xml'):
149
-
150
- if node.tag.endswith("base"):
151
- output["url"] = node.text
152
- elif node.tag.endswith("title"):
153
- output["title"] = node.text
154
- elif node.tag.endswith("text"):
155
- output["text"] = process_text(node.text)
156
- output["id"] = f"{n:08d}"
157
- yield n, output
158
- n += 1
159
- output = {}
160
 
161
 
162
 
 
144
 
145
  def _generate_examples(self, files):
146
  n = 0
147
+ for file in files:
148
+ output, text = {}, ""
149
+ for event, node in ET.iterparse(file):
150
+ if node.tag.endswith("base"):
151
+ output["url"] = node.text
152
+ elif node.tag.endswith("title"):
153
+ output["title"] = node.text
154
+ elif node.tag.endswith("text"):
155
+ output["text"] = process_text(node.text)
156
+ output["id"] = f"{n:08d}"
157
+ yield n, output
158
+ n += 1
159
+ output = {}
160
 
161
 
162