Phoneme.h header
#include <ew/core/Phoneme.h>
Namespace ew::core
Phoneme struct
struct ew::core::Phoneme
One phoneme in a constructed language's sound inventory: how it is written in IPA and in the language's own romanization, its PhonemeClass, free-form articulatory features, and a relative frequency weight that biases word generation toward the sounds the language favours. The grapheme is what a generated word shows; the IPA is the canonical pronunciation.
Members
QString ew::core::Phoneme::ipa
The IPA symbol for the sound (e.g. "ʃ"). May be empty for a sketch inventory.
QString ew::core::Phoneme::grapheme
The romanization / grapheme the language writes this sound with (e.g. "sh"). When empty, the IPA symbol stands in.
PhonemeClass ew::core::Phoneme::phonemeClass =
The phoneme's broad class.
QString ew::core::Phoneme::features
Free-form articulatory features (e.g. "voiceless postalveolar fricative"); optional.
int ew::core::Phoneme::weight = 1
Relative frequency weight (at least 1): a phoneme with twice the weight is generated twice as often. Equal weights give a uniform inventory.
QString ew::core::Phoneme::display() const
The grapheme if set, else the IPA symbol – what a generated word displays for this phoneme.
bool ew::core::Phoneme::operator==(const Phoneme &other) const =default
Value equality over all fields.
PhonemeInventory struct
struct ew::core::PhonemeInventory
The sound inventory of a constructed language: its phonemes plus suprasegmentals (a stress rule and an optional tone system). This structured inventory supersedes the flat space-separated consonant/vowel strings, which still parse into it on load (see phonemeInventoryFromLegacy) so existing projects keep working.
Members
std::vector<Phoneme> ew::core::PhonemeInventory::phonemes
The phonemes, in inventory order.
QString ew::core::PhonemeInventory::stressRule
The stress rule as free-form text (e.g. "penultimate", "initial", "weight-sensitive"); empty when unspecified.
QString ew::core::PhonemeInventory::tones
The tone system as free-form text (e.g. "high low rising falling"); empty for an atonal language.
bool ew::core::PhonemeInventory::isEmpty() const
Whether the inventory carries nothing (no phonemes and no suprasegmentals).
bool ew::core::PhonemeInventory::operator==(const PhonemeInventory &other) const =default
Value equality over all fields.
Enumerations
enum class PhonemeClass { Consonant, Vowel, Glide, Liquid, Nasal, Other }
The broad class of a phoneme – its role in the sound system. Used to group the inventory, to resolve category symbols in phonotactics/generation, and to derive an inventory from a legacy consonant/vowel string. Serialized as a stable lowercase token so a project survives reordering.
Functions
std::optional< PhonemeClass > ew::core::phonemeClassFromToken(QStringView token)
Parses a phoneme class from its serialization token; std::nullopt if unrecognized.
PhonemeInventory ew::core::phonemeInventoryFromLegacy(const QString &consonants, const QString &vowels)
Builds a PhonemeInventory from the legacy space-separated consonants and vowels strings (the pre-inventory model): each whitespace-separated token becomes a phoneme whose IPA and grapheme are the token, classed Consonant or Vowel respectively, at the default weight. Used to migrate an old language on load so no vocabulary is lost; suprasegmentals start empty.
QString ew::core::toToken(PhonemeClass phonemeClass)
The stable serialization token for phonemeClass (e.g. "consonant").