int main(int argc, char* argv[]) { const char* login_config = "appid = 5392db98, work_dir = . "; const char* param = "rst=plain,rse=gb2312,sub=asr,ssm=1,aue=speex,auf=audio/L16;rate=16000,ent=sms16k";//注意sub=asr const char* grammar = NULL; int ret = 0 ; char key = 0 ; const char* asrfile = get_audio_file(); ret = MSPLogin(NULL, NULL, login_config); if ( ret != MSP_SUCCESS ) { printf("MSPLogin failed , Error code %d.\n",ret); return 0 ; } grammar = get_grammar( "gm_continuous_digit.abnf" ); if(ret != MSP_SUCCESS) { printf("getExID with errorCode: %d \n", ret); return 0; } ret = run_asr(asrfile, param, grammar); if(ret != MSP_SUCCESS) { printf("run_asr with errorCode: %d \n", ret); return 0; } release_grammar(&grammar); MSPLogout(); return 0; }
int _tmain(int argc, _TCHAR* argv[]) { const char* grammar = NULL; const char* asrfile = get_audio_file(); int ret = MSP_SUCCESS; //appid 请勿随意改动 ret = QISRInit("appid=52d8f781"); if(ret != MSP_SUCCESS) { printf("QISRInit with errorCode: %d \n", ret); return 0; } grammar = get_grammar( "gm_continuous_digit.abnf" ); if(ret != MSP_SUCCESS) { printf("getExID with errorCode: %d \n", ret); return 0; } ret = run_asr(grammar , asrfile); release_grammar(&grammar); QISRFini(); char key = _getch(); return 0; }