Skip to content

Instantly share code, notes, and snippets.

@naupaw
Created November 16, 2012 02:05
Show Gist options
  • Select an option

  • Save naupaw/4083277 to your computer and use it in GitHub Desktop.

Select an option

Save naupaw/4083277 to your computer and use it in GitHub Desktop.
Script Simsimi codeigniter
<?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);
}
}
@takien
Copy link
Copy Markdown

takien commented Nov 20, 2012

nais

@naupaw
Copy link
Copy Markdown
Author

naupaw commented Nov 26, 2012

tu mit yu

@Tester2009
Copy link
Copy Markdown

macam mana nak guna ?
kasi full code link boleh?

@codercui
Copy link
Copy Markdown

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment