$res = $ai->nlp()->textTranslate([
'type' => 0, //翻译类型
'text' => ;今天天气怎么样;
]);
if($res->success()){
var_dump($res->toArray());
}
$res = $ai->nlp()->speechTranslate([
'format' => 3, //语音压缩格式编码
'seq' => 0, //语音分片所在语音流的偏移量(字节)
'end' => 0, //是否结束分片标识,定义见下文描述
'session_id' => '10000', //语音唯一标识(同一应用内)
'speech_chunk' => base64_encode(file_get_contents('path/to/some_speech.mp3')),//语言分片数据的base64编码
'source' => 'zh' //源语言缩写
'target' => 'en' //目标语言缩写
]);
if($res->success()){
var_dump($res->toArray());
}
$res = $ai->nlp()->path('path/to/some_image.jpg')->imageTranslate([
'session_id' => time(),
'scene' => 'doc',
'source' => 'zh', //源语言缩写
'target' => 'en' //目标语言缩写
]);
if($res->success()){
var_dump($res->toArray());
}
$res = $ai->nlp()->textDetect([
'text' => '今天天气怎么样',
'candidate_langs' => 'zh',
'force' => 0
]);
if($res->success()){
var_dump($res->toArray());
}