diff --git a/src/message/ske_messages.py b/src/message/ske_messages.py index 0032312..9769f3a 100644 --- a/src/message/ske_messages.py +++ b/src/message/ske_messages.py @@ -58,7 +58,15 @@ class SkeCollocation: def __init__(self, data): self.word = data.word self.frequency = data.count - self.structure_name, self.structure_id = convert_structure(data.gramrel) + + info = convert_structure(data.gramrel) + if info is None: + self.structure_name = None + self.structure_id = None + else: + self.structure_name = info[0] + self.structure_id = info[1] + self.other = {"score": data.score, "cm": data.cm} @@ -243,6 +251,7 @@ class SkeInsert(DataChgClickMessage): new_collocation.inner = MultiwordExample() new_collocation.inner.other_attributes["structure_id"] = example.structure_id + new_collocation.inner.other_attributes["structureName"] = example.structure_name new_collocation.inner.other_attributes["logDice"] = example.other["score"] new_collocation.inner.other_attributes["frequency"] = example.frequency new_collocation.inner.type = "collocation" @@ -253,7 +262,7 @@ class SkeInsert(DataChgClickMessage): lex_mid = ComponentLexeme() lex_mid.text = example.word - lex_mid.role = "headword" + lex_mid.role = "collocation" lex_right = ComponentLexeme() lex_right.text = ""