Transforms a singular form to the plural form, based on these rules:
http://www.edufind.com/english-grammar/plural-nouns/ Only some irregular nouns are
respected in this implementation.

@param singular
@return
4066
private String transformToPluralForm(String singular) {
        String lowercaseSingular = singular.toLowerCase();
        if (IRREGULAR_NOUNS.containsKey(lowercaseSingular)) {
            // e.g. "Woman" -> "Women", "Ox" -> "Oxen" …
            String plural = IRREGULAR_NOUNS.get(lowercaseSingular);
            if (Character.isUpperCase(singular.charAt(0)) && plural.length() >= 2) {
                plural = String.valueOf(plural.charAt(0)).toUpperCase() + plural.substring(1);
            }
            return plural;
        }

        StringBuilder plural = new StringBuilder();

        // start with singular form
        plural.append(singular);

        if (singular.endsWith(String.valueOf(LAST_CHAR_Y))) {
            // e.g. "City" -> "Cities"

            // replace last char with suffix form
            int length = plural.length();
            plural.replace(length - 1, length, PLURAL_SUFFIX_IES);

        } else if (singular.endsWith(String.valueOf(LAST_CHAR_S))
            || singular.endsWith(String.valueOf(LAST_CHAR_X))
            || singular.endsWith(String.valueOf(LAST_CHAR_Z))
            || singular.endsWith(LAST_CHARS_CH)
            || singular.endsWith(LAST_CHARS_SH)) {
            // e.g. "Bus" -> "Buses"
            // e.g. "Box" -> "Boxes"
            // e.g. "Buzz" -> "Buzzes"
            // e.g. "Wish" -> "Wishes"
            // e.g. "Pitch" -> "Pitches"

            plural.append(PLURAL_SUFFIX_ES);

        } else {
            // e.g. "Boat" -> "Boats"

            // default
            plural.append(PLURAL_SUFFIX_S);
        }

        return plural.toString();
    }
58652
def gettext(self, singular, plural=None, n=1, locale=None) -> str:
        
        if locale is None:
            locale = self.ctx_locale.get()

        if locale not in self.locales:
            if n is 1:
                return singular
            else:
                return plural

        translator = self.locales[locale]

        if plural is None:
            return translator.gettext(singular)
        else:
            return translator.ngettext(singular, plural, n)
424868
public function ngettext($singular, $plural, $count) {
		if ($this->reader === null) {
			return $count > 1 ? $plural : $singular;
		}
		return $this->reader->ngettext((string)$singular, (string)$plural, $count);
	}
808757
private void expandAffixes(String pluralCount) {
        // expandAffix() will set currencyChoice to a non-null value if
        // appropriate AND if it is null.
        currencyChoice = null;

        // Reuse one StringBuffer for better performance
        StringBuffer buffer = new StringBuffer();
        if (posPrefixPattern != null) {
            expandAffix(posPrefixPattern, pluralCount, buffer);
            positivePrefix = buffer.toString();
        }
        if (posSuffixPattern != null) {
            expandAffix(posSuffixPattern, pluralCount, buffer);
            positiveSuffix = buffer.toString();
        }
        if (negPrefixPattern != null) {
            expandAffix(negPrefixPattern, pluralCount, buffer);
            negativePrefix = buffer.toString();
        }
        if (negSuffixPattern != null) {
            expandAffix(negSuffixPattern, pluralCount, buffer);
            negativeSuffix = buffer.toString();
        }
    }
1363110
public function plural($key, $count, array $vars = [])
    {
        if ($count === 1) {
            return $this->singular($key, $vars);
        }

        return $this->singular($key . '_plural', ['count' => $count] + $vars);
    }
1131180
public function translatePlural($singular, $plural, $number)
    {
        return Translator::getInstance()
            ->translatePlural($singular, $plural, $number);
    }
1051323
public function translatePlural( $singular,
                                     $plural,
                                     $number,
                                     $textDomain = self::DEFAULT_TEXT_DOMAIN,
                                     $locale     = null )
    {
        return $this->getTranslator()
                    ->translatePlural( $singular, $plural, $number,
                                       $textDomain, $locale );
    }
