← Back to blog

6/10/2026

How our name correction demo works

G2P phonemes, alignment-sliced prefilters, bounded edit distance, and weighted-interval patch selection. All in your browser.

The names demo takes two inputs: the names you care about, and a transcript that gets them wrong. It rewrites the transcript with your spelling. The trick is that it never searches for the spelling; it searches for the sound.

Speech-to-text systems rarely misspell ordinary words, but names come out as whatever sounded right: nil armstrong, buz aldrin, amelia erhart. String search cannot find these. Their pronunciations, though, are nearly identical to the names you intended.

Here is the pipeline, in the order it runs in your browser:

  1. Phonemize the inputs. Every name and every transcript token goes through the same G2P model that powers the homepage demo. The output is an IPA phoneme sequence plus an alignment: each phoneme maps back to the characters that produced it.
  2. Slide candidate windows. Character spans roughly the length of each name move across the transcript. Spans ignore whitespace and may sit inside longer tokens, which is how sallyride is found inside supersallyridearchive.
  3. Reject cheaply. Each window is pre-screened with a phoneme-count check, q-gram overlap, and a banded edit distance, all computed on phonemes sliced out of the token alignments. No model call happens at this stage, and it throws away almost every window.
  4. Verify the survivors. Windows that look plausible are phonemized for real and compared against the name's phonemes with a bounded edit distance: bit-parallel Myers for short sequences, banded Ukkonen for long ones.
  5. Score and select. Matches get a hybrid score, 85% phoneme similarity and 15% surface similarity. Overlapping candidates go through weighted-interval scheduling so the best non-overlapping set wins. When two names share one span with the same pronunciation (Sara vs. Sarah), the demo skips the span as ambiguous rather than guessing.
  6. Splice. Replacements are applied on the original string using original character offsets, so punctuation, casing context, and spacing survive untouched.

An earlier version of the demo phonemized every candidate window with the neural model, which meant hundreds of G2P calls per click. The alignment-based pre-screen cut that to a handful: scan plus replace on the default example dropped from several seconds to a few hundred milliseconds on a laptop CPU, still entirely in the browser.

The same two calls run in Python, Node, and the browser: see the pronunciation correction API docs and the quickstart, or try the demo.