mid component should be colocation, not headword,

Also, readd structureName and handle unknown structure when importing ske collocation
This commit is contained in:
Ozbolt Menegatti 2020-07-08 21:21:24 +02:00
parent 8cb63eaa1d
commit 5396868601

View File

@ -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 = ""