コード例 #1
0
ファイル: talk.php プロジェクト: hidetobara/VolatileTwit
 function handle()
 {
     $cache = new FileCache();
     $info = $cache->get(self::CACHE_KEY);
     if (!is_array($info)) {
         $shokos = new VolatileTwitShokos();
         $info = $shokos->bestTalkInfo();
         $cache->set(self::CACHE_KEY, $info, new DateTime("+30 min"));
     }
     $this->assign('rate', $info['rate']);
     $this->assign('text', $info['text']);
     $this->assign('status', 'ok');
 }
コード例 #2
0
ファイル: evaluate.php プロジェクト: hidetobara/VolatileTwit
 function handle()
 {
     $text = $_REQUEST['text'];
     if (!$text) {
         $text = "今日の腐さん";
     }
     if (!$text || !is_string($text)) {
         throw new Exception('No text');
     }
     if (mb_strlen($text) > self::TEXT_LIMIT) {
         throw new Exception('Too long text');
     }
     $shokos = new VolatileTwitShokos();
     $rate = $shokos->evaluateLikelihood($text);
     $this->assign('rate', $rate);
     $this->assign('text', htmlspecialchars($text));
     $this->assign('status', 'ok');
 }
コード例 #3
0
ファイル: talk.php プロジェクト: hidetobara/VolatileTwit
<?php

ini_set('display_errors', 1);
require_once '../configure.php';
require_once CONF_DIR . 'common.php';
require_once INCLUDE_DIR . "learn/VolatileTwitHajime.class.php";
require_once INCLUDE_DIR . "learn/VolatileTwitShokos.class.php";
require_once INCLUDE_DIR . "learn/VolatileTwitQb.class.php";
//$hajime = new VolatileTwitHajime();
//$hajime->run();
//unset($hajime);
$shokos = new VolatileTwitShokos();
$shokos->run();
unset($shokos);
$qb = new VolatileTwitQb();
$qb->run();
unset($qb);