changeset 17:6fa24c711f86

Add some comments.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 May 2021 15:12:14 +0300
parents 285b0820d2c6
children ff959de0f6c8
files lxmldump.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lxmldump.py	Tue May 11 14:47:01 2021 +0300
+++ b/lxmldump.py	Tue May 11 15:12:14 2021 +0300
@@ -141,20 +141,23 @@
             pkk_dump_recursive(indent + 1, qnode)
 
 
-## Output item under given node
+## Output item(s) under given node with given format string
 def pkk_output_subs_fmt(indent, dnode, dsub, dname, dfmt):
     for qnode in dnode.findall(dsub):
         pkk_printi(indent, dfmt.format(dname, pkk_node_to_text(qnode)))
 
-
+## Output item(s) under given node with a prefixed name string
 def pkk_output_subs_prefix(indent, dnode, dsub, dname):
     pkk_output_subs_fmt(indent, dnode, dsub, dname, "{0} \"{1}\"\n")
 
 
+## Output a main "Headword" or "Sense" node under it
 def pkk_output_sense(indent, dnode):
+    # Search form and definition
     pkk_output_subs_prefix(indent, dnode, "./SearchForm", "srch")
     pkk_output_subs_prefix(indent, dnode, "./Definition", "defn")
 
+    # Examples
     for wnode in dnode.findall("./ExampleBlock/ExampleCtn"):
         sstr = pkk_node_to_text(wnode.find("./Example"))
         lstr = ""
@@ -170,6 +173,7 @@
         pkk_printi(indent + 1, "{} \"{}\"{}\n".format("exmp", sstr, lstr))
 
 
+## Output one "DictionaryEntry" node
 def pkk_output_node(indent, dnode):
 
     for wnode in dnode.findall("./HeadwordCtn"):