editing example texts now as I see it could look like.

This commit is contained in:
2020-01-25 21:33:22 +01:00
parent 98cce79b79
commit 4fb17bb2fc
6 changed files with 114 additions and 15 deletions

View File

@@ -36,7 +36,8 @@ class Example(Editable):
inner_xml = example_xml.querySelector("multiwordExample")
self.inner = MultiwordExample(inner_xml)
self.components = [ComponentLexeme(el) for el in inner_xml.childNodes]
all_components = [ComponentLexeme(el) for el in inner_xml.childNodes]
self.components = [comp for comp in all_components if comp.isValid()]
def export(self, doc):
@@ -112,7 +113,7 @@ class MultiwordExample:
return self.cluster if self.cluster_valid else None
class ComponentLexeme:
class ComponentLexeme(Editable):
def __init__(self, xml):
self.other_attributes = {}
@@ -126,6 +127,11 @@ class ComponentLexeme:
for oth_attr in ["lexical_unit_lexeme_id", "slolex", "kol"]:
if xml.hasAttribute(oth_attr):
self.other_attributes[oth_attr] = xml.getAttribute(oth_attr)
self.text = self.text.strip()
def isValid(self):
return len(self.text) > 0
def export(self, doc):
if self.role is None: