PluralVerbEncoder constructor

PluralVerbEncoder()

Implementation

PluralVerbEncoder() {
  irregularPluralVerbs.forEach((singular, plural) {
    addInflectionRule(singular, (Match m) => plural);
  });

  [
    [r'e?s$', (Match m) => ''],
    [r'ies$', (Match m) => 'y'],
    [r'([^h|z|o|i])es$', (Match m) => '${m[1]}e'],
    [r'ses$', (Match m) => 's'],
    [r'zzes$', (Match m) => 'zz'],
    [r'([cs])hes$', (Match m) => '${m[1]}h'],
    [r'xes$', (Match m) => 'x'],
    [r'sses$', (Match m) => 'ss']
  ]
      .reversed
      .forEach((rule) => addInflectionRule(rule.first as String, rule.last));
}