\PorterStemmer
Synopsis
class PorterStemmer
{
- // members
- private static string $regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)';
- private static string $regex_vowel = '(?:[aeiou]|(?<![aeiou])y)';
- // methods
- public static string Stem()
- private static void step1ab()
- private static void step1c()
- private static void step2()
- private static void step3()
- private static void step4()
- private static void step5()
- private static bool replace()
- private static int m()
- private static bool doubleConsonant()
- private static bool cvc()
Members
private
- $regex_consonant
—
string
Regex for matching a consonant - $regex_vowel
—
string
Regex for matching a vowel
Methods
private
- cvc() — Checks for ending CVC sequence where second C is not W, X or Y
- doubleConsonant() — 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.
- m() — What, you mean it's not obvious from the name?
- replace() — 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.
- step1ab() — Step 1
- step1c() — Step 1c
- step2() — Step 2
- step3() — Step 3
- step4() — Step 4
- step5() — Step 5
public
- Stem() — Stems a word. Simple huh?