WordSetSpellChecker.h header
#include <ew/app/WordSetSpellChecker.h>
Namespace ew::app
WordSetSpellChecker class
class ew::app::WordSetSpellChecker
A SpellChecker backed by in-memory word sets: a base dictionary plus learned words. Until a base dictionary is set it judges every word correct, so it is harmlessly inert with no dictionary data. Matching is case-insensitive.
Members
void ew::app::WordSetSpellChecker::setDictionary(const QStringList &words)
Replaces the base dictionary with words.
bool ew::app::WordSetSpellChecker::hasDictionary() const
Returns true if a base dictionary has been set.
bool ew::app::WordSetSpellChecker::isCorrect(QStringView word) const override
Returns true if a base dictionary is not yet set, or word is in the base dictionary or learned words (case-insensitively).
void ew::app::WordSetSpellChecker::addWord(QString word) override
Learns word so it is treated as correct.
QStringList ew::app::WordSetSpellChecker::suggestions(QStringView word, int maxResults=7) const override
Ranks the dictionary and learned words by edit distance to word (see spellingSuggestions), returning up to maxResults replacements; empty when no dictionary is set. Only words within the edit-distance budget of word are considered, so a large dictionary stays responsive on a right-click.