I am using Glove, Gensim-word2vec, module and I can use it to return the similarity score between entities such as 'man' and 'woman' will return 0.89034. But is there a way to return the semantic relationship between two entities? For example given the word 'people' and a 'location', the result should be the relationship 'lives_in'?
I can do something like:
print(model.most_similar(positive=['king', 'woman'], negative=['man']))
Output is:
[('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)]
Desired output:
[(is_a, 0.3223), (same_as, 0349230), (people, 0302432) ...]
First, you can decide an ideal example for people and location.
ex- people
Trumphand locationwhitehouse.Then, for a new people
Georgeand locationCalifornia,You can make the following math to calculate the live _in score,
Cosine similarly between (A-B+C) and D
Implementation: