Introducing Turing Robot php API
Turing Robot Platform, based on technologies such as natural language processing, knowledge base and cloud computing, provides developers and partners with a series of intelligent semantic processing capabilities (including semantic understanding, intelligent question answering, knowledge base docking, etc.). So far, the platform has accumulated nearly 10 billion corpora and PB-level basic data. The overall accuracy of the tested platform has reached more than 90%, and the platform has been applied to HTC's Xiao Hi voice assistant and China Telecom's WeChat. Platform, Haier's smart home appliance control system, etc., have been widely praised by enterprises.
Here is an introduction to his API:
The following is excerpted from the official website: http://www.tuling123.com/openapi/cloud/api.jsp?section=9
$apiKey = "own appKey";
$apiURL = "http://www.tuling123.com/openapi/api?key=KEY&info=INFO";
//Set the message header and construct the request message
header("Content-type: text/html; charset=utf-8");
$reqInfo = "Tell a joke";
$url = str_replace("INFO", $reqInfo, str_replace("KEY", $apiKey, $apiURL));
/**Method 1: Use file_get_contents to get the content in get mode*/
$res =file_get_contents($url);
echo $res;
/**Method 2. To use the curl library, you need to check whether the curl extension has been turned on in php.ini.*/
$ch = curl_init();
$timeout = 5; curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$file_contents = curl_exec($ch);
curl_close($ch);
echo $file_contents;
Return results:
This is a json string. We just need to use php’s json to process the string
Use json_decode() to return the json data $data, so that jokes can be output through $data->text.
In the same way, we can use the $reqInfo variable to let users enter their own input, and then we can create a robot with its own interface.
http://www.bkjia.com/PHPjc/857043.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/857043.htmlTechArticleIntroducing Turing Robot php API Turing Robot Platform, based on natural language processing, knowledge base and cloud computing technologies, A series of intelligent semantic processing provided for developers and partners...