Text normalization

August 2, 2026 ยท View on GitHub

Glyph Core

Text normalization

Filter tokens. Strip unigrams and vgrams.

Two helpers control how text becomes features.

TextFilter(text)

Used on tokens (words).

StepRule
1Lowercase
2Remove characters outside the allowed set

Allowed characters include letters, digits, common punctuation, and space.

TextFilter("Hello, World!"); // "hello, world!"
TextFilter("A-B_C");         // "a-b_c"

TextStrip(text)

Used on unigrams and vgrams.

StepRule
1Run TextFilter
2Keep letters and digits only (drop spaces and punctuation)
TextStrip("Hello, World!"); // "helloworld"
TextStrip("foo-bar baz 123"); // "foobarbaz123"

When each runs

Feature typeHelpernormalize: false
TokenTextFilterRaw split words
UnigramTextStripRaw tokens
VgramTextStrip on joined windowRaw joined window

Set normalize: false in Create() or Tokenize() to skip both helpers.

Related links ranked by Glyph.