Fixed singular of committee

This commit is contained in:
Peter Rehm 2016-05-29 18:16:27 +02:00 committed by Fabien Potencier
parent a81b6cec5d
commit 5661d52ace
2 changed files with 10 additions and 6 deletions

View File

@ -24,7 +24,6 @@ class StringUtil
* @var array * @var array
* *
* @see http://english-zone.com/spelling/plurals.html * @see http://english-zone.com/spelling/plurals.html
* @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
*/ */
private static $pluralMap = array( private static $pluralMap = array(
// First entry: plural suffix, reversed // First entry: plural suffix, reversed
@ -69,6 +68,15 @@ class StringUtil
// movies (movie) // movies (movie)
array('seivom', 6, true, true, 'movie'), array('seivom', 6, true, true, 'movie'),
// feet (foot)
array('teef', 4, true, true, 'foot'),
// geese (goose)
array('eseeg', 5, true, true, 'goose'),
// teeth (tooth)
array('hteet', 5, true, true, 'tooth'),
// news (news) // news (news)
array('swen', 4, true, true, 'news'), array('swen', 4, true, true, 'news'),
@ -214,11 +222,6 @@ class StringUtil
} }
} }
// Convert teeth to tooth, feet to foot
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && 'feedback' !== $plural) {
return substr_replace($plural, 'oo', $pos, 2);
}
// Assume that plural and singular is identical // Assume that plural and singular is identical
return $plural; return $plural;
} }

View File

@ -53,6 +53,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase
array('children', 'child'), array('children', 'child'),
array('circuses', array('circus', 'circuse', 'circusis')), array('circuses', array('circus', 'circuse', 'circusis')),
array('cliffs', 'cliff'), array('cliffs', 'cliff'),
array('committee', 'committee'),
array('crises', array('cris', 'crise', 'crisis')), array('crises', array('cris', 'crise', 'crisis')),
array('criteria', array('criterion', 'criterium')), array('criteria', array('criterion', 'criterium')),
array('cups', 'cup'), array('cups', 'cup'),