U.S. flag

Made in the USA.

Craigslist Jobs Stats Jobble Stats

Linguistics

Expanding the "Librarian": Lexical Relations in NLTK

While Gensim uses math and spaCy uses statistical brains, NLTK relies on WordNet. This allows it to navigate precise "nyms"—the linguistic categories that define how words relate to one another.

1. The "Is-A" Hierarchy (Taxonomy)

  • Hypernyms: The broader, "umbrella" term.
    Example: "Fruit" is the hypernym of "Apple."
  • Hyponyms: The specific sub-type.
    Example: "Salmon" is a hyponym of "Fish."

2. The "Has-A" Hierarchy (Parts and Wholes)

  • Meronyms: A part of a whole.
    Example: "Wheel" is a meronym of "Bicycle."
  • Holonyms: The whole entity that contains parts.
    Example: "Keyboard" is a holonym of "Escape Key."

3. Meanings and Opposites

  • Synonyms: Words with identical or near-identical meanings.
    Example: "Purchase" and "Buy."
  • Antonyms: Words with opposite meanings.
    Example: "Victory" and "Defeat."

Library Comparison Table

Feature NLTK spaCy Gensim
Logic Human-defined Dictionary Pre-trained Statistical Brain Neural Network Math
Best For Synonyms & Part-of logic Similarity scores & Speed Finding hidden patterns
Weakness Doesn't understand slang Can confuse opposites Needs huge amounts of data