hide-sense added

This commit is contained in:
matic_t 2021-03-04 23:27:29 -08:00
parent 4abf89868d
commit 208f5b0ee8
4 changed files with 34 additions and 16 deletions

View File

@ -119,7 +119,13 @@ class Entry(Data):
if len(self.labels) == 0: if len(self.labels) == 0:
view_buttons.append(buttons[2]) view_buttons.append(buttons[2])
else: else:
labels = ", ".join([clean_label(val) for _, val in self.labels]) labels = ""
for key, val in self.labels:
if key == "SKRIJ POMEN" and val == "Skrij":
labels = "SKRIJ POMEN, " + labels
else:
labels += clean_label(val) + ", "
labels = labels[:-2]
view_table.append((buttons[2], labels)) view_table.append((buttons[2], labels))
if self.comment == "": if self.comment == "":

View File

@ -22,6 +22,8 @@ class Example(Data):
# removes space from last component if multiword example # removes space from last component if multiword example
def check_multiword_components(self): def check_multiword_components(self):
if self.is_multiword(): if self.is_multiword():
# .no_space breaks if it's undefined
if self.components[len(self.components) - 1] != None:
self.components[len(self.components) - 1].no_space = ComponentLexeme.LAST_COMPONENT_SPACE self.components[len(self.components) - 1].no_space = ComponentLexeme.LAST_COMPONENT_SPACE
@staticmethod @staticmethod

View File

@ -10,7 +10,8 @@ TAGS = {
"semantično": [], "semantično": [],
"kontekstualna": [], "kontekstualna": [],
"Polno angleško": [], "Polno angleško": [],
"Blagovna znamka": [] "Blagovna znamka": [],
"SKRIJ POMEN": ["Skrij"]
} }
SLO2ENG_TAGS = { SLO2ENG_TAGS = {
@ -26,7 +27,8 @@ SLO2ENG_TAGS = {
"semantično": "semantic", "semantično": "semantic",
"kontekstualna": "context", "kontekstualna": "context",
"Polno angleško": "English-full", "Polno angleško": "English-full",
"Blagovna znamka": "trademark" "Blagovna znamka": "trademark",
"SKRIJ POMEN": "hide-sense",
} }
ENG2SLO_TAGS = { value: key for key, value in SLO2ENG_TAGS.items() } ENG2SLO_TAGS = { value: key for key, value in SLO2ENG_TAGS.items() }
@ -73,6 +75,9 @@ def import_tag(key, value):
# this should not happen, but maybe there was a bug... # this should not happen, but maybe there was a bug...
value = value.replace("--", "").strip() value = value.replace("--", "").strip()
if key == "SKRIJ POMEN" and value == "true":
value = "Skrij"
for tag_key in TAGS.keys(): for tag_key in TAGS.keys():
for possible_value in TAGS[tag_key]: for possible_value in TAGS[tag_key]:
if value == possible_value or "-- " + value == possible_value: if value == possible_value or "-- " + value == possible_value:
@ -97,7 +102,8 @@ def export_tag(key, value):
else: else:
key = SLO2ENG_TAGS[key] key = SLO2ENG_TAGS[key]
if key == "hide-sense":
value = "true"
value = value.replace("--", "").strip() value = value.replace("--", "").strip()
return key, value return key, value

View File

@ -132,7 +132,11 @@ def label_list_editor(current_labels, add_label_message_class):
center = h("select.label-value", {}, options) center = h("select.label-value", {}, options)
right_value = label if label not in TAGS[label_type] else "" right_value = label if label not in TAGS[label_type] else ""
right_value = "blagovna znamka" if label_type == 'Blagovna znamka' else right_value if label_type == "Blagovna znamka":
right_value = "blagovna znamka"
elif label_type == "SKRIJ POMEN":
right_value = "Skrij"
# right_value = "blagovna znamka" if label_type == 'Blagovna znamka' else right_value
right = h("input.label-value-other", right = h("input.label-value-other",
{"props": {"type": "text", "value": right_value, "placeholder": "drugo"}}, {"props": {"type": "text", "value": right_value, "placeholder": "drugo"}},
[]) [])