From b3d54cec21f90b151225f14f9ecd0ea2048ceec9 Mon Sep 17 00:00:00 2001 From: Vitaliy Klimin Date: Thu, 11 Jan 2018 19:27:19 +0500 Subject: Update Stemmer.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Так будет корректнее. --- src/NXP/Stemmer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/NXP/Stemmer.php') diff --git a/src/NXP/Stemmer.php b/src/NXP/Stemmer.php index 0188434..73b993c 100644 --- a/src/NXP/Stemmer.php +++ b/src/NXP/Stemmer.php @@ -93,7 +93,7 @@ class Stemmer public static function removeEndings(&$word, $regex, $region) { $prefix = mb_substr($word, 0, $region, 'UTF-8'); - $ending = substr($word, strlen($prefix)); + $ending = mb_substr($word, mb_strlen($prefix, 'UTF-8'), null, 'UTF-8'); if (is_array($regex)) { if (preg_match('/.+[а|я]' . $regex[0] . '/ui', $ending)) { $word = $prefix . preg_replace('/' . $regex[0] . '/ui', '', $ending); -- cgit v1.2.3 From 2d504dac47d00c15a4a21a5bfc4ef7070f2a0350 Mon Sep 17 00:00:00 2001 From: Vitaliy Klimin Date: Thu, 11 Jan 2018 19:34:51 +0500 Subject: Update Stemmer.php --- src/NXP/Stemmer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/NXP/Stemmer.php') diff --git a/src/NXP/Stemmer.php b/src/NXP/Stemmer.php index 73b993c..09b24f7 100644 --- a/src/NXP/Stemmer.php +++ b/src/NXP/Stemmer.php @@ -95,7 +95,7 @@ class Stemmer $prefix = mb_substr($word, 0, $region, 'UTF-8'); $ending = mb_substr($word, mb_strlen($prefix, 'UTF-8'), null, 'UTF-8'); if (is_array($regex)) { - if (preg_match('/.+[а|я]' . $regex[0] . '/ui', $ending)) { + if (preg_match('/.+[ая]' . $regex[0] . '/ui', $ending)) { $word = $prefix . preg_replace('/' . $regex[0] . '/ui', '', $ending); return true; } -- cgit v1.2.3