Skip to content

Commit

Permalink
use find over count
Browse files Browse the repository at this point in the history
  • Loading branch information
krunal1313 committed Nov 29, 2024
1 parent dbbf0f6 commit 2720dff
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/stemmer_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ std::string StemmerManager::get_normalized_word(const std::string &dictionary_na
std::lock_guard<std::mutex> lock(mutex);

std::string normalized_word;
if(stem_dictionaries.count(dictionary_name) != 0) {
const auto& dictionary = stem_dictionaries.at(dictionary_name);

auto stem_dictionaries_it = stem_dictionaries.find(dictionary_name);
if(stem_dictionaries_it != stem_dictionaries.end()) {
const auto& dictionary = stem_dictionaries_it->second;
auto found = dictionary.find(word);

if(found != dictionary.end()) {
normalized_word = found->second;
}
Expand Down

0 comments on commit 2720dff

Please sign in to comment.