You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
from lib.snabbdom import h
|
|
|
|
class CorpusExample:
|
|
def __init__(self):
|
|
self.other_attributes = {}
|
|
|
|
def import_xml(self, example_xml):
|
|
for oth_attr in ["exampleId", "modified", "lexical_unit_id", "audio"]:
|
|
if example_xml.hasAttribute(oth_attr):
|
|
self.other_attributes[oth_attr] = example_xml.getAttribute(oth_attr)
|
|
|
|
# this is a quick fix. when all data has been updated from @example_id to @exampleId, you can remove this
|
|
if oth_attr is "exampleId":
|
|
if example_xml.hasAttribute("example_id"):
|
|
self.other_attributes[oth_attr] = example_xml.getAttribute("example_id")
|
|
|
|
def export(self, doc, modified):
|
|
result = doc.createElement("corpusExample")
|
|
if modified:
|
|
result.setAttribute("modified", "true")
|
|
|
|
for key, value in self.other_attributes.items():
|
|
result.setAttribute(key, value)
|
|
return result
|
|
|
|
def get_cluster(self):
|
|
return None
|
|
|
|
def get_structure(self):
|
|
return None
|
|
|
|
def view(self, components):
|
|
return [h("span" + comp.view_style(), {}, comp.text) for comp in components]
|
|
|