public static @Nullable String stem(String str) {
    // check for zero length
    int strLen = str.length();
    if (strLen == 0) {
      return null;
    }

    int lastNonLetter = -1;
    for (int i = 0; i < strLen; ++i) {
      char c = str.charAt(i);
      if (Character.isDigit(c) || c == '-' || c == '_') {
        lastNonLetter = i;
      }
      else if (!Character.isLetter(c)) {
        return null;
      }
    }
    ++lastNonLetter;
    if (lastNonLetter > 0 && lastNonLetter < strLen) {
      return str.substring(0, lastNonLetter) + stemString(str.substring(lastNonLetter));
    }
    return stemString(str);
  }
public static @Nullable String stem(String str)