我正在使用 Glove、Gensim-word2vec模块,我可以使用它来返回实体之间的相似度分数,例如'man'
and 'woman'
will return 0.89034
。但是有没有办法返回两个实体之间的语义关系呢?比如给定word'people'
和a 'location'
,结果应该是关系'lives_in'
?
我可以做类似的事情:
print(model.most_similar(positive=['king', 'woman'], negative=['man']))
输出是:
[('queen', 0.775162398815155), ('prince', 0.6123066544532776), ('princess', 0.6016970872879028), ('kings', 0.5996100902557373), ('queens', 0.565579891204834), ('royal', 0.5646308660507202), ('throne', 0.5580971240997314), ('Queen', 0.5569202899932861), ('monarch', 0.5499411821365356), ('empress', 0.5295248627662659)]
期望的输出:
[(is_a, 0.3223), (same_as, 0349230), (people, 0302432) ...]