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