<?php
function stopWords($term, $stopwords_file)
{
//load list of common words
$common = file($stopwords_file);
$total = count($common);
for ($x=0; $x<= $total; $x++)
{
$common[$x] = trim(strtolower($common[$x]));
}
//make array of search terms
$_terms = explode(" ", $term);
foreach ($_terms as $line)
{
if (in_array(strtolower(trim($line)), $common))
{
$removeKey = array_search($line, $this->_terms);
unset($_terms[$removeKey]);
}
else
{
$clean_term .= " ".$line;
}
}
return $clean_term;
}
?>
function stopWords($term, $stopwords_file)
{
//load list of common words
$common = file($stopwords_file);
$total = count($common);
for ($x=0; $x<= $total; $x++)
{
$common[$x] = trim(strtolower($common[$x]));
}
//make array of search terms
$_terms = explode(" ", $term);
foreach ($_terms as $line)
{
if (in_array(strtolower(trim($line)), $common))
{
$removeKey = array_search($line, $this->_terms);
unset($_terms[$removeKey]);
}
else
{
$clean_term .= " ".$line;
}
}
return $clean_term;
}
?>
