Merge pull request 'add support for lexeme_id on comp' (#7) from mt-additional-xml-shema-support into master

Reviewed-on: #7
This commit is contained in:
matic_t 2020-08-20 15:32:36 +00:00
commit 04c8bc1471

View File

@ -19,11 +19,10 @@ class ComponentLexeme(Data):
else: else:
self.text = xml.textContent self.text = xml.textContent
self.role = xml.getAttribute("role") self.role = xml.getAttribute("role")
if xml.hasAttribute("space"): if xml.hasAttribute("space"):
self.no_space = xml.getAttribute("space") == "false" self.no_space = xml.getAttribute("space") == "false"
for oth_attr in ["lexical_unit_lexeme_id", "slolex", "kol", "sloleks"]: for oth_attr in ["lexeme_id", "lexical_unit_lexeme_id", "slolex", "kol", "sloleks"]:
if xml.hasAttribute(oth_attr): if xml.hasAttribute(oth_attr):
self.other_attributes[oth_attr] = xml.getAttribute(oth_attr) self.other_attributes[oth_attr] = xml.getAttribute(oth_attr)
@ -33,7 +32,6 @@ class ComponentLexeme(Data):
def export(self, doc): def export(self, doc):
if self.role is None: if self.role is None:
return doc.createTextNode(self.text) return doc.createTextNode(self.text)
result = doc.createElement("comp") result = doc.createElement("comp")
result.setAttribute("role", self.role) result.setAttribute("role", self.role)
result.textContent = self.text result.textContent = self.text