r1 property

String? get r1

The region after the first non-vowel following a vowel, or the end of the word if there is no such non-vowel.

If the words begins gener, commun or arsen, r1 is the remainder of the word after gener, commun or arsen is removed from the beginning.

See note on R1 and R2 http://snowball.tartarus.org/texts/r1r2.html.

Implementation

String? get r1 {
  for (final x in Porter2StemmerConstants.kRegion1Exceptions) {
    if (startsWith(x)) {
      final retVal = replaceFirst(x, '');
      return retVal.isEmpty ? null : retVal;
    }
  }
  return RegExp(r'(?<=(' +
          Porter2StemmerConstants.rVowels +
          Porter2StemmerConstants.rNotVowels +
          r'))\w+(?=$)')
      .firstMatch(this)
      ?.group(0);
}