Harmonia Spell Checker
A fast, accurate, and feature-rich Python spell checker - a powerful alternative to pyspellchecker with advanced features and optimized performance.
🚀 Features
- High Performance: Optimized dictionary loading and word lookup algorithms
- Accurate Suggestions: Advanced algorithms for spelling suggestions:
- Levenshtein distance with optimized implementation
- Phonetic matching with Soundex algorithm
- Context-aware weighted suggestions
- Flexible Word Handling:
- Support for hyphenated words
- Contractions and possessives detection
- Automatically derived word forms
- Robust Output Options:
- Interactive command-line interface
- Detailed HTML reports with hover suggestions
- Markdown report generation
- Customizable output formats
- Developer-Friendly:
- Clean, well-documented API
- Highly customizable settings
- Comprehensive error handling
- Memory-efficient implementation
📦 Installation
pip install harmoniapy
🖥️ CLI Usage
Check a file for spelling errors:
# Basic usage
harmonia check myfile.txt
# Show suggestions for each error
harmonia check myfile.txt --suggest
# Generate HTML report with hover suggestions
harmonia check myfile.txt --suggest --html report.html
# Generate Markdown report
harmonia check myfile.txt --suggest --markdown report.md
# Ignore specific words
harmonia check myfile.txt --ignore ignored-words.txt
# Show version information
harmonia --version
💻 Python API Usage
from harmonia import Dictionary, check_file
# Initialize dictionary (loads automatically)
dictionary = Dictionary()
# Check file with suggestions
errors = check_file("myfile.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("myfile.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.
🔄 Comparison with pyspellchecker
| Feature | Harmonia | pyspellchecker |
|---|---|---|
| Suggestion algorithm | Multi-algorithm hybrid | Primarily edit distance |
| Phonetic matching | ✅ Soundex | ❌ Not included |
| Word frequency | ✅ Wikipedia-based | ✅ Basic frequency |
| HTML reports | ✅ Interactive | ❌ Not included |
| Misspellings DB | ✅ Extensive | ✅ Limited |
| Performance | ✅ Highly optimized | ⚠️ Standard |
| Custom dictionaries | ✅ Supported | ✅ Supported |
| Hyphenated words | ✅ Advanced handling | ⚠️ Basic support |
| Derived word forms | ✅ Automatic | ❌ Not included |
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for harmoniapy 1.2.0
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 |
|---|---|---|---|---|
| harmoniapy-1.2.0.tar.gz | 15.5 kB | Without provenance | Details for harmoniapy-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| harmoniapy-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for harmoniapy-1.2.0-py3-none-any.whl |
Total release size: 32.1 kB
Release files / harmoniapy-1.2.0.tar.gz
| Download URL | harmoniapy-1.2.0.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7ebcb279107db9dd7db2ec26f7ec96598f6ef3f6a263aa800654957899ee789
|
|
BLAKE2b-256 checksum How to use checksums |
f68e095651876134220963c7bf4e924ba977c9cc6340def4c663aafeecb190fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / harmoniapy-1.2.0-py3-none-any.whl
| Download URL | harmoniapy-1.2.0-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f95ccd0ecceb713796b3fc3cae69fbcd6b06bfd5904aab43be8c165d8afc7887
|
|
BLAKE2b-256 checksum How to use checksums |
0cb533f820ee330357a2e5ff29cc8024c05f460b4cb1123c895ad2b2eaedc7f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for harmoniapy 1.2.0
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.