comparison lxmldump.py @ 11:b2ac68732e45

Clean.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 May 2021 11:30:42 +0300
parents 013f0cd9e5b3
children d50e71642be7
comparison
equal deleted inserted replaced
10:013f0cd9e5b3 11:b2ac68732e45
135 for qnode in lnode.findall("./*"): 135 for qnode in lnode.findall("./*"):
136 pkk_dump_recursive(indent + 1, qnode) 136 pkk_dump_recursive(indent + 1, qnode)
137 137
138 138
139 ## 139 ##
140 def pkk_output_one(indent, dnode, dsub): 140 def pkk_output_one(indent, dnode, dsub, dfmt):
141 for qnode in dnode.findall(dsub): 141 for qnode in dnode.findall(dsub):
142 pkk_printi(indent, "{}\n".format(pkk_get_text(qnode))) 142 pkk_printi(indent, dfmt.format(pkk_get_text(qnode)))
143 143
144 def pkk_output_subs(indent, dnode, dsub, dname): 144 def pkk_output_subs(indent, dnode, dsub, dname):
145 for qnode in dnode.findall(dsub): 145 for qnode in dnode.findall(dsub):
146 pkk_printi(indent, "{} \"{}\"\n".format(dname, pkk_get_text(qnode))) 146 pkk_printi(indent, "{} \"{}\"\n".format(dname, pkk_get_text(qnode)))
147 147
166 166
167 167
168 def pkk_output_node(indent, dnode): 168 def pkk_output_node(indent, dnode):
169 169
170 for wnode in dnode.findall("./HeadwordCtn"): 170 for wnode in dnode.findall("./HeadwordCtn"):
171 pkk_output_one (indent, wnode, "./Headword") 171 pkk_output_one (indent, wnode, "./Headword", "\"{}\":\n")
172 pkk_output_sense(indent + 1, wnode) 172 pkk_output_sense(indent + 1, wnode)
173 173
174 index = 1 174 index = 1
175 for wnode in dnode.findall("./SenseGrp"): 175 for wnode in dnode.findall("./SenseGrp"):
176 pkk_printi(indent + 1, "sense #{}\n".format(index)) 176 pkk_printi(indent + 1, "sense #{}\n".format(index))