412bf9355e
Implements the Kölner Phonetik algorithm for German word sound-encoding. This phonetic algorithm is used to find gazetteer entries that sound similar to a potentially misspelled token, enabling correction suggestions. The implementation includes: - `encode`: The main function that orchestrates the encoding process. - `prepare`: Prepares the input string by expanding umlauts, uppercasing, and filtering non-alphabetic characters. - `raw_encode`: Performs the character-by-character phonetic encoding with context-aware rules. - `postprocess`: Cleans up the raw output by collapsing duplicate digits and removing leading zeros. Includes unit tests to verify the correctness of the encoding for various German words and edge cases, ensuring phonetic similarity and handling of special character combinations.
10 lines
397 B
Rust
10 lines
397 B
Rust
//! Gazetteer: Pre-LLM correction layer for proper names and technical
|
|
//! vocabulary (medications, anatomy, substances). See
|
|
//! `~/.claude/plans/happy-mapping-snail.md` for the design document.
|
|
//!
|
|
//! This module is currently a stub — only the Kölner Phonetik encoder
|
|
//! exists. The `Gazetteer` struct, loader, and annotator land in later
|
|
//! steps of the implementation.
|
|
|
|
pub mod koelner;
|