|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
from model.editable import Editable
|
|
|
|
|
from model.translation import from_container_list
|
|
|
|
|
from model.example_clusters import ExampleClusters
|
|
|
|
|
from lib.snabbdom import h
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Example(Editable):
|
|
|
|
@ -29,8 +30,8 @@ class Example(Editable):
|
|
|
|
|
result.appendChild(inner)
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def text(self):
|
|
|
|
|
return " ".join([comp.text for comp in self.components])
|
|
|
|
|
def view(self):
|
|
|
|
|
return self.inner.view(self.components)
|
|
|
|
|
|
|
|
|
|
def get_cluster(self):
|
|
|
|
|
return self.inner.get_cluster()
|
|
|
|
@ -79,6 +80,9 @@ class CorpusExample:
|
|
|
|
|
def get_structure(self):
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def view(self, components):
|
|
|
|
|
return [h("span" + comp.view_style(), {}, comp.text) for comp in components]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class MultiwordExample:
|
|
|
|
|
def __init__(self, example_xml):
|
|
|
|
@ -124,6 +128,9 @@ class MultiwordExample:
|
|
|
|
|
return self.other_attributes["structureName"]
|
|
|
|
|
else:
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
def view(self, components):
|
|
|
|
|
return " ".join([comp.text for comp in components])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ComponentLexeme(Editable):
|
|
|
|
@ -159,4 +166,13 @@ class ComponentLexeme(Editable):
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def view_style(self):
|
|
|
|
|
result = ".comp-text"
|
|
|
|
|
if self.role is not None:
|
|
|
|
|
result += ".comp-role"
|
|
|
|
|
if self.role == "headword":
|
|
|
|
|
result += ".comp-role-headword"
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|