TerminologyRule.h header

#include <ew/app/TerminologyRule.h>

Namespace ew::app

TerminologyRule class

class ew::app::TerminologyRule

Enforces the project's house style: canonical spellings, banned terms, discouraged words.

The only rule in this family built from project data rather than a shipped list. Every other rule here encodes advice that holds for any manuscript, so its word list can live in the binary. This one carries the decisions one project made about its own vocabulary, which is why it is constructed with them instead of knowing them.

A rule constructed with an empty terminology finds nothing, which is the correct behaviour for a project that has not set a house style rather than a reason to omit the rule.

Members

ew::app::style::TerminologyRule::TerminologyRule(std::vector< ew::core::style::TerminologyEntry > terminology)

Constructs the rule over terminology, with its match patterns compiled once.

QString ew::app::style::TerminologyRule::id() const override

Returns the rule's stable identifier.

StyleCategory ew::app::style::TerminologyRule::category() const override

Returns StyleCategory::Terminology.

std::vector< StyleFinding > ew::app::style::TerminologyRule::analyze(QStringView text) const override

Finds every house-style violation in text.

Matches whole words only. A house style that renamed "dwarfs" to "dwarves" must not flag the "dwarfs" inside a longer word, and a project banning "app" must not light up every "happen" – a rule that cries wolf on correct prose is one writers switch off, which costs more than the rule was ever worth.