get type from data.lempos

This commit is contained in:
Luka Kavčič 2020-07-17 11:19:19 +02:00
parent bfad8e3b06
commit 2b0c82f11b
2 changed files with 9 additions and 6 deletions

View File

@ -40,13 +40,16 @@ def convert_structure(structure, type):
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:
# fix for ids 65, 66, 67 which instead matched with 64
if match and vto_id == '64' and '-s' in type:
vto_name = 's0-vp-s0'
vto_id = '65'
elif match and vto_id == '64' and '-g' in type:
vto_name = 'gg-vp-gg'
vto_id = '66'
elif match and vto_id == '64' and '-r' in type:
vto_name = 'r-vp-r'
vto_id = '67'
if match:
# we need to remove replace alias here as we want to use javascript's one

View File

@ -58,7 +58,7 @@ class SkeCollocation:
def __init__(self, data):
self.word = data.word
self.frequency = data.count
self.structure_name, self.structure_id = convert_structure(data.gramrel, data.filterwords)
self.structure_name, self.structure_id = convert_structure(data.gramrel, data.lempos)
self.other = {"score": data.score, "cm": data.cm}