# -*- coding: utf-8 -*-
"""3_a_bWordnet, lemmas, hyponyms, hypernyms.

Automatically generated by Colab.

Original file is located at
    https://colab.research.google.com/drive/1JTkpe2kTxfc6P8fhAf372oyr8yXSE7fP
"""

#'WordNet provides synsets which is the collection of synonym words also called
#“lemmas”.
import nltk
from nltk.corpus import wordnet
nltk.download('wordnet')
print(wordnet.synsets("computer"))

import nltk
nltk.download('wordnet')
from nltk.corpus import wordnet
print(wordnet.synsets("computer"))
print(wordnet.synset("computer.n.01").definition())

print("Examples:", wordnet.synset("computer.n.01").examples())

print(wordnet.lemma('buy.v.01.buy').antonyms())

import nltk
from nltk.corpus import wordnet
print(wordnet.synsets("computer"))
print(wordnet.synset("computer.n.01").lemma_names())

for e in wordnet.synsets("computer"):
    print(f'{e} --> {e.lemma_names()}')

20
print(wordnet.synset('computer.n.01').lemmas())


print(wordnet.lemma('computer.n.01.computing_device').synset())

print(wordnet.lemma('computer.n.01.computing_device').name())


syn = wordnet.synset('computer.n.01')
print(syn.hyponyms)
print([lemma.name() for synset in syn.hyponyms() for lemma in synset.lemmas()])


vehicle = wordnet.synset('vehicle.n.01')
car = wordnet.synset('car.n.01')
print(car.lowest_common_hypernyms(vehicle))

