Created
November 16, 2012 02:05
-
-
Save naupaw/4083277 to your computer and use it in GitHub Desktop.
Script Simsimi codeigniter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
| class Simsimi extends CI_Controller { | |
| public function index() | |
| { | |
| header("Content-type: text/javascript"); | |
| $teks = $this->input->get('txt'); | |
| $teks = strtolower($teks); | |
| if($teks){ | |
| $hasil = $this->db->query("SELECT * FROM vocab WHERE MATCH(ask) AGAINST('".$teks."' IN BOOLEAN MODE);"); | |
| if($hasil->num_rows() > 0){ | |
| $cius = $hasil->result_array(); | |
| shuffle($cius); | |
| $arr = array('ask'=> $teks ,'response' => $cius[0]['answer']); | |
| }else{ | |
| $cius = array('gue ga ngerti cok','lo ngomong apa cok','zz','ape si cok','ga ngarti dah','bahasa planet','ngomong ape si','lo manusia apa manusia','dasar !!','gue kaga ngarti'); | |
| shuffle($cius); | |
| $arr = array('ask'=> $teks ,'response' => $cius[0]); | |
| } | |
| }else{ | |
| $arr = array('response' => 'input the text'); | |
| } | |
| echo json_encode($arr); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ai share e cái api simsimi giống này vs key vô hạn nha
http://botcamxuc.us/api/simsimi.php?text=puaru