Core_Inflection_En
extends Core_Inflection
in package
English inflection.
Tags
Table of Contents
Properties
- $pluralIrregular : array<string|int, mixed>
- Array of irregular form singular => plural
- $pluralRules : array<string|int, mixed>
- Rules for convert singular to plural form
- $singularIrregular : array<string|int, mixed>
- Array of irregular form plural => singular
- $singularRules : array<string|int, mixed>
- Rules for convert plural to singular form
- $_drivers : array<string|int, mixed>
- List of language drivers
- $_maxObjects : int
- Maximum count of objects Максимальное количество объектов
- $_pluralCache : array<string|int, mixed>
- Cache
- $_singularCache : array<string|int, mixed>
- Cache
Methods
- __construct() : mixed
- Constructor.
- available() : bool
- Check if driver available
- currencyInWords() : mixed
- getClassName() : string
- Get class name
- getPlural() : string
- Get plural form of word
- getSingular() : string
- Get singular form of word
- instance() : mixed
- Get driver instance
- isPluralIrrigular() : bool
- Chech if $word is PLURAL and IRRIGUAL
- isSingularIrrigular() : bool
- Chech if $word is SINGULAR and IRRIGUAL
- num2str() : string
- Number to str
- plural() : string
- Get plural form by singular
- singular() : string
- Get singular form by plural
- _getPlural() : string
- Get plural form by singular
- _getSingular() : string
- Get singular form by plural
- numberInWords() : mixed
- Number to str
Properties
$pluralIrregular
Array of irregular form singular => plural
public
static array<string|int, mixed>
$pluralIrregular
= array(
'bus' => 'busses',
'child' => 'children',
'calf' => 'calves',
'elf' => 'elves',
'foot' => 'feet',
'goose' => 'geese',
'half' => 'halves',
'hoof' => 'hooves',
'is' => 'are',
'knife' => 'knives',
'leaf' => 'leaves',
'life' => 'lives',
'loaf' => 'loaves',
'louse' => 'lice',
'man' => 'men',
'mouse' => 'mice',
'ox' => 'oxen',
'people' => 'people',
'person' => 'people',
'quiz' => 'quizzes',
'scarf' => 'scarves',
'self' => 'selves',
'sheaf' => 'sheaves',
'shelf' => 'shelves',
'size' => 'sizes',
'thief' => 'thieves',
'tooth' => 'teeth',
'was' => 'were',
'wife' => 'wives',
'woman' => 'women',
'wolf' => 'wolves',
// Plural ends in -i:
'alumnus' => 'alumni',
'bacillus' => 'bacilli',
'cactus' => 'cacti',
'focus' => 'foci',
'stimulus' => 'stimuli',
'octopus' => 'octopi',
'radius' => 'radii',
'terminus' => 'termini',
// Plural ends in -ices:
'appendix' => 'appendices',
'index' => 'indeces',
'matrix' => 'matrices',
'vertex' => 'vertices',
'vortex' => 'vortices',
'apex' => 'apices',
'cervix' => 'cervices',
'axis' => 'axes',
'testis' => 'testes',
// Plural ends in -a
'criterion' => 'criteria',
'phenomenon' => 'phenomena',
'automaton' => 'automata',
// Plural ends in -ae
'alga' => 'algae',
'amoeba' => 'amoebae',
'larva' => 'larvae',
'formula' => 'formulae',
'antenna' => 'antannae',
'nebula' => 'nebulae',
'vertebra' => 'vertebrae',
'vita' => 'vitae',
// Plural ends in -a:
'corpus' => 'corpora',
'genus' => 'genera',
// Plural ends in -eaux:
'bureau' => 'bureaux',
'beau' => 'beaux',
'portmanteau' => 'portmanteaux',
'tableau' => 'tableaux',
// Italian
'libretto' => 'libretti',
'tempo' => 'tempi',
'virtuoso' => 'virtuosi',
// Hebrew
'cherub' => 'cherubim',
'seraph' => 'seraphim',
// Greek
'schema' => 'schemata',
// always plural
'pants' => 'pants',
'clothes' => 'clothes',
'binoculars' => 'binoculars',
'jeans' => 'jeans',
'forceps' => 'forceps',
'trousers' => 'trousers',
'tongs' => 'tongs',
'shorts' => 'shorts',
'tweezers' => 'tweezers',
'pajamas' => 'pajamas',
'police' => 'police',
'glasses' => 'glasses',
'scissors' => 'scissors',
'mathematics' => 'mathematics',
'money' => 'money',
'moose' => 'moose',
'rice' => 'rice',
// Aggregate Nouns
//'accomodations' => 'accomodations',
'bread' => 'bread',
'amends' => 'amends',
'tea' => 'tea',
//'archives' => 'archives',
'cheese' => 'cheese',
'bowels' => 'bowels',
'jam' => 'jam',
//'communications' => 'communications',
'soup' => 'soup',
'congratulations' => 'congratulations',
'soap' => 'soap',
'contents' => 'contents',
'snow' => 'snow',
'stairs' => 'stairs',
'cotton' => 'cotton',
'wood' => 'wood',
'thanks' => 'thanks',
'water' => 'water',
'goods' => 'goods',
'information' => 'information',
//'advice' => 'advice',
'knowledge' => 'knowledge',
'furniture' => 'furniture',
'news' => 'news',
'means' => 'means',
'series' => 'series',
'species' => 'species',
'barracks' => 'barracks',
'crossroads' => 'crossroads',
'gallows' => 'gallows',
'headquarters' => 'headquarters',
// Nouns with the same form
'salmon' => 'salmon',
'trout' => 'trout',
'deer' => 'deer',
'sheep' => 'sheep',
'swine' => 'swine',
'offspring' => 'offspring',
'my' => 'my',
)
$pluralRules
Rules for convert singular to plural form
public
static array<string|int, mixed>
$pluralRules
= array(
'/sis$/i' => 'ses',
// analysis -> analyses
'/(ch|ss|sh|x|z|s)$/i' => '\\1es',
// box -> boxes
'/([^aeiou])o$/i' => '\\1oes',
// echo -> echoes
'/([^aeiou])y$/i' => '\\1ies',
// story -> stories
'/(t|i)um$/i' => '\\1a',
// bacterium -> bacteria
// last condition
'/([a-rt-z])$/i' => '\\1s',
)
$singularIrregular
Array of irregular form plural => singular
public
static array<string|int, mixed>
$singularIrregular
= array()
$singularRules
Rules for convert plural to singular form
public
static array<string|int, mixed>
$singularRules
= array(
'/(^analy)ses$/i' => '\\1sis',
// analyses -> analysis, but ipaddresses -> ipaddress
//'/(ch|ss|sh|x|z|[^o][a-z]s)es$/i' => '\1', // boxes -> box, responses -> (resp(o)nse)s, (wareh(o)use)s -> warehouse
//'/(ch|ss|sh|[aieuo]x|z|[^o][ieu]s)es$/i' => '\1', // boxes -> box, responses -> (resp(o)nse)s, (wareh(o)use)s -> warehouse
'/(ch|ss|sh|[aieuo]x|z|[^omtf]us|[^vc]es|[^au]is)es$/i' => '\\1',
// boxes -> box, responses -> (resp(o)nse)s, (wareh(o)use)s -> warehouse, (a(b)use)s -> abuse, accuses -> accuse
'/([^aeiou])oes$/i' => '\\1o',
// echoes -> echo
'/([^aeiou])ies$/i' => '\\1y',
// stories -> story
'/(t|i)a$/i' => '\\1um',
// bacteria -> bacterium
'/(la|ia|rra|va|cu|tu|ep)ses$/i' => '\\1s',
// aliases -> alias, canvases -> canvas, statuses -> status
// last condition
'/([a-rt-z])s$/i' => '\\1',
)
$_drivers
List of language drivers
protected
static array<string|int, mixed>
$_drivers
= array()
$_maxObjects
Maximum count of objects Максимальное количество объектов
protected
static int
$_maxObjects
= 512
$_pluralCache
Cache
protected
array<string|int, mixed>
$_pluralCache
= array()
$_singularCache
Cache
protected
array<string|int, mixed>
$_singularCache
= array()
Methods
__construct()
Constructor.
public
__construct() : mixed
available()
Check if driver available
public
static available([string $lng = 'en' ]) : bool
Parameters
- $lng : string = 'en'
-
language
Return values
boolcurrencyInWords()
public
currencyInWords(mixed $float, mixed $currencyCode) : mixed
Parameters
- $float : mixed
- $currencyCode : mixed
getClassName()
Get class name
public
static getClassName(string $lng) : string
Parameters
- $lng : string
-
language
Return values
string —e.g. Core_Inflection_En
getPlural()
Get plural form of word
public
static getPlural(string $word[, int $count = NULL ][, string $lng = 'en' ]) : string
Parameters
- $word : string
-
word
- $count : int = NULL
- $lng : string = 'en'
-
driver
Return values
stringgetSingular()
Get singular form of word
public
static getSingular(string $word[, int $count = NULL ][, string $lng = 'en' ]) : string
Parameters
- $word : string
-
word
- $count : int = NULL
- $lng : string = 'en'
-
driver
Return values
stringinstance()
Get driver instance
public
static instance([string $lng = 'en' ]) : mixed
Parameters
- $lng : string = 'en'
-
language
isPluralIrrigular()
Chech if $word is PLURAL and IRRIGUAL
public
isPluralIrrigular(mixed $word) : bool
Parameters
- $word : mixed
Return values
boolisSingularIrrigular()
Chech if $word is SINGULAR and IRRIGUAL
public
isSingularIrrigular(mixed $word) : bool
Parameters
- $word : mixed
Return values
boolnum2str()
Number to str
public
static num2str(float $float[, string $lng = 'en' ]) : string
Parameters
- $float : float
- $lng : string = 'en'
Return values
stringplural()
Get plural form by singular
public
plural(mixed $singularWord[, int $count = NULL ]) : string
Parameters
- $singularWord : mixed
- $count : int = NULL
Return values
stringsingular()
Get singular form by plural
public
singular(string $pluralWord[, mixed $count = NULL ]) : string
Parameters
- $pluralWord : string
-
word
- $count : mixed = NULL
Return values
string_getPlural()
Get plural form by singular
protected
_getPlural(string $word[, int $count = NULL ]) : string
Parameters
- $word : string
-
word
- $count : int = NULL
Return values
string_getSingular()
Get singular form by plural
protected
_getSingular(string $word[, int $count = NULL ]) : string
Parameters
- $word : string
-
word
- $count : int = NULL
Return values
stringnumberInWords()
Number to str
protected
numberInWords(float $float) : mixed
Parameters
- $float : float