Porteren

Implements StemmerInterface

Porter English stemmer class.

This class was adapted from one written by Richard Heyes. See copyright and link information above.

since

1.0

package

Joomla Framework

Methods

cvc

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

cvc(string str) : bool
since

1.0

Arguments

str

stringString to check

Response

boolResult

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.

doubleConsonant(string str) : bool
since

1.0

Arguments

str

stringString to check

Response

boolResult

m

m() measures the number of consonant sequences in $str. if c is a consonant sequence and v a vowel sequence, and <..> indicates arbitrary presence,

m(string str) : int

gives 0 vc gives 1 vcvc gives 2 vcvcvc gives 3

since

1.0

Arguments

str

stringThe string to return the m count for

Response

intThe m count

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.

replace(string &str, string check, string repl, int m = null) : bool
since

1.0

Arguments

str

stringString to check

check

stringEnding to check for

repl

stringReplacement string

m

intOptional minimum number of m() to meet

Response

boolWhether the $check string was at the end of the $str string. True does not necessarily mean that it was replaced.

stem

Method to stem a token and return the root.

stem(string token, string lang) : string
since

1.0

Arguments

token

stringThe token to stem.

lang

stringThe language of the token.

Response

stringThe root token.

step1ab

Step 1

step1ab(string word) : string
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step1c

Step 1c

step1c(string word) : string
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step2

Step 2

step2(string word) : string
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step3

Step 3

step3(string word) : string
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step4

Step 4

step4(string word) : string
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step5

Step 5

step5(string word) : string
since

1.0

Arguments

word

stringThe token to stem.

Response

string

Properties

cache

An internal cache of stemmed tokens.

since

1.0

Type(s)

array

regexConsonant

Regex for matching a consonant.

since

1.4.0

Type(s)

string

regexVowel

Regex for matching a vowel

since

1.4.0

Type(s)

string