PluralEncoder constructor
PluralEncoder()
Implementation
PluralEncoder() {
irregularPluralNouns.forEach((singular, plural) {
addIrregularInflectionRule(singular, plural);
});
[
[r'$', (Match m) => 's'],
[r's$', (Match m) => 's'],
[r'^(ax|test)is$', (Match m) => '${m[1]}es'],
[r'(octop|vir)us$', (Match m) => '${m[1]}i'],
[r'(octop|vir)i$', (Match m) => m[0]!],
[r'(alias|status)$', (Match m) => '${m[1]}es'],
[r'(bu)s$', (Match m) => '${m[1]}ses'],
[r'(buffal|tomat)o$', (Match m) => '${m[1]}oes'],
[r'([ti])um$', (Match m) => '${m[1]}a'],
[r'([ti])a$', (Match m) => m[0]!],
[r'sis$', (Match m) => 'ses'],
[r'(?:([^f])fe|([lr])f)$', (Match m) => '${m[1]}${m[2]}ves'],
[r'([^aeiouy]|qu)y$', (Match m) => '${m[1]}ies'],
[r'(x|ch|ss|sh)$', (Match m) => '${m[1]}es'],
[r'(matr|vert|ind)(?:ix|ex)$', (Match m) => '${m[1]}ices'],
[r'^(m|l)ouse$', (Match m) => '${m[1]}ice'],
[r'^(m|l)ice$', (Match m) => m[0]!],
[r'^(ox)$', (Match m) => '${m[1]}en'],
[r'^(oxen)$', (Match m) => m[1]!],
[r'(quiz)$', (Match m) => '${m[1]}zes']
].reversed.forEach((rule) => addInflectionRule(rule.first as String, rule.last as MatchToString));
}