| 1 |
<?php |
<?php |
| 2 |
// $Id: porterstemmer.module,v 1.2.2.3 2009/10/08 16:22:10 jhodgdon Exp $ |
// $Id: porterstemmer.module,v 1.2.2.4 2009/10/21 23:39:54 jhodgdon Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 27 |
} |
} |
| 28 |
|
|
| 29 |
// See if the PECL stemming package is installed and try to load it. |
// See if the PECL stemming package is installed and try to load it. |
| 30 |
|
|
| 31 |
$has_pecl_stem = FALSE; |
$has_pecl_stem = FALSE; |
| 32 |
|
|
| 33 |
if (extension_loaded( 'stem')) { |
if (extension_loaded( 'stem')) { |
| 34 |
$has_pecl_stem = TRUE; |
$has_pecl_stem = TRUE; |
| 35 |
} |
} |
| 47 |
$isword = !preg_match('/' . PORTERSTEMMER_BOUNDARY . '/', $words[0] ); |
$isword = !preg_match('/' . PORTERSTEMMER_BOUNDARY . '/', $words[0] ); |
| 48 |
foreach ($words as $k => $word) { |
foreach ($words as $k => $word) { |
| 49 |
if ($isword) { |
if ($isword) { |
| 50 |
if( $has_pecl_stem ) { |
if ( $has_pecl_stem ) { |
| 51 |
$words[$k] = stem_english($word); |
$words[$k] = stem_english($word); |
| 52 |
} else { |
} |
| 53 |
|
else { |
| 54 |
$words[$k] = porterstemmer_stem($word); |
$words[$k] = porterstemmer_stem($word); |
| 55 |
} |
} |
| 56 |
} |
} |