Skip to content

Commit 241641a

Browse files
paullallierfabpot
authored andcommitted
Add some more non-countable English nouns
1 parent 2765096 commit 241641a

File tree

1 file changed

+28
-10
lines changed

1 file changed

+28
-10
lines changed

Inflector/EnglishInflector.php

+28-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class EnglishInflector implements InflectorInterface
2121
private const PLURAL_MAP = [
2222
// First entry: plural suffix, reversed
2323
// Second entry: length of plural suffix
24-
// Third entry: Whether the suffix may succeed a vocal
24+
// Third entry: Whether the suffix may succeed a vowel
2525
// Fourth entry: Whether the suffix may succeed a consonant
2626
// Fifth entry: singular suffix, normal
2727

@@ -162,7 +162,7 @@ final class EnglishInflector implements InflectorInterface
162162
private const SINGULAR_MAP = [
163163
// First entry: singular suffix, reversed
164164
// Second entry: length of singular suffix
165-
// Third entry: Whether the suffix may succeed a vocal
165+
// Third entry: Whether the suffix may succeed a vowel
166166
// Fourth entry: Whether the suffix may succeed a consonant
167167
// Fifth entry: plural suffix, normal
168168

@@ -343,15 +343,30 @@ final class EnglishInflector implements InflectorInterface
343343
// deer
344344
'reed',
345345

346+
// equipment
347+
'tnempiuqe',
348+
346349
// feedback
347350
'kcabdeef',
348351

349352
// fish
350353
'hsif',
351354

355+
// health
356+
'htlaeh',
357+
358+
// history
359+
'yrotsih',
360+
352361
// info
353362
'ofni',
354363

364+
// information
365+
'noitamrofni',
366+
367+
// money
368+
'yenom',
369+
355370
// moose
356371
'esoom',
357372

@@ -363,6 +378,9 @@ final class EnglishInflector implements InflectorInterface
363378

364379
// species
365380
'seiceps',
381+
382+
// traffic
383+
'ciffart',
366384
];
367385

368386
/**
@@ -399,14 +417,14 @@ public function singularize(string $plural): array
399417
if ($j === $suffixLength) {
400418
// Is there any character preceding the suffix in the plural string?
401419
if ($j < $pluralLength) {
402-
$nextIsVocal = false !== strpos('aeiou', $lowerPluralRev[$j]);
420+
$nextIsVowel = false !== strpos('aeiou', $lowerPluralRev[$j]);
403421

404-
if (!$map[2] && $nextIsVocal) {
405-
// suffix may not succeed a vocal but next char is one
422+
if (!$map[2] && $nextIsVowel) {
423+
// suffix may not succeed a vowel but next char is one
406424
break;
407425
}
408426

409-
if (!$map[3] && !$nextIsVocal) {
427+
if (!$map[3] && !$nextIsVowel) {
410428
// suffix may not succeed a consonant but next char is one
411429
break;
412430
}
@@ -479,14 +497,14 @@ public function pluralize(string $singular): array
479497
if ($j === $suffixLength) {
480498
// Is there any character preceding the suffix in the plural string?
481499
if ($j < $singularLength) {
482-
$nextIsVocal = false !== strpos('aeiou', $lowerSingularRev[$j]);
500+
$nextIsVowel = false !== strpos('aeiou', $lowerSingularRev[$j]);
483501

484-
if (!$map[2] && $nextIsVocal) {
485-
// suffix may not succeed a vocal but next char is one
502+
if (!$map[2] && $nextIsVowel) {
503+
// suffix may not succeed a vowel but next char is one
486504
break;
487505
}
488506

489-
if (!$map[3] && !$nextIsVocal) {
507+
if (!$map[3] && !$nextIsVowel) {
490508
// suffix may not succeed a consonant but next char is one
491509
break;
492510
}

0 commit comments

Comments
 (0)