1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Unicode normalization (NFC / NFD / NFKC / NFKD) applied before tokenization.
//!
//! Correct Unicode normalization requires the full Unicode Character Database
//! (composition/decomposition mappings and combining classes), which is far too
//! large to hand-roll while staying correct. To keep the crate's default build
//! **dependency-free**, this capability is gated behind the opt-in
//! `normalization` Cargo feature, which pulls in the well-tested
//! [`unicode-normalization`] crate (itself `no_std` + `alloc`).
//!
//! Enable it with:
//!
//! ```toml
//! tpt-tokenizer-core = { version = "0.1", features = ["normalization"] }
//! ```
//!
//! [`unicode-normalization`]: https://docs.rs/unicode-normalization
use String;
use UnicodeNormalization;
/// A Unicode normalization form, matching the four standard forms used by
/// Hugging Face tokenizers.
/// Normalize `text` to the given [`NormalizationForm`].