normalizer_tr/lib.rs
1//! A local, synchronous Turkish text-to-speech normalizer.
2//!
3//! The default preserves unresolved spans and reports them. Use
4//! [`AmbiguityPolicy::Reject`] when partial speech is not acceptable.
5//! [`AmbiguityPolicy::Fallback`] renders unresolved source with separate diagnostics.
6//! Original source ranges are UTF-8 byte coordinates, not character indices.
7//!
8//! ```
9//! use normalizer_tr::{Normalizer, NormalizeOptions};
10//! let normalizer = Normalizer::new()?;
11//! let result = normalizer.normalize("25 TL", &NormalizeOptions::default())?;
12//! assert_eq!(result.normalized_text(), "yirmi beş Türk lirası");
13//! assert!(result.complete());
14//! # Ok::<(), normalizer_tr::NormalizeError>(())
15//! ```
16#![forbid(unsafe_code)]
17#![doc = include_str!("../README.md")]
18
19mod api;
20mod classify;
21mod domain;
22mod fallback;
23mod model;
24mod morphology;
25mod normalizer;
26mod numerals;
27mod pipeline;
28mod resources;
29mod source_map;
30mod verbalize;
31
32pub use api::{
33 AmbiguityPolicy, FallbackClass, FallbackDiagnostic, FallbackReason, FallbackStrategy, Hint,
34 HintKind, Issue, IssueCategory, LimitKind, NormalizeError, NormalizeOptions, NormalizeResult,
35 Segment, SegmentKind, SourceRange, WorkControl,
36};
37pub use normalizer::Normalizer;
38pub use resources::NORMALIZER_ID;
39
40/// Maximum original UTF-8 input length in bytes.
41pub const MAX_INPUT_BYTES: usize = 32 * 1024;
42/// Maximum number of caller hints.
43pub const MAX_HINTS: usize = 256;
44/// Maximum number of semiotic candidate records, including unresolved spans.
45pub const MAX_CANDIDATES: usize = 4096;
46/// Maximum logical bytes of owned result and diagnostic allocations.
47pub const MAX_RESULT_BYTES: usize = 512 * 1024;