SoundChangeEngine.h header

#include <ew/app/SoundChangeEngine.h>

Namespace ew::app

SoundChangeStep struct

struct ew::app::SoundChangeStep

One step in a traced sound-change derivation: the rule that ran and the word it produced. A trace is the ordered list of these, so a user can watch a proto-form evolve rule by rule.

Members

QString ew::app::conlang::SoundChangeStep::ruleLabel

A human-readable label for the rule (e.g. "p -> b / V_V"), for display.

QString ew::app::conlang::SoundChangeStep::result

The word after this rule was applied to the previous step's result.

Functions

QString ew::app::conlang::applySoundChangeRule(const QString &word, const ew::core::conlang::SoundChangeRule &rule, const ew::core::conlang::Phonotactics &phonotactics, const ew::core::conlang::PhonemeInventory &inventory)

Applies one sound-change rule to word once (left to right, non-overlapping), returning the rewritten word. The word is tokenized into graphemes using inventory (so a digraph like "sh" is one sound), while the rule's target and environment are read in the category symbols of phonotactics as well as those graphemes – so a symbol of any length, not only a single letter, names its class. The environment's _ / # anchor the match. An empty target leaves the word unchanged. Context is matched against the rule's input, not its partially-rewritten output, so a rule cannot feed on itself within one pass.

QString ew::app::conlang::applySoundChanges(const QString &word, const ew::core::conlang::SoundChangeRuleset &ruleset, const ew::core::conlang::Phonotactics &phonotactics, const ew::core::conlang::PhonemeInventory &inventory)

Applies every rule of ruleset to word in order (each to the output of the previous), returning the final evolved word.

std::vector< SoundChangeStep > ew::app::conlang::traceSoundChanges(const QString &word, const ew::core::conlang::SoundChangeRuleset &ruleset, const ew::core::conlang::Phonotactics &phonotactics, const ew::core::conlang::PhonemeInventory &inventory)

Applies ruleset to word rule by rule, returning one SoundChangeStep per rule (in order) so the intermediate forms can be shown. The result of the last step is the fully evolved word.