Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Pure python spell checker based on work by Peter Norvig

Project Description

Pure Python Spell Checking based on Peter Norvig’s blog post on setting up a simple spell checking algorithm.

It uses a Levenshtein Distance algorithm to find permutations within an edit distance of 2 from the original word. It then compares all permutations (insertions, deletions, replacements, and transpositions) to known words in a word frequency list. Those words that are found more often in the frequency list are *more likely* the correct results.

pyspellchecker supports multiple languages including English, Spanish, German, and French. Dictionaries were generated using the WordFrequency project on GitHub.

pyspellchecker supports Python 3. If may work for Python 2.7 but it is not guaranteed (especially for Non-English dictionaries)!


The easiest method to install is using pip:

pip install pyspellchecker

To install from source:

git clone
cd pyspellchecker
python install

As always, I highly recommend using the Pipenv package to help manage dependencies!


After installation, using pyspellchecker should be fairly straight forward:

from spellchecker import SpellChecker

spell = SpellChecker()

# find those words that may be misspelled
misspelled = spell.unknown(['something', 'is', 'hapenning', 'here'])

for word in misspelled:
    # Get the one `most likely` answer

    # Get a list of `likely` options

If the Word Frequency list is not to your liking, you can add additional text to generate a more appropriate list for your use case.

from spellChecker import SpellChecker

spell = SpellChecker()  # loads default word frequency list

# if I just want to make sure some words are not flagged as misspelled
spell.word_frequency.load_words(['microsoft', 'apple', 'google'])
spell.known(['microsoft', 'google'])  # will return both now!

More work in storing and loading word frequency lists is planned; stay tuned.

Additional Methods

On-line documentation is in the future; until then you can find more information on SpellChecker here:

correction(word): Returns the most probable result for the misspelled word

candidates(word): Returns a set of possible candidates for the misspelled word

known([words]): Returns those words that are in the word frequency list

unknown([words]): Returns those words that are not in the frequency list

word_probability(word): The frequency of the given word out of all words in the frequency list

The following are less likely to be needed by the user but are available:

edit_distance_1(word): Returns a set of all strings at a Levenshtein Distance of one based on the alphabet of the selected language

edit_distance_2(word): Returns a set of all strings at a Levenshtein Distance of two based on the alphabet of the selected language


Release History

This version
History Node


History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(8.6 kB) Copy SHA256 Hash SHA256
Wheel py2.py3 Mar 4, 2018
(8.6 kB) Copy SHA256 Hash SHA256
Wheel py3 Mar 4, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers