Is there a way to obtain Wordnet adjective nominalizations using NLTK?
For example, for happy
the desired output would be happiness
.
I tried to dig around, but couldn't find anything.
The quick and dirty answer is that wordnet does this already:
<adj.all>S: (adj) happy (enjoying or showing or marked by joy or pleasure) "a happy smile"; "spent many happy days on the beach"; "a happy marriage"
- attribute
- <noun.state>S: (n) happiness, felicity (state of well-being characterized by emotions ranging from contentment to intense joy)
- <noun.feeling>S: (n) happiness (emotions experienced when in a state of well-being)
- derivationally related form
- <noun.state> W: (n) happiness [Related to: happy] (state of well-being characterized by emotions ranging from contentment to intense joy)
- <noun.feeling> W: (n) happiness [Related to: happy] (emotions experienced when in a state of well-being)
The remaining question is how to do this programmatically (without web-scraping).
The wordnet library wrapper tool is pretty powerful and demonstrates what appears to be the breadth of the C library interface:
$ wn happy
No information available for noun happy
No information available for verb happy
Information available for adj happy
-antsa Antonyms
-synsa Synonyms (ordered by estimated frequency)
-attra Attributes
-deria Derived Forms
-famla Familiarity & Polysemy Count
-grepa List of Compound Words
-over Overview of Senses
$ wn happy -deria -n1
Derived Forms of adj happy
Sense 1
happy (vs. unhappy)
RELATED TO->(noun) happiness#1
=> happiness, felicity
RELATED TO->(noun) happiness#2
=> happiness
So, Pythonically, you could either subprocess
to the wn command which is kinda sloppy, or use the wordnet facilities already built into NLTK.
On ubuntu (and presumably debian) the wordnet libraries and tools are conveniently available with:
sudo apt-get install wordnet wordnet-dev
Alas:
$ wn pythonic
No information available for pythonic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With