adding of multiword examples, still some cleanup to do.

This commit is contained in:
2020-06-11 22:34:04 +02:00
parent fcd6f158a1
commit 887eb37d20
8 changed files with 56 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ from view.utils import show_toggle_cluster_buttons
from model.example.component_lexeme import ComponentLexeme
from model.example.corpus_example import CorpusExample
from model.example.multiword_example import MultiwordExample
from model.example_clusters import ExampleClusters
class Example(Data):
@@ -16,12 +17,27 @@ class Example(Data):
self.inner = None
self.components = []
self.edited = False
self.newly_created = False
# removes space from last component if multiword example
def check_multiword_components(self):
if self.is_multiword():
self.components[len(self.components) - 1].no_space = ComponentLexeme.LAST_COMPONENT_SPACE
@staticmethod
def new_multiword():
example = Example()
example.newly_created = True
example.edited = True
example.inner = MultiwordExample()
example.inner.cluster = ExampleClusters.first_empty_cluster()
example.inner.type = "type??"
empty_component = ComponentLexeme()
empty_component.role = "headword"
example.components.append(empty_component)
return example
def import_xml(self, example_xml):
self.translations = from_container_list(example_xml.querySelectorAll("translationContainer"))