cd /news/generative-ai/why-naive-syllable-concatenation-pro… · home › topics › generative-ai › article
[ARTICLE · art-177094] src=dev.to ↗ pub= topic=generative-ai verified=true sentiment=↑ positive

Why Naive Syllable Concatenation Produces Unpronounceable RPG Names (And How Phonotactic Weights Fix Them)

A developer built a compact TypeScript procedural name generator that replaces flat syllable arrays with a weighted phonotactic transition table, vowel-harmony constraints, and a deduplication pass to avoid unpronounceable RPG names. The engine scores each root-suffix join by coda-to-onset boundary legality and front/back harmony, zeroing out illegal clusters like stop-to-stop and fricative-to-fricative collisions without needing an LLM at runtime.

key takeaway

Scoring syllable joins with a coda-to-onset transition table (stop-to-stop and fricative-to-fricative weighted 0.0) plus a 1.0/0.25 vowel-harmony bonus eliminates illegal consonant pileups without an LLM at runtime.

by read5 min views4 publishedNov 27, 2026

Most procedural RPG name generators start the same way: three arrays of syllables—prefixes, middles, and suffixes—joined with Math.random(). On paper, 40 prefixes × 30 middles × 40 suffixes yields 48,000 combinations. In practice, roughly half of them look like kthrg'vl, bztl'k, or aeouia. Players stumble over them on voice chat, and tabletop GMs end up renaming the NPC "Bob" two minutes into the session.

The root cause is structural. Random concatenation treats syllables as independent tokens, ignoring phonotactics—the rules governing which phoneme sequences a language permits at syllable boundaries. When a prefix ends in a stop cluster (-kt) and the next syllable starts with a fricative cluster ( thr-), the boundary creates an illegal five-consonant pileup.

Replacing flat arrays with a weighted transition table, a vowel-harmony constraint, and a lightweight deduplication layer fixes the output without needing an LLM at runtime.

Uniform sampling breaks down along three predictable axes:

r, n, or l transitions cleanly into t, d, or s, whereas a coda ending in k or g colliding with an onset like vr- or zh- forces an unnatural glottal stop.ae- + -ia- + -eo) creates diphthongs with no rhythmic anchor, making stress placement ambiguous. Tools that focus on lore-grounded character naming—such as Fantasy Name Generator—solve this by separating phoneme inventories per culture and pairing phonological structure with semantic roots rather than relying on blind string joins.

Instead of storing raw syllable strings in flat arrays, represent each morpheme with its phonetic class, coda/onset tags, vowel harmony group (front vs. back), and optional semantic gloss. A compact 40-line TypeScript engine can enforce legal transitions deterministically:

type Harmony = "front" | "back";
type Boundary = "vowel" | "liquid" | "nasal" | "stop" | "fricative";

interface Morpheme {
  text: string;
  gloss: string;
  harmony: Harmony;
  onset: Boundary;
  coda: Boundary;
  weight: number;
}

// Allowed coda -> onset transitions (0 = forbidden)
const TRANSITION_WEIGHT: Record<Boundary, Record<Boundary, number>> = {
  vowel:     { vowel: 0.1, liquid: 1.0, nasal: 1.0, stop: 0.9, fricative: 0.8 },
  liquid:    { vowel: 1.0, liquid: 0.15, nasal: 0.6, stop: 0.7, fricative: 0.5 },
  nasal:     { vowel: 1.0, liquid: 0.4, nasal: 0.1, stop: 0.8, fricative: 0.5 },
  stop:      { vowel: 1.0, liquid: 0.5, nasal: 0.2, stop: 0.0, fricative: 0.1 },
  fricative: { vowel: 1.0, liquid: 0.4, nasal: 0.3, stop: 0.2, fricative: 0.0 },
};

function pickWeighted<T>(items: Array<{ item: T; score: number }>, rng: () => number): T {
  const total = items.reduce((sum, x) => sum + x.score, 0);
  let r = rng() * total;
  for (const entry of items) {
    r -= entry.score;
    if (r <= 0) return entry.item;
  }
  return items[items.length - 1].item;
}

