PySpell
PySpell provides functionality for spell checking and sentence correction. It uses a dictionary of words and the Levenshtein distance algorithm to suggest corrections.
Functions
load_dictionary(file_path)
This function loads a dictionary from a text file. Each line in the file should contain a single word.
get_difference(word1, word2)
This function calculates the Levenshtein distance between two words. The Levenshtein distance is a measure of the difference between two sequences of words.
spell_check(word, amount: int, show_distance=False)
This function checks the spelling of a word and suggests corrections. The number of suggestions is determined by the amount parameter. If show_distance is set to True, the function will also return the Levenshtein distance for each suggestion.
correct_word(word)
This function returns the most likely correction for a word.
correct_sentence(sentence)
This function corrects all the words in a sentence and returns the corrected sentence.
Usage
First, load the dictionary:
# Import the library
import pyspell
# Load words from text file
dictionary = pyspell.load_dictionary("words.txt")
# Get top 5 closest words to helo
print(pyspell.spell_check("heelo", 5, dictionary))
# Get top suggestion to helo
print(pyspell.correct_word("heelo", dictionary))
# Correct all words in a sentance
print(pyspell.correct_sentence("heelo wrold", dictionary))
Metadata
Release files for pyspell 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyspell-0.0.6.tar.gz | 2.5 kB | Without provenance | Details for pyspell-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyspell-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for pyspell-0.0.6-py3-none-any.whl |
Total release size: 5.3 kB
Release files / pyspell-0.0.6.tar.gz
| Download URL | pyspell-0.0.6.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e54ad9ab8eb113a970ee801391a0136271808aab724ace39d53fd9ada8c39f7
|
|
BLAKE2b-256 checksum How to use checksums |
7900b0403af336cb555da30dc33f3f42c1a7b8df8e753d67d9264d87b93224db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Release files / pyspell-0.0.6-py3-none-any.whl
| Download URL | pyspell-0.0.6-py3-none-any.whl |
|---|---|
| Size | 2.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d347120b701c359e1adb6bc25db38cf5eef8b3a0d7d7a45f6b1d679c20da3550
|
|
BLAKE2b-256 checksum How to use checksums |
88a54e69682d34f3307cca9f5423ff7c14c3bc64ed25acd8354555df0fa8c465
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.1
|
Security for pyspell 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.