better collocation export

This commit is contained in:
2020-09-03 10:29:24 +02:00
parent 8802a09c9c
commit 19d3e38dcb
2 changed files with 64 additions and 20 deletions

View File

@@ -24,6 +24,7 @@ def build_structure_conversions():
if line[1] == "struktura":
continue
vto_structure = line[1].strip().split(">")[1].split("<")[0]
vto_name = line[2].strip()
vto_id = line[4].strip()
@@ -31,14 +32,14 @@ def build_structure_conversions():
continue
vfrom = "^" + line[0].replace("?", "\?").replace("%s", "([a-zA-Z螚ȎŠ-]+)") + "$"
structure_conversions.append((__new__(RegExp(vfrom, 'u')), vto_name, vto_id))
structure_conversions.append((__new__(RegExp(vfrom, 'u')), vto_name, vto_structure, vto_id))
def convert_structure(structure, type):
if structure_conversions is None:
build_structure_conversions()
for vfrom, vto_name, vto_id in structure_conversions:
for vfrom, vto_name, vto_structure, vto_id in structure_conversions:
match = structure.match(vfrom)
# fix for ids 65, 66, 67 which instead matched with 64
if match and vto_id == '64' and '-s' in type:
@@ -57,7 +58,7 @@ def convert_structure(structure, type):
result = structure.replace(vfrom, vto_name).strip()
__pragma__('alias', 'replace', "py_replace")
return result, vto_id
return result, vto_structure, vto_id
window.console.log("Unknown structure: ", structure)
return 'N/A', '/'