917337
public static String stem(String s) {
    String stem = s;

     // Handle irregular ones
     String irreg=irregular.get(s);
     if(irreg!=null) return(stem=irreg);

     // -on to -a
     if(categoryON_A.contains(s)) return(stem=cut(s,"a")+"on");

     // -um to -a
     if(categoryUM_A.contains(s)) return(stem=cut(s,"a")+"um");

     // -x to -ices
     if(categoryIX_ICES.contains(s)) return(stem=cut(s,"ices")+"ix");

     // -o to -i
     if(categoryO_I.contains(s)) return(stem=cut(s,"i")+"o");

     // -se to ses
     if(categorySE_SES.contains(s)) return(stem=cut(s,"s"));

     // -is to -es
     if(categoryIS_ES.contains(s) || s.endsWith("theses")) return(stem=cut(s,"es")+"is");

     // -us to -i
     if(categoryUS_I.contains(s)) return(stem=cut(s,"i")+"us");
     //Wrong plural
     if(s.endsWith("uses") && (categoryUS_I.contains(cut(s,"uses")+"i") ||
                               s.equals("genuses") || s.equals("corpuses"))) return(stem=cut(s,"es"));

     // -ex to -ices
     if(categoryEX_ICES.contains(s)) return(stem=cut(s,"ices")+"ex");

     // Words that do not inflect in the plural
     if(s.endsWith("ois") || s.endsWith("itis") || category00.contains(s) || categoryICS.contains(s)) return(stem=s);

     // -en to -ina
     // No other common words end in -ina
     if(s.endsWith("ina")) return(stem=cut(s,"en"));

     // -a to -ae
     // No other common words end in -ae
     if(s.endsWith("ae")) return(stem=cut(s,"e"));

     // -a to -ata
     // No other common words end in -ata
     if(s.endsWith("ata")) return(stem=cut(s,"ta"));

     // trix to -trices
     // No common word ends with -trice(s)
     if(s.endsWith("trices")) return(stem=cut(s,"trices")+"trix");

     // -us to -us
     //No other common word ends in -us, except for false plurals of French words
     //Catch words that are not latin or known to end in -u
     if(s.endsWith("us") && !s.endsWith("eaus") && !s.endsWith("ieus") && !noLatin(s)
        && !categoryU_US.contains(s)) return(stem=s);

     // -tooth to -teeth
     // -goose to -geese
     // -foot to -feet
     // -zoon to -zoa
     //No other common words end with the indicated suffixes
     if(s.endsWith("teeth")) return(stem=cut(s,"teeth")+"tooth");
     if(s.endsWith("geese")) return(stem=cut(s,"geese")+"goose");
     if(s.endsWith("feet")) return(stem=cut(s,"feet")+"foot");
     if(s.endsWith("zoa")) return(stem=cut(s,"zoa")+"zoon");

     // -eau to -eaux
     //No other common words end in eaux
     if(s.endsWith("eaux")) return(stem=cut(s,"x"));

     // -ieu to -ieux
     //No other common words end in ieux
     if(s.endsWith("ieux")) return(stem=cut(s,"x"));

     // -nx to -nges
     // Pay attention not to kill words ending in -nge with plural -nges
     // Take only Greek words (works fine, only a handfull of exceptions)
     if(s.endsWith("nges") && greek(s)) return(stem=cut(s,"nges")+"nx");

     // -[sc]h to -[sc]hes
     //No other common word ends with "shes", "ches" or "she(s)"
     //Quite a lot end with "che(s)", filter them out
     if(s.endsWith("shes") || s.endsWith("ches") && !categoryCHE_CHES.contains(s)) return(stem=cut(s,"es"));

     // -ss to -sses
     // No other common singular word ends with "sses"
     // Filter out those ending in "sse(s)"
     if(s.endsWith("sses") && !categorySSE_SSES.contains(s) && !s.endsWith("mousses")) return(stem=cut(s,"es"));

     // -x to -xes
     // No other common word ends with "xe(s)" except for "axe"
     if(s.endsWith("xes") && !s.equals("axes")) return(stem=cut(s,"es"));

     // -[nlw]ife to -[nlw]ives
     //No other common word ends with "[nlw]ive(s)" except for olive
     if(s.endsWith("nives") || s.endsWith("lives") && !s.endsWith("olives") ||
        s.endsWith("wives")) return(stem=cut(s,"ves")+"fe");

     // -[aeo]lf to -ves  exceptions: valve, solve
     // -[^d]eaf to -ves  exceptions: heave, weave
     // -arf to -ves      no exception
     if(s.endsWith("alves") && !s.endsWith("valves") ||
        s.endsWith("olves") && !s.endsWith("solves") ||
        s.endsWith("eaves") && !s.endsWith("heaves") && !s.endsWith("weaves") ||
        s.endsWith("arves") ) return(stem=cut(s,"ves")+"f");

     // -y to -ies
     // -ies is very uncommon as a singular suffix
     // but -ie is quite common, filter them out
     if(s.endsWith("ies") && !categoryIE_IES.contains(s)) return(stem=cut(s,"ies")+"y");

     // -o to -oes
     // Some words end with -oe, so don't kill the "e"
     if(s.endsWith("oes") && !categoryOE_OES.contains(s)) return(stem=cut(s,"es"));

     // -s to -ses
     // -z to -zes
     // no words end with "-ses" or "-zes" in singular
     if(s.endsWith("ses") || s.endsWith("zes") ) return(stem=cut(s,"es"));

     // - to -s
     if(s.endsWith("s") && !s.endsWith("ss") && !s.endsWith("is")) return(stem=cut(s,"s"));

     return stem;
  }
