| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Doctrine\Inflector\Rules\English; |
| 6 |
|
| 7 |
use Doctrine\Inflector\Rules\Pattern; |
| 8 |
use Doctrine\Inflector\Rules\Substitution; |
| 9 |
use Doctrine\Inflector\Rules\Transformation; |
| 10 |
use Doctrine\Inflector\Rules\Word; |
| 11 |
|
| 12 |
class Inflectible |
| 13 |
{ |
| 14 |
|
| 15 |
public static function getSingular(): iterable |
| 16 |
{ |
| 17 |
yield new Transformation(new Pattern('(s)tatuses$'), '\1\2tatus'); |
| 18 |
yield new Transformation(new Pattern('(s)tatus$'), '\1\2tatus'); |
| 19 |
yield new Transformation(new Pattern('(c)ampus$'), '\1\2ampus'); |
| 20 |
yield new Transformation(new Pattern('^(.*)(menu)s$'), '\1\2'); |
| 21 |
yield new Transformation(new Pattern('(quiz)zes$'), '\\1'); |
| 22 |
yield new Transformation(new Pattern('(matr)ices$'), '\1ix'); |
| 23 |
yield new Transformation(new Pattern('(vert|ind)ices$'), '\1ex'); |
| 24 |
yield new Transformation(new Pattern('^(ox)en'), '\1'); |
| 25 |
yield new Transformation(new Pattern('(alias)(es)*$'), '\1'); |
| 26 |
yield new Transformation(new Pattern('(buffal|her|potat|tomat|volcan)oes$'), '\1o'); |
| 27 |
yield new Transformation(new Pattern('(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$'), '\1us'); |
| 28 |
yield new Transformation(new Pattern('([ftw]ax)es'), '\1'); |
| 29 |
yield new Transformation(new Pattern('(analys|ax|cris|test|thes)es$'), '\1is'); |
| 30 |
yield new Transformation(new Pattern('(shoe|slave)s$'), '\1'); |
| 31 |
yield new Transformation(new Pattern('(o)es$'), '\1'); |
| 32 |
yield new Transformation(new Pattern('ouses$'), 'ouse'); |
| 33 |
yield new Transformation(new Pattern('([^a])uses$'), '\1us'); |
| 34 |
yield new Transformation(new Pattern('([m|l])ice$'), '\1ouse'); |
| 35 |
yield new Transformation(new Pattern('(x|ch|ss|sh)es$'), '\1'); |
| 36 |
yield new Transformation(new Pattern('(m)ovies$'), '\1\2ovie'); |
| 37 |
yield new Transformation(new Pattern('(s)eries$'), '\1\2eries'); |
| 38 |
yield new Transformation(new Pattern('([^aeiouy]|qu)ies$'), '\1y'); |
| 39 |
yield new Transformation(new Pattern('([lr])ves$'), '\1f'); |
| 40 |
yield new Transformation(new Pattern('(tive)s$'), '\1'); |
| 41 |
yield new Transformation(new Pattern('(hive)s$'), '\1'); |
| 42 |
yield new Transformation(new Pattern('(drive)s$'), '\1'); |
| 43 |
yield new Transformation(new Pattern('(dive)s$'), '\1'); |
| 44 |
yield new Transformation(new Pattern('(olive)s$'), '\1'); |
| 45 |
yield new Transformation(new Pattern('([^fo])ves$'), '\1fe'); |
| 46 |
yield new Transformation(new Pattern('(^analy)ses$'), '\1sis'); |
| 47 |
yield new Transformation(new Pattern('(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$'), '\1\2sis'); |
| 48 |
yield new Transformation(new Pattern('(tax)a$'), '\1on'); |
| 49 |
yield new Transformation(new Pattern('(c)riteria$'), '\1riterion'); |
| 50 |
yield new Transformation(new Pattern('([ti])a(?<!regatta)$'), '\1um'); |
| 51 |
yield new Transformation(new Pattern('(p)eople$'), '\1\2erson'); |
| 52 |
yield new Transformation(new Pattern('(m)en$'), '\1an'); |
| 53 |
yield new Transformation(new Pattern('(c)hildren$'), '\1\2hild'); |
| 54 |
yield new Transformation(new Pattern('(f)eet$'), '\1oot'); |
| 55 |
yield new Transformation(new Pattern('(n)ews$'), '\1\2ews'); |
| 56 |
yield new Transformation(new Pattern('eaus$'), 'eau'); |
| 57 |
yield new Transformation(new Pattern('^tights$'), 'tights'); |
| 58 |
yield new Transformation(new Pattern('^shorts$'), 'shorts'); |
| 59 |
yield new Transformation(new Pattern('s$'), ''); |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
public static function getPlural(): iterable |
| 64 |
{ |
| 65 |
yield new Transformation(new Pattern('(s)tatus$'), '\1\2tatuses'); |
| 66 |
yield new Transformation(new Pattern('(quiz)$'), '\1zes'); |
| 67 |
yield new Transformation(new Pattern('^(ox)$'), '\1\2en'); |
| 68 |
yield new Transformation(new Pattern('([m|l])ouse$'), '\1ice'); |
| 69 |
yield new Transformation(new Pattern('(matr|vert|ind)(ix|ex)$'), '\1ices'); |
| 70 |
yield new Transformation(new Pattern('(x|ch|ss|sh)$'), '\1es'); |
| 71 |
yield new Transformation(new Pattern('([^aeiouy]|qu)y$'), '\1ies'); |
| 72 |
yield new Transformation(new Pattern('(hive|gulf)$'), '\1s'); |
| 73 |
yield new Transformation(new Pattern('(?:([^f])fe|([lr])f)$'), '\1\2ves'); |
| 74 |
yield new Transformation(new Pattern('sis$'), 'ses'); |
| 75 |
yield new Transformation(new Pattern('([ti])um$'), '\1a'); |
| 76 |
yield new Transformation(new Pattern('(tax)on$'), '\1a'); |
| 77 |
yield new Transformation(new Pattern('(c)riterion$'), '\1riteria'); |
| 78 |
yield new Transformation(new Pattern('(p)erson$'), '\1eople'); |
| 79 |
yield new Transformation(new Pattern('(m)an$'), '\1en'); |
| 80 |
yield new Transformation(new Pattern('(c)hild$'), '\1hildren'); |
| 81 |
yield new Transformation(new Pattern('(f)oot$'), '\1eet'); |
| 82 |
yield new Transformation(new Pattern('(buffal|her|potat|tomat|volcan)o$'), '\1\2oes'); |
| 83 |
yield new Transformation(new Pattern('(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|vir)us$'), '\1i'); |
| 84 |
yield new Transformation(new Pattern('us$'), 'uses'); |
| 85 |
yield new Transformation(new Pattern('(alias)$'), '\1es'); |
| 86 |
yield new Transformation(new Pattern('(analys|ax|cris|test|thes)is$'), '\1es'); |
| 87 |
yield new Transformation(new Pattern('s$'), 's'); |
| 88 |
yield new Transformation(new Pattern('^$'), ''); |
| 89 |
yield new Transformation(new Pattern('$'), 's'); |
| 90 |
} |
| 91 |
|
| 92 |
|
| 93 |
public static function getIrregular(): iterable |
| 94 |
{ |
| 95 |
yield new Substitution(new Word('abuse'), new Word('abuses')); |
| 96 |
yield new Substitution(new Word('alga'), new Word('algae')); |
| 97 |
yield new Substitution(new Word('atlas'), new Word('atlases')); |
| 98 |
yield new Substitution(new Word('avalanche'), new Word('avalanches')); |
| 99 |
yield new Substitution(new Word('axis'), new Word('axes')); |
| 100 |
yield new Substitution(new Word('axe'), new Word('axes')); |
| 101 |
yield new Substitution(new Word('beef'), new Word('beefs')); |
| 102 |
yield new Substitution(new Word('blouse'), new Word('blouses')); |
| 103 |
yield new Substitution(new Word('brother'), new Word('brothers')); |
| 104 |
yield new Substitution(new Word('brownie'), new Word('brownies')); |
| 105 |
yield new Substitution(new Word('cache'), new Word('caches')); |
| 106 |
yield new Substitution(new Word('cafe'), new Word('cafes')); |
| 107 |
yield new Substitution(new Word('canvas'), new Word('canvases')); |
| 108 |
yield new Substitution(new Word('cave'), new Word('caves')); |
| 109 |
yield new Substitution(new Word('chateau'), new Word('chateaux')); |
| 110 |
yield new Substitution(new Word('child'), new Word('children')); |
| 111 |
yield new Substitution(new Word('cookie'), new Word('cookies')); |
| 112 |
yield new Substitution(new Word('corpus'), new Word('corpuses')); |
| 113 |
yield new Substitution(new Word('cow'), new Word('cows')); |
| 114 |
yield new Substitution(new Word('criterion'), new Word('criteria')); |
| 115 |
yield new Substitution(new Word('curriculum'), new Word('curricula')); |
| 116 |
yield new Substitution(new Word('curve'), new Word('curves')); |
| 117 |
yield new Substitution(new Word('demo'), new Word('demos')); |
| 118 |
yield new Substitution(new Word('die'), new Word('dice')); |
| 119 |
yield new Substitution(new Word('domino'), new Word('dominoes')); |
| 120 |
yield new Substitution(new Word('echo'), new Word('echoes')); |
| 121 |
yield new Substitution(new Word('emphasis'), new Word('emphases')); |
| 122 |
yield new Substitution(new Word('epoch'), new Word('epochs')); |
| 123 |
yield new Substitution(new Word('foe'), new Word('foes')); |
| 124 |
yield new Substitution(new Word('foot'), new Word('feet')); |
| 125 |
yield new Substitution(new Word('fungus'), new Word('fungi')); |
| 126 |
yield new Substitution(new Word('ganglion'), new Word('ganglions')); |
| 127 |
yield new Substitution(new Word('gas'), new Word('gases')); |
| 128 |
yield new Substitution(new Word('genie'), new Word('genies')); |
| 129 |
yield new Substitution(new Word('genus'), new Word('genera')); |
| 130 |
yield new Substitution(new Word('goose'), new Word('geese')); |
| 131 |
yield new Substitution(new Word('graffito'), new Word('graffiti')); |
| 132 |
yield new Substitution(new Word('grave'), new Word('graves')); |
| 133 |
yield new Substitution(new Word('hippopotamus'), new Word('hippopotami')); |
| 134 |
yield new Substitution(new Word('hoax'), new Word('hoaxes')); |
| 135 |
yield new Substitution(new Word('hoof'), new Word('hoofs')); |
| 136 |
yield new Substitution(new Word('human'), new Word('humans')); |
| 137 |
yield new Substitution(new Word('iris'), new Word('irises')); |
| 138 |
yield new Substitution(new Word('larva'), new Word('larvae')); |
| 139 |
yield new Substitution(new Word('leaf'), new Word('leaves')); |
| 140 |
yield new Substitution(new Word('lens'), new Word('lenses')); |
| 141 |
yield new Substitution(new Word('loaf'), new Word('loaves')); |
| 142 |
yield new Substitution(new Word('man'), new Word('men')); |
| 143 |
yield new Substitution(new Word('medium'), new Word('media')); |
| 144 |
yield new Substitution(new Word('memorandum'), new Word('memoranda')); |
| 145 |
yield new Substitution(new Word('money'), new Word('monies')); |
| 146 |
yield new Substitution(new Word('mongoose'), new Word('mongooses')); |
| 147 |
yield new Substitution(new Word('motto'), new Word('mottoes')); |
| 148 |
yield new Substitution(new Word('move'), new Word('moves')); |
| 149 |
yield new Substitution(new Word('mythos'), new Word('mythoi')); |
| 150 |
yield new Substitution(new Word('neurosis'), new Word('neuroses')); |
| 151 |
yield new Substitution(new Word('niche'), new Word('niches')); |
| 152 |
yield new Substitution(new Word('niveau'), new Word('niveaux')); |
| 153 |
yield new Substitution(new Word('nucleus'), new Word('nuclei')); |
| 154 |
yield new Substitution(new Word('numen'), new Word('numina')); |
| 155 |
yield new Substitution(new Word('nursery'), new Word('nurseries')); |
| 156 |
yield new Substitution(new Word('oasis'), new Word('oases')); |
| 157 |
yield new Substitution(new Word('occiput'), new Word('occiputs')); |
| 158 |
yield new Substitution(new Word('octopus'), new Word('octopuses')); |
| 159 |
yield new Substitution(new Word('opus'), new Word('opuses')); |
| 160 |
yield new Substitution(new Word('ox'), new Word('oxen')); |
| 161 |
yield new Substitution(new Word('passerby'), new Word('passersby')); |
| 162 |
yield new Substitution(new Word('penis'), new Word('penises')); |
| 163 |
yield new Substitution(new Word('person'), new Word('people')); |
| 164 |
yield new Substitution(new Word('plateau'), new Word('plateaux')); |
| 165 |
yield new Substitution(new Word('runner-up'), new Word('runners-up')); |
| 166 |
yield new Substitution(new Word('safe'), new Word('safes')); |
| 167 |
yield new Substitution(new Word('save'), new Word('saves')); |
| 168 |
yield new Substitution(new Word('sex'), new Word('sexes')); |
| 169 |
yield new Substitution(new Word('sieve'), new Word('sieves')); |
| 170 |
yield new Substitution(new Word('soliloquy'), new Word('soliloquies')); |
| 171 |
yield new Substitution(new Word('son-in-law'), new Word('sons-in-law')); |
| 172 |
yield new Substitution(new Word('stadium'), new Word('stadiums')); |
| 173 |
yield new Substitution(new Word('syllabus'), new Word('syllabi')); |
| 174 |
yield new Substitution(new Word('testis'), new Word('testes')); |
| 175 |
yield new Substitution(new Word('thief'), new Word('thieves')); |
| 176 |
yield new Substitution(new Word('tooth'), new Word('teeth')); |
| 177 |
yield new Substitution(new Word('tornado'), new Word('tornadoes')); |
| 178 |
yield new Substitution(new Word('trilby'), new Word('trilbys')); |
| 179 |
yield new Substitution(new Word('turf'), new Word('turfs')); |
| 180 |
yield new Substitution(new Word('valve'), new Word('valves')); |
| 181 |
yield new Substitution(new Word('volcano'), new Word('volcanoes')); |
| 182 |
yield new Substitution(new Word('wave'), new Word('waves')); |
| 183 |
yield new Substitution(new Word('zombie'), new Word('zombies')); |
| 184 |
} |
| 185 |
} |