SqueakyCleanText 0.5.1__tar.gz → 0.5.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/PKG-INFO +26 -64
  2. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/README.md +24 -63
  3. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/SqueakyCleanText.egg-info/PKG-INFO +26 -64
  4. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/pyproject.toml +5 -1
  5. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/__init__.py +1 -1
  6. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/LICENSE +0 -0
  7. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/SqueakyCleanText.egg-info/SOURCES.txt +0 -0
  8. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/SqueakyCleanText.egg-info/dependency_links.txt +0 -0
  9. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/SqueakyCleanText.egg-info/requires.txt +0 -0
  10. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/SqueakyCleanText.egg-info/top_level.txt +0 -0
  11. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/config.py +0 -0
  12. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/sct.py +0 -0
  13. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/__init__.py +0 -0
  14. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/constants.py +0 -0
  15. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/contact.py +0 -0
  16. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/datetime.py +0 -0
  17. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/gliner_adapter.py +0 -0
  18. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/ner.py +0 -0
  19. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/normtext.py +0 -0
  20. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/onnx_pipeline.py +0 -0
  21. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/resources.py +0 -0
  22. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/special.py +0 -0
  23. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/stopwords.py +0 -0
  24. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/sct/utils/torch_pipeline.py +0 -0
  25. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/setup.cfg +0 -0
  26. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/setup.py +0 -0
  27. {squeakycleantext-0.5.1 → squeakycleantext-0.5.2}/tests/test_sct.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SqueakyCleanText
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: Text preprocessing & PII anonymization pipeline for NLP/ML: ONNX NER ensemble, language detection, stopword removal, and configurable token replacement.
5
5
  Author: Rehan Fazal
6
6
  License: MIT
@@ -8,6 +8,7 @@ Project-URL: Homepage, https://github.com/rhnfzl/SqueakyCleanText
8
8
  Project-URL: Repository, https://github.com/rhnfzl/SqueakyCleanText
9
9
  Project-URL: Issues, https://github.com/rhnfzl/SqueakyCleanText/issues
10
10
  Project-URL: Changelog, https://github.com/rhnfzl/SqueakyCleanText/releases
11
+ Project-URL: llms.txt, https://github.com/rhnfzl/SqueakyCleanText/blob/main/llms.txt
11
12
  Keywords: text cleaning,text preprocessing,NLP,natural language processing,named entity recognition,NER,anonymization,PII removal,data cleaning,machine learning,ONNX,language detection
12
13
  Classifier: Development Status :: 5 - Production/Stable
13
14
  Classifier: Intended Audience :: Developers
@@ -79,11 +80,11 @@ Dynamic: license-file
79
80
  A comprehensive text cleaning and preprocessing pipeline for machine learning and NLP tasks.
80
81
  </div>
81
82
 
