You are here

function porterstemmer_step1c in Porter-Stemmer 7

Same name and namespace in other branches
  1. 6.2 porterstemmer.module \porterstemmer_step1c()

Step 1c of algorithm: y suffixes.

Parameters

string $word: Word to stem, modified in place if successful.

Return value

bool TRUE if it is time to stop stemming, FALSE to continue.

2 calls to porterstemmer_step1c()
PorterStemmerInternalsUnitTest::testGeology in ./porterstemmer.test
Test internal steps on the word "geology".
porterstemmer_stem in includes/standard-stemmer.inc
Stems a word, using the Porter Stemmer 2 algorithm.

File

includes/standard-stemmer.inc, line 399
This is an implementation of the Porter 2 Stemming algorithm.

Code

function porterstemmer_step1c(&$word) {
  $tmp = $word;
  $didit = FALSE;

  // Replace y or Y by i if the letter before is not a vowel,
  // and that non-vowel is not the beginning of the word.
  $ytest = '/.' . PORTERSTEMMER_NOT_VOWEL . '[Yy]$/';
  porterstemmer_suffix($tmp, 'Y', 'i', $didit, $ytest) or porterstemmer_suffix($tmp, 'y', 'i', $didit, $ytest);
  return porterstemmer_step_ending($word, $tmp);
}