Skip to main content

spellcheckmate

License Python

description

A hopefully cross-platform reimplementation of Peter Norvig's spelling corrector with minor modifications. Checking for spelling and/or grammar mistakes by calling the .check(text) method of the SpellCheckMate() class enables users to interactively correct their mistakes sentence by sentence. Correct a single word by calling .correct(word) and get a list of all the alternative corrections by calling .alternatives(word) or print them out directly by .print_alternatives(word).

usage

from spellcheckmate import SpellCheckMate

spell_check = SpellCheckMate()

word = "somthign"
corrected_word = spell_check.correct(word)
""" the words 'somthign' and the correct 'something' are 1 character deletion and 1 transposed character away from each other. """
print(corrected_word) # prints the correct version, 'something'

word = "smthign"
corrected_word = spell_check.correct(word)
"""this is a limitation of the library, since it won't search for words of which Damerau–Levenshtein distance is greater than 2. """
print(corrected_word) # prints '404', since 'smthign' and 'something' are more than 2 edits away from each other.

word = "aie"
word_alternatives = spell_check.alternatives(word)
print(word_alternatives) # prints ['ave', 'amie', 'ate', 'ale', 'die', 'tie', 'ai', 'aye', 'are', ... ]
spell_check.print_alternatives(word)
"""
ave
amie
ate
ale
die
tie
ai
aye
are
...
"""

text = "We lov everithin. Or smthign like that."
""" parses text interactively sentence by sentence and points to mistyped word after which user can select from recommendations
or type correct version if not found in recommendations. """
corrected_text = spell_check.check(text)

"""
we lov everithin
   ^
low
lot
log
love
lo
nov
sov
los
loi
> love
we lov everithin
       ^
everything
> everything
we lov everithin
we love everything 
 or smthign like that
    ^
404
> something
 or smthign like that
or something like that 
"""

installation

pip install spellcheckmate

Metadata

Release files for spellcheckmate 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spellcheckmate 0.1.4
File Size Uploaded
spellcheckmate-0.1.4.tar.gz 2.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for spellcheckmate 0.1.4
File Interpreter ABI Platform
spellcheckmate-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 4.8 MB

Release files / spellcheckmate-0.1.4.tar.gz

Download URL spellcheckmate-0.1.4.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c6075aba9d15218996e44a4afca0a0720bef3635d66d2d7966483ed91c454c54
BLAKE2b-256 checksum
How to use checksums
8d274b82c3f1cd458b22cd34352f8de7a5c64f34ca7d427a40ddef9c5969a947
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-17-generic

Release files / spellcheckmate-0.1.4-py3-none-any.whl

Download URL spellcheckmate-0.1.4-py3-none-any.whl
Size 2.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
b2c5e81e4e2fd874f4881f99b2203228acdd83548944f776865abfa90056b693
BLAKE2b-256 checksum
How to use checksums
d43f0ea94504feb8d3a108f56ed4f2867df054594c1a8edf50e61c1eba6a3dc5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-17-generic

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

1 release file

0.1.2

1 release file

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page