|
|
|
@ -6,8 +6,10 @@ class MultiwordExample:
|
|
|
|
|
self.other_attributes = {}
|
|
|
|
|
self.cluster = -1
|
|
|
|
|
self.type = None
|
|
|
|
|
self.original_xml = None
|
|
|
|
|
|
|
|
|
|
def import_xml(self, example_xml):
|
|
|
|
|
self.original_xml = example_xml.cloneNode(True)
|
|
|
|
|
for oth_attr in ["lexical_unit_id", "structure_id", "structureName", "audio", "frequency", "logDice"]:
|
|
|
|
|
if example_xml.hasAttribute(oth_attr):
|
|
|
|
|
self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr)
|
|
|
|
@ -16,7 +18,10 @@ class MultiwordExample:
|
|
|
|
|
|
|
|
|
|
if example_xml.hasAttribute("type"):
|
|
|
|
|
self.type = example_xml.getAttribute("type")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
example_xml.remove()
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
def _determine_cluster_number(example_xml):
|
|
|
|
|
if not example_xml.hasAttribute("cluster"):
|
|
|
|
@ -27,8 +32,8 @@ class MultiwordExample:
|
|
|
|
|
return cluster
|
|
|
|
|
|
|
|
|
|
def export(self, doc, _modified):
|
|
|
|
|
result = doc.createElement("multiwordExample")
|
|
|
|
|
|
|
|
|
|
result = self.original_xml if self.original_xml is not None else doc.createElement("multiwordExample")
|
|
|
|
|
# result = doc.createElement("multiwordExample")
|
|
|
|
|
for key, value in self.other_attributes.items():
|
|
|
|
|
result.setAttribute(key, value)
|
|
|
|
|
|
|
|
|
|