You are here

protected static function Porter2::isVowel in Porter-Stemmer 8

Checks whether a character is a vowel.

Parameters

int $position: The character's position.

string $word: The word in which to check.

string[] $additional: (optional) Additional characters that should count as vowels.

Return value

bool TRUE if the character is a vowel, FALSE otherwise.

5 calls to Porter2::isVowel()
Porter2::containsVowel in src/Porter2.php
Checks whether the given string contains a vowel.
Porter2::isShortSyllable in src/Porter2.php
Determines whether the word ends in a "vowel-consonant" suffix.
Porter2::prepare in src/Porter2.php
Set initial y, or y after a vowel, to Y.
Porter2::r in src/Porter2.php
Determines the start of a certain "R" region.
Porter2::step1c in src/Porter2.php
Replaces suffix y or Y with i if after non-vowel not @ word begin.

File

src/Porter2.php, line 409

Class

Porter2
PHP Implementation of the Porter2 Stemming Algorithm.

Namespace

Drupal\porterstemmer

Code

protected static function isVowel($position, $word, array $additional = []) {
  $vowels = array_merge([
    'a',
    'e',
    'i',
    'o',
    'u',
    'y',
  ], $additional);
  return in_array(self::charAt($position, $word), $vowels);
}