Feature#1405 collocation structure

This commit is contained in:
2020-07-17 10:50:12 +02:00
parent b010414bfe
commit aca8093ab3
3 changed files with 17 additions and 6 deletions

View File

@@ -34,19 +34,30 @@ def build_structure_conversions():
structure_conversions.append((__new__(RegExp(vfrom, 'u')), vto_name, vto_id))
def convert_structure(structure):
def convert_structure(structure, type):
if structure_conversions is None:
build_structure_conversions()
for vfrom, vto_name, vto_id in structure_conversions:
match = structure.match(vfrom)
# fix for ids 65, 66 which matched instead with 64
if match and vto_id == '64' and '-g' in type:
vto_name = 'gg-vp-gg'
vto_id = '66'
elif match and vto_id == '64' and '-s' in type:
vto_name = 's0-vp-s0'
vto_id = '65'
if match:
# we need to remove replace alias here as we want to use javascript's one
__pragma__('noalias', 'replace')
result = structure.replace(vfrom, vto_name).strip()
__pragma__('alias', 'replace', "py_replace")
if vto_id == '64':
console.log(structure)
return result, vto_id
window.console.log("Unknown structure: ", structure)
return None
return 'N/A', '/'