|
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 Singular |
|
13
|
|
|
{ |
|
14
|
|
|
/** |
|
15
|
|
|
* @return Transformation[] |
|
16
|
|
|
*/ |
|
17
|
524 |
|
public static function getTransformations() : iterable |
|
18
|
|
|
{ |
|
19
|
524 |
|
yield new Transformation(new Pattern('(s)tatuses$'), '\1\2tatus'); |
|
20
|
524 |
|
yield new Transformation(new Pattern('^(.*)(menu)s$'), '\1\2'); |
|
21
|
524 |
|
yield new Transformation(new Pattern('(quiz)zes$'), '\\1'); |
|
22
|
524 |
|
yield new Transformation(new Pattern('(matr)ices$'), '\1ix'); |
|
23
|
524 |
|
yield new Transformation(new Pattern('(vert|ind)ices$'), '\1ex'); |
|
24
|
524 |
|
yield new Transformation(new Pattern('^(ox)en'), '\1'); |
|
25
|
524 |
|
yield new Transformation(new Pattern('(alias)(es)*$'), '\1'); |
|
26
|
524 |
|
yield new Transformation(new Pattern('(buffal|her|potat|tomat|volcan)oes$'), '\1o'); |
|
27
|
524 |
|
yield new Transformation(new Pattern('(alumn|bacill|cact|foc|fung|nucle|radi|stimul|syllab|termin|viri?)i$'), '\1us'); |
|
28
|
524 |
|
yield new Transformation(new Pattern('([ftw]ax)es'), '\1'); |
|
29
|
524 |
|
yield new Transformation(new Pattern('(analys|ax|cris|test|thes)es$'), '\1is'); |
|
30
|
524 |
|
yield new Transformation(new Pattern('(shoe|slave)s$'), '\1'); |
|
31
|
524 |
|
yield new Transformation(new Pattern('(o)es$'), '\1'); |
|
32
|
524 |
|
yield new Transformation(new Pattern('ouses$'), 'ouse'); |
|
33
|
524 |
|
yield new Transformation(new Pattern('([^a])uses$'), '\1us'); |
|
34
|
524 |
|
yield new Transformation(new Pattern('([m|l])ice$'), '\1ouse'); |
|
35
|
524 |
|
yield new Transformation(new Pattern('(x|ch|ss|sh)es$'), '\1'); |
|
36
|
524 |
|
yield new Transformation(new Pattern('(m)ovies$'), '\1\2ovie'); |
|
37
|
524 |
|
yield new Transformation(new Pattern('(s)eries$'), '\1\2eries'); |
|
38
|
524 |
|
yield new Transformation(new Pattern('([^aeiouy]|qu)ies$'), '\1y'); |
|
39
|
524 |
|
yield new Transformation(new Pattern('([lr])ves$'), '\1f'); |
|
40
|
524 |
|
yield new Transformation(new Pattern('(tive)s$'), '\1'); |
|
41
|
524 |
|
yield new Transformation(new Pattern('(hive)s$'), '\1'); |
|
42
|
524 |
|
yield new Transformation(new Pattern('(drive)s$'), '\1'); |
|
43
|
524 |
|
yield new Transformation(new Pattern('(dive)s$'), '\1'); |
|
44
|
524 |
|
yield new Transformation(new Pattern('(olive)s$'), '\1'); |
|
45
|
524 |
|
yield new Transformation(new Pattern('([^fo])ves$'), '\1fe'); |
|
46
|
524 |
|
yield new Transformation(new Pattern('(^analy)ses$'), '\1sis'); |
|
47
|
524 |
|
yield new Transformation(new Pattern('(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$'), '\1\2sis'); |
|
48
|
524 |
|
yield new Transformation(new Pattern('(tax)a$'), '\1on'); |
|
49
|
524 |
|
yield new Transformation(new Pattern('(c)riteria$'), '\1riterion'); |
|
50
|
524 |
|
yield new Transformation(new Pattern('([ti])a$'), '\1um'); |
|
51
|
524 |
|
yield new Transformation(new Pattern('(p)eople$'), '\1\2erson'); |
|
52
|
524 |
|
yield new Transformation(new Pattern('(m)en$'), '\1an'); |
|
53
|
524 |
|
yield new Transformation(new Pattern('(c)hildren$'), '\1\2hild'); |
|
54
|
524 |
|
yield new Transformation(new Pattern('(f)eet$'), '\1oot'); |
|
55
|
524 |
|
yield new Transformation(new Pattern('(n)ews$'), '\1\2ews'); |
|
56
|
524 |
|
yield new Transformation(new Pattern('eaus$'), 'eau'); |
|
57
|
524 |
|
yield new Transformation(new Pattern('^(.*us)$'), '\\1'); |
|
58
|
524 |
|
yield new Transformation(new Pattern('s$'), ''); |
|
59
|
524 |
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @return Pattern[] |
|
63
|
|
|
*/ |
|
64
|
524 |
|
public static function getUninflected() : iterable |
|
65
|
|
|
{ |
|
66
|
524 |
|
yield new Pattern('.*[nrlm]ese'); |
|
67
|
524 |
|
yield new Pattern('.*deer'); |
|
68
|
524 |
|
yield new Pattern('.*fish'); |
|
69
|
524 |
|
yield new Pattern('.*measles'); |
|
70
|
524 |
|
yield new Pattern('.*ois'); |
|
71
|
524 |
|
yield new Pattern('.*pox'); |
|
72
|
524 |
|
yield new Pattern('.*sheep'); |
|
73
|
524 |
|
yield new Pattern('.*ss'); |
|
74
|
524 |
|
yield new Pattern('data'); |
|
75
|
524 |
|
yield new Pattern('police'); |
|
76
|
524 |
|
yield new Pattern('pants'); |
|
77
|
524 |
|
yield new Pattern('clothes'); |
|
78
|
524 |
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return Substitution[] |
|
82
|
|
|
*/ |
|
83
|
524 |
|
public static function getIrregular() : iterable |
|
84
|
|
|
{ |
|
85
|
524 |
|
yield new Substitution(new Word('abuses'), new Word('abuse')); |
|
86
|
524 |
|
yield new Substitution(new Word('avalanches'), new Word('avalanche')); |
|
87
|
524 |
|
yield new Substitution(new Word('caches'), new Word('cache')); |
|
88
|
524 |
|
yield new Substitution(new Word('criteria'), new Word('criterion')); |
|
89
|
524 |
|
yield new Substitution(new Word('curves'), new Word('curve')); |
|
90
|
524 |
|
yield new Substitution(new Word('emphases'), new Word('emphasis')); |
|
91
|
524 |
|
yield new Substitution(new Word('foes'), new Word('foe')); |
|
92
|
524 |
|
yield new Substitution(new Word('geese'), new Word('goose')); |
|
93
|
524 |
|
yield new Substitution(new Word('graves'), new Word('grave')); |
|
94
|
524 |
|
yield new Substitution(new Word('hoaxes'), new Word('hoax')); |
|
95
|
524 |
|
yield new Substitution(new Word('media'), new Word('medium')); |
|
96
|
524 |
|
yield new Substitution(new Word('neuroses'), new Word('neurosis')); |
|
97
|
524 |
|
yield new Substitution(new Word('saves'), new Word('save')); |
|
98
|
524 |
|
yield new Substitution(new Word('waves'), new Word('wave')); |
|
99
|
524 |
|
yield new Substitution(new Word('oases'), new Word('oasis')); |
|
100
|
524 |
|
yield new Substitution(new Word('valves'), new Word('valve')); |
|
101
|
524 |
|
} |
|
102
|
|
|
} |
|
103
|
|
|
|