You are here

public function Stemmer::setLanguage in Snowball Stemmer 2.x

Same name and namespace in other branches
  1. 8 src/Stemmer.php \Drupal\snowball_stemmer\Stemmer::setLanguage()

Set language.

Parameters

string $language: Two character language code.

Return value

bool True if able to set, false if not supported.

File

src/Stemmer.php, line 51

Class

Stemmer
Service wrapper class for stemmer.

Namespace

Drupal\snowball_stemmer

Code

public function setLanguage($language) {
  try {
    $this->stemmers[$language] = StemmerFactory::create($language);
    $this->language = $language;
    return TRUE;
  } catch (NotFoundException $e) {
    return FALSE;
  }
}