Forum Moderators: coopster
require_once'class.stemmer.inc';
$title = "walking and talking";
$stop_words = array("the", "and", "a", "to", "of", "in", "i", "is","that", "it", "on", "you", "this", "for", "but",
"with", "are", "have", "be", "at", "or", "as", "was", "so", "if", "out", "not");
$stemmer = new Stemmer;
$words = explode(" ", $title);
foreach($words as $word) {
$stem = $stemmer->stem($word);
if(!in_array($stem, $stop_words)) {
$stem_words[] = $stem;
}
}
foreach ($stem_words as $k=>$v) {
echo "$v ";
}
foreach ($stem_words as $k=>$v) {
// only add "or" if the where statement has already been started
if ($where) { $where .= ' or'; }
$where .=" field_name='$v'";
}