How can I make a hash table for all relations in wordNet and cPickle them?

101 views Asked by At

I am looking for a cPickle file that contains a hash table for a hierarchy superset relations of wordNet. Or is there any tips how to do it in python 2.7 please.

What I have done is something for specific words like:

>>> hypernyms = {}
>>> for x in s[0].hypernyms()[0].hypernyms()[0].lemmas:
        try:
             hypernyms[“dog”][x.name] = True
        except:
             hypernyms[“dog”] = {X.name: True}

and now when I see hypernyms, it will be something like:

>>> hypernyms
hypernyms
{'dog': {'animate_being': True, 'brute': True, 'beast': True, 'animal': True, 'fauna': True, 'creature': True}}

but how can I do it recursively for all words in wordNet? and how to put them in cPickle.

0

There are 0 answers