PhonotacticGenerator.h header

#include <ew/app/PhonotacticGenerator.h>

Namespace ew::app

PhonotacticGeneratorConfig struct

struct ew::app::PhonotacticGeneratorConfig

Everything the phonotactics-aware word generator needs to build a word for a constructed language: the sound inventory (which supplies each phoneme's romanization and frequency weight), the phonotactics (categories, weighted syllable templates, constraints, and rewrite rules), and the syllable-count bounds (which live on the language, not the phonotactics). This is the modern replacement for ConlangConfig: instead of two flat phoneme strings and literal C/V patterns, it draws on the structured model so weighting, clusters, forbidden sequences, vowel harmony, and post-generation rewrites are all honoured.

Members

ew::core::PhonemeInventory ew::app::PhonotacticGeneratorConfig::inventory

The sounds the language is built from; a category member's generation frequency comes from its phoneme weight here.

ew::core::Phonotactics ew::app::PhonotacticGeneratorConfig::phonotactics

The rules that decide which sound sequences form a legal word.

int ew::app::PhonotacticGeneratorConfig::minSyllables = 1

The fewest syllables a generated word may have (at least one).

int ew::app::PhonotacticGeneratorConfig::maxSyllables = 3

The most syllables a generated word may have (at least minSyllables).

Functions

std::vector< QString > ew::app::generatePhonotacticLexicon(const PhonotacticGeneratorConfig &config, int count, quint64 seed)

Generates a lexicon of count words from config over consecutive seeds (seed, seed + 1, ...), a deterministic batch. Returns an empty list when count is not positive.

QString ew::app::generatePhonotacticWord(const PhonotacticGeneratorConfig &config, quint64 seed)

Generates one word from config using seed, so the same config and seed reproduce the same word (deterministic and unit-testable). A syllable count is drawn from [minSyllables, maxSyllables] biased by the phonotactics' dropoff and monosyllable weight; each syllable draws a template by weight and fills its category slots by phoneme weight, honouring vowel harmony; a candidate containing a forbidden sequence is re-rolled a bounded number of times; finally the ordered rewrite rules are applied. Returns an empty string only when there are no sounds to draw from. When the forbidden-sequence constraints cannot be satisfied within the retry budget, the last candidate is returned as a best effort rather than looping forever.