Static Public Member Functions | |
| static | stem ($word) |
Static Private Member Functions | |
| static | step1ab ($word) |
| static | step1c ($word) |
| static | step2 ($word) |
| static | step3 ($word) |
| static | step4 ($word) |
| static | step5 ($word) |
| static | replace (&$str, $check, $repl, $m=null) |
| static | m ($str) |
| static | doubleConsonant ($str) |
| static | cvc ($str) |
Static Private Attributes | |
| static | $regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)' |
| static | $regex_vowel = '(?:[aeiou]|(?<![aeiou])y)' |
All rights reserved.
This script is free software.
Downloaded from: http://tartarus.org/~martin/PorterStemmer/php.txt Modified to be multibyte compatible. PHP5 Implementation of the Porter Stemmer algorithm. Certain elements were borrowed from the (broken) implementation by Jon Abernathy.
Usage:
$stem = Pluf_Text_Stemmer_Porter::stem($word);
How easy is that?
| static Pluf_Text_Stemmer_Porter::stem | ( | $ | word | ) | [static] |
Stems a word. Simple huh?
| string | $word Word to stem |
| static Pluf_Text_Stemmer_Porter::step1ab | ( | $ | word | ) | [static, private] |
Step 1
| static Pluf_Text_Stemmer_Porter::step1c | ( | $ | word | ) | [static, private] |
Step 1c
| string | $word Word to stem |
| static Pluf_Text_Stemmer_Porter::step2 | ( | $ | word | ) | [static, private] |
Step 2
| string | $word Word to stem |
| static Pluf_Text_Stemmer_Porter::step3 | ( | $ | word | ) | [static, private] |
Step 3
| string | $word String to stem |
| static Pluf_Text_Stemmer_Porter::step4 | ( | $ | word | ) | [static, private] |
Step 4
| string | $word Word to stem |
| static Pluf_Text_Stemmer_Porter::step5 | ( | $ | word | ) | [static, private] |
Step 5
| string | $word Word to stem |
| static Pluf_Text_Stemmer_Porter::replace | ( | &$ | str, | |
| $ | check, | |||
| $ | repl, | |||
| $ | m = null | |||
| ) | [static, private] |
Replaces the first string with the second, at the end of the string. If third arg is given, then the preceding string must match that m count at least.
| string | $str String to check | |
| string | $check Ending to check for | |
| string | $repl Replacement string | |
| int | $m Optional minimum number of m() to meet |
| static Pluf_Text_Stemmer_Porter::m | ( | $ | str | ) | [static, private] |
What, you mean it's not obvious from the name?
m() measures the number of consonant sequences in $str. if c is a consonant sequence and v a vowel sequence, and <..> indicates arbitrary presence,
<v> gives 0 vc<v> gives 1 vcvc<v> gives 2 vcvcvc<v> gives 3
string $str The string to return the m count for
| static Pluf_Text_Stemmer_Porter::doubleConsonant | ( | $ | str | ) | [static, private] |
Returns true/false as to whether the given string contains two of the same consonant next to each other at the end of the string.
| string | $str String to check |
| static Pluf_Text_Stemmer_Porter::cvc | ( | $ | str | ) | [static, private] |
Checks for ending CVC sequence where second C is not W, X or Y
| string | $str String to check |
Pluf_Text_Stemmer_Porter::$regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)' [static, private] |
Pluf_Text_Stemmer_Porter::$regex_vowel = '(?:[aeiou]|(?<![aeiou])y)' [static, private] |