public function pluralize($word)
{
// Get the cached noun of it exists
if (isset($this->cache['pluralized'][$word])) {
return $this->cache['pluralized'][$word];
}
// Check if the noun is already in plural form, i.e. in the singularized cache
if (isset($this->cache['singularized'][$word])) {
return $word;
}
// Create the plural noun
if (in_array($word, $this->rules['uncountable'])) {
$_cache['pluralized'][$word] = $word;
return $word;
}
foreach ($this->rules['pluralization'] as $regexp => $replacement) {
$matches = null;
$plural = preg_replace($regexp, $replacement, $word, -1, $matches);
if ($matches > 0) {
$_cache['pluralized'][$word] = $plural;
return $plural;
}
}
return $word;
}