Pure Python spell checker inspired by pyspellchecker
Project description
Harmonia Spell Checker
A fast, (pretty) accurate Python spell checker, inspired by pyspellchecker.
Installation
pip install harmoniapy
Features
- Optimized dictionary loading
- Phonetic (Soundex) matching
- Hyphen/quote variation support
- Levenshtein distance-based suggestions
- HTML report generation with hover suggestions
CLI Usage
# Show errors
harmonia check file.txt
# Show errors with suggestions
harmonia check file.txt --suggest
# Generate HTML report with hover suggestions
harmonia check file.txt --suggest --html report.html
Python API Usage
from harmonia import Dictionary, check_file
# Initialize dictionary (English only for now)
dictionary = Dictionary()
# Check file with suggestions
errors = check_file("file.txt", dictionary, suggest=True)
# Process errors
for error in errors:
print(f"Error: {error['word']} at line {error['line']}")
if error['suggestions']:
print(f"Suggestions: {', '.join(error['suggestions'])}")
# Generate HTML report
from harmonia.formatters import generate_html_report
with open("file.txt") as f:
text = f.read()
html_report = generate_html_report(text, errors)
with open("report.html", "w") as f:
f.write(html_report)
HTML Report
The HTML report shows the text with red underlines for misspelled words. Hover over any underlined word to see spelling suggestions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
harmoniapy-1.1.0.tar.gz
(9.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file harmoniapy-1.1.0.tar.gz.
File metadata
- Download URL: harmoniapy-1.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f5de702bfd07925a943c24f83411538ab98609ec864107a5a46b664b73d503d
|
|
| MD5 |
27c350864bc2d67f4033d3f8dfbbf2ab
|
|
| BLAKE2b-256 |
007c837ad4c645f073dec5edada58f174af9f925c40fbd4a6cac2b263f3228d7
|
File details
Details for the file harmoniapy-1.1.0-py3-none-any.whl.
File metadata
- Download URL: harmoniapy-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e2589144a2e655be61e77d483a5b803e7d4d3bb8acc244b3ec25bb13062f405
|
|
| MD5 |
9b4297784a4f52943a57dca2d7be16a7
|
|
| BLAKE2b-256 |
78712e967d79c0789dbdab4825723c84f278e73a5357577453aae74211718245
|