コード例 #1
0
ファイル: catus.php プロジェクト: smalyshev/textcat
}
if (!empty($options['d'])) {
    $dirs = explode(",", $options['d']);
} else {
    $dirs = array(__DIR__ . "/LM");
}
$cat = new TextCat($dirs);
if (!empty($options['t'])) {
    $cat->setMaxNgrams(intval($options['t']));
}
if (!empty($options['f'])) {
    $cat->setMinFreq(intval($options['f']));
}
$input = isset($options['l']) ? $options['l'] : file_get_contents("php://stdin");
if (!empty($options['c'])) {
    $result = $cat->classify($input, explode(",", $options['c']));
} else {
    $result = $cat->classify($input);
}
if (empty($result)) {
    echo "No match found.\n";
    exit(1);
}
if (!empty($options['u'])) {
    $max = reset($result) * $options['u'];
} else {
    $max = reset($result) * 1.05;
}
if (!empty($options['a'])) {
    $top = $options['a'];
} else {