| 148 |
lars |
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 |
/** @return Transformation[] */
|
|
|
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$'), '\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 |
/** @return Transformation[] */
|
|
|
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 |
/** @return Substitution[] */
|
|
|
93 |
public static function getIrregular(): iterable
|
|
|
94 |
{
|
|
|
95 |
yield new Substitution(new Word('atlas'), new Word('atlases'));
|
|
|
96 |
yield new Substitution(new Word('axe'), new Word('axes'));
|
|
|
97 |
yield new Substitution(new Word('beef'), new Word('beefs'));
|
|
|
98 |
yield new Substitution(new Word('blouse'), new Word('blouses'));
|
|
|
99 |
yield new Substitution(new Word('brother'), new Word('brothers'));
|
|
|
100 |
yield new Substitution(new Word('cafe'), new Word('cafes'));
|
|
|
101 |
yield new Substitution(new Word('chateau'), new Word('chateaux'));
|
|
|
102 |
yield new Substitution(new Word('niveau'), new Word('niveaux'));
|
|
|
103 |
yield new Substitution(new Word('child'), new Word('children'));
|
|
|
104 |
yield new Substitution(new Word('canvas'), new Word('canvases'));
|
|
|
105 |
yield new Substitution(new Word('cookie'), new Word('cookies'));
|
|
|
106 |
yield new Substitution(new Word('corpus'), new Word('corpuses'));
|
|
|
107 |
yield new Substitution(new Word('cow'), new Word('cows'));
|
|
|
108 |
yield new Substitution(new Word('criterion'), new Word('criteria'));
|
|
|
109 |
yield new Substitution(new Word('curriculum'), new Word('curricula'));
|
|
|
110 |
yield new Substitution(new Word('demo'), new Word('demos'));
|
|
|
111 |
yield new Substitution(new Word('domino'), new Word('dominoes'));
|
|
|
112 |
yield new Substitution(new Word('echo'), new Word('echoes'));
|
|
|
113 |
yield new Substitution(new Word('foot'), new Word('feet'));
|
|
|
114 |
yield new Substitution(new Word('fungus'), new Word('fungi'));
|
|
|
115 |
yield new Substitution(new Word('ganglion'), new Word('ganglions'));
|
|
|
116 |
yield new Substitution(new Word('gas'), new Word('gases'));
|
|
|
117 |
yield new Substitution(new Word('genie'), new Word('genies'));
|
|
|
118 |
yield new Substitution(new Word('genus'), new Word('genera'));
|
|
|
119 |
yield new Substitution(new Word('goose'), new Word('geese'));
|
|
|
120 |
yield new Substitution(new Word('graffito'), new Word('graffiti'));
|
|
|
121 |
yield new Substitution(new Word('hippopotamus'), new Word('hippopotami'));
|
|
|
122 |
yield new Substitution(new Word('hoof'), new Word('hoofs'));
|
|
|
123 |
yield new Substitution(new Word('human'), new Word('humans'));
|
|
|
124 |
yield new Substitution(new Word('iris'), new Word('irises'));
|
|
|
125 |
yield new Substitution(new Word('larva'), new Word('larvae'));
|
|
|
126 |
yield new Substitution(new Word('leaf'), new Word('leaves'));
|
|
|
127 |
yield new Substitution(new Word('lens'), new Word('lenses'));
|
|
|
128 |
yield new Substitution(new Word('loaf'), new Word('loaves'));
|
|
|
129 |
yield new Substitution(new Word('man'), new Word('men'));
|
|
|
130 |
yield new Substitution(new Word('medium'), new Word('media'));
|
|
|
131 |
yield new Substitution(new Word('memorandum'), new Word('memoranda'));
|
|
|
132 |
yield new Substitution(new Word('money'), new Word('monies'));
|
|
|
133 |
yield new Substitution(new Word('mongoose'), new Word('mongooses'));
|
|
|
134 |
yield new Substitution(new Word('motto'), new Word('mottoes'));
|
|
|
135 |
yield new Substitution(new Word('move'), new Word('moves'));
|
|
|
136 |
yield new Substitution(new Word('mythos'), new Word('mythoi'));
|
|
|
137 |
yield new Substitution(new Word('niche'), new Word('niches'));
|
|
|
138 |
yield new Substitution(new Word('nucleus'), new Word('nuclei'));
|
|
|
139 |
yield new Substitution(new Word('numen'), new Word('numina'));
|
|
|
140 |
yield new Substitution(new Word('occiput'), new Word('occiputs'));
|
|
|
141 |
yield new Substitution(new Word('octopus'), new Word('octopuses'));
|
|
|
142 |
yield new Substitution(new Word('opus'), new Word('opuses'));
|
|
|
143 |
yield new Substitution(new Word('ox'), new Word('oxen'));
|
|
|
144 |
yield new Substitution(new Word('passerby'), new Word('passersby'));
|
|
|
145 |
yield new Substitution(new Word('penis'), new Word('penises'));
|
|
|
146 |
yield new Substitution(new Word('person'), new Word('people'));
|
|
|
147 |
yield new Substitution(new Word('plateau'), new Word('plateaux'));
|
|
|
148 |
yield new Substitution(new Word('runner-up'), new Word('runners-up'));
|
|
|
149 |
yield new Substitution(new Word('safe'), new Word('safes'));
|
|
|
150 |
yield new Substitution(new Word('sex'), new Word('sexes'));
|
|
|
151 |
yield new Substitution(new Word('sieve'), new Word('sieves'));
|
|
|
152 |
yield new Substitution(new Word('soliloquy'), new Word('soliloquies'));
|
|
|
153 |
yield new Substitution(new Word('son-in-law'), new Word('sons-in-law'));
|
|
|
154 |
yield new Substitution(new Word('syllabus'), new Word('syllabi'));
|
|
|
155 |
yield new Substitution(new Word('testis'), new Word('testes'));
|
|
|
156 |
yield new Substitution(new Word('thief'), new Word('thieves'));
|
|
|
157 |
yield new Substitution(new Word('tooth'), new Word('teeth'));
|
|
|
158 |
yield new Substitution(new Word('tornado'), new Word('tornadoes'));
|
|
|
159 |
yield new Substitution(new Word('trilby'), new Word('trilbys'));
|
|
|
160 |
yield new Substitution(new Word('turf'), new Word('turfs'));
|
|
|
161 |
yield new Substitution(new Word('valve'), new Word('valves'));
|
|
|
162 |
yield new Substitution(new Word('volcano'), new Word('volcanoes'));
|
|
|
163 |
yield new Substitution(new Word('abuse'), new Word('abuses'));
|
|
|
164 |
yield new Substitution(new Word('avalanche'), new Word('avalanches'));
|
|
|
165 |
yield new Substitution(new Word('cache'), new Word('caches'));
|
|
|
166 |
yield new Substitution(new Word('criterion'), new Word('criteria'));
|
|
|
167 |
yield new Substitution(new Word('curve'), new Word('curves'));
|
|
|
168 |
yield new Substitution(new Word('emphasis'), new Word('emphases'));
|
|
|
169 |
yield new Substitution(new Word('foe'), new Word('foes'));
|
|
|
170 |
yield new Substitution(new Word('grave'), new Word('graves'));
|
|
|
171 |
yield new Substitution(new Word('hoax'), new Word('hoaxes'));
|
|
|
172 |
yield new Substitution(new Word('medium'), new Word('media'));
|
|
|
173 |
yield new Substitution(new Word('neurosis'), new Word('neuroses'));
|
|
|
174 |
yield new Substitution(new Word('save'), new Word('saves'));
|
|
|
175 |
yield new Substitution(new Word('wave'), new Word('waves'));
|
|
|
176 |
yield new Substitution(new Word('oasis'), new Word('oases'));
|
|
|
177 |
yield new Substitution(new Word('valve'), new Word('valves'));
|
|
|
178 |
yield new Substitution(new Word('zombie'), new Word('zombies'));
|
|
|
179 |
}
|
|
|
180 |
}
|