support for multiple sense definitions

This commit is contained in:
2020-01-14 20:59:15 +01:00
parent dcb4840f2a
commit 404bafdae3
5 changed files with 16 additions and 12 deletions

View File

@@ -6,9 +6,11 @@ from model.tags import import_label_list
class Sense(Editable):
def __init__(self, sense_xml):
definition = sense_xml.querySelector("definitionList definition")
self.definition = {}
for definition in sense_xml.querySelectorAll("definitionList definition"):
key = definition.getAttribute("type")
self.definition[key] = definition.textContent
self.definition = definition.textContent if definition else ""
self.labels = import_label_list("sense > labelList label", sense_xml)
self.examples = [Example(example_xml) for example_xml in
sense_xml.querySelectorAll("exampleContainerList exampleContainer")]