Sign in

    ShiChengxu/moonlayout/hyphen does not have a README file

    Hyphenator

    pub(open) trait Hyphenator {
    fn positions(Self, String) -> Array[Int]
    }

    Pluggable discretionary word breaks, expressed as UTF-8 byte offsets within the supplied word. The wrapping layer validates and deduplicates positions.

    Liang

    pub struct Liang {
    nodes : Array[Node]
    exceptions : Map[String, Array[Int]]
    left_min : Int
    right_min : Int
    }

    Immutable-after-construction Liang pattern trie for ASCII English words.
    impl Hyphenator for Liang

    Liang::english

    fn Liang::english() -> Liang

    American English patterns from hyph-utf8, default margins 2/3. Construct once and reuse the trie. Source and licensing: testdata/hyphen/hyph-en-us.tex.

    Liang::new

    fn Liang::new(patterns : Array[String], exceptions? : Array[String], left_min? : Int, right_min? : Int) -> Liang

    Compile patterns such as a1bc3 (odd weights permit breaks, even suppress). Malformed patterns/exceptions are ignored atomically. Exceptions use literal hyphens, e.g. hy-phen-ation; unhyphenated exceptions suppress all breaks.

    Liang::positions

    fn Liang::positions(self : Liang, word : String) -> Array[Int]

    Find allowed byte offsets. Non-ASCII words and punctuation return no breaks.

    Node

    type Node

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io