sound.speech.text

index · sound.speech

Overview

Text normalization for the formant TTS (sound.speech).

Turns a raw string into a flat token list the G2P layer consumes:

  { word = "hello" [, emph = true ] }   a lowercase word (a-z + apostrophe)
  { punct = "." | "," | "?" | "!" }     a phrase/sentence boundary

Handles: number expansion (integers, decimals, negatives — "42" -> "forty two"), a small abbreviation table, *word* emphasis markup, and punctuation classing (.;:!? and em-dashes become boundaries; everything else is dropped).

Functions

NameSignature
number_wordsnumber_words(s) -> words
normalizenormalize(s) -> tokens

number_words(s) -> words

Expand a number literal into English words

s is a decimal literal ("42", "3.5", "-7"). Returns an array of lowercase words ({ "forty", "two" }). Integers are expanded up to the billions; fractional digits are spelled out one by one after "point".

normalize(s) -> tokens

Normalize a text string into word/punct tokens