Exemple #1
0
function output_score($id, $info)
{
    global $evalset;
    global $has_analysis;
    global $setup;
    global $dir;
    reset($evalset);
    $state = return_state_for_link();
    while (list($set, $dummy) = each($evalset)) {
        if (property_exists($info, "result") && array_key_exists($set, $info->result)) {
            $score = $info->result[$set];
        } else {
            $score = "";
        }
        print "<td align=center id=\"score-{$id}-{$set}\">";
        // print "<table><tr><td>";
        $each_score = explode(" ; ", $score);
        for ($i = 0; $i < count($each_score); $i++) {
            if (preg_match('/([\\d\\(\\)\\.\\s]+) (BLEU[\\-c]*)/', $each_score[$i], $match) || preg_match('/([\\d\\(\\)\\.\\s]+) (IBM[\\-c]*)/', $each_score[$i], $match) || preg_match('/([\\d\\(\\)\\.\\s]+) (METEOR[\\-c]*)/', $each_score[$i], $match)) {
                if ($i > 0) {
                    print "<BR>";
                }
                $opened_a_tag = 0;
                if ($set != "avg") {
                    if (file_exists("{$dir}/evaluation/{$set}.cleaned.{$id}")) {
                        print "<a href=\"?{$state}&show=evaluation/{$set}.cleaned.{$id}\">";
                        $opened_a_tag = 1;
                    } else {
                        if (file_exists("{$dir}/evaluation/{$set}.output.{$id}")) {
                            print "<a href=\"?{$state}&show=evaluation/{$set}.output.{$id}\">";
                            $opened_a_tag = 1;
                        }
                    }
                }
                if ($set == "avg" && count($each_score) > 1) {
                    print $match[2] . ": ";
                }
                print $match[1];
                if ($opened_a_tag) {
                    print "</a>";
                }
            } else {
                print "-";
            }
        }
        print "</td>";
        if ($has_analysis && array_key_exists($set, $has_analysis)) {
            print "<td align=center>";
            global $dir;
            $analysis = get_analysis_version($dir, $set, $id);
            if ($analysis["basic"]) {
                print "<a href=\"?analysis=show&setup={$setup}&set={$set}&id={$id}\">&#x24B6;</a> <input type=checkbox name=analysis-{$id}-{$set} value=1>";
            }
            print "</td>";
        }
    }
}
Exemple #2
0
function get_current_analysis_filename2($type, $file)
{
    global $dir, $set, $id2;
    $version = get_analysis_version($dir, $set, $id2);
    return "{$dir}/evaluation/{$set}.analysis." . $version[$type] . "/" . $file;
}