Overview
WordNet organizes concepts through semantic relations that connect synsets. bun_nltk provides methods to traverse these relationships, enabling semantic analysis and concept hierarchies.Relation Types
WordNet supports four primary semantic relations:| Relation | Description | Example |
|---|---|---|
| Hypernym | More general concept (“is-a” parent) | dog → canine → mammal |
| Hyponym | More specific concept (“is-a” child) | vehicle → car → sedan |
| Similar To | Related/similar concept (mainly adjectives) | wet ↔ damp |
| Antonym | Opposite concept | hot ↔ cold |
Methods
hypernyms
Returns more general synsets (superordinates) in the taxonomy.idOrSynset: string | WordNetSynset- Synset ID or synset object
WordNetSynset[]- Array of hypernym synsets (empty if none exist)
- Returns empty array if synset not found or has no hypernyms
- Filters out any broken references (IDs that don’t resolve)
- Most common for nouns and verbs
- Represents “is-a” or “is-a-kind-of” relationships
hyponyms
Returns more specific synsets (subordinates) in the taxonomy.idOrSynset: string | WordNetSynset- Synset ID or synset object
WordNetSynset[]- Array of hyponym synsets (empty if none exist)
- Returns empty array if synset not found or has no hyponyms
- Filters out any broken references (IDs that don’t resolve)
- Abstract concepts typically have many hyponyms
- Specific concepts may have few or no hyponyms
similarTo
Returns synsets with similar meaning (primarily for adjectives).idOrSynset: string | WordNetSynset- Synset ID or synset object
WordNetSynset[]- Array of similar synsets (empty if none exist)
- Returns empty array if synset not found or has no similar synsets
- Filters out any broken references
- Most common for adjectives
- Represents similarity rather than hierarchy
- Not necessarily symmetric (A similar to B doesn’t mean B similar to A)
antonyms
Returns synsets with opposite meaning.idOrSynset: string | WordNetSynset- Synset ID or synset object
WordNetSynset[]- Array of antonym synsets (empty if none exist)
- Returns empty array if synset not found or has no antonyms
- Filters out any broken references
- Most common for adjectives and some adverbs
- Less common for nouns and verbs
- May be symmetric (hot ↔ cold) but not guaranteed
Traversal Examples
Building Hypernym Chains
Climb the taxonomy tree from specific to general:Finding Common Ancestors
Find the lowest common hypernym between two concepts:Exploring Hyponym Trees
Recursively explore all specific concepts:Semantic Similarity
Compare concepts based on shared hypernyms:Finding Antonym Pairs
Relationship Properties
Stored as ID Arrays
Relationships are stored as arrays of synset IDs in theWordNetSynset type: