Skip to content

Step 2, "li" ending - should check if the ending is in R1 #3

Description

@neilt1700

I ran the code on all 29418 stem example given at https://snowballstem.org/algorithms/english/stemmer.html (Sample English vocabulary, Its stemmed equivalent). It only failed on one :-) - "freely" stemmed to "free", it should stem to "freeli".

In step2 there should be a check to see if the ending is in R1 when the ending is "li" (as well as for all the other endings). So:

    if (self::hasEnding($word, 'li')) {
      if (strlen($word) > 4 && self::validLi(self::charAt(-3, $word))) {
        $word = self::removeEnding($word, 'li');
      }
    }

should be replaced with:

    if (self::inR1($word, "li") && self::hasEnding($word, 'li')) {
      if (strlen($word) > 4 && self::validLi(self::charAt(-3, $word))) {
        $word = self::removeEnding($word, 'li');
      }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions