From c0d8c1c291759e319ad603f2267aa240ba455ee7 Mon Sep 17 00:00:00 2001 From: Alexander kiryukhin Date: Thu, 13 Nov 2014 15:53:59 +0300 Subject: Issue 1, Issue 2, Issue 3, Issue 4 --- src/NXP/Stemmer.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/NXP') diff --git a/src/NXP/Stemmer.php b/src/NXP/Stemmer.php index 3457c21..76d494b 100644 --- a/src/NXP/Stemmer.php +++ b/src/NXP/Stemmer.php @@ -36,7 +36,6 @@ class Stemmer private $word = ''; private $RV = 0; - private $R1 = 0; private $R2 = 0; public function getWordBase($word) @@ -105,7 +104,8 @@ class Stemmer private function findRegions() { $state = 0; - for ($i = 1; $i < mb_strlen($this->word, 'utf8'); $i++) { + $wordLength = mb_strlen($this->word, 'utf8'); + for ($i = 1; $i < $wordLength; $i++) { $prevChar = mb_substr($this->word, $i - 1, 1, 'utf8'); $char = mb_substr($this->word, $i, 1, 'utf8'); switch ($state) { @@ -117,7 +117,6 @@ class Stemmer break; case 1: if ($this->isVowel($prevChar) && !$this->isVowel($char)) { - $this->R1 = $i + 1; $state = 2; } break; @@ -135,4 +134,4 @@ class Stemmer { return (strpos($this->vowel, $char) !== false); } -} \ No newline at end of file +} -- cgit v1.2.3