You are here

protected function Porter2::isVowel in Search API 8

Checks whether a character is a vowel.

Parameters

int $position: The character's position.

string|null $word: (optional) The word in which to check. Defaults to $this->word.

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/Plugin/search_api/processor/Resources/Porter2.php
Checks whether the given string contains a vowel.
Porter2::isShortSyllable in src/Plugin/search_api/processor/Resources/Porter2.php
Determines whether the word ends in a "vowel-consonant" suffix.
Porter2::R in src/Plugin/search_api/processor/Resources/Porter2.php
Determines the start of a certain "R" region.
Porter2::step1c in src/Plugin/search_api/processor/Resources/Porter2.php
Replaces suffix y or Y with i if after non-vowel not @ word begin.
Porter2::__construct in src/Plugin/search_api/processor/Resources/Porter2.php
Constructs a SearchApiPorter2 object.

File

src/Plugin/search_api/processor/Resources/Porter2.php, line 407

Class

Porter2
Implements the Porter2 stemming algorithm.

Namespace

Drupal\search_api\Plugin\search_api\processor\Resources

Code

protected function isVowel($position, $word = NULL, array $additional = []) {
  if ($word === NULL) {
    $word = $this->word;
  }
  $vowels = array_merge([
    'a',
    'e',
    'i',
    'o',
    'u',
    'y',
  ], $additional);
  return in_array($this
    ->charAt($position, $word), $vowels);
}