Skip to content

Commit

Permalink
Hotfix PREDLOJ form issue#34 comment#3
Browse files Browse the repository at this point in the history
  • Loading branch information
Nappsel committed Sep 4, 2018
1 parent 6227400 commit b000f59
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions src/Russian/GeographicalNamesInflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,30 @@ public static function getCases($name)
self::PREDLOJ => $prefix . 'ой',
];

// Россошь
case 'шь':
$prefix = S::name(S::slice($name, 0, -1));
return [
self::IMENIT => $prefix.'ь',
self::RODIT => $prefix.'и',
self::DAT => $prefix.'и',
self::VINIT => $prefix.'ь',
self::TVORIT => $prefix.'ью',
self::PREDLOJ => $prefix.'и',
];

// Орёл
case 'ел':
$prefix = S::name(S::slice($name, 0, -2));
return [
self::IMENIT => $prefix.'ёл',
self::RODIT => $prefix.'ла',
self::DAT => $prefix.'лу',
self::VINIT => $prefix.'ла',
self::TVORIT => $prefix.'лом',
self::PREDLOJ => $prefix.'ле',
];

// Грозный, Благодарный
case 'ый':
$prefix = S::name(S::slice($name, 0, -2));
Expand All @@ -160,7 +184,7 @@ public static function getCases($name)
self::PREDLOJ => $prefix . 'ом',
];

// Ставрополь, Ярославль
// Ставрополь, Ярославль, Электросталь
case 'ль':
$prefix = S::name(S::slice($name, 0, -1));
return [
Expand All @@ -169,7 +193,7 @@ public static function getCases($name)
self::DAT => $prefix . 'ю',
self::VINIT => $prefix . 'ь',
self::TVORIT => $prefix . 'ем',
self::PREDLOJ => $prefix . 'е',
self::PREDLOJ => $prefix.(S::name(S::slice($name == 'электросталь', -1)) ? 'и' : 'е'),
];

// Тверь, Анадырь
Expand Down Expand Up @@ -272,8 +296,31 @@ public static function getCases($name)


switch (S::slice($name, -1)) {
// Азия
case 'р':
// Бор
$prefix = S::name(S::slice($name, 0, -1));
return [
self::IMENIT => $prefix.'р',
self::RODIT => $prefix.'ра',
self::DAT => $prefix.'ру',
self::VINIT => $prefix.'р',
self::TVORIT => $prefix.'ром',
self::PREDLOJ => $prefix.'ру',
];
case 'ы':
// Чебоксары, Шахты
$prefix = S::name(S::slice($name, 0, -1));
return [
self::IMENIT => $prefix.'ы',
self::RODIT => $prefix.(self::isVelarConsonant(S::slice($name, -1, -1)) == ' '),
self::DAT => $prefix.'ам',
self::VINIT => $prefix.'ы',
self::TVORIT => $prefix.'ами',
self::PREDLOJ => $prefix.'ах',
];

case 'я':
// Азия
$prefix = S::name(S::slice($name, 0, -1));
return [
self::IMENIT => S::name($name),
Expand Down Expand Up @@ -328,6 +375,9 @@ public static function getCases($name)
// ово, ёво, ...
if (in_array(S::slice($name, -3, -1), $suffixes, true)) {
$prefix = S::name(S::slice($name, 0, -1));
return [
self::PREDLOJ => $prefix.'о',
];
}
// ов, её, ...
elseif (in_array(S::slice($name, -2), $suffixes, true)) {
Expand Down Expand Up @@ -363,4 +413,4 @@ public static function getCase($name, $case)
$forms = self::getCases($name);
return $forms[$case];
}
}
}

0 comments on commit b000f59

Please sign in to comment.