sound.speech.g2p

index · sound.speech

Overview

English grapheme-to-phoneme for the formant TTS (sound.speech).

Two layers, exceptions first:

  1. A small dictionary of common irregular words, carrying real stress marks (ARPAbet with 0/1/2 stress digits on the vowels).
  2. Context-sensitive letter-to-sound rules in the NRL formalism (Elovitz et al. 1976): each rule is "A[B]C=PH PH ..." — the literal letters B, in left context A and right context C, produce the phones D. First matching rule wins and the cursor advances past B. The rule set here is authored in that formalism (not a verbatim NRL transcription), sized for the charmingly-imperfect retro bar: ~90% of ordinary text comes out right, and the dictionary catches the worst of the rest.

Context pattern symbols:

  #   one or more vowels (a e i o u y)     :   zero or more consonants
  ^   exactly one consonant                .   a voiced consonant (bdvgjlmnrwz)
  +   a front vowel (e i y)                &   a sibilant (s c g z x j ch sh)
  @   t s r d l z n j th ch sh             %   a suffix (e er es ed ing ely)
  (space) word boundary                    other letters match literally

Rules give no stress; a heuristic marks the first vowel of a rule-derived word as primary. Words the rules mangle badly belong in the dictionary — or can be phonemized by hand via the events API (sound.speech.synth).

Functions

NameSignature
wordword(w) -> events

word(w) -> events

Transcribe one lowercase word into phoneme events

Returns a list of { ph = <ARPAbet>, stress = 0|1|2 }. The exceptions dictionary is consulted first (with, then without, apostrophes); otherwise the letter-to-sound rules run with the first-vowel stress heuristic.