WordSenses.h header

#include <ew/app/WordSenses.h>

Namespace ew::app

RootOccurrence struct

struct ew::app::RootOccurrence

One root occurrence in a segmented word, reduced to what a sense pattern matches on.

Members

QString ew::app::conlang::RootOccurrence::root

The root's dictionary form.

bool ew::app::conlang::RootOccurrence::oppositePolarity = false

Whether this occurrence carried the opposite pole.

bool ew::app::conlang::RootOccurrence::operator==(const RootOccurrence &other) const =default

Value equality over all fields.

Functions

qsizetype ew::app::conlang::matchSensePattern(const std::vector< RootOccurrence > &chain, const std::vector< ew::core::conlang::SensePatternPart > &pattern, qsizetype from)

The index in chain at or after from where pattern matches, or -1 when it does not.

Matching is exact and positional: each pattern part must find its named root at its pole, and a part with an empty root matches any occurrence. Root names compare case-insensitively, as every other lexicon lookup does.

std::vector< ew::core::conlang::WordSense > ew::app::conlang::resolvedSenses(const ew::core::conlang::LexiconEntry &entry)

Every reading entry has, from whichever field carries it, as ONE list.

A word's meanings can be written three ways – the plain LexiconEntry::gloss, the two-pole shorthand LexiconEntry::oppositeGloss, and the general LexiconEntry::senses – and a consumer that reads only some of them silently misses meanings the writer recorded. That is the failure this exists to prevent: every consumer reads this, so there is one answer to "what can this word mean?" rather than one per caller.

The plain gloss becomes the unconditioned primary sense, oppositeGloss the unconditioned opposite one, and LexiconEntry::senses is appended as given. A sense already stated explicitly is not duplicated by the shorthand.

QString ew::app::conlang::senseFor(const ew::core::conlang::LexiconEntry &entry, int positionClass, bool oppositePolarity)

The reading entry takes at positionClass under oppositePolarity, or an empty string when it has none.

A sense naming the exact position wins over one that applies anywhere, so a word whose meaning changes by slot resolves to the slot's reading rather than to its general one.