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

# 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

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 Extractionget_suffixes() returns derivational suffixes in order, or None if the word isn't in WordNet

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.0.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.0-py3-none-any.whl (2.5 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wordnet_lookup-1.3.0.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.0.tar.gz
Algorithm Hash digest
SHA256 969d74f98a513a54dcd5477abd7b1fea990f92b021b26e51df0409605cfca6aa
MD5 d20b73e52326daccc760491d8eb40a16
BLAKE2b-256 0d073a413888536199fe265a244fb575329d3c4e52ea4e017b79d839022ed72d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wordnet_lookup-1.3.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2e0cc2eec1fe3a2d8d1a316d013c86061a278985f5135ebc216d27c2e7b3479
MD5 a5e0018839bc9bd74495c4e3cbf4a4aa
BLAKE2b-256 cf09d4d9ad1d1068ac4e69c2e7cac94270231dda369dcfbc461242d958087dd4

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