Skip to main content

Module hyphenation

Module hyphenation 

Source
Expand description

Deterministic hyphenation engine using Liang’s TeX algorithm.

Implements the standard TeX hyphenation pattern matching algorithm for discovering valid break points within words. The algorithm is deterministic: same patterns + same word → same break points, always.

§Architecture

Patterns → PatternTrie (compile once)
Word → wrap with delimiters → slide all substrings through trie
     → collect max levels at each inter-character position
     → odd levels = break allowed

§Integration

Break points integrate with the penalty model from crate::wrap:

Structs§

HyphenBreakPoint
A valid hyphenation break point within a word.
HyphenationDict
A hyphenation dictionary for a specific language.
HyphenationPattern
A compiled hyphenation pattern.
PatternTrie
Trie-based pattern storage for O(n²) per-word lookup.

Constants§

ENGLISH_EXCEPTIONS_MINI
Common English exception words with explicit hyphenation.
ENGLISH_PATTERNS_MINI
A minimal set of English TeX hyphenation patterns.

Functions§

break_penalties
Map a sequence of hyphenation break points to penalties suitable for the Knuth-Plass line-breaking algorithm.
compile_pattern
Parse a TeX-format hyphenation pattern string into a compiled pattern.
english_dict_mini
Create a minimal English hyphenation dictionary.