public static string Plural(string x) { if (irregular_plural.TryGetValue(x, out string ret)) { return(ret); } if (elided_adj_nouns.TryGetValue(x, out KeyValuePair <string, string> test)) { return(test.Key + Noun.Plural(test.Value)); } return(x + "s"); }
// XXX incomplete implementation; have a grammar text available but past a certain point you need a Noun or Verb class. // some languages also have the notion of dual # so this isn't even a correct API public static string Plural(this string name, bool plural) { if (!plural) { return(name); } KeyValuePair <string, string>?test = name.SplitLastWord(); if (null != test) { return(test.Value.Key + " " + Noun.Plural(test.Value.Value)); } return(Noun.Plural(name)); }