Natural Language Processing


(Deadline: 24.05.2020 23:59:59)

Daca nu sunteti logati exercitiile nu se mai afiseaza.


Wordnet is a semantic dictionary organized into synsets (synonim rings). A synset is a group of synonym words and has an associated id and sense (a word can appear in multiple synsets if that word (or collocation) is polysemantic) illustrated by a brief gloss.

To easily visualize the links between words, you can use this web based GUI

>>> from nltk.corpus import wordnet
>>> wordnet.synsets('school')
[Synset('school.n.01'), Synset('school.n.02'), Synset('school.n.03'), Synset('school.n.04'), Synset('school.n.05'), Synset('school.n.06'), Synset('school.n.07'), Synset('school.v.01'), Synset('educate.v.03'), Synset('school.v.03')]

>>> wordnet.synsets('schooled')
[Synset('school.v.01'), Synset('educate.v.03'), Synset('school.v.03')]
>>> wordnet.synsets('cats')
[Synset('cat.n.01'), Synset('guy.n.01'), Synset('cat.n.03'), Synset('kat.n.01'), Synset('cat-o'-nine-tails.n.01'), Synset('caterpillar.n.02'), Synset('big_cat.n.01'), Synset('computerized_tomography.n.01'), Synset('cat.v.01'), Synset('vomit.v.01')]

Types of relations (for nouns):

Types of relations (for verbs):

Types of relations (for adjectives):

Types of relations (for adverbs):

The similarity of two synsets: >>> tree=wordnet.synset('tree.n.01')
>>> tree.path_similarity(wordnet.synset('plant.n.01'))

>>> tree.path_similarity(wordnet.synset('car.n.01'))

>>> tree.path_similarity(wordnet.synset('public_school.n.01'))


Exercises and homework

All exercises can be done by all students, unregarding attendance.