Adding import/export for entry.measure and entry.lexical_unit

This commit is contained in:
2019-12-27 18:57:22 +01:00
parent 413f3febae
commit 227c3ee4b8
2 changed files with 39 additions and 0 deletions

View File

@@ -15,6 +15,19 @@ class Entry(Editable):
self.comment = comment.textContent if comment else ""
self.variants = [v.textContent for v in entry_xml.querySelectorAll("head variantList variant")]
self.lexical_unit = {}
lex_unit = entry_xml.querySelector("lexical_unit lexeme,lexicalUnit lexeme")
if lex_unit:
self.lexical_unit['id'] = lex_unit.getAttribute("lexical_unit_lexeme_id")
self.lexical_unit['text'] = lex_unit.textContent
self.measure = {}
measure = entry_xml.querySelector("measureList measure")
if measure:
self.measure["source"] = measure.getAttribute("source")
self.measure["type"] = measure.getAttribute("type")
self.measure["text"] = measure.textContent
self.labels = []
for tag_xml in entry_xml.querySelectorAll("head labelList label"):
t_type = tag_xml.getAttribute("type")
@@ -28,4 +41,8 @@ class Entry(Editable):
self.senses = [Sense(sense_xml) for sense_xml in
entry_xml.querySelectorAll("body senseList sense")]
def get_measure_text(self):
console.log(self.measure["text"] if "text" in self.measure else "")
return self.measure["text"] if "text" in self.measure else ""