|
|
|
@ -66,6 +66,15 @@ class Example(Editable):
|
|
|
|
|
def is_collocation(self):
|
|
|
|
|
return type(self.inner) is CorpusExample
|
|
|
|
|
|
|
|
|
|
def get_view_type(self):
|
|
|
|
|
# as per the bosses, these are the rules for different colors
|
|
|
|
|
if type(self.inner) is CorpusExample:
|
|
|
|
|
return 1
|
|
|
|
|
elif self.inner.type == "collocation":
|
|
|
|
|
return 2
|
|
|
|
|
else:
|
|
|
|
|
return 3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CorpusExample:
|
|
|
|
|
def __init__(self, example_xml):
|
|
|
|
@ -90,7 +99,7 @@ class CorpusExample:
|
|
|
|
|
class MultiwordExample:
|
|
|
|
|
def __init__(self, example_xml):
|
|
|
|
|
self.other_attributes = {}
|
|
|
|
|
for oth_attr in ["type", "lexical_unit_id", "structure_id", "structureName", "audio", "frequency", "logDice"]:
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
@ -100,6 +109,11 @@ class MultiwordExample:
|
|
|
|
|
self.cluster_valid = True
|
|
|
|
|
self.cluster = int(example_xml.getAttribute("cluster"))
|
|
|
|
|
|
|
|
|
|
if example_xml.hasAttribute("type"):
|
|
|
|
|
self.type = example_xml.getAttribute(oth_attr)
|
|
|
|
|
else:
|
|
|
|
|
self.type = None
|
|
|
|
|
|
|
|
|
|
def export(self, doc):
|
|
|
|
|
result = doc.createElement("multiwordExample")
|
|
|
|
|
|
|
|
|
@ -109,6 +123,9 @@ class MultiwordExample:
|
|
|
|
|
if self.cluster_valid:
|
|
|
|
|
result.setAttribute("cluster", str(self.cluster))
|
|
|
|
|
|
|
|
|
|
if self.type is not None:
|
|
|
|
|
result.setAttribute("type", self.type)
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def get_cluster(self):
|
|
|
|
|