In [1]:
from nltk.corpus import wordnet as wn
import nltk
import networkx as nx
#nltk.download()

In [2]:
def closure_graph(synset, fn):
    seen = set()
    graph = nx.DiGraph()

    def recurse(s):
        if not s in seen:
            seen.add(s)
            graph.add_node(s.name)
            for s1 in fn(s):
                graph.add_node(s1.name)
                graph.add_edge(s.name, s1.name)
                recurse(s1)

    recurse(synset)
    return graph

In [3]:
words = ['philosophy.n.01', 'sociology.n.01', 'physics.n.01', 'economics.n.01', 'social_science.n.01', 'social_scientist.n.01']
words1 = ['philosopher.n.01', 'sociologist.n.01', 'physicist.n.01', 'economist.n.01', 'natural_science.n.01', 'social_scientist.n.01', 'researcher.n.01']
for word in words1:

    synlist = wn.synset(word)
    graph = closure_graph(synlist,
                          lambda s: s.hypernyms()) #hyponyms
    print graph.nodes()


['philosopher.n.01', 'scholar.n.01', 'living_thing.n.01', 'physical_entity.n.01', 'causal_agent.n.01', 'entity.n.01', 'person.n.01', 'object.n.01', 'organism.n.01', 'intellectual.n.01', 'whole.n.02']
['living_thing.n.01', 'physical_entity.n.01', 'sociologist.n.01', 'causal_agent.n.01', 'scientist.n.01', 'entity.n.01', 'person.n.01', 'object.n.01', 'organism.n.01', 'social_scientist.n.01', 'whole.n.02']
['living_thing.n.01', 'physical_entity.n.01', 'causal_agent.n.01', 'physicist.n.01', 'scientist.n.01', 'entity.n.01', 'person.n.01', 'object.n.01', 'organism.n.01', 'whole.n.02']
['living_thing.n.01', 'physical_entity.n.01', 'causal_agent.n.01', 'scientist.n.01', 'economist.n.01', 'entity.n.01', 'person.n.01', 'object.n.01', 'organism.n.01', 'social_scientist.n.01', 'whole.n.02']
['science.n.01', 'knowledge_domain.n.01', 'abstraction.n.06', 'natural_science.n.01', 'content.n.05', 'psychological_feature.n.01', 'discipline.n.01', 'entity.n.01', 'cognition.n.01']
['living_thing.n.01', 'physical_entity.n.01', 'causal_agent.n.01', 'scientist.n.01', 'entity.n.01', 'person.n.01', 'object.n.01', 'organism.n.01', 'social_scientist.n.01', 'whole.n.02']
['living_thing.n.01', 'physical_entity.n.01', 'research_worker.n.01', 'scientist.n.01', 'entity.n.01', 'person.n.01', 'object.n.01', 'organism.n.01', 'causal_agent.n.01', 'whole.n.02']

Some more to look into:

- hypernyms, instance_hypernyms
- hyponyms, instance_hyponyms
- member_holonyms, substance_holonyms, part_holonyms
- member_meronyms, substance_meronyms, part_meronyms
- attributes
- entailments
- causes
- also_sees
- verb_groups
- similar_tos

In [4]:
wn.synset('sociology.n.01').definition


Out[4]:
'the study and classification of human societies'

In [11]:
wn.synset('philosophy.n.02').definition


Out[11]:
'the rational investigation of questions about existence and knowledge and ethics'

In [13]:
wn.synset('physics.n.01').definition


Out[13]:
'the science of matter and energy and their interactions'

In [14]:
wn.synset('social_science.n.01').definition


Out[14]:
'the branch of science that studies society and the relationships of individual within a society'

In [15]:
wn.synset('natural_science.n.01').definition


Out[15]:
'the sciences involved in the study of the physical world and its phenomena'

In [18]:
wn.synset('humanities.n.01').definition


Out[18]:
'studies intended to provide general knowledge and intellectual skills (rather than occupational or professional skills)'