Porteren

Extends Stemmer

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
static
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
static
since

1.0

Arguments

str

stringString to check

Response

boolResult

getInstance

Method to get a stemmer, creating it if necessary.

getInstance(string adapter) : \Joomla\Language\Stemmer
inherited static deprecated
since

1.0

deprecated

2.0 Use LanguageFactory::getStemmer() instead

throws

\RuntimeExceptionon invalid stemmer.

Arguments

adapter

stringThe type of stemmer to load.

Response

\Joomla\Language\Stemmer

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
static

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
static
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
static
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step1c

Step 1c

step1c(string word) : string
static
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step2

Step 2

step2(string word) : string
static
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step3

Step 3

step3(string word) : string
static
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step4

Step 4

step4(string word) : string
static
since

1.0

Arguments

word

stringThe token to stem.

Response

string

step5

Step 5

step5(string word) : string
static
since

1.0

Arguments

word

stringThe token to stem.

Response

string

Properties

regexConsonant

Regex for matching a consonant.

static
since

1.4.0

Type(s)

string

regexVowel

Regex for matching a vowel

static
since

1.4.0

Type(s)

string

cache

An internal cache of stemmed tokens.

inherited deprecated
since

1.0

deprecated

2.0 Subclasses should implement this property directly

Type(s)

array

instances

Stemmer instances.

inherited static deprecated
since

1.0

deprecated

2.0

Type(s)

\Joomla\Language\Stemmer[]