TextMiner.php
//removeStopWords: removes the stopwords from a referenced array
removes the stopwords from a referenced array
removes the stopwords from a referenced array
public static function removeStopWords (&$words) { 
        $numWordsIn = count($words);
        if(self::verbose) { echo "removedStopWords => wordcount (IN: ".$numWordsIn.") "; }
        if(file_exists(self::stop_words_file)) {
            $stopWords = explode("\n",strtolower(file_get_contents(self::stop_words_file)));
        } else {
            $stopWords = array("","the","and","a","of","by","although","i","to","in","on","at","but","or","nor","for","-");
        }
        $words = array_diff($words,$stopWords);
        $words = array_values($words);
        $numWordsOut = count($words);
        if(self::verbose) { echo " (OUT: ".$numWordsOut.") Removed: ".($numWordsIn-$numWordsOut)."<br/>"; }
        return $words;
    }
public static function removeStopWords ( & $ words ) { $ numWordsIn = count ( $ words ) ; if ( self :: verbose ) { echo " removedStopWords => wordcount (IN:  " . $ numWordsIn . " )  " ; } if ( file_exists ( self :: stop_words_file ) ) { $ stopWords = explode ( " \n " , strtolower ( file_get_contents ( self :: stop_words_file ) ) ) ; } else { $ stopWords = array ( " " , " the " , " and " , " a " , " of " , " by " , " although " , " i " , " to " , " in " , " on " , " at " , " but " , " or " , " nor " , " for " , " - " ) ; } $ words = array_diff ( $ words , $ stopWords ) ; $ words = array_values ( $ words ) ; $ numWordsOut = count ( $ words ) ; if ( self :: verbose ) { echo "  (OUT:  " . $ numWordsOut . " ) Removed:  " . ( $ numWordsIn - $ numWordsOut ) . " <br/> " ; } return $ words ; }
removeStopWords: removes the stopwords from a referenced array
removeStopWords : removes the stopwords from a referenced array
//expects an array ([0] = w1, [1] = w2, etc.) //printa($stopWords); //re-indexes array