export function buildName(
  roots: Morpheme[],
  suffixes: Morpheme[],
  rng: () => number = Math.random
): { name: string; meaning: string } {
  const root = pickWeighted(roots.map((m) => ({ item: m, score: m.weight })), rng);

  const scoredSuffixes = suffixes
    .map((suf) => {
      const boundaryScore = TRANSITION_WEIGHT[root.coda][suf.onset];
      const harmonyBonus = root.harmony === suf.harmony ? 1.0 : 0.25;
      return { item: suf, score: suf.weight * boundaryScore * harmonyBonus };
    })
    .filter((x) => x.score > 0);

  const suffix = pickWeighted(scoredSuffixes, rng);
  const raw = `${root.text}${suffix.text}`.replace(/(.)\1\1+/g, "$1$1");
  return {
    name: raw.charAt(0).toUpperCase() + raw.slice(1),
    meaning: `${root.gloss} + ${suffix.gloss}`,
  };
}

Three details do most of the heavy lifting here:

stop -> stop and fricative -> fricative`` kt-, gd-, sz-, and fv- collisions at the join point.1.0 vs 0.25) e, i, ae) naturally pair with front-vowel suffixes, while back vowels (a, o, u) pull back-vowel endings. Keeping a 0.25 fallback prevents the pool from feeling repetitive./(.)\1\1+/g) ll). When designing multiple elven cultures in the same game world, you do not need separate codebases—just distinct phoneme tables mapped against the International Phonetic Alphabet (IPA). Even within a single species, shifting liquid/nasal ratios and syllable counts produces immediately recognizable families:

Design Axis Moonlight / Woodland Elven Solar / Astral High-Born Elven
Core Onsets Soft stops & nasals ( /m/ ,/n/ ,/t/ ,/ʃ/ ) Liquids & sibilants ( /l/ ,/r/ ,/s/ ,/v/ )
Dominant Vowels Balanced short/long ( /a/ ,/i/ ,/u/ ,/o/ ) Front & diphthong-heavy ( /eː/ ,/iː/ ,/aɪ/ ,ae )
Syllable Target 2–3 syllables given name + compound surname 3–4 syllables given name + patronymic or house affix
Semantic Roots Moon, owl, shadow, grove, whisper, tide Dawn, star, crown, spire, crystal, flame
Example Structure Syl- +-varis →Sylvaris ,Lyr- +-eth →Lyreth Ael- +-arion →Aelarion ,Cal- +-endil →Calendil

Traditional Elder Scrolls lore documented in the UESP Altmer naming documentation illustrates this solar/high-born pattern clearly: multi-syllabic stems with open vowels and crisp liquid codas (-il, -or, -ion) signal antiquity and formal register. If you want to inspect how meaning-tagged high-born elven roots combine across different syllable weights in a live tool, Fantasy Name Generator's High Elf name generator exposes the semantic breakdown alongside each generated name.

Checking seen.has(name) is not enough. If a batch outputs Aelarion, Aelaryon, and Aelarien in the same ten-item roll, players perceive them as duplicates even though all three are distinct strings.

A fast, zero-dependency deduplication filter combines three checks:

y -> i, ph -> f, c -> k. Both Aelarion and Aelaryon hash to ALRN, blocking near-homophones in the same batch. distance >= 3)

function phoneticKey(name: string): string {
  const lower = name.toLowerCase().replace(/[^a-z]/g, "");
  if (!lower) return "";
  const head = lower[0];
  const tail = lower
    .slice(1)
    .replace(/ph/g, "f")
    .replace(/[cy]/g, (ch) => (ch === "c" ? "k" : "i"))
    .replace(/[aeiou]/g, "")
    .replace(/(.)\1+/g, "$1");
  return head + tail;
}

Run a 1,000-sample smoke test before shipping and assert four metrics:

Phonotactic weights take under 100 lines of TypeScript, run in microseconds on the client, and eliminate the gibberish that breaks immersion.

── more in #generative-ai 4 stories · sorted by recency
── more on @fantasy name generator 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/why-naive-syllable-c…] indexed:0 read:5min 2026-11-27 · —