You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A fast and comprehensive Python library for expanding English contractions and slang.
9
-
10
-
**This is an enhanced fork of the original [contractions](https://github.com/kootenpv/contractions) library by Pascal van Kooten, with significant improvements in performance, testing, type safety, and maintainability.**
8
+
A fast and comprehensive Python library for expanding English contractions.
11
9
12
10
## Features
13
11
14
-
- ⚡ **Fast**: 50x faster than version 0.0.18 (uses efficient Aho-Corasick algorithm)
12
+
- ⚡ **Fast**: ~112K ops/sec for typical text expansion (Aho-Corasick algorithm)
15
13
- 📚 **Comprehensive**: Handles standard contractions, slang, and custom additions
16
14
- 🎯 **Smart**: Preserves case and handles ambiguous contractions intelligently
17
15
- 🔧 **Flexible**: Easy to add custom contractions on the fly
@@ -126,7 +124,7 @@ The `preview()` function lets you see all contractions in a text before expandin
- Optimized dictionary operations and comprehensions
303
+
- Eliminated redundant code paths
293
304
- Reduced function call overhead
294
-
- Improved list comprehensions
295
-
- Cached computations
296
305
297
-
### 🧪 Enhanced Testing
298
-
-**100% test coverage**(up from ~60%)
299
-
-16 comprehensive tests including edge cases
300
-
-Error handling tests
306
+
### 🧪 Testing
307
+
-**100% test coverage**enforced via CI/CD
308
+
-Comprehensive tests including edge cases
309
+
-Input validation and error handling tests
301
310
- Performance benchmarking suite
302
311
303
312
### 📦 Modern Tooling
304
-
-**Python 3.10+** support (modern type hints)
305
-
- Ruff for fast linting
306
-
- Pre-commit hooks
307
-
- GitHub Actions CI/CD
308
-
- Automated PyPI publishing
313
+
-**Python 3.10+** support (modern type hints with `list[dict]`, etc.)
314
+
- Ruff for fast linting (replaces black, flake8, isort)
315
+
- Mypy for strict type checking
316
+
- GitHub Actions CI/CD with concurrency control
317
+
- Automated PyPI publishing via Git tags
318
+
-`uv` support for fast dependency management
309
319
310
320
### 📚 Better Documentation
311
-
- Comprehensive README with examples
312
-
- API reference documentation
313
-
- Deployment guide
314
-
- Contributing guidelines
321
+
- Comprehensive README with real benchmark results
322
+
- Complete API reference with examples
323
+
- Clear contributing guidelines
315
324
316
325
## Why "sane-contractions"?
317
326
327
+
**This is an enhanced fork of the original [contractions](https://github.com/kootenpv/contractions) library by Pascal van Kooten, with improvements in performance, testing, type safety, and maintainability.**
328
+
318
329
The original library is excellent but has been unmaintained since 2021. This fork provides:
0 commit comments