SwishResult::stem

(PECL swish >= 0.1.0)

SwishResult::stemStems the given word

说锟斤拷

SwishResult::stem ( string $word ) : array
Warning

锟剿猴拷锟斤拷锟斤拷实锟斤拷锟斤拷锟侥★拷锟剿猴拷锟斤拷锟侥憋拷锟襟,帮拷锟斤拷锟斤拷锟狡硷拷锟斤拷锟斤拷锟斤拷牡锟斤拷锟斤拷锟斤拷锟斤拷锟轿达拷锟斤拷锟� PHP 锟斤拷锟斤拷锟芥本锟斤拷未通知锟酵憋拷锟睫改★拷使锟矫憋拷锟斤拷锟斤拷锟斤拷锟斤拷锟皆碉拷 锟斤拷

Stems the word based on the fuzzy mode used during indexing. Each result object is linked with its index, so the results are based on this index.

锟斤拷锟斤拷

word

The word to stem.

锟斤拷锟斤拷值

Returns array containing the stemmed word variants (usually just one).

锟斤拷锟斤拷锟届常

Throws SwishException on error.

锟斤拷锟斤拷

Example #1 Basic SwishResult::stem() example

<?php

try {

    
$swish = new Swish("ext/swish/tests/index.swish-e");
    
$results $swish->query("testing OR others");

    if (
$result $results->nextResult()) {
        
var_dump($result->stem("testing")); //the results fully depend on the stemmer used in the index
        
var_dump($result->stem("others"));
    }

} catch (
SwishException $e) {
    echo 
"Error: "$e->getMessage(), "\n";
}

?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

array(1) {
  [0]=>
  string(4) "test"
}
array(1) {
  [0]=>
  string(5) "other"
}