MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / CreateDictionaryEntry

Method CreateDictionaryEntry

Util/src/SymSpell/SymSpell.cpp:59–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59bool SymSpell::CreateDictionaryEntry(const std::string &key, int count) {
60 if (count <= 0) {
61 return false;
62 }
63
64 auto wordsFounded = _words.find(key);
65 if (wordsFounded != _words.end()) {
66 int countPrevious = wordsFounded->second;
67 count = (std::numeric_limits<int>::max() - countPrevious > count)
68 ? (countPrevious + count)
69 : std::numeric_limits<int>::max();
70 wordsFounded->second = count;
71 return false;
72 } else {
73 _words.insert({key, count});
74 }
75
76 if (_strategy == Strategy::LazyLoaded) {
77 return true;
78 }
79
80 return BuildDeletesWords(key);
81}
82
83bool SymSpell::IsCorrectWord(const std::string &word) const {
84 return (word.size() <= static_cast<std::size_t>(_maxDictionaryEditDistance)) || (_words.count(word) == 1);

Callers

nothing calls this directly

Calls 3

findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected