Pluf_Text_Stemmer_Porter Class Reference

List of all members.

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)'


Detailed Description

Copyright (c) 2005 Richard Heyes (http://www.phpguru.org/)

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?


Member Function Documentation

static Pluf_Text_Stemmer_Porter::stem ( word  )  [static]

Stems a word. Simple huh?

Parameters:
string $word Word to stem
Returns:
string Stemmed word

static Pluf_Text_Stemmer_Porter::step1ab ( word  )  [static, private]

Step 1

static Pluf_Text_Stemmer_Porter::step1c ( word  )  [static, private]

Step 1c

Parameters:
string $word Word to stem

static Pluf_Text_Stemmer_Porter::step2 ( word  )  [static, private]

Step 2

Parameters:
string $word Word to stem

static Pluf_Text_Stemmer_Porter::step3 ( word  )  [static, private]

Step 3

Parameters:
string $word String to stem

static Pluf_Text_Stemmer_Porter::step4 ( word  )  [static, private]

Step 4

Parameters:
string $word Word to stem

static Pluf_Text_Stemmer_Porter::step5 ( word  )  [static, private]

Step 5

Parameters:
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.

Parameters:
string $str String to check
string $check Ending to check for
string $repl Replacement string
int $m Optional minimum number of m() to meet
Returns:
bool Whether the $check string was at the end of the $str string. True does not necessarily mean that it was replaced.

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

Parameters:
string $str The string to return the m count for
Returns:
int The m count

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.

Parameters:
string $str String to check
Returns:
bool Result

static Pluf_Text_Stemmer_Porter::cvc ( str  )  [static, private]

Checks for ending CVC sequence where second C is not W, X or Y

Parameters:
string $str String to check
Returns:
bool Result


Member Data Documentation

Pluf_Text_Stemmer_Porter::$regex_consonant = '(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)' [static, private]

Pluf_Text_Stemmer_Porter::$regex_vowel = '(?:[aeiou]|(?<![aeiou])y)' [static, private]


The documentation for this class was generated from the following file:

Generated on Wed Feb 3 15:44:52 2010 for Pluf by  doxygen