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

Uploaded Python 3

File details

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

File metadata

  • Download URL: wordnet_lookup-1.3.3.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.3.tar.gz
Algorithm Hash digest
SHA256 0d7c649e19172d19ad3fcc4c66babecff80f5df2b2a712b3f79c7a85576e3046
MD5 80fde004f4b2cf18c876cc9f252391fe
BLAKE2b-256 d5a41b8d3049c4b3246fbe3f110606fd28dab7c873edfdb66849e61294ec359d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wordnet_lookup-1.3.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2b88d1ad7354b77c3111e256b581b3386190e1cac6db39871a71a60d59426e82
MD5 74bd38ea9f30ab4bff3501c2ec72ce7e
BLAKE2b-256 3748b855333993139e3e94ef84f00068804eafa0b2fe8a517fe0c80ecf7226ca

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