Exemplo n.º 1
0
$text = $_POST["text"];
//$text = array();
//$text[] = "カリン、自分でまいた種は自分で刈り取[qw]";
//$text[] = 'モーラ、モラ(mora)とは、音韻論上、一定の時間的長さをもった音の分節単位。古典詩における韻律用語であるラテン語のmŏra(モラ)の転用(日本語における「モーラ」という表記は英語からの音訳であり、「モラ」という表記はラテン語からの音訳)。拍(はく)と訳される。';
$type = 0;
if ($_POST["dict"]) {
    $type |= Processor::Lemmas;
}
if ($_POST["rubies"]) {
    $type |= Processor::Rubies;
}
if ($_POST["full_reading"]) {
    $type |= Processor::FullReadings;
}
//$type = Processor::ReadingsAndLemmas;
$proc = new Processor($type);
$retv = array();
$sent = 0;
foreach ($text as $v) {
    $proc->send_text($v);
    $sent++;
    if ($sent >= 3) {
        $retv[] = $proc->get_response();
        $sent--;
    }
}
while ($sent) {
    $retv[] = $proc->get_response();
    $sent--;
}
jexit(array("status" => "OK", "wall_time" => microtime(true) - $time_start, "cpu_time" => rutime(getrusage(), $ru_start, "utime"), "data" => $retv));