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.isEmpty) {
    if (uncountableNouns.contains(word.toLowerCase())) {
      return word;
    } else {
      for (var r in _inflectionRules) {
        var pattern = r.first;
        if (pattern.hasMatch(word)) {
          return word.replaceAllMapped(pattern, r.last as MatchToString);
        }
      }
    }
  }

  return word;
}