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