Overview
WordNet is a lexical database that groups words into sets of synonyms (synsets) and records semantic relationships. bun_nltk provides three WordNet versions:- Mini: Compact subset for basic usage
- Extended: Larger vocabulary with more relationships
- Packed: Full WordNet in compressed binary format
Loading WordNet
Mini WordNet
Extended WordNet
Packed WordNet (Full)
Custom Path
Working with Synsets
Find Synsets by Word
Filter by Part of Speech
"n": Noun"v": Verb"a": Adjective"r": Adverb
Get Synset by ID
Semantic Relations
Hypernyms (Is-A Relationship)
Find more general terms:Hyponyms (Instance-Of Relationship)
Find more specific terms:Similar Terms (Adjectives)
Antonyms (Opposites)
Morphological Analysis
Morphy - Lemmatization
Find base form of inflected words:All Parts of Speech
- Nouns: cats → cat, dogs → dog,iries → iry
- Verbs: running → run, walked → walk, tries → try
- Adjectives: better → good, biggest → big
Vocabulary Access
Get All Lemmas
Filter Lemmas by POS
Practical Examples
Find Synonyms
Build Semantic Hierarchy
Word Sense Disambiguation
Semantic Similarity
Expand Query Terms
Synset Data Structure
Packed Format Details
The packed WordNet uses a binary format:- Header: 5-byte magic string
- Length: 4-byte payload size
- Payload: Compressed JSON data
Performance Notes
- All loaders cache results (singleton pattern)
- Morphy uses native code optimization
- Lookups use hash maps for O(1) access
- Packed format reduces disk I/O
API Reference
Loading Functions
loadWordNetMini(path?)- Load mini WordNetloadWordNetExtended(path?)- Load extended WordNetloadWordNetPacked(path?)- Load packed WordNet
WordNet Methods
synset(id)- Get synset by IDsynsets(word, pos?)- Find synsets for wordlemmas(pos?)- Get all lemmasmorphy(word, pos?)- Lemmatize wordhypernyms(synset)- Get parent conceptshyponyms(synset)- Get child conceptssimilarTo(synset)- Get similar synsetsantonyms(synset)- Get opposite synsets