porter2_stemmer
porter2_stemmer copied to clipboard
Invalid idx when suffix is longer than word
bool Porter2Stemmer::internal::replaceIfExists(std::string& word, const std::string& suffix, const std::string& replacement, size_t start)
contains size_t idx = word.size() - suffix.size();
but since size_t
is an unsigned type, a error occurs when the word is shorter than the suffix. For example:
bool Porter2Stemmer::internal::replaceIfExists("Ryuuko", "ational", "ate", 5);
Thanks! I will merge a PR that fixes this.