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