1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Doctrine\Inflector\Rules\Spanish; |
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
|
73 |
|
public static function getSingular() : iterable |
18
|
|
|
{ |
19
|
73 |
|
yield new Transformation(new Pattern('/ereses$/'), 'erés'); |
|
|
|
|
20
|
73 |
|
yield new Transformation(new Pattern('/iones$/'), 'ión'); |
21
|
73 |
|
yield new Transformation(new Pattern('/ces$/'), 'z'); |
22
|
73 |
|
yield new Transformation(new Pattern('/es$/'), ''); |
23
|
73 |
|
yield new Transformation(new Pattern('/s$/'), ''); |
24
|
73 |
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return Transformation[] |
28
|
|
|
*/ |
29
|
73 |
|
public static function getPlural() : iterable |
30
|
|
|
{ |
31
|
73 |
|
yield new Transformation(new Pattern('/ú([sn])$/i'), 'u\1es'); |
|
|
|
|
32
|
73 |
|
yield new Transformation(new Pattern('/ó([sn])$/i'), 'o\1es'); |
33
|
73 |
|
yield new Transformation(new Pattern('/í([sn])$/i'), 'i\1es'); |
34
|
73 |
|
yield new Transformation(new Pattern('/é([sn])$/i'), 'e\1es'); |
35
|
73 |
|
yield new Transformation(new Pattern('/á([sn])$/i'), 'a\1es'); |
36
|
73 |
|
yield new Transformation(new Pattern('/z$/i'), 'ces'); |
37
|
73 |
|
yield new Transformation(new Pattern('/([aeiou]s)$/i'), '\1'); |
38
|
73 |
|
yield new Transformation(new Pattern('/([^aeéiou])$/i'), '\1es'); |
39
|
73 |
|
yield new Transformation(new Pattern('/$/'), 's'); |
40
|
73 |
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return Substitution[] |
44
|
|
|
*/ |
45
|
73 |
|
public static function getIrregular() : iterable |
46
|
|
|
{ |
47
|
73 |
|
yield new Substitution(new Word('el'), new Word('los')); |
|
|
|
|
48
|
73 |
|
yield new Substitution(new Word('papá'), new Word('papás')); |
49
|
73 |
|
yield new Substitution(new Word('mamá'), new Word('mamás')); |
50
|
73 |
|
yield new Substitution(new Word('sofá'), new Word('sofás')); |
51
|
73 |
|
yield new Substitution(new Word('mes'), new Word('meses')); |
52
|
73 |
|
} |
53
|
|
|
} |
54
|
|
|
|