-
-
Notifications
You must be signed in to change notification settings - Fork 137
dutch language #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.2.x
Are you sure you want to change the base?
dutch language #173
Changes from 11 commits
3c5aa5a
4a7b0ee
838df5b
0121531
c69d15e
8c9ef65
ab6bae4
45aad5b
8e76ff8
04d6ecf
3d61fb6
6547834
4a1054b
6d2b403
9a6bc70
7f6a1b4
b8a2e59
d610fd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Doctrine\Inflector\Rules\Dutch; | ||
|
|
||
| use Doctrine\Inflector\Rules\Pattern; | ||
| use Doctrine\Inflector\Rules\Substitution; | ||
| use Doctrine\Inflector\Rules\Transformation; | ||
| use Doctrine\Inflector\Rules\Word; | ||
|
|
||
| /** | ||
| * // http://nl.wikipedia.org/wiki/Klinker_(klank) | ||
| * private $klinker = '(a|e|i|o|u|ij)'; | ||
| * private $korteKlinker = '(u|i|e|a|o)'; // @todo '(ie|oe)'. $plofKlank | ||
| * | ||
| * // http://nl.wikipedia.org/wiki/Medeklinker | ||
| * private $plofKlank = '(p|t|k|b|d)'; | ||
| * private $wrijfKlank = '(f|s|ch|sj|v|z|g|j)'; // journaal | ||
| * private $neusKlank = '(m|n|ng)'; | ||
| * private $vloeiKlank = '(l|r)'; | ||
| * private $glijKlank = '(j|w)'; // jaar | ||
| * private $affricate = '(ts|zz|tsj|g)'; // /d3/ gin | ||
| * private $missingFromWiki = '(c|h|p|q|x|y|z)'; | ||
| * | ||
| * public function __construct() | ||
| * { | ||
| * $this->medeklinker = '(' . $this->missingFromWiki . '|' . $this->plofKlank . '|' . $this->wrijfKlank . '|' . $this->neusKlank . '|' . $this->vloeiKlank . '|' . $this->glijKlank . '|' . $this->affricate . ')'; | ||
| * $this->medeklinker = '((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g))'; | ||
| * } | ||
| */ | ||
| class Inflectible | ||
| { | ||
| /** | ||
| * @return iterable<Transformation> | ||
| */ | ||
| public static function getSingular(): iterable | ||
| { | ||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Klinkerverandering | ||
| yield new Transformation(new Pattern('()heden$'), '\1heid'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Beroepen_eindigend_op_-man | ||
| yield new Transformation(new Pattern('()mannen$'), '\1man'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Latijnse_meervoudsvormen | ||
| yield new Transformation(new Pattern('()ices$'), '\1ex'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Stapelmeervoud | ||
| yield new Transformation(new Pattern('^(ei|gemoed|goed|hoen|kind|lied|rad|rund)eren$'), '\1'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Nederlandse_grammatica | ||
| yield new Transformation(new Pattern('()ijen$'), '\1ij'); | ||
|
|
||
| yield new Transformation(new Pattern('()ieen$'), '\1ie'); // ën | ||
|
|
||
| yield new Transformation(new Pattern('()((a|e|i|o|u|ij))s$'), '\1\2'); | ||
|
|
||
| yield new Transformation(new Pattern('()((s)s)en$'), '\1s'); | ||
|
|
||
| yield new Transformation(new Pattern('()((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g))en$'), '\1\2'); | ||
| } | ||
|
|
||
| /** | ||
| * @return iterable<Transformation> | ||
| */ | ||
| public static function getPlural(): iterable | ||
| { | ||
| // @todo already in plural (?) | ||
| // @todo refine | ||
| yield new Transformation(new Pattern('()(e)(s)$'), '\1\2\3\3en'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Klinkerverandering | ||
| yield new Transformation(new Pattern('()heid$'), '\1heden'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Beroepen_eindigend_op_-man | ||
| yield new Transformation(new Pattern('()man$'), '\1mannen'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Latijnse_meervoudsvormen | ||
| yield new Transformation(new Pattern('()ix$'), '\1ices'); | ||
|
|
||
| yield new Transformation(new Pattern('()ex$'), '\1ices'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Stapelmeervoud | ||
| yield new Transformation(new Pattern('^(ei|gemoed|goed|hoen|kind|lied|rad|rund)$'), '\1eren'); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Nederlandse_grammatica | ||
| yield new Transformation(new Pattern('()ij$'), '\1ijen'); | ||
|
|
||
| yield new Transformation(new Pattern('()orie$'), '\1orieen'); // ën klemtoon | ||
|
|
||
| yield new Transformation(new Pattern('()io$'), '\1io\'s'); | ||
|
|
||
| yield new Transformation(new Pattern('()(a|e|i|o|u|ij)$'), '\1\2s'); | ||
|
|
||
| yield new Transformation(new Pattern('()(((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g))e((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g)))$'), '\1\2s'); | ||
|
|
||
| yield new Transformation(new Pattern('()(((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g))(u|i|e|a|o)s)$'), '\1\2sen'); | ||
|
|
||
| yield new Transformation(new Pattern('()(((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g))s)$'), '\1\2en'); | ||
|
|
||
| yield new Transformation(new Pattern('()s$'), '\1zen'); | ||
|
|
||
| yield new Transformation(new Pattern('()((c|h|p|q|x|y|z)|(p|t|k|b|d)|(f|s|ch|sj|v|z|g|j)|(m|n|ng)|(l|r)|(j|w)|(ts|zz|tsj|g))$'), '\1\2en'); | ||
| } | ||
|
|
||
| /** | ||
| * @return iterable<Substitution> | ||
| */ | ||
| public static function getIrregular(): iterable | ||
| { | ||
| // http://nl.wikipedia.org/wiki/Klemtoon | ||
| yield new Substitution(new Word('olie'), new Word('oliën')); | ||
|
|
||
| yield new Substitution(new Word('industrie'), new Word('industrieën')); | ||
|
|
||
| yield new Substitution(new Word('idee'), new Word('ideeën')); | ||
|
|
||
| // @todo: above 3 examples maybe could be compacted into a rule | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This indeed needs to be a rule instead of specific exceptions for these words, for example
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for now i see 2 rules:
|
||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Klinkerverandering | ||
| yield new Substitution(new Word('lid'), new Word('leden')); | ||
|
|
||
| yield new Substitution(new Word('smid'), new Word('smeden')); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the word above should be a rule. Also includes words like |
||
|
|
||
| yield new Substitution(new Word('schip'), new Word('schepen')); | ||
|
|
||
| yield new Substitution(new Word('stad'), new Word('steden')); | ||
|
|
||
| yield new Substitution(new Word('gelid'), new Word('gelederen')); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Stapelmeervoud | ||
| yield new Substitution(new Word('gelid'), new Word('gelederen')); | ||
noud marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| yield new Substitution(new Word('kalf'), new Word('kalveren')); | ||
|
|
||
| yield new Substitution(new Word('lam'), new Word('lammeren')); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Onregelmatige_meervoudsvorming | ||
| yield new Substitution(new Word('koe'), new Word('koeien')); | ||
|
|
||
| yield new Substitution(new Word('vlo'), new Word('vlooien')); | ||
|
|
||
| yield new Substitution(new Word('leerrede'), new Word('leerredenen')); | ||
|
|
||
| yield new Substitution(new Word('lende'), new Word('lendenen')); | ||
|
|
||
| yield new Substitution(new Word('epos'), new Word('epen')); | ||
|
|
||
| yield new Substitution(new Word('genius'), new Word('geniën')); | ||
|
|
||
| yield new Substitution(new Word('aanbod'), new Word('aanbiedingen')); | ||
|
|
||
| yield new Substitution(new Word('beleg'), new Word('belegeringen')); | ||
|
|
||
| yield new Substitution(new Word('dank'), new Word('dankbetuigingen')); | ||
|
|
||
| yield new Substitution(new Word('gedrag'), new Word('gedragingen')); | ||
|
|
||
| yield new Substitution(new Word('genot'), new Word('genietingen')); | ||
|
|
||
| yield new Substitution(new Word('lof'), new Word('lofbetuigingen')); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Meervoud_(Nederlands)#Latijnse_meervoudsvormen | ||
| yield new Substitution(new Word('quaestrix'), new Word('qaestrices')); | ||
|
|
||
| yield new Substitution(new Word('matrix'), new Word('matrices')); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Doctrine\Inflector\Rules\Dutch; | ||
|
|
||
| use Doctrine\Inflector\GenericLanguageInflectorFactory; | ||
| use Doctrine\Inflector\Rules\Ruleset; | ||
|
|
||
| final class InflectorFactory extends GenericLanguageInflectorFactory | ||
| { | ||
| protected function getSingularRuleset(): Ruleset | ||
| { | ||
| return Rules::getSingularRuleset(); | ||
| } | ||
|
|
||
| protected function getPluralRuleset(): Ruleset | ||
| { | ||
| return Rules::getPluralRuleset(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Doctrine\Inflector\Rules\Dutch; | ||
|
|
||
| use Doctrine\Inflector\Rules\Patterns; | ||
| use Doctrine\Inflector\Rules\Ruleset; | ||
| use Doctrine\Inflector\Rules\Substitutions; | ||
| use Doctrine\Inflector\Rules\Transformations; | ||
|
|
||
| final class Rules | ||
| { | ||
| public static function getSingularRuleset(): Ruleset | ||
| { | ||
| return new Ruleset( | ||
| new Transformations(...Inflectible::getSingular()), | ||
| new Patterns(...Uninflected::getSingular()), | ||
| (new Substitutions(...Inflectible::getIrregular()))->getFlippedSubstitutions() | ||
| ); | ||
| } | ||
|
|
||
| public static function getPluralRuleset(): Ruleset | ||
| { | ||
| return new Ruleset( | ||
| new Transformations(...Inflectible::getPlural()), | ||
| new Patterns(...Uninflected::getPlural()), | ||
| new Substitutions(...Inflectible::getIrregular()) | ||
| ); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Doctrine\Inflector\Rules\Dutch; | ||
|
|
||
| use Doctrine\Inflector\Rules\Pattern; | ||
|
|
||
| final class Uninflected | ||
| { | ||
| /** | ||
| * @return iterable<Pattern> | ||
| */ | ||
| public static function getSingular(): iterable | ||
| { | ||
| yield from self::getDefault(); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Plurale_tantum | ||
| yield new Pattern('hersenen'); | ||
| yield new Pattern('ingewanden'); | ||
| yield new Pattern('mazelen'); | ||
| yield new Pattern('pokken'); | ||
| yield new Pattern('waterpokken'); | ||
| yield new Pattern('financiën'); | ||
| yield new Pattern('activa'); | ||
| yield new Pattern('passiva'); | ||
| yield new Pattern('onkosten'); | ||
| yield new Pattern('kosten'); | ||
| yield new Pattern('bescheiden'); | ||
| yield new Pattern('paperassen'); | ||
| yield new Pattern('notulen'); | ||
| yield new Pattern('Roma'); | ||
| yield new Pattern('Sinti'); | ||
| yield new Pattern('Inuit'); | ||
| yield new Pattern('taliban'); | ||
| yield new Pattern('illuminati'); | ||
| yield new Pattern('aanstalten'); | ||
| yield new Pattern('hurken'); | ||
| yield new Pattern('lurven'); | ||
| yield new Pattern('luren'); | ||
| } | ||
|
|
||
| /** | ||
| * @return iterable<Pattern> | ||
| */ | ||
| public static function getPlural(): iterable | ||
| { | ||
| yield from self::getDefault(); | ||
|
|
||
| // http://nl.wikipedia.org/wiki/Singulare_tantum | ||
| yield new Pattern('letterkunde'); | ||
| yield new Pattern('muziek'); | ||
| yield new Pattern('heelal'); | ||
| yield new Pattern('vastgoed'); | ||
| yield new Pattern('have'); | ||
| yield new Pattern('nageslacht'); | ||
| } | ||
|
|
||
| /** | ||
| * @return iterable<Pattern> | ||
| */ | ||
| private static function getDefault(): iterable | ||
| { | ||
| yield new Pattern('twitter'); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.