hide-sense added
This commit is contained in:
parent
4abf89868d
commit
208f5b0ee8
|
@ -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 == "":
|
||||||
|
|
|
@ -22,7 +22,9 @@ 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():
|
||||||
self.components[len(self.components) - 1].no_space = ComponentLexeme.LAST_COMPONENT_SPACE
|
# .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
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def new_multiword():
|
def new_multiword():
|
||||||
|
|
|
@ -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() }
|
||||||
|
@ -42,7 +44,7 @@ def import_label_list(selector, xml_element):
|
||||||
for tag_xml in xml_element.querySelectorAll(selector):
|
for tag_xml in xml_element.querySelectorAll(selector):
|
||||||
t_type = tag_xml.getAttribute("type")
|
t_type = tag_xml.getAttribute("type")
|
||||||
t_value = tag_xml.textContent
|
t_value = tag_xml.textContent
|
||||||
|
|
||||||
t_type, t_value = import_tag(t_type, t_value)
|
t_type, t_value = import_tag(t_type, t_value)
|
||||||
result.append((t_type, t_value))
|
result.append((t_type, t_value))
|
||||||
return result
|
return result
|
||||||
|
@ -54,14 +56,14 @@ def import_tag(key, value):
|
||||||
# simmilar for "stilne"
|
# simmilar for "stilne"
|
||||||
# if english, than translate and change style-xxx for stilne
|
# if english, than translate and change style-xxx for stilne
|
||||||
# for value, just handle if some bad "-- xxx" stuff is in xml
|
# for value, just handle if some bad "-- xxx" stuff is in xml
|
||||||
|
|
||||||
if key in SLO2ENG_TAGS:
|
if key in SLO2ENG_TAGS:
|
||||||
pass
|
pass
|
||||||
elif key in ("stilne", "style"):
|
elif key in ("stilne", "style"):
|
||||||
key = "stilne"
|
key = "stilne"
|
||||||
elif key in ENG2SLO_TAGS:
|
elif key in ENG2SLO_TAGS:
|
||||||
key = ENG2SLO_TAGS[key]
|
key = ENG2SLO_TAGS[key]
|
||||||
|
|
||||||
# handle stilne-xxx stuff
|
# handle stilne-xxx stuff
|
||||||
if "-" in key:
|
if "-" in key:
|
||||||
key = key.split("-")[0]
|
key = key.split("-")[0]
|
||||||
|
@ -69,15 +71,18 @@ def import_tag(key, value):
|
||||||
window.console.log("Uknown tag :(", key, value)
|
window.console.log("Uknown tag :(", key, value)
|
||||||
# using some default
|
# using some default
|
||||||
key = TAGS.keys()[0]
|
key = TAGS.keys()[0]
|
||||||
|
|
||||||
# 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:
|
||||||
return key, possible_value
|
return key, possible_value
|
||||||
|
|
||||||
# not found, must be manually inputted
|
# not found, must be manually inputted
|
||||||
return key, value
|
return key, value
|
||||||
|
|
||||||
|
@ -87,18 +92,19 @@ def export_tag(key, value):
|
||||||
arr = TAGS["stilne"]
|
arr = TAGS["stilne"]
|
||||||
key = "style"
|
key = "style"
|
||||||
value_idx = arr.index(value)
|
value_idx = arr.index(value)
|
||||||
|
|
||||||
if value_idx >= 0:
|
if value_idx >= 0:
|
||||||
for sec_slo, sec_eng in reversed(STYLE_SECTIONS):
|
for sec_slo, sec_eng in reversed(STYLE_SECTIONS):
|
||||||
idx = arr.index(sec_slo)
|
idx = arr.index(sec_slo)
|
||||||
if idx < value_idx:
|
if idx < value_idx:
|
||||||
key = "style-" + sec_eng
|
key = "style-" + sec_eng
|
||||||
break
|
break
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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"}},
|
||||||
[])
|
[])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user