Example #1
0
}
mysql_free_result($sqlresults);
// do the actual job
// get cowords
$sql = "SELECT LOWER(A.text COLLATE {$collation}) AS h1, LOWER(B.text COLLATE {$collation}) AS h2 ";
$sql .= "FROM " . $esc['mysql']['dataset'] . "_hashtags A, " . $esc['mysql']['dataset'] . "_hashtags B, " . $esc['mysql']['dataset'] . "_tweets t ";
$sql .= sqlSubset() . " AND ";
$sql .= "LENGTH(A.text)>1 AND LENGTH(B.text)>1 AND ";
$sql .= "LOWER(A.text COLLATE {$collation}) < LOWER(B.text COLLATE {$collation}) AND A.tweet_id = t.id AND A.tweet_id = B.tweet_id ";
$sql .= "ORDER BY h1,h2";
//print $sql."<br>";
$sqlresults = mysql_query($sql);
while ($res = mysql_fetch_assoc($sqlresults)) {
    $coword->addWord($res['h1']);
    $coword->addWord($res['h2']);
    $coword->addCoword($res['h1'], $res['h2'], 1);
}
unset($coword->words);
// as we are adding words manually the frequency would be messed up
if ($esc['shell']['minf'] > 1 && !($esc['shell']['topu'] > 0)) {
    $coword->applyMinFreq($esc['shell']['minf']);
    //$coword->applyMinDegree($esc['shell']['minf']);	// Berno: method no longer in use, remains unharmed
    $filename = get_filename_for_export("hashtagCooc", (isset($_GET['probabilityOfAssociation']) ? "_normalizedAssociationWeight" : "") . "_minFreqOf" . $esc['shell']['minf'], "gdf");
} elseif ($esc['shell']['topu'] > 0) {
    $coword->applyTopUnits($esc['shell']['topu']);
    $filename = get_filename_for_export("hashtagCooc", (isset($_GET['probabilityOfAssociation']) ? "_normalizedAssociationWeight" : "") . "_Top" . $esc['shell']['topu'], "gdf");
} else {
    $filename = get_filename_for_export("hashtagCooc", isset($_GET['probabilityOfAssociation']) ? "_normalizedAssociationWeight" : "", "gdf");
}
//print_r($coword);
$lookup = array();