'/(matr|vert|ind)(ix|ex)$/i' => '\1ices',
'/(x|ch|ss|sh)$/i' => '\1es',
'/([^aeiouy]|qu)y$/i' => '\1ies',
- '/(hive)$/i' => '\1s',
+ '/(hive|gulf)$/i' => '\1s',
'/(?:([^f])fe|([lr])f)$/i' => '\1\2ves',
'/sis$/i' => 'ses',
'/([ti])um$/i' => '\1a',
'/$/' => 's',
),
'uninflected' => array(
- '.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', 'people', 'cookie'
+ '.*[nrlm]ese',
+ '.*deer',
+ '.*fish',
+ '.*measles',
+ '.*ois',
+ '.*pox',
+ '.*sheep',
+ 'people',
+ 'cookie',
+ 'police',
),
'irregular' => array(
'atlas' => 'atlases',
'brother' => 'brothers',
'cafe' => 'cafes',
'chateau' => 'chateaux',
+ 'niveau' => 'niveaux',
'child' => 'children',
'cookie' => 'cookies',
'corpus' => 'corpuses',
'hoof' => 'hoofs',
'human' => 'humans',
'iris' => 'irises',
+ 'larva' => 'larvae',
'leaf' => 'leaves',
'loaf' => 'loaves',
'man' => 'men',
'octopus' => 'octopuses',
'opus' => 'opuses',
'ox' => 'oxen',
+ 'passerby' => 'passersby',
'penis' => 'penises',
'person' => 'people',
'plateau' => 'plateaux',
'/(tive)s$/i' => '\1',
'/(hive)s$/i' => '\1',
'/(drive)s$/i' => '\1',
+ '/(dive)s$/i' => '\1',
'/([^fo])ves$/i' => '\1fe',
'/(^analy)ses$/i' => '\1sis',
'/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
'.*pox',
'.*sheep',
'.*ss',
+ 'police',
+ 'pants',
+ 'clothes',
),
'irregular' => array(
+ 'caches' => 'cache',
'criteria' => 'criterion',
'curves' => 'curve',
'emphases' => 'emphasis',
'Amoyese', 'bison', 'Borghese', 'bream', 'breeches', 'britches', 'buffalo', 'cantus',
'carp', 'chassis', 'clippers', 'cod', 'coitus', 'Congoese', 'contretemps', 'corps',
'debris', 'diabetes', 'djinn', 'eland', 'elk', 'equipment', 'Faroese', 'flounder',
- 'Foochowese', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
+ 'Foochowese', 'Furniture', 'gallows', 'Genevese', 'Genoese', 'Gilbertese', 'graffiti',
'headquarters', 'herpes', 'hijinks', 'Hottentotese', 'information', 'innings',
- 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'mackerel', 'Maltese', '.*?media',
+ 'jackanapes', 'Kiplingese', 'Kongoese', 'Lucchese', 'Luggage', 'mackerel', 'Maltese', '.*?media',
'mews', 'moose', 'mumps', 'Nankingese', 'news', 'nexus', 'Niasese',
'Pekingese', 'Piedmontese', 'pincers', 'Pistoiese', 'pliers', 'Portuguese',
'proceedings', 'rabies', 'rice', 'rhinoceros', 'salmon', 'Sarawakese', 'scissors',
*/
public static function classify($word)
{
- return str_replace(" ", "", ucwords(strtr($word, "_-", " ")));
+ return str_replace(' ', '', ucwords(strtr($word, '_-', ' ')));
}
/**
if (preg_match('/(.*)\\b(' . self::$plural['cacheIrregular'] . ')$/i', $word, $regs)) {
self::$cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$plural['merged']['irregular'][strtolower($regs[2])], 1);
-
+
return self::$cache['pluralize'][$word];
}
if (preg_match('/(.*)\\b(' . self::$singular['cacheIrregular'] . ')$/i', $word, $regs)) {
self::$cache['singularize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$singular['merged']['irregular'][strtolower($regs[2])], 1);
-
+
return self::$cache['singularize'][$word];
}