ConlangGenerator.h header

#include <ew/app/ConlangGenerator.h>

Namespace ew::app

ConlangConfig struct

struct ew::app::ConlangConfig

A constructed-language sound system: the phonemes a word can be built from and the syllable shapes it may take. Phoneme and pattern lists are space-separated. In a pattern, C is replaced by a random consonant and V by a random vowel; any other character is kept literally (so a pattern like CV' can include an apostrophe). This lets a worldbuilder define a language's feel and generate a consistent lexicon from it.

Members

QString ew::app::ConlangConfig::consonants

Space-separated consonant phonemes, e.g. "p t k s m n l r th sh".

QString ew::app::ConlangConfig::vowels

Space-separated vowel phonemes, e.g. "a e i o u ae".

QString ew::app::ConlangConfig::patterns

Space-separated syllable patterns to choose from, e.g. "CV CVC V". Empty falls back to "CV".

int ew::app::ConlangConfig::minSyllables = 1

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

int ew::app::ConlangConfig::maxSyllables = 3

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

Functions

std::vector< QString > ew::app::generateConlangLexicon(const ConlangConfig &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::generateConlangWord(const ConlangConfig &config, quint64 seed)

Generates one word from config using seed, so the same config and seed reproduce the same word (deterministic and unit-testable). The word takes a random number of syllables in [minSyllables, maxSyllables]; each syllable picks a pattern and fills its C/V slots with random consonants/vowels. Returns an empty string only when the config has no consonants and no vowels to draw from.