CLOVA Speech短文認識 API

Prev Next

Classic/VPC環境で利用できます。

version

Version Date Changes
v1.0.0 2023.11.23. 最初の作成
v1.0.1 2023.12.21. 発音評価(英語)機能を追加

リクエスト

Method Request URI
POST CLOVA Speechドメインで作成された API Gatewayの InvokeURLで呼び出す

API URL

Method Request URI
POST https://clovaspeech-gw.ncloud.com/recog/v1/stt

リクエストヘッダ

ヘッダ名 説明
X-CLOVASPEECH-API-KEY {Secret Key}
Content-Type application/octet-stream

Query Param

name value required value
lang string true Kor, Eng, Jpn, Chn
assessment bool false 発音評価の結果を返すかどうかを決めるパラメータ(Eng only)
utterance string false 発音評価対象のテキスト
graph bool false 音声波形を返すかどうかを決めるパラメータ
  • Assementは、英語(Eng)を選択すると動作します。

レスポンス

レスポンスボディ

Field Name Type Description
text string 認識した音源の結果
quota int 音源の長さ(15秒単位)
assessment_score int センテンス全体の発音スコア(0~100)
ref_graph int array 基準発音に対する音声波形の値配列(正の整数、1秒当たり50サンプル)
usr_graph int array 入力発音に対する音声波形の値配列(正の整数、1秒当たり50サンプル)

Example (cURL shell)

curl --location 'https://clovaspeech-gw.ncloud.com/recog/v1/stt?lang=Eng&assessment=true&graph=true' \
--header 'X-CLOVASPEECH-API-KEY: ${secret key}' \
--header 'Content-Type: application/octet-stream' \
--data '@/D:/example.mp3'
{
    "text": "sunday morning in an angry creditor",
    "quota": 15, "assessment_score": 14, "assessment_details": "false|{f(f):45, a(ɔː):100, l(l):97, se(s):43} ",
    "ref_graph": [
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 6, 8, 10, 11, 13, 15, 17, 18, 20, 21, 21, 22, 21, 21, 21, 20, 20, 19, 18, 17, 15, 14, 12, 11, 9, 7, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0
    ],
    "usr_graph": [
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 4, 6, 7, 9, 11, 13, 15, 16, 18, 19, 20, 21, 21, 21, 21, 20, 20, 19, 18, 17, 16, 15, 13, 12, 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0
    ]
}

エラーコード

{
    "timestamp": 1700536699045,
    "error": {
        "errorCode": "STT005",
        "message": "Invalid Language"
    }
}

APIエラー

HttpStatusCode ErrorCode ErrorMessage Description
400 400 - Invalid request parameters
401 401 Invalid secret Invalid secret
413 STT001 Exceed Sound Data length 音声データの最大長さを超過(60秒)
400 STT002 Invalid Content Type application/octet-stream以外の content-typeの場合に発生
400 STT003 Empty Sound Data 音声データが入力されていない
400 STT005 Invalid Language 決められた言語以外の言語が入力される
400 STT004 Empty Language 音声パラメータが入力されていない
500 STT006 Failed to pre-processing 音声認識前処理中にエラーが発生 音声データが正常な wav、mp3、flacであるかどうか確認が必要
500 STT998 Failed to STT 音声認識中にエラー発生(カスタマーサポートまで連絡すると速やかに対応)
500 STT999 Internal Server Error 不明なエラー発生(カスタマーサポートまで連絡すると速やかに対応)