From e9f39d188d6d6db26c8ae012aaf78f8be8b2abc0 Mon Sep 17 00:00:00 2001 From: rvelices Date: Wed, 30 Apr 2014 18:49:36 +0000 Subject: english inflection rules ing/er git-svn-id: http://piwigo.org/svn/trunk@28319 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/inflectors/en.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/inflectors/en.php b/include/inflectors/en.php index 2ce43fb22..63571440d 100644 --- a/include/inflectors/en.php +++ b/include/inflectors/en.php @@ -96,13 +96,14 @@ class Inflector_en $this->er2ing = array_reverse(array( '/ers?$/' => 'ing', - '/(be|draw)ers?$/' => '\0' + '/(be|draw|liv)ers?$/' => '\0' )); $this->ing2er = array_reverse(array( '/ing$/' => 'er', - '/(th|r|hous)ing$/' => '\0', - '/(be|draw)ing$/' => '\0' + '/(snow|rain)ing$/' => '\1', + '/(th|hous|dur|spr|wedd)ing$/' => '\0', + '/(liv|draw)ing$/' => '\0' )); } @@ -123,11 +124,17 @@ class Inflector_en self::run($this->pluralizers, $word, $res); self::run($this->singularizers, $word, $res); - self::run($this->er2ing, $word, $res); - $rc = self::run($this->ing2er, $word, $res); - if ($rc !== false) + if (strlen($word)>4) { - self::run($this->pluralizers, $rc, $res); + self::run($this->er2ing, $word, $res); + } + if (strlen($word)>5) + { + $rc = self::run($this->ing2er, $word, $res); + if ($rc !== false) + { + self::run($this->pluralizers, $rc, $res); + } } return $res; } -- cgit v1.2.3