1152255
function singularVerb(phrase) {

  var word = /\w+/.exec(phrase)[0];

  if(word === 'are') {
    phrase = phrase.replace('are', 'is');
  } else if (word.slice(-1) === 'y') {
    phrase = phrase.replace(word, word.slice(0,-1) + 'ies');
  } else {
    phrase = phrase.replace(word, word + 's' );
  }

  return phrase;
}
28243
def articles(self):
		'''  '''

		result = [None, None]
		element = self._first('NN')
		if element:
			element = element.split('\r\n')[0]
			if ' | ' in element:
				# This means there is a plural
				singular, plural = element.split(' | ')
				singular, plural = singular.strip(), plural.strip()
			else:
				# This means there is no plural
				singular, plural = element.strip(), ''
				result[1] = ''
			if singular:
				result[0] = singular.split(' ')[0].split('/')
			if plural:
				result[1] = plural.split(' ')[0].split('/')
		return result
681109
func pluralize(i int, singular, plural string) string {
	if i == 1 {
		return singular
	}
	return plural
}
559079
def stem_plural_word(self, plural):
        
        matches = re.match(r'^(.*)-(.*)$', plural)
        #translated from PHP conditional check:
        #if (!isset($words[1]) || !isset($words[2]))
        if not matches:
            return plural
        words = [matches.group(1), matches.group(2)]

        #malaikat-malaikat-nya -> malaikat malaikat-nya
        suffix = words[1]
        suffixes = ['ku', 'mu', 'nya', 'lah', 'kah', 'tah', 'pun']
        matches = re.match(r'^(.*)-(.*)$', words[0])
        if suffix in suffixes and matches:
            words[0] = matches.group(1)
            words[1] = matches.group(2) + '-' + suffix

        #berbalas-balasan -> balas
        rootWord1 = self.stem_singular_word(words[0])
        rootWord2 = self.stem_singular_word(words[1])

        #meniru-nirukan -> tiru
        if not self.dictionary.contains(words[1]) and rootWord2 == words[1]:
            rootWord2 = self.stem_singular_word('me' + words[1])

        if rootWord1 == rootWord2:
            return rootWord1
        else:
            return plural
906619
def pluralized_array_from_hash(hash, singular_key, plural_key)
      [].tap do |array|
        value = value_from_singular_key(hash, singular_key)
        value ||= value_from_plural_key(hash, plural_key)
        array << value
      end.flatten.compact
    end
867997
public function singular($value)
        {
            // First we'll check the cache of inflected values. We cache each word that
            // is inflected so we don't have to spin through the regular expressions
            // each time we need to inflect a given value for the developer.
            if (isset($this->singular[$value])) {
                return $this->singular[$value];
            }

            // English words may be automatically inflected using regular expressions.
            // If the word is English, we'll just pass off the word to the automatic
            // inflection method and return the result, which is cached.
            $irregular = $this->config['irregular'];

            $result = $this->auto($value, $this->config['singular'], $irregular);

            return $this->singular[$value] = $result ?: $value;
        }
1197335
def singularize(plural):
    
    if plural in UNCOUNTABLES:
        return plural
    for i in IRREGULAR:
        if i[1] == plural:
            return i[0]
    for i in SINGULARIZE_PATTERNS:
        if re.search(i[0], plural):
            return re.sub(i[0], i[1], plural)
    return plural
451598
public static MessageFormat pluralizeFormat(final String pattern, final String... choices)
    {
        double[] indexes = new double[choices.length];

        for (int i = 0; i < choices.length; i++)
        {
            indexes[i] = i;
        }

        ChoiceFormat choiceForm = new ChoiceFormat(indexes, choices);
        MessageFormat format = (MessageFormat) messageFormat(pattern).clone();
        format.setFormat(0, choiceForm);

        return format;
    }
978734
public function getPluralForm($root) {
		$pluralForm = $root;

		if (!is_string($root)) {
			throw new \InvalidArgumentException('The pluralizer expects a string.');
		}

		if (!in_array(strtolower($root), $this->uncountable)) {
			// This check must be run before `checkIrregularForm` call
			if (!$this->isAmbiguousPlural($root)) {
				if (null !== $replacement = $this->checkIrregularForm($root, $this->irregular)) {
					$pluralForm = $replacement;
				} elseif (null !== $replacement = $this->checkIrregularSuffix($root, $this->plural)) {
					$pluralForm = $replacement;
				} elseif (!$this->isPlural($root)) {
					// fallback to naive pluralization
					$pluralForm = $root . 's';
				}
			}
		}

		return $pluralForm;
	}