Closed hwsamuel closed 9 years ago
Hi, thanks for the find!
I have added the following simple fix
if (empty($word))
return $word;
I have also added a test just for this particular bug. Everything seems to work fine. If there is something that I am missing could you point it out? Do you want me to push a temporary branch so you can test it?
Thanks, this fix works, I've tested it out in my code as well
The Lancaster stemmer doesn't gracefully exit if an empty string is supplied. To reproduce, use the following code.
The following error is shown.
Notice: Uninitialized string offset: -1 in /php-nlp-tools/src/NlpTools/Stemmers/LancasterStemmer.php on line 86
I've tried the following modification to the
stem
function's code by adding the conditionif (strlen($word) == 0) return;
. However, after doing that a new error shows up from another file that I'm not sure how to fix.Notice: Uninitialized string offset: -1 in /php-nlp-tools/src/NlpTools/Utils/EnglishVowels.php on line 20