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

Uploaded Python 3

File details

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

File metadata

  • Download URL: wordnet_lookup-1.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 f853f98d14d75b947294c244cb2b101903f7d982ee4d65fa07947f78274a0a95
MD5 6691ec3795bccb71b451ee91aaa6e380
BLAKE2b-256 bdd5838de36cd4f56bcc3c35aaab1acc8658c468c09dfe505456489c617c49ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wordnet_lookup-1.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1152100f2afcb7a303fed241ef707ff456d438c8d47c2b562b91a0cb60ced9d9
MD5 198da2b4997735c840ae57aab727d0ea
BLAKE2b-256 b39b0dcce2d3f659a8a327dfa50fe036e4bca0ac61172cbc9a8e87b2c3806a0e

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