From 2b0c82f11b636fd2e55e274cdcd1cdb56bdfa56c Mon Sep 17 00:00:00 2001 From: LukeItUp Date: Fri, 17 Jul 2020 11:19:19 +0200 Subject: [PATCH] get type from data.lempos --- src/lib/structure_conversions.py | 13 ++++++++----- src/message/ske_messages.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/structure_conversions.py b/src/lib/structure_conversions.py index 2dbfec8..782072f 100644 --- a/src/lib/structure_conversions.py +++ b/src/lib/structure_conversions.py @@ -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 diff --git a/src/message/ske_messages.py b/src/message/ske_messages.py index 9d03c9b..0f7a200 100644 --- a/src/message/ske_messages.py +++ b/src/message/ske_messages.py @@ -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}