Example #1
0
 $stopwordDictionary = new dictionary('stop-words-english1.txt');
 //$stopwordDictionary->loadStopwordFile();
 // Add Query to Stopwords
 $stopwordDictionary->addQueryToStopwords($cluster1->tokeniseString($q));
 $stopwords = $stopwordDictionary->returnStopwords();
 // Can use Title or Snippets for Clusters - Using Snippets
 //$aggTitles = $aggregator1->returnResultSetAggTitles();
 // Get array of snippets in list
 //$aggSnippets = $aggregator1->returnResultSetAggSnippets();
 // Find the cluster terms of interest
 // But don't include stopwords
 //$cluster1->findTerms($aggTitles, $stopwords);
 $cluster1->findTerms($aggregator1->returnResultSetAggSnippets(), $stopwords);
 // Count Term Freq
 //$cluster1->countTermFrequency($aggTitles);
 $cluster1->countTermFrequency($aggregator1->returnResultSetAggSnippets());
 // Set most frequet terms
 $cluster1->setMostFrequentTerms(10);
 //$cluster1->stopwordRemoval($stopwords);
 echo '<div class="row"><div class="span3"><h2>F-Clusters</h2>';
 // Print Clustered Terms
 $cluster1->displayMostFrequentTerms($q);
 // $cluster1->displayMostFrequentBinTerms($q);
 echo '</div><div class="span5"><h2>Results</h2>';
 // Print Cluser Term Results
 $aggregator1->printResultSetAggCluster(isset($_GET['term']) ? $_GET['term'] : ($_GET['term'] = ''));
 // end of DIV
 echo '</div></div> <!-- End of Class row -->';
 // Query Timer
 $time_post = microtime(true);
 $exec_time = $time_post - $time_pre;