Forum und email

SwishResult->stem

(PECL swish:0.1-0.3.0)

SwishResult->stem — Stems the given word

Descrizione

array SwishResult->stem ( string $word )
Avviso

Questa funzione è SPERIMENTALE. Ovvero, il comportamento di questa funzione, il nome di questa funzione, in definitiva tutto ciò che è documentato qui può cambiare nei futuri rilasci del PHP senza preavviso. Siete avvisati, l'uso di questa funzione è a vostro rischio.

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.

Elenco dei parametri

word

The word to stem.

Valori restituiti

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

Errori/Eccezioni

Throws SwishException on error.

Esempi

Example#1 Basic 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 th index
        
var_dump($result->stem("others"));
    }

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

?>

Il precedente esempio visualizzerà qualcosa simile a:

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