summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2014-09-18 13:46:35 +0100
committerJoe Robinson <joe@lc8n.com>2014-09-18 13:46:35 +0100
commiteba1508f45c209ee3c3aac66f219d994f98d02b0 (patch)
tree420795b820d8224b739f37ce9d8ccb5b3636a4f6
parent80ea16da36729475643c9dc591a09f516bb5473c (diff)
Cleaning up debug output
-rwxr-xr-x[-rw-r--r--]bladictionary.py34
1 files changed, 13 insertions, 21 deletions
diff --git a/bladictionary.py b/bladictionary.py
index 8e1c7b9..e6c32a9 100644..100755
--- a/bladictionary.py
+++ b/bladictionary.py
@@ -112,7 +112,6 @@ def parse_xml(xml):
extra_words = part.split(" ")
if extra_words[0] == "syn:":
for syn in extra_words[1:]:
- print syn.strip("{},]")
synonyms.append(syn.strip("{},]"))
syn_line = True
elif extra_words[0] == "ant:":
@@ -120,9 +119,6 @@ def parse_xml(xml):
antonyms.append(ant.strip("{},]"))
ant_line = True
- print definition
- print "\n"
-
return items
def parse_args():
@@ -148,8 +144,8 @@ def parse_args():
def parse_oed(word):
types = ["n.", "—n.", "v.", "—v.", "adj.", "—adj.", "adv.", "—adv."]
- print "test"
file = open("oed.txt")
+
for line in file:
word_part = line.split(" ")[0]
@@ -160,11 +156,13 @@ def parse_oed(word):
if word_line is None:
return
+ print line
+
prev_part = ""
items = []
id = 0
definition = ""
- print line
+
for part in line.split(" ")[1:]:
if part in types:
@@ -183,32 +181,26 @@ def parse_oed(word):
else:
definition += part + " "
-
prev_part = part
- for item in items:
- print item.word
- print item.word_type
- print item.definition
-
+ return items
def main():
word, word_type, word_dict = parse_args()
- print word_dict
- if word_dict == "oed":
- parse_oed(word)
- xml = get_xml()
+ if word_dict == "oed":
+ items = parse_oed(word)
+ else:
+ xml = get_xml()
- if xml is None:
- return
+ if xml is None:
+ return
- items = parse_xml(xml)
+ items = parse_xml(xml)
- print len(items)
for item in items:
print item.definition
- print "\n"
+ print "-"
if __name__ == "__main__":
main() \ No newline at end of file