Source for file stemmer.php
Documentation is available at stemmer.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @package Joomla.Platform
* An internal cache of stemmed tokens.
* @var array JLanguageStemmer instances.
protected static $instances =
array();
* Method to get a stemmer, creating it if necessary.
* @param string $adapter The type of stemmer to load.
* @return JLanguageStemmer A JLanguageStemmer instance.
* @throws RuntimeException on invalid stemmer.
// Only create one stemmer for each adapter.
if (isset
(self::$instances[$adapter]))
return self::$instances[$adapter];
// Setup the adapter for the stemmer.
$class =
'JLanguageStemmer' .
ucfirst(trim($adapter));
// Check if a stemmer exists for the adapter.
// Throw invalid adapter exception.
throw
new RuntimeException(JText::sprintf('JLIB_STEMMER_INVALID_STEMMER', $adapter));
self::$instances[$adapter] =
new $class;
return self::$instances[$adapter];
* Method to stem a token and return the root.
* @param string $token The token to stem.
* @param string $lang The language of the token.
* @return string The root token.
abstract public function stem($token, $lang);
Documentation generated on Tue, 19 Nov 2013 15:14:21 +0100 by phpDocumentor 1.4.3