moonbitstack/moontoken/split does not have a README file

    Digits

    pub(all) struct Digits {
    individual : Bool
    }

    Whether digits are cut one at a time or as a run.

    Split

    pub(all) enum Split {
    Whole
    Gpt2
    Cl100k
    O200k
    Whitespace
    Metaspace
    Digits(Digits)
    Sequence(Array[Split])
    }

    How text is cut into the words a model is applied to.

    The three named rules are the published pre-tokenizers of the byte-level encodings: r50k/p50k/gpt2, cl100k_base and o200k_base. They are scanners here rather than regular expressions because the patterns lean on lookahead and possessive quantifiers, and because a tokenizer runs them once per word over the whole input.

    Split::pieces

    fn Split::pieces(self : Split, text : StringView) -> Array[StringView]

    The words of text, in order. Joining them gives back the text under every rule but Whitespace, which drops what it splits on.

    digits_individual

    let digits_individual : Digits

    digits_run

    let digits_run : Digits

    utf8_width_at

    fn utf8_width_at(bytes : Bytes, at : Int) -> Int

    The width of the UTF-8 sequence that starts at at, or 0 when the bytes there are not one.