File: ItalianFunctionalTest.php

package info (click to toggle)
php-doctrine-inflector 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 536 kB
  • sloc: php: 3,308; makefile: 17
file content (132 lines) | stat: -rw-r--r-- 4,075 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php

declare(strict_types=1);

namespace Doctrine\Tests\Inflector\Rules\Italian;

use Doctrine\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\Inflector\Language;
use Doctrine\Tests\Inflector\Rules\LanguageFunctionalTestCase;

class ItalianFunctionalTest extends LanguageFunctionalTestCase
{
    /** @return string[][] */
    public static function dataSampleWords(): array
    {
        return [
            // Empty string and edge cases
            ['', ''],
            [' ', ' '],
            ['123', '123'],
            ['@#!', '@#!'],

            // Invariable nouns (same in singular and plural)
            ['re', 're'],
            ['città', 'città'],
            ['virtù', 'virtù'],
            ['specie', 'specie'],
            ['serie', 'serie'],
            ['crisi', 'crisi'],
            ['superficie', 'superfici'],
            ['metropoli', 'metropoli'],

            // Foreign words and loanwords
            ['film', 'film'],
            ['sport', 'sport'],
            ['bar', 'bar'],
            ['computer', 'computer'],
            ['menu', 'menu'],
            ['taxi', 'taxi'],
            ['quiz', 'quiz'],
            ['smartphone', 'smartphone'],
            ['tablet', 'tablet'],
            ['virus', 'virus'],
            ['campus', 'campus'],

            // Abbreviations and shortened forms
            ['foto', 'foto'],  // from fotografia
            ['moto', 'moto'],  // from motocicletta
            ['auto', 'auto'],  // from automobile

            // Words with accented vowels
            ['caffè', 'caffè'],
            ['tè', 'tè'],
            ['menù', 'menù'],

            // Compound words
            ['dopocena', 'dopocena'],
            ['sottoscala', 'sottoscala'],

            // Nouns with irregular patterns
            ['tempio', 'templi'],
            ['ala', 'ali'],
            ['mano', 'mani'],

            // Words with multiple plural forms
            ['braccio', 'braccia'],  // arm -> arms
            ['ginocchio', 'ginocchia'],  // body part
            ['dito', 'dita'],  // more common
            ['baco', 'bachi'],  // more common

            // Words that change meaning in plural
            ['membro', 'membri'],    // members of an organization
            ['membrana', 'membrane'],  // membranes

            // Words with identical forms but different genders/meanings
            ['capitale', 'capitali'],  // capital (money)
            ['capitale', 'capitali'], // capital city (context determines meaning)

            // Irregular plurals and exceptions
            ['uomo', 'uomini'],
            ['dio', 'dei'],
            ['bue', 'buoi'],

            // Nouns ending in -o (masculine)
            ['libro', 'libri'],
            ['tavolo', 'tavoli'],
            ['ragazzo', 'ragazzi'],

            // Nouns ending in -a (feminine)
            ['casa', 'case'],
            ['penna', 'penne'],
            ['amica', 'amiche'],

            // Nouns ending in -e
            ['fiore', 'fiori'],
            ['cane', 'cani'],
            ['chiave', 'chiavi'],

            // Nouns ending in -ca/ga
            ['banca', 'banche'],

            // Nouns ending in -cia/gia
            ['arancia', 'arance'],
            ['valigia', 'valigie'],
            ['camicia', 'camicie'],
            ['fascia', 'fasce'],
            ['farmacia', 'farmacie'],

            // Nouns ending in -co/go
            ['gioco', 'giochi'],
            ['fuoco', 'fuochi'],
            ['albergo', 'alberghi'],

            // Words that are the same in both singular and plural
            ['sosia', 'sosia'],
            ['vaglia', 'vaglia'],
            ['gorilla', 'gorilla'],
            ['yogurt', 'yogurt'],
            ['boomerang', 'boomerang'],
            ['kamikaze', 'kamikaze'],
            ['karaoke', 'karaoke'],
            ['brindisi', 'brindisi'],
            ['boia', 'boia'],
        ];
    }

    protected function createInflector(): Inflector
    {
        return InflectorFactory::createForLanguage(Language::ITALIAN)->build();
    }
}