Lowest common hypernyms shared by a set of words

330 Views Asked by At

Given a set of 10 words (["dog", "cat", "rabbit" .... ]) I'd like to find the lowest common hypernym if there's one.

I know that WordNet lets you find one between two synsets, but what would be a good way to find it among multiple words?

My problem comes from the fact each word has a set of sysnets, in which each member of this set can have a different hypernym, and each hypernym has a set of synsets, and so on. So a naive algorithm would end up doing a lot of iterations.

1

There are 1 best solutions below

0
On

Given two words (synsets) in WordNet, find their lowest common hypernym (LCH). Then find the LCH of that hypernym and the next word. Repeat until you have done all the words. In code this could look like this:

syns = [...] # list of synsets
lch = syns[0]
for word in syns[1:]:
    lch = find_lch(lch, word)

You'll have to do N iterations, where N is the size of your list, but there's no way around that.