porter2_stemmer icon indicating copy to clipboard operation
porter2_stemmer copied to clipboard

Invalid idx when suffix is longer than word

Open ghost opened this issue 8 years ago • 1 comments

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);

ghost avatar Jun 20 '16 04:06 ghost

Thanks! I will merge a PR that fixes this.

smassung avatar Jun 20 '16 23:06 smassung