更新时间:2023-09-27 GMT+08:00
分享

SDK简介

语音交互概述

语音交互服务(Speech Interaction Service,简称SIS)是一种人机交互方式,用户通过实时访问和调用API获取语音交互结果。支持用户通过语音识别功能,将口述音频、普通话或者带有一定方言的语音文件识别成可编辑的文本,同时也支持通过语音合成功能将文本转换成逼真的语音等提升用户体验。适用场景如语音客服质检、会议记录、语音短消息、有声读物、电话回访等。

SDK概述

  • 优先推荐使用新版SDK语音交互服务SDK,该SDK基于统一规范开发,支持Java/Python/C++/.NET/Go/NodeJs/PHP,使用方法可参考api-explorer。该SDK暂不支持websocket方法。
  • 如果需要使用实时语音识别,可考虑使用替代SDK,当前支持Java SDK、Python SDK、CPP SDK、iOS SDK、Android SDK。使用方法可参考Java SDKPython SDKCPP SDK(Windows)CPP SDK(Linux)。后序章节均指代该SDK。

Java接口与API对应关系

Java接口与API对应关系请参见表 Java接口与API对应关系表

表1 Java接口与API对应关系表

Class

Method

API

功能名称

RasrClient

void continueStreamConnect(RasrRequest request)

wss://{endpoint}/v1/{project_id}/rasr/continue-stream

实时流连续模式

void shortStreamConnect(RasrRequest request)

wss://{endpoint}/v1/{project_id}/rasr/short-stream

实时流一句话模式

void sentenceStreamConnect(RasrRequest request)

wss://{endpoint}/v1/{project_id}/rasr/sentence-stream

实时流单句模式

AsrCustomizationClient

AsrCustomShortResponse getAsrShortResponse(AsrCustomShortRequest request)

POST /v1/{project_id}/asr/short-audio

一句话识别

String submitJob(AsrCustomLongRequest request)

POST /v1/{project_id}/asr/transcriber/jobs

录音文件识别-提交请求

AsrCustomLongResponse getAsrLongResponse(String jobId)

GET /v1/{project_id}/asr/transcriber/jobs/{job_id}

录音文件识别-状态查询

TtsCustomizationClient

TtsCustomResponse getTtsResponse(TtsCustomRequest request)

POST /v1/{project_id}/tts

语音合成

HotWordClient

String create(HotWordRequest request)

POST /v1/{project_id}/asr/vocabularies

创建热词表

String update(HotWordRequest request, String vocabularyId)

PUT /v1/{project_id}/asr/vocabularies/{vocabulary_id}

更新热词表

HotWordResponse query(String vocabularyId)

GET /v1/{project_id}/asr/vocabularies/{vocabulary_id}

查询热词表信息

HotWordsResponse query()

GET /v1/{project_id}/asr/vocabularies

查询热词表列表

void delete(String vocabularyId)

DELETE /v1/{project_id}/asr/vocabularies/{vocabulary_id}

删除热词表

Python接口与API对应关系

Python接口与API对应关系请参见表 Python接口与API对应关系表

表2 Python接口与API对应关系表

Class

Method

API

功能名称

RasrClient

continue_stream_connect(request)

wss://{endpoint}/v1/{project_id}/rasr/continue-stream

实时流连续模式

short_stream_connect(request)

wss://{endpoint}/v1/{project_id}/rasr/short-stream

实时流一句话模式

sentence_stream_connect(request)

wss://{endpoint}/v1/{project_id}/rasr/sentence-stream

实时流单句模式

AsrCustomizationClient

get_short_response(request)

POST /v1/{project_id}/asr/short-audio

一句话识别

submit_job(request)

POST /v1/{project_id}/asr/transcriber/jobs

录音文件识别-提交请求

get_long_response(job_id)

GET /v1/{project_id}/asr/transcriber/jobs/{job_id}

录音文件识别-状态查询

TtsCustomizationClient

get_tts_response(request)

POST /v1/{project_id}/tts

语音合成

HotWordClient

create(request)

POST /v1/{project_id}/asr/vocabularies

创建热词表

update(request, vocabulary_id)

PUT /v1/{project_id}/asr/vocabularies/{vocabulary_id}

更新热词表

query_by_vocabulary_id(vocabularyId)

GET /v1/{project_id}/asr/vocabularies/{vocabulary_id}

查询热词表信息

query()

GET /v1/{project_id}/asr/vocabularies

查询热词表列表

delete(vocabulary_id)

DELETE /v1/{project_id}/asr/vocabularies/{vocabulary_id}

删除热词表

分享:

    相关文档

    相关产品