fixed id=null and moving collocations between senses - inside v4.1 #12
|
@ -48,13 +48,15 @@ def export_entry(entry):
|
|||
# if({}) works uncorrectly in transcrypt
|
||||
if len(entry.lexical_unit) > 0 and len(entry.lexical_unit['lexemes']) > 0:
|
||||
lexunit = doc.createElement("lexicalUnit")
|
||||
lexunit.setAttribute("id", entry.lexical_unit["id"])
|
||||
if(entry.lexical_unit["id"]):
|
||||
lexunit.setAttribute("id", entry.lexical_unit["id"])
|
||||
lexunit.setAttribute("type", entry.lexical_unit['type'])
|
||||
for lexeme in entry.lexical_unit["lexemes"]:
|
||||
lexeme_xml = doc.createElement("lexeme")
|
||||
lexeme_xml.setAttribute("lexical_unit_lexeme_id", lexeme["id"])
|
||||
if(lexeme["id"]):
|
||||
lexeme_xml.setAttribute("lexical_unit_lexeme_id", lexeme["id"])
|
||||
lexeme_xml.textContent = lexeme["text"]
|
||||
if len(entry.lexical_unit["lexemes"] > 1):
|
||||
if len(entry.lexical_unit["lexemes"]) > 1:
|
||||
component = doc.createElement('component')
|
||||
component.appendChild(lexeme_xml)
|
||||
lexunit.appendChild(component)
|
||||
|
@ -231,7 +233,6 @@ def export_example_to_entry_xml(example, other_examples = None):
|
|||
lexical_unit = doc.createElement("lexicalUnit")
|
||||
lexical_unit.setAttribute("type", "MWE")
|
||||
head.appendChild(lexical_unit)
|
||||
|
||||
if example.inner.other_attributes['structure_id'] != None and len(example.components) <= 3:
|
||||
lexical_unit.setAttribute("id", example.inner.other_attributes['structure_id'])
|
||||
for comp in example.components:
|
||||
|
@ -241,7 +242,6 @@ def export_example_to_entry_xml(example, other_examples = None):
|
|||
lexical_unit.appendChild(comp_xml)
|
||||
comp_xml.appendChild(lexeme)
|
||||
|
||||
|
||||
grammar = doc.createElement("grammar")
|
||||
category = doc.createElement("category")
|
||||
grammar.appendChild(category)
|
||||
|
|
|
@ -45,13 +45,14 @@ class Entry(Data):
|
|||
lex_units = entry_xml.querySelectorAll("lexical_unit lexeme,lexicalUnit lexeme")
|
||||
lex_unit_parent = entry_xml.querySelector("lexicalUnit")
|
||||
self.lexical_unit['lexemes'] = []
|
||||
self.lexical_unit['id'] = lex_unit_parent.getAttribute('id') if lex_unit_parent and lex_unit_parent.hasAttribute(
|
||||
"id") else None
|
||||
if lex_unit_parent and lex_unit_parent.hasAttribute("id"):
|
||||
self.lexical_unit['id'] = lex_unit_parent.getAttribute('id')
|
||||
self.lexical_unit['type'] = lex_unit_parent.getAttribute("type") if lex_unit_parent and lex_unit_parent.hasAttribute(
|
||||
"type") else "single"
|
||||
for unit in lex_units:
|
||||
lexical_unit = {}
|
||||
lexical_unit['id'] = unit.getAttribute("lexical_unit_lexeme_id")
|
||||
if unit.hasAttribute("lexical_unit_lexeme_id"):
|
||||
lexical_unit['id'] = unit.getAttribute("lexical_unit_lexeme_id")
|
||||
lexical_unit['text'] = unit.textContent
|
||||
self.lexical_unit['lexemes'].append(lexical_unit)
|
||||
|
||||
|
|
|
@ -185,12 +185,14 @@ def move_examples_to_sense(example_list, entry):
|
|||
sense_of_first_example = example_senses[0]
|
||||
|
||||
options = [h("p", {}, "Choose sense for examples")]
|
||||
definition = ""
|
||||
for x in sense.definitions:
|
||||
if x["type"] == "indicator":
|
||||
definition = x.value
|
||||
break
|
||||
|
||||
for idx, sense in enumerate(entry.senses):
|
||||
definition = sense.definitions[0].value
|
||||
for x in sense.definitions:
|
||||
if x["type"] == "indicator":
|
||||
definition = x.value
|
||||
break
|
||||
|
||||
text = "{}: {}".format(idx + 1, definition)
|
||||
id_ = "choose-example-{}".format(idx)
|
||||
|
||||
|
@ -201,7 +203,6 @@ def move_examples_to_sense(example_list, entry):
|
|||
options.append(h("input#{}.checkable-input".format(id_), {"props": props}, []))
|
||||
options.append(h("label.checkable", {"attrs": {"for": id_}}, text))
|
||||
options.append(h("br", {}, []))
|
||||
|
||||
return modal_template(options, "Examples picker", (message.MoveExamplesToSense, example_list))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user