convert method

  1. @override
String convert(
  1. String word
)
override

Converts input and returns the result of the conversion.

Implementation

@override
String convert(String word) {
  if (word.isNotEmpty) {
    if (uncountableNouns.contains(word.toLowerCase())) {
      return word;
    } else {
      for (final r in _inflectionRules) {
        final pattern = r.first as RegExp;
        if (pattern.hasMatch(word)) {
          return word.replaceAllMapped(pattern, r.last as MatchToString);
        }
      }
    }
  }

  return word;
}