82
- > **Using an AI coding assistant?** This repo includes an [`llms.txt`](./llms.txt) with the full API surface, config reference, and Q&A — optimised for Claude, Cursor, Copilot, and ChatGPT.
83
+ > **Using an AI coding assistant?** This repo includes an [`llms.txt`](https://github.com/rhnfzl/SqueakyCleanText/blob/main/llms.txt) with the full API surface, config reference, and Q&A - optimised for Claude, Cursor, Copilot, and ChatGPT.
83
84
 
84
85
  In the world of machine learning and natural language processing, clean and well-structured text data is crucial for building effective downstream models and managing token limits in language models.
85
86
 
86
- SqueakyCleanText simplifies the process by automatically addressing common text issues — removing PII, anonymizing named entities (persons, organisations, locations), and ensuring your data is clean and well-structured for language models and classical ML pipelines with minimal effort on your part.
87
+ SqueakyCleanText simplifies the process by automatically addressing common text issues - removing PII, anonymizing named entities (persons, organisations, locations), and ensuring your data is clean and well-structured for language models and classical ML pipelines with minimal effort on your part.
87
88
 
88
89
  ### Key Features
89
90
 
@@ -156,7 +157,7 @@ SqueakyCleanText simplifies the process by automatically addressing common text
156
157
  pip install SqueakyCleanText
157
158
  ```
158
159
 
159
- The base install uses **ONNX Runtime** for NER inference — no PyTorch or Transformers required.
160
+ The base install uses **ONNX Runtime** for NER inference - no PyTorch or Transformers required.
160
161
 
161
162
  ### Optional Extras
162
163
 
@@ -231,7 +232,7 @@ cfg = TextCleanerConfig(
231
232
  gliner_labels=('person', 'organization', 'location', 'product', 'event'),
232
233
  gliner_label_map={
233
234
  'person': 'PER', 'organization': 'ORG', 'location': 'LOC',
234
- # 'product' and 'event' are unmapped — they become <PRODUCT>, <EVENT> tokens
235
+ # 'product' and 'event' are unmapped - they become <PRODUCT>, <EVENT> tokens
235
236
  },
236
237
  gliner_threshold=0.4,
237
238
  )
@@ -321,7 +322,7 @@ SqueakyCleanText supports five NER backends, selectable via the `ner_backend` co
321
322
 
322
323
  | Backend | Description | Dependencies | Best for |
323
324
  |---------|-------------|-------------|----------|
324
- | `onnx` (default) | ONNX Runtime inference with quantized XLM-RoBERTa models | Base install | Production — fast, torch-free |
325
+ | `onnx` (default) | ONNX Runtime inference with quantized XLM-RoBERTa models | Base install | Production: fast, torch-free |
325
326
  | `torch` | PyTorch/Transformers pipeline with full XLM-RoBERTa models | `[torch]` extra | Compatibility with existing PyTorch workflows |
326
327
  | `gliner` | GLiNER zero-shot NER with custom entity labels | `[gliner]` or `[gliner2]` extra | Custom entity types (PRODUCT, SKILL, EVENT, etc.) |
327
328
  | `ensemble_onnx` | ONNX + GLiNER ensemble voting | `[gliner]` extra | Maximum recall with custom entities |
@@ -506,69 +507,30 @@ Input Text
506
507
  (lm_text, stat_text, language)
507
508
  ```
508
509
 
509
- Each step is toggled by a `TextCleanerConfig` field. The pipeline is built once at initialization — disabled steps are skipped entirely (zero overhead).
510
+ Each step is toggled by a `TextCleanerConfig` field. The pipeline is built once at initialization; disabled steps are skipped entirely (zero overhead).
510
511
 
511
- ## What's New in v0.5.0
512
+ ## What's New
512
513
 
513
- Quality, performance, and API improvements:
514
+ **v0.5.x**
515
+ - `aprocess_batch()`: async batch processing for FastAPI / aiohttp integrations
516
+ - `warmup(languages)`: pre-load NER models at startup to eliminate first-request latency
517
+ - `custom_pipeline_steps`: attach arbitrary `(text: str) -> str` callables after the built-in pipeline
518
+ - French, Portuguese, and Italian NER support via a shared multilingual ONNX session
519
+ - Improved NER sentence boundary detection with abbreviation guard
514
520
 
515
- **Async & API**
516
- - `aprocess_batch()` — async batch processing for FastAPI / aiohttp (uses `get_running_loop`, Python 3.12+ compatible)
517
- - `warmup(languages)` — public method to pre-load NER models at startup
518
- - `custom_pipeline_steps` config field — plug in arbitrary `(text: str) -> str` callables after the built-in pipeline
519
-
520
- **Language Support**
521
- - French, Portuguese, Italian now supported out of the box via the multilingual ONNX model
522
- - ONNX sessions are shared across same-model languages (FR/PT/IT → one session, ~600 MB saved)
523
-
524
- **Performance & Thread Safety**
525
- - Per-model inference locks replace the coarse per-language lock — true concurrent inference across different language models
526
- - `split_text()` is now lock-free (HF fast tokenizer is thread-safe)
527
- - Conservative `chars/token` ratio (2×) in `_simple_chunk` prevents context-window overflow for CJK and Arabic texts
528
-
529
- **Correctness**
530
- - `SENTENCE_BOUNDARY_PATTERN` upgraded to the `regex` library with an abbreviation guard — "Dr. Smith", "Mr. Jones", "U.S. Army" no longer cause false splits during NER chunking
531
- - `ner_batch_size=0` and `ner_batch_size=-1` now raise `ValueError` immediately instead of silently producing empty results
532
- - Quantized ONNX models are cached to `~/.cache/sct_quantized/` instead of the read-only HuggingFace Hub cache directory
533
-
534
- ---
535
-
536
- ## What's New in v0.4.5
537
-
538
- Major release with architectural overhaul since v0.3.0:
539
-
540
- **Architecture**
541
- - Frozen `TextCleanerConfig` dataclass replaces global mutable config (thread-safe, per-instance)
542
- - ONNX-first NER inference — torch-free base install (~400MB models vs ~7GB)
543
- - Thread-parallel batch processing via `ThreadPoolExecutor` (ONNX releases the GIL)
544
-
545
- **NER**
546
- - 5 backends: `onnx`, `torch`, `gliner`, `ensemble_onnx`, `ensemble_torch`
521
+ **v0.4.5**
522
+ - Frozen `TextCleanerConfig` dataclass: immutable, thread-safe, per-instance configuration
523
+ - ONNX-first NER inference: torch-free base install (~400 MB models vs ~7 GB)
524
+ - Thread-parallel batch processing via `ThreadPoolExecutor`
525
+ - Five NER backends: `onnx`, `torch`, `gliner`, `ensemble_onnx`, `ensemble_torch`
547
526
  - GLiNER zero-shot NER for custom entity types (PRODUCT, EVENT, SKILL, etc.)
548
527
  - Ensemble voting across backends for improved recall
549
- - Lazy per-language model loading (only loads models when needed)
550
- - Language-keyed model dict replaces fragile positional tuple
551
- - ONNX-quantized models hosted on [HuggingFace Hub](https://huggingface.co/rhnfzl)
552
-
553
- **Text Processing**
554
- - Multilingual date detection (ISO 8601, European formats, month names in EN/NL/DE/ES)
555
- - Fuzzy date matching for misspelled months (via rapidfuzz, empirically calibrated threshold)
556
- - Configurable emoji removal
557
- - Configurable bracket/brace content removal
558
- - Smart case folding (preserves NER replacement tokens)
559
- - Custom stopwords and month names per language
560
-
561
- **Dependencies**
562
- - `stop-words` package replaces NLTK (50KB bundled vs 30MB download)
563
- - PyTorch/Transformers moved to optional `[torch]` extra
564
- - New optional extras: `[gpu]`, `[fuzzy]`, `[gliner]`, `[gliner2]`, `[all-ner]`
565
- - Migrated from `setup.py` to `pyproject.toml` (PEP 517)
566
-
567
- **Quality**
568
- - Python 3.11–3.13 support
569
- - `ruff` linter (replaces flake8)
570
- - hypothesis-based property testing with pytest-timeout
571
- - Collision-safe NER entity keys
528
+ - Lazy per-language model loading
529
+ - Multilingual date detection and fuzzy date matching
530
+ - Configurable emoji removal, bracket/brace content removal, and smart case folding
531
+ - `stop-words` replaces NLTK (50 KB bundled vs 30 MB download)
532
+ - PyTorch and Transformers moved to optional extras
533
+ - Migrated to `pyproject.toml` (PEP 517), Python 3.11-3.13, ruff linter
572
534
 
573
535
  ## Contributing
574
536
 
@@ -11,11 +11,11 @@
11
11
  A comprehensive text cleaning and preprocessing pipeline for machine learning and NLP tasks.
12
12
  </div>
13
13
 
14
- > **Using an AI coding assistant?** This repo includes an [`llms.txt`](./llms.txt) with the full API surface, config reference, and Q&A — optimised for Claude, Cursor, Copilot, and ChatGPT.
14
+ > **Using an AI coding assistant?** This repo includes an [`llms.txt`](https://github.com/rhnfzl/SqueakyCleanText/blob/main/llms.txt) with the full API surface, config reference, and Q&A - optimised for Claude, Cursor, Copilot, and ChatGPT.
15
15
 
16
16
  In the world of machine learning and natural language processing, clean and well-structured text data is crucial for building effective downstream models and managing token limits in language models.
17
17
 
18
- SqueakyCleanText simplifies the process by automatically addressing common text issues — removing PII, anonymizing named entities (persons, organisations, locations), and ensuring your data is clean and well-structured for language models and classical ML pipelines with minimal effort on your part.
18
+ SqueakyCleanText simplifies the process by automatically addressing common text issues - removing PII, anonymizing named entities (persons, organisations, locations), and ensuring your data is clean and well-structured for language models and classical ML pipelines with minimal effort on your part.
19
19
 
20
20
  ### Key Features
21
21
 
@@ -88,7 +88,7 @@ SqueakyCleanText simplifies the process by automatically addressing common text
88
88
  pip install SqueakyCleanText
89
89
  ```
90
90
 
91
- The base install uses **ONNX Runtime** for NER inference — no PyTorch or Transformers required.
91
+ The base install uses **ONNX Runtime** for NER inference - no PyTorch or Transformers required.
92
92
 
93
93
  ### Optional Extras
94
94
 
@@ -163,7 +163,7 @@ cfg = TextCleanerConfig(
163
163
  gliner_labels=('person', 'organization', 'location', 'product', 'event'),
164
164
  gliner_label_map={
165
165
  'person': 'PER', 'organization': 'ORG', 'location': 'LOC',
166
- # 'product' and 'event' are unmapped — they become <PRODUCT>, <EVENT> tokens
166
+ # 'product' and 'event' are unmapped - they become <PRODUCT>, <EVENT> tokens
167
167
  },
168
168
  gliner_threshold=0.4,
169
169
  )
@@ -253,7 +253,7 @@ SqueakyCleanText supports five NER backends, selectable via the `ner_backend` co
253
253
 
254
254
  | Backend | Description | Dependencies | Best for |
255
255
  |---------|-------------|-------------|----------|
256
- | `onnx` (default) | ONNX Runtime inference with quantized XLM-RoBERTa models | Base install | Production — fast, torch-free |
256
+ | `onnx` (default) | ONNX Runtime inference with quantized XLM-RoBERTa models | Base install | Production: fast, torch-free |
257
257
  | `torch` | PyTorch/Transformers pipeline with full XLM-RoBERTa models | `[torch]` extra | Compatibility with existing PyTorch workflows |
258
258
  | `gliner` | GLiNER zero-shot NER with custom entity labels | `[gliner]` or `[gliner2]` extra | Custom entity types (PRODUCT, SKILL, EVENT, etc.) |
259
259
  | `ensemble_onnx` | ONNX + GLiNER ensemble voting | `[gliner]` extra | Maximum recall with custom entities |
@@ -438,69 +438,30 @@ Input Text
438
438
  (lm_text, stat_text, language)
439
439
  ```
440
440
 
441
- Each step is toggled by a `TextCleanerConfig` field. The pipeline is built once at initialization — disabled steps are skipped entirely (zero overhead).
441
+ Each step is toggled by a `TextCleanerConfig` field. The pipeline is built once at initialization; disabled steps are skipped entirely (zero overhead).
442
442
 
443
- ## What's New in v0.5.0
443
+ ## What's New
444
444
 
445
- Quality, performance, and API improvements:
445
+ **v0.5.x**
446
+ - `aprocess_batch()`: async batch processing for FastAPI / aiohttp integrations
447
+ - `warmup(languages)`: pre-load NER models at startup to eliminate first-request latency
448
+ - `custom_pipeline_steps`: attach arbitrary `(text: str) -> str` callables after the built-in pipeline
449
+ - French, Portuguese, and Italian NER support via a shared multilingual ONNX session
450
+ - Improved NER sentence boundary detection with abbreviation guard
446
451
 
447
- **Async & API**
448
- - `aprocess_batch()` — async batch processing for FastAPI / aiohttp (uses `get_running_loop`, Python 3.12+ compatible)
449
- - `warmup(languages)` — public method to pre-load NER models at startup
450
- - `custom_pipeline_steps` config field — plug in arbitrary `(text: str) -> str` callables after the built-in pipeline
451
-
452
- **Language Support**
453
- - French, Portuguese, Italian now supported out of the box via the multilingual ONNX model
454
- - ONNX sessions are shared across same-model languages (FR/PT/IT → one session, ~600 MB saved)
455
-
456
- **Performance & Thread Safety**
457
- - Per-model inference locks replace the coarse per-language lock — true concurrent inference across different language models
458
- - `split_text()` is now lock-free (HF fast tokenizer is thread-safe)
459
- - Conservative `chars/token` ratio (2×) in `_simple_chunk` prevents context-window overflow for CJK and Arabic texts
460
-
461
- **Correctness**
462
- - `SENTENCE_BOUNDARY_PATTERN` upgraded to the `regex` library with an abbreviation guard — "Dr. Smith", "Mr. Jones", "U.S. Army" no longer cause false splits during NER chunking
463
- - `ner_batch_size=0` and `ner_batch_size=-1` now raise `ValueError` immediately instead of silently producing empty results
464
- - Quantized ONNX models are cached to `~/.cache/sct_quantized/` instead of the read-only HuggingFace Hub cache directory
465
-
466
- ---
467
-
468
- ## What's New in v0.4.5
469
-
470
- Major release with architectural overhaul since v0.3.0:
471
-
472
- **Architecture**
473
- - Frozen `TextCleanerConfig` dataclass replaces global mutable config (thread-safe, per-instance)
474
- - ONNX-first NER inference — torch-free base install (~400MB models vs ~7GB)
475
- - Thread-parallel batch processing via `ThreadPoolExecutor` (ONNX releases the GIL)
476
-
477
- **NER**
478
- - 5 backends: `onnx`, `torch`, `gliner`, `ensemble_onnx`, `ensemble_torch`
452
+ **v0.4.5**
453
+ - Frozen `TextCleanerConfig` dataclass: immutable, thread-safe, per-instance configuration
454
+ - ONNX-first NER inference: torch-free base install (~400 MB models vs ~7 GB)
455
+ - Thread-parallel batch processing via `ThreadPoolExecutor`
456
+ - Five NER backends: `onnx`, `torch`, `gliner`, `ensemble_onnx`, `ensemble_torch`
479
457
  - GLiNER zero-shot NER for custom entity types (PRODUCT, EVENT, SKILL, etc.)
480
458
  - Ensemble voting across backends for improved recall
481
- - Lazy per-language model loading (only loads models when needed)
482
- - Language-keyed model dict replaces fragile positional tuple
483
- - ONNX-quantized models hosted on [HuggingFace Hub](https://huggingface.co/rhnfzl)
484
-
485
- **Text Processing**
486
- - Multilingual date detection (ISO 8601, European formats, month names in EN/NL/DE/ES)
487
- - Fuzzy date matching for misspelled months (via rapidfuzz, empirically calibrated threshold)
488
- - Configurable emoji removal
489
- - Configurable bracket/brace content removal
490
- - Smart case folding (preserves NER replacement tokens)
491
- - Custom stopwords and month names per language
492
-
493
- **Dependencies**
494
- - `stop-words` package replaces NLTK (50KB bundled vs 30MB download)
495
- - PyTorch/Transformers moved to optional `[torch]` extra
496
- - New optional extras: `[gpu]`, `[fuzzy]`, `[gliner]`, `[gliner2]`, `[all-ner]`
497
- - Migrated from `setup.py` to `pyproject.toml` (PEP 517)
498
-
499
- **Quality**
500
- - Python 3.11–3.13 support
501
- - `ruff` linter (replaces flake8)
502
- - hypothesis-based property testing with pytest-timeout
503
- - Collision-safe NER entity keys
459
+ - Lazy per-language model loading
460
+ - Multilingual date detection and fuzzy date matching
461
+ - Configurable emoji removal, bracket/brace content removal, and smart case folding
462
+ - `stop-words` replaces NLTK (50 KB bundled vs 30 MB download)
463
+ - PyTorch and Transformers moved to optional extras
464
+ - Migrated to `pyproject.toml` (PEP 517), Python 3.11-3.13, ruff linter
504
465
 
505
466
  ## Contributing
506
467
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: SqueakyCleanText
3
- Version: 0.5.1
3
+ Version: 0.5.2
4
4
  Summary: Text preprocessing & PII anonymization pipeline for NLP/ML: ONNX NER ensemble, language detection, stopword removal, and configurable token replacement.
5
5
  Author: Rehan Fazal
6
6
  License: MIT
@@ -8,6 +8,7 @@ Project-URL: Homepage, https://github.com/rhnfzl/SqueakyCleanText
8
8
  Project-URL: Repository, https://github.com/rhnfzl/SqueakyCleanText
9
9
  Project-URL: Issues, https://github.com/rhnfzl/SqueakyCleanText/issues
10
10
  Project-URL: Changelog, https://github.com/rhnfzl/SqueakyCleanText/releases
11
+ Project-URL: llms.txt, https://github.com/rhnfzl/SqueakyCleanText/blob/main/llms.txt
11
12
  Keywords: text cleaning,text preprocessing,NLP,natural language processing,named entity recognition,NER,anonymization,PII removal,data cleaning,machine learning,ONNX,language detection
12
13
  Classifier: Development Status :: 5 - Production/Stable
13
14
  Classifier: Intended Audience :: Developers
@@ -79,11 +80,11 @@ Dynamic: license-file
79
80
  A comprehensive text cleaning and preprocessing pipeline for machine learning and NLP tasks.
80
81
  </div>
81
82
 
82
- > **Using an AI coding assistant?** This repo includes an [`llms.txt`](./llms.txt) with the full API surface, config reference, and Q&A — optimised for Claude, Cursor, Copilot, and ChatGPT.
83
+ > **Using an AI coding assistant?** This repo includes an [`llms.txt`](https://github.com/rhnfzl/SqueakyCleanText/blob/main/llms.txt) with the full API surface, config reference, and Q&A - optimised for Claude, Cursor, Copilot, and ChatGPT.
83
84
 
84
85
  In the world of machine learning and natural language processing, clean and well-structured text data is crucial for building effective downstream models and managing token limits in language models.
85
86
 
86
- SqueakyCleanText simplifies the process by automatically addressing common text issues — removing PII, anonymizing named entities (persons, organisations, locations), and ensuring your data is clean and well-structured for language models and classical ML pipelines with minimal effort on your part.
87
+ SqueakyCleanText simplifies the process by automatically addressing common text issues - removing PII, anonymizing named entities (persons, organisations, locations), and ensuring your data is clean and well-structured for language models and classical ML pipelines with minimal effort on your part.
87
88
 
88
89
  ### Key Features
89
90
 
@@ -156,7 +157,7 @@ SqueakyCleanText simplifies the process by automatically addressing common text
156
157
  pip install SqueakyCleanText
157
158
  ```
158
159
 
159
- The base install uses **ONNX Runtime** for NER inference — no PyTorch or Transformers required.
160
+ The base install uses **ONNX Runtime** for NER inference - no PyTorch or Transformers required.
160
161
 
161
162
  ### Optional Extras
162
163
 
@@ -231,7 +232,7 @@ cfg = TextCleanerConfig(
231
232
  gliner_labels=('person', 'organization', 'location', 'product', 'event'),
232
233
  gliner_label_map={
233
234
  'person': 'PER', 'organization': 'ORG', 'location': 'LOC',
234
- # 'product' and 'event' are unmapped — they become <PRODUCT>, <EVENT> tokens
235
+ # 'product' and 'event' are unmapped - they become <PRODUCT>, <EVENT> tokens
235
236
  },
236
237
  gliner_threshold=0.4,
237
238
  )
@@ -321,7 +322,7 @@ SqueakyCleanText supports five NER backends, selectable via the `ner_backend` co
321
322
 
322
323
  | Backend | Description | Dependencies | Best for |
323
324
  |---------|-------------|-------------|----------|
324
- | `onnx` (default) | ONNX Runtime inference with quantized XLM-RoBERTa models | Base install | Production — fast, torch-free |
325
+ | `onnx` (default) | ONNX Runtime inference with quantized XLM-RoBERTa models | Base install | Production: fast, torch-free |
325
326
  | `torch` | PyTorch/Transformers pipeline with full XLM-RoBERTa models | `[torch]` extra | Compatibility with existing PyTorch workflows |
326
327
  | `gliner` | GLiNER zero-shot NER with custom entity labels | `[gliner]` or `[gliner2]` extra | Custom entity types (PRODUCT, SKILL, EVENT, etc.) |
327
328
  | `ensemble_onnx` | ONNX + GLiNER ensemble voting | `[gliner]` extra | Maximum recall with custom entities |
@@ -506,69 +507,30 @@ Input Text
506
507
  (lm_text, stat_text, language)
507
508
  ```
508
509
 
509
- Each step is toggled by a `TextCleanerConfig` field. The pipeline is built once at initialization — disabled steps are skipped entirely (zero overhead).
510
+ Each step is toggled by a `TextCleanerConfig` field. The pipeline is built once at initialization; disabled steps are skipped entirely (zero overhead).
510
511
 
511
- ## What's New in v0.5.0
512
+ ## What's New
512
513
 
513
- Quality, performance, and API improvements:
514
+ **v0.5.x**
515
+ - `aprocess_batch()`: async batch processing for FastAPI / aiohttp integrations
516
+ - `warmup(languages)`: pre-load NER models at startup to eliminate first-request latency
517
+ - `custom_pipeline_steps`: attach arbitrary `(text: str) -> str` callables after the built-in pipeline
518
+ - French, Portuguese, and Italian NER support via a shared multilingual ONNX session
519
+ - Improved NER sentence boundary detection with abbreviation guard
514
520
 
515
- **Async & API**
516
- - `aprocess_batch()` — async batch processing for FastAPI / aiohttp (uses `get_running_loop`, Python 3.12+ compatible)
517
- - `warmup(languages)` — public method to pre-load NER models at startup
518
- - `custom_pipeline_steps` config field — plug in arbitrary `(text: str) -> str` callables after the built-in pipeline
519
-
520
- **Language Support**
521
- - French, Portuguese, Italian now supported out of the box via the multilingual ONNX model
522
- - ONNX sessions are shared across same-model languages (FR/PT/IT → one session, ~600 MB saved)
523
-
524
- **Performance & Thread Safety**
525
- - Per-model inference locks replace the coarse per-language lock — true concurrent inference across different language models
526
- - `split_text()` is now lock-free (HF fast tokenizer is thread-safe)
527
- - Conservative `chars/token` ratio (2×) in `_simple_chunk` prevents context-window overflow for CJK and Arabic texts
528
-
529
- **Correctness**
530
- - `SENTENCE_BOUNDARY_PATTERN` upgraded to the `regex` library with an abbreviation guard — "Dr. Smith", "Mr. Jones", "U.S. Army" no longer cause false splits during NER chunking
531
- - `ner_batch_size=0` and `ner_batch_size=-1` now raise `ValueError` immediately instead of silently producing empty results
532
- - Quantized ONNX models are cached to `~/.cache/sct_quantized/` instead of the read-only HuggingFace Hub cache directory
533
-
534
- ---
535
-
536
- ## What's New in v0.4.5
537
-
538
- Major release with architectural overhaul since v0.3.0:
539
-
540
- **Architecture**
541
- - Frozen `TextCleanerConfig` dataclass replaces global mutable config (thread-safe, per-instance)
542
- - ONNX-first NER inference — torch-free base install (~400MB models vs ~7GB)
543
- - Thread-parallel batch processing via `ThreadPoolExecutor` (ONNX releases the GIL)
544
-
545
- **NER**
546
- - 5 backends: `onnx`, `torch`, `gliner`, `ensemble_onnx`, `ensemble_torch`
521
+ **v0.4.5**
522
+ - Frozen `TextCleanerConfig` dataclass: immutable, thread-safe, per-instance configuration
523
+ - ONNX-first NER inference: torch-free base install (~400 MB models vs ~7 GB)
524
+ - Thread-parallel batch processing via `ThreadPoolExecutor`
525
+ - Five NER backends: `onnx`, `torch`, `gliner`, `ensemble_onnx`, `ensemble_torch`
547
526
  - GLiNER zero-shot NER for custom entity types (PRODUCT, EVENT, SKILL, etc.)
548
527
  - Ensemble voting across backends for improved recall
549
- - Lazy per-language model loading (only loads models when needed)
550
- - Language-keyed model dict replaces fragile positional tuple
551
- - ONNX-quantized models hosted on [HuggingFace Hub](https://huggingface.co/rhnfzl)
552
-
553
- **Text Processing**
554
- - Multilingual date detection (ISO 8601, European formats, month names in EN/NL/DE/ES)
555
- - Fuzzy date matching for misspelled months (via rapidfuzz, empirically calibrated threshold)
556
- - Configurable emoji removal
557
- - Configurable bracket/brace content removal
558
- - Smart case folding (preserves NER replacement tokens)
559
- - Custom stopwords and month names per language
560
-
561
- **Dependencies**
562
- - `stop-words` package replaces NLTK (50KB bundled vs 30MB download)
563
- - PyTorch/Transformers moved to optional `[torch]` extra
564
- - New optional extras: `[gpu]`, `[fuzzy]`, `[gliner]`, `[gliner2]`, `[all-ner]`
565
- - Migrated from `setup.py` to `pyproject.toml` (PEP 517)
566
-
567
- **Quality**
568
- - Python 3.11–3.13 support
569
- - `ruff` linter (replaces flake8)
570
- - hypothesis-based property testing with pytest-timeout
571
- - Collision-safe NER entity keys
528
+ - Lazy per-language model loading
529
+ - Multilingual date detection and fuzzy date matching
530
+ - Configurable emoji removal, bracket/brace content removal, and smart case folding
531
+ - `stop-words` replaces NLTK (50 KB bundled vs 30 MB download)
532
+ - PyTorch and Transformers moved to optional extras
533
+ - Migrated to `pyproject.toml` (PEP 517), Python 3.11-3.13, ruff linter
572
534
 
573
535
  ## Contributing
574
536
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "SqueakyCleanText"
7
- version = "0.5.1"
7
+ dynamic = ["version"]
8
8
  description = "Text preprocessing & PII anonymization pipeline for NLP/ML: ONNX NER ensemble, language detection, stopword removal, and configurable token replacement."
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -51,6 +51,7 @@ Homepage = "https://github.com/rhnfzl/SqueakyCleanText"
51
51
  Repository = "https://github.com/rhnfzl/SqueakyCleanText"
52
52
  Issues = "https://github.com/rhnfzl/SqueakyCleanText/issues"
53
53
  Changelog = "https://github.com/rhnfzl/SqueakyCleanText/releases"
54
+ "llms.txt" = "https://github.com/rhnfzl/SqueakyCleanText/blob/main/llms.txt"
54
55
 
55
56
  [project.optional-dependencies]
56
57
  gpu = [
@@ -88,6 +89,9 @@ test = [
88
89
  "pytest-cov>=4.1",
89
90
  ]
90
91
 
92
+ [tool.setuptools.dynamic]
93
+ version = {attr = "sct.__version__"}
94
+
91
95
  [tool.setuptools.packages.find]
92
96
  include = ["sct*"]
93
97
  exclude = ["tests*"]
@@ -3,5 +3,5 @@
3
3
  from sct.config import TextCleanerConfig
4
4
  from sct.sct import TextCleaner
5
5
 
6
- __version__ = "0.5.1"
6
+ __version__ = "0.5.2"
7
7
  __all__ = ["TextCleaner", "TextCleanerConfig"]