Skip to main content

Static Dictionaries for Rapid Wordnet Lookups

Project description

WordNet Lookup

PyPI version Downloads Downloads/Month Tests Python 3.7+ License: MIT

Is this token a word? O(1) answer. No setup. No dependencies.

A simple question deserves a simple answer. This library gives you instant yes/no validation against 88,000 common English words from the Princeton WordNet lexicon - plus morphological suffix extraction.

Quick Start

pip install wordnet-lookup
from wordnet_lookup import is_wordnet_term, get_suffixes, get_inflections, get_morphology

# Word existence - O(1), no I/O
is_wordnet_term('alpha')        # True
is_wordnet_term('waddling')     # True
is_wordnet_term('myxovirus')    # True
is_wordnet_term('nonexistent')  # False

# Case-insensitive, whitespace-tolerant
is_wordnet_term('ALPHA')        # True
is_wordnet_term(' alpha ')      # True

# Plurals handled automatically
is_wordnet_term('computers')    # True

# Morphological suffix extraction
get_suffixes('happiness')       # ['ness']
get_suffixes('beautifully')     # ['ful', 'ly']
get_suffixes('nationalized')    # ['al', 'ize', 'ed']
get_suffixes('cat')             # []   - in WordNet, no derivational suffixes
get_suffixes('xyz123')          # None - not in WordNet

# Inflectional suffix detection (runtime, not pre-computed)
get_inflections('cats')         # ['s']
get_inflections('running')      # ['ing']
get_inflections('walked')       # ['ed']
get_inflections('fastest')      # ['est']
get_inflections('cat')          # []   - base form, no inflection
get_inflections('xyz123')       # None - not in WordNet

# Combined morphological analysis
m = get_morphology('beautifully')
m.derivational  # ['ful', 'ly']
m.inflectional  # []

m = get_morphology('cats')
m.derivational  # []
m.inflectional  # ['s']

Features

  • Zero Dependencies - Pure Python, no external packages
  • Zero I/O - No filesystem access, no database queries
  • Zero Setup - No corpus downloads or configuration
  • Microsecond Lookups - O(1) hash-based access
  • Smart Plurals - Automatically checks singular forms
  • Unicode Normalization - Accented forms (e.g. naïve, café) resolved to ASCII
  • Suffix Extraction - get_suffixes() returns derivational suffixes in order, or None if the word isn't in WordNet
  • Inflectional Detection - get_inflections() detects -s, -es, -ing, -ed, -est at runtime with allomorphic stem restoration
  • Combined Morphology - get_morphology() returns a Morphology dataclass with both derivational and inflectional suffix lists

When to Use This

  • Tokenization filtering - Keep real words, discard garbage
  • Input validation - Reject nonsense in user input
  • NLP preprocessing - Filter candidates before expensive operations
  • Morphological analysis - Identify suffix chains for stemming pipelines
  • Data cleaning - Identify malformed or corrupted text

What This Doesn't Do

  • No definitions, synonyms, or semantic relationships (use spaCy for that)
  • No slang, proper nouns, or recent coinages (WordNet is from 2006)
  • No spell-checking or suggestions (just yes/no)
  • No hyphenated compounds or multi-word phrases

Documentation

See API Documentation and Implementation Notes for full details.

Development

git clone https://github.com/craigtrim/wordnet-lookup.git
cd wordnet-lookup
make all      # Full build pipeline

License

Dual-licensed: MIT (software) + Princeton WordNet License (data). See LICENSE.

WordNet 3.0 Copyright 2006 by Princeton University. All rights reserved.

See Also

  • bnc-lookup - O(1) lookup using the British National Corpus
  • morphroot - Suffix extraction pipeline that feeds this library

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wordnet_lookup-1.3.4.tar.gz (2.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wordnet_lookup-1.3.4-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

Details for the file wordnet_lookup-1.3.4.tar.gz.

File metadata

  • Download URL: wordnet_lookup-1.3.4.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.9 Darwin/25.3.0

File hashes

Hashes for wordnet_lookup-1.3.4.tar.gz
Algorithm Hash digest
SHA256 7dd464629cafa4ed0587d945bc8bbe56759e2b3bf9c52f516d6d009bd96768ae
MD5 7372d986819fae829aa64868f06a985f
BLAKE2b-256 576cdb23a92a48b07d17ce4652540df8bb3573d79ee3ffbf6fe31e0b5b5e6036

See more details on using hashes here.

File details

Details for the file wordnet_lookup-1.3.4-py3-none-any.whl.

File metadata

  • Download URL: wordnet_lookup-1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 2.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.11.9 Darwin/25.3.0

File hashes

Hashes for wordnet_lookup-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ec3d3464c9e310835eae28b736aba5445e6fdfd66f04e21da0f49e2009ac22ef
MD5 abd213526fb5859db92357bd730933f7
BLAKE2b-256 2dfa55c36c2c5850d54dd318722fd3e31d800107ecca5f78a33d9076ef71d3fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page