Пример #1
0
function findAggregateResults($query, $from_pg, $to_pg)
{
    global $positive, $negative;
    $tweets = tweetCollector($query, $from_pg, $to_pg);
    foreach ($tweets as $tweet_id => $tweet_details) {
        findCatagory($tweet_id, $tweet_details["text"]);
    }
    arsort($positive);
    asort($negative);
    return $tweets;
}
Пример #2
0
function findEffeciency($file_name)
{
    $correct = 0;
    $incorrect = 0;
    $fp = fopen($file_name . ".csv", "r");
    while (!feof($fp)) {
        $new_tweet = fgetcsv($fp);
        if ($new_tweet) {
            //print(findCatagory($new_tweet[1])."\n");
            if (findCatagory($new_tweet[1]) == $new_tweet[0]) {
                $correct++;
            } else {
                $incorrect++;
            }
        }
    }
    fclose($fp);
    print "Correct:\t" . $correct . "\n";
    print "Incorrect:\t" . $incorrect . "\n";
    print "Effeciency:\t" . $correct / ($correct + $incorrect) . "\n";
}