Complete implementation of Fast Spelling and Style Polish tool with: - Australian English spelling conversion (7 patterns + case preservation) - CLI support with text input or clipboard mode - Daemon mode with configurable hotkey - MIN_LENGTH, AGGRESSION, and CUSTOM_DICTIONARY config options - Comprehensive diff logging - 12 passing tests (100% test coverage for AU spelling) - Wheel package built and ready for deployment - Agent-friendly CLI with stdin/stdout support Features: - Text correction using t5-small-spoken-typo model - Australian/American spelling conversion - Configurable correction aggression levels - Custom dictionary whitelist support - Background daemon with hotkey trigger - CLI tool for direct text polishing - Preserves clipboard history (adds new item vs replace) Ready for deployment to /opt and Gitea repository.
21 lines
622 B
Python
21 lines
622 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
sys.path.insert(0, '/MASTERFOLDER/Tools/text-polish/src')
|
|
|
|
from model_loader import load_model, polish
|
|
from au_spelling import convert_to_au_spelling
|
|
|
|
model, tokenizer = load_model()
|
|
|
|
test_cases = [
|
|
"teh color was realy nice", # Should become "the colour was really nice"
|
|
"I need to organize the theater", # Should become "I need to organise the theatre"
|
|
]
|
|
|
|
for test in test_cases:
|
|
result = polish(model, tokenizer, test)
|
|
result_au = convert_to_au_spelling(result)
|
|
print(f"Input: {test}")
|
|
print(f"Polish: {result}")
|
|
print(f"AU: {result_au}")
|
|
print() |