private boolean endsIn(char a, char b) {
    if (2 > k) return false;
    // check left to right since the endings have often already matched
    if (word.charAt(k - 1) == a && word.charAt(k) == b) {
      j = k - 2;
      return true;
    }
    return false;
  }
A stemmer implementing the Kstem algorithm by Bob Krovetz.
linguistics/src/main/java/com/yahoo/language/simple/kstem/KStemmer.java