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::SoundChangeStep::ruleLabel
A human-readable label for the rule (e.g. "p -> b / V_V"), for display.
QString ew::app::SoundChangeStep::result
The word after this rule was applied to the previous step's result.
Functions
QString ew::app::applySoundChangeRule(const QString &word, const ew::core::SoundChangeRule &rule, const ew::core::Phonotactics &phonotactics, const ew::core::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), category symbols in the rule resolve against phonotactics, and 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::applySoundChanges(const QString &word, const ew::core::SoundChangeRuleset &ruleset, const ew::core::Phonotactics &phonotactics, const ew::core::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::traceSoundChanges(const QString &word, const ew::core::SoundChangeRuleset &ruleset, const ew::core::Phonotactics &phonotactics, const ew::core::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.