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| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- de
|
| 6 |
+
- fr
|
| 7 |
+
- es
|
| 8 |
+
- it
|
| 9 |
+
- pt
|
| 10 |
+
- nl
|
| 11 |
+
- pl
|
| 12 |
+
- ru
|
| 13 |
+
- uk
|
| 14 |
+
- cs
|
| 15 |
+
- da
|
| 16 |
+
- sv
|
| 17 |
+
- fi
|
| 18 |
+
- el
|
| 19 |
+
- bg
|
| 20 |
+
- ro
|
| 21 |
+
- sk
|
| 22 |
+
- sl
|
| 23 |
+
- lt
|
| 24 |
+
- lv
|
| 25 |
+
- et
|
| 26 |
+
- hr
|
| 27 |
+
- hu
|
| 28 |
+
- zh
|
| 29 |
+
- ja
|
| 30 |
+
- ko
|
| 31 |
+
- ar
|
| 32 |
+
- hi
|
| 33 |
+
- th
|
| 34 |
+
- vi
|
| 35 |
+
- tr
|
| 36 |
+
- id
|
| 37 |
+
- ms
|
| 38 |
+
- tl
|
| 39 |
+
- fa
|
| 40 |
+
- he
|
| 41 |
+
- ur
|
| 42 |
+
- bn
|
| 43 |
+
- ta
|
| 44 |
+
- te
|
| 45 |
+
- ml
|
| 46 |
+
- kn
|
| 47 |
+
- gu
|
| 48 |
+
- pa
|
| 49 |
+
- mr
|
| 50 |
+
tags:
|
| 51 |
+
- punctuation
|
| 52 |
+
- truecasing
|
| 53 |
+
- sentence-boundary-detection
|
| 54 |
+
- gguf
|
| 55 |
+
- crispasr
|
| 56 |
+
- xlm-roberta
|
| 57 |
+
- text-processing
|
| 58 |
+
library_name: crispasr
|
| 59 |
+
base_model: 1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase
|
| 60 |
+
pipeline_tag: token-classification
|
| 61 |
+
---
|
| 62 |
+
|
| 63 |
+
# PCS (Punctuation + Capitalization + Segmentation) β GGUF
|
| 64 |
+
|
| 65 |
+
GGUF conversion of [1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase](https://huggingface.co/1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase) for use with [CrispASR](https://github.com/CrispStrobe/CrispASR) and [CrisperWeaver](https://github.com/CrispStrobe/CrisperWeaver).
|
| 66 |
+
|
| 67 |
+
## Model
|
| 68 |
+
|
| 69 |
+
PCS performs three text post-processing tasks in a single pass:
|
| 70 |
+
|
| 71 |
+
1. **Punctuation restoration** β adds commas, periods, question marks, exclamation marks, colons, semicolons, dashes, and 10 other punctuation types
|
| 72 |
+
2. **Truecasing** β restores proper capitalization (per-character upper/lower classification)
|
| 73 |
+
3. **Sentence boundary detection** β identifies sentence breaks
|
| 74 |
+
|
| 75 |
+
Particularly useful for ASR backends that output unpunctuated lowercase text (wav2vec2, fastconformer-ctc, firered-asr, parakeet-ctc, omniasr-ctc).
|
| 76 |
+
|
| 77 |
+
### Architecture
|
| 78 |
+
|
| 79 |
+
- **Encoder**: XLM-RoBERTa-base (12 layers, d=768, 12 heads, SentencePiece tokenizer)
|
| 80 |
+
- **4 classification heads**:
|
| 81 |
+
- `post_punc`: Linear(768 -> 256 -> 17) β post-word punctuation (., ,, ?, !, :, ;, -, etc.)
|
| 82 |
+
- `pre_punc`: Linear(768 -> 256 -> 2) β pre-word punctuation (ΒΏ, Β‘)
|
| 83 |
+
- `sbd`: Linear(772 -> 128 -> 2) β sentence boundary detection
|
| 84 |
+
- `truecase`: Linear(769 -> 128 -> 16) β per-character upper/lower case
|
| 85 |
+
|
| 86 |
+
### Languages
|
| 87 |
+
|
| 88 |
+
Supports 47 languages via XLM-RoBERTa's multilingual encoder. Quality is best on the 12 languages the classification heads were trained on (EN, DE, FR, ES, IT, PT, NL, PL, RU, UK, CS, DA) but generalizes to all 47 XLM-R languages.
|
| 89 |
+
|
| 90 |
+
## Files
|
| 91 |
+
|
| 92 |
+
| File | Size | Description |
|
| 93 |
+
|------|------|-------------|
|
| 94 |
+
| `pcs-xlmr-base.gguf` | 903 MB | Full-precision (F16) β reference quality |
|
| 95 |
+
| `pcs-xlmr-base-q4_k.gguf` | 155 MB | Q4_K quantised β ~6x smaller |
|
| 96 |
+
|
| 97 |
+
## Usage
|
| 98 |
+
|
| 99 |
+
### CrispASR CLI
|
| 100 |
+
|
| 101 |
+
```bash
|
| 102 |
+
# Apply PCS to unpunctuated text
|
| 103 |
+
crispasr --punc-model pcs-xlmr-base-q4_k.gguf \
|
| 104 |
+
-f audio.wav \
|
| 105 |
+
--backend parakeet
|
| 106 |
+
|
| 107 |
+
# Standalone text processing
|
| 108 |
+
echo "hello how are you doing today i am fine" | \
|
| 109 |
+
crispasr-pcs pcs-xlmr-base-q4_k.gguf
|
| 110 |
+
# Output: "Hello, how are you doing today? I am fine."
|
| 111 |
+
```
|
| 112 |
+
|
| 113 |
+
### CrisperWeaver (Flutter GUI)
|
| 114 |
+
|
| 115 |
+
Download from Model Management (Post-processors section). Enable "Restore punctuation" in Advanced Options β PCS runs automatically as a post-processing step after transcription.
|
| 116 |
+
|
| 117 |
+
### C API
|
| 118 |
+
|
| 119 |
+
```c
|
| 120 |
+
#include "crispasr.h"
|
| 121 |
+
|
| 122 |
+
void* pcs = crispasr_pcs_init("pcs-xlmr-base-q4_k.gguf");
|
| 123 |
+
const char* result = crispasr_pcs_process(pcs, "hello how are you");
|
| 124 |
+
// result: "Hello, how are you?"
|
| 125 |
+
crispasr_pcs_free_text(result);
|
| 126 |
+
crispasr_pcs_free(pcs);
|
| 127 |
+
```
|
| 128 |
+
|
| 129 |
+
### Dart FFI
|
| 130 |
+
|
| 131 |
+
```dart
|
| 132 |
+
final pcs = crispasr.PcsModel.open('pcs-xlmr-base-q4_k.gguf');
|
| 133 |
+
final text = pcs.process('hello how are you doing today');
|
| 134 |
+
print(text); // "Hello, how are you doing today?"
|
| 135 |
+
pcs.close();
|
| 136 |
+
```
|
| 137 |
+
|
| 138 |
+
## Comparison with other post-processors
|
| 139 |
+
|
| 140 |
+
| Model | Languages | Punct | Truecase | SBD | Size (Q4_K) |
|
| 141 |
+
|-------|-----------|-------|----------|-----|-------------|
|
| 142 |
+
| **PCS** | 47 | 17 types | per-char | yes | 155 MB |
|
| 143 |
+
| FireRedPunc | ZH + EN | yes | yes | no | ~100 MB |
|
| 144 |
+
| Fullstop-punc | EN/DE/FR/IT | yes | yes | no | ~300 MB |
|
| 145 |
+
| Truecaser LSTM | DE/EN/ES/RU | no | yes | no | ~3 MB |
|
| 146 |
+
|
| 147 |
+
PCS is the most comprehensive option β it handles all three tasks in one pass across the widest language set.
|
| 148 |
+
|
| 149 |
+
## License
|
| 150 |
+
|
| 151 |
+
MIT (same as upstream [1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase](https://huggingface.co/1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase)).
|
| 152 |
+
|
| 153 |
+
## Links
|
| 154 |
+
|
| 155 |
+
- Upstream model: [1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase](https://huggingface.co/1-800-BAD-CODE/xlm-roberta_punctuation_fullstop_truecase)
|
| 156 |
+
- Engine: [CrispASR](https://github.com/CrispStrobe/CrispASR)
|
| 157 |
+
- App: [CrisperWeaver](https://github.com/CrispStrobe/CrisperWeaver)
|