PolarityMark.h header
#include <ew/app/PolarityMark.h>
Namespace ew::app
PolarityStripped struct
struct ew::app::PolarityStripped
A word with its polarity marks removed, remembering which characters carried one.
The mark is not a property of the WORD but of a stretch inside it: a polysynthetic language chains several roots into one form and marks only the inverted ones, so "senX" tells us nothing unless we know which of its roots wore the accent. Keeping the flags positional lets the segmenter ask about the span it just consumed rather than about the whole word.
Members
QString ew::app::conlang::PolarityStripped::bare
The word with every polarity mark removed, in composed (NFC) form.
std::vector<bool> ew::app::conlang::PolarityStripped::markedAt
One flag per character of bare: whether that character carried a polarity mark.
bool ew::app::conlang::PolarityStripped::anyMarked = false
Whether any character carried the mark (so a caller can skip the positional work).
bool ew::app::conlang::PolarityStripped::operator==(const PolarityStripped &other) const =default
Value equality over all fields.
Functions
QString ew::app::conlang::applyPolarityMark(const QString &word, const QString &marker, const ew::core::conlang::PhonemeInventory &inventory)
word written with the polarity marker applied, so an inverted sense emits as the form the language actually spells rather than as its bare headword.
The mark lands after the word's first vowel, identified from inventory (a language's own sounds decide what a vowel is; "y" is one in some and not in others). A word with no vowel in the inventory takes the mark after its first character, which keeps the function total. An empty marker returns word unchanged.
bool ew::app::conlang::spanIsMarked(const PolarityStripped &stripped, qsizetype start, qsizetype length)
Whether any of the length characters of stripped starting at start carried the mark – i.e. whether the root occupying that span is the inverted one. A span outside the word is not marked.
PolarityStripped ew::app::conlang::stripPolarityMarks(const QString &word, const QString &marker)
Removes every occurrence of marker from word, recording which surviving character each one sat on. Comparison is under Unicode normalization, so a precomposed "é" and a decomposed "e" + U+0301 are both found, and the result is returned composed.
An empty marker (a language with no polarity contrast) returns word unmarked, so callers need no special case.