バッチ文字起こしの結果を取得する

文字起こしの結果を取得するには、まず文字起こしジョブの 状態 を確認します。 ジョブが完了した場合は、文字起こしと文字起こしレポートを 取得 できます。

文字起こしの状態を取得する

文字起こしジョブの状態を取得するには、Speech to text REST APITranscriptions_Get 操作を呼び出します。

重要

バッチ文字起こしジョブは、ベスト エフォートの原則でスケジュールされます。 ピークの時間帯には、文字起こしジョブの処理が開始されるまでに最大 30 分以上かかることもあります。 実行中のほとんどの時間、文字起こしの状態は Running になります。 これは、ジョブがバッチ文字起こしバックエンド システムに移行するとすぐに、そのジョブには Running 状態が割り当てられるためです。 この割り当ては、基本モデルが使用されている場合はほぼ瞬時に、カスタム モデルの場合は若干遅れて発生します。 このため、文字起こしジョブが Running 状態にある時間は、実際の文字起こしの時間には対応せず、これには内部キューでの待ち時間も含まれます。

HTTP GET 要求は、次の例に示すように URI を使用して行います。 YourTranscriptionId を文字起こし ID に置き換え、 YourSubscriptionKey を音声 リソース キーに置き換えて、 YourServiceRegion を 音声 リソース リージョンに置き換えます。

curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/YourTranscriptionId" -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey"

応答本文は次の形式で返されます。

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/base/aaa321e9-5a4e-4db1-88a2-f251bbe7b555"
  },
  "links": {
    "files": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files"
  },
  "properties": {
    "diarizationEnabled": false,
    "wordLevelTimestampsEnabled": false,
    "displayFormWordLevelTimestampsEnabled": true,
    "channels": [
      0,
      1
    ],
    "punctuationMode": "DictatedAndAutomatic",
    "profanityFilterMode": "Masked",
    "duration": "PT3S",
    "languageIdentification": {
      "candidateLocales": [
        "en-US",
        "de-DE",
        "es-ES"
      ]
    }
  },
  "lastActionDateTime": "2022-09-10T18:39:09Z",
  "status": "Succeeded",
  "createdDateTime": "2022-09-10T18:39:07Z",
  "locale": "en-US",
  "displayName": "My Transcription"
}

この status プロパティは、文字起こしの現在の状態を示します。 文字起こしと文字起こしレポートは、文字起こしの状態が Succeeded のときに使用できます。

重要

バッチ文字起こしジョブは、ベスト エフォートの原則でスケジュールされます。 ピークの時間帯には、文字起こしジョブの処理が開始されるまでに最大 30 分以上かかることもあります。 実行中のほとんどの時間、文字起こしの状態は Running になります。 これは、ジョブがバッチ文字起こしバックエンド システムに移行するとすぐに、そのジョブには Running 状態が割り当てられるためです。 この割り当ては、基本モデルが使用されている場合はほぼ瞬時に、カスタム モデルの場合は若干遅れて発生します。 このため、文字起こしジョブが Running 状態にある時間は、実際の文字起こしの時間には対応せず、これには内部キューでの待ち時間も含まれます。

文字起こしジョブの状態を取得するには、 spx batch transcription status コマンドを使用します。 次の手順に従って要求パラメーターを作成します。

  • transcription パラメーターを、取得する文字起こしの ID に設定します。

文字起こしの状態を取得する Speech CLI コマンドの例を次に示します。

spx batch transcription status --api-version v3.1 --transcription YourTranscriptionId

応答本文は次の形式で返されます。

{
  "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3",
  "model": {
    "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/models/base/aaa321e9-5a4e-4db1-88a2-f251bbe7b555"
  },
  "links": {
    "files": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files"
  },
  "properties": {
    "diarizationEnabled": false,
    "wordLevelTimestampsEnabled": false,
    "displayFormWordLevelTimestampsEnabled": true,
    "channels": [
      0,
      1
    ],
    "punctuationMode": "DictatedAndAutomatic",
    "profanityFilterMode": "Masked",
    "duration": "PT3S"
  },
  "lastActionDateTime": "2022-09-10T18:39:09Z",
  "status": "Succeeded",
  "createdDateTime": "2022-09-10T18:39:07Z",
  "locale": "en-US",
  "displayName": "My Transcription"
}

この status プロパティは、文字起こしの現在の状態を示します。 文字起こしと文字起こしレポートは、文字起こしの状態が Succeeded のときに使用できます。

文字起こしに関する 音声 CLI ヘルプを表示するには、次のコマンドを実行します:

spx help batch transcription

文字起こしの結果を取得する

Transcriptions_ListFiles 操作から、この文字起こしの結果ファイルの一覧が返されます。 送信されたバッチ文字起こしジョブごとに 文字起こしレポート ファイルが提供されます。 さらに、正常に文字起こしされたオーディオ ファイルごとに 1 つの 文字起こし ファイル (最終結果) が提供されます。

前の応答本文の "files" URI を使用して HTTP GET 要求を行います。 YourTranscriptionId を文字起こし ID に置き換え、 YourSubscriptionKey を音声 リソース キーに置き換えて、 YourServiceRegion を 音声 リソース リージョンに置き換えます。

curl -v -X GET "https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/YourTranscriptionId/files" -H "Ocp-Apim-Subscription-Key: YourSubscriptionKey"

応答本文は次の形式で返されます。

{
  "values": [
    {
      "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files/2dd180a1-434e-4368-a1ac-37350700284f",
      "name": "contenturl_0.json",
      "kind": "Transcription",
      "properties": {
        "size": 3407
      },
      "createdDateTime": "2022-09-10T18:39:09Z",
      "links": {
        "contentUrl": "https://spsvcprodeus.blob.core.windows.net/bestor-c6e3ae79-1b48-41bf-92ff-940bea3e5c2d/TranscriptionData/637d9333-6559-47a6-b8de-c7d732c1ddf3_0_0.json?sv=2021-08-06&st=2022-09-10T18%3A36%3A01Z&se=2022-09-11T06%3A41%3A01Z&sr=b&sp=rl&sig=AobsqO9DH9CIOuGC5ifFH3QpkQay6PjHiWn5G87FcIg%3D"
      }
    },
    {
      "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files/c027c6a9-2436-4303-b64b-e98e3c9fc2e3",
      "name": "contenturl_1.json",
      "kind": "Transcription",
      "properties": {
        "size": 8233
      },
      "createdDateTime": "2022-09-10T18:39:09Z",
      "links": {
        "contentUrl": "https://spsvcprodeus.blob.core.windows.net/bestor-c6e3ae79-1b48-41bf-92ff-940bea3e5c2d/TranscriptionData/637d9333-6559-47a6-b8de-c7d732c1ddf3_1_0.json?sv=2021-08-06&st=2022-09-10T18%3A36%3A01Z&se=2022-09-11T06%3A41%3A01Z&sr=b&sp=rl&sig=wO3VxbhLK4PhT3rwLpJXBYHYQi5EQqyl%2Fp1lgjNvfh0%3D"
      }
    },
    {
      "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files/faea9a41-c95c-4d91-96ff-e39225def642",
      "name": "report.json",
      "kind": "TranscriptionReport",
      "properties": {
        "size": 279
      },
      "createdDateTime": "2022-09-10T18:39:09Z",
      "links": {
        "contentUrl": "https://spsvcprodeus.blob.core.windows.net/bestor-c6e3ae79-1b48-41bf-92ff-940bea3e5c2d/TranscriptionData/637d9333-6559-47a6-b8de-c7d732c1ddf3_report.json?sv=2021-08-06&st=2022-09-10T18%3A36%3A01Z&se=2022-09-11T06%3A41%3A01Z&sr=b&sp=rl&sig=gk1k%2Ft5qa1TpmM45tPommx%2F2%2Bc%2FUUfsYTX5FoSa1u%2FY%3D"
      }
    }
  ]
}

各文字起こしの場所および文字起こしレポート ファイルの詳細が、応答本文で返されます。 このcontentUrlプロパティには、 文字起こし ("kind": "Transcription") または 文字起こしレポート ("kind": "TranscriptionReport") ファイルの URL が含まれています。

文字起こし要求の destinationContainerUrl プロパティにコンテナーを指定しなかった場合、結果は Microsoft によって管理されるコンテナーに格納されます。 文字起こしジョブを削除すると、文字起こしの結果データも削除されます。

この spx batch transcription list コマンドから、文字起こしの結果ファイルの一覧が返されます。 送信されたバッチ文字起こしジョブごとに 文字起こしレポート ファイルが提供されます。 さらに、正常に文字起こしされたオーディオ ファイルごとに 1 つの 文字起こし ファイル (最終結果) が提供されます。

  • 必須の files フラグを設定します。
  • 必須の transcription パラメーターをログを取得する文字起こしの ID に設定します。

文字起こしの結果ファイルの一覧を取得する Speech CLI コマンドの例を次に示します。

spx batch transcription list --api-version v3.1 --files --transcription YourTranscriptionId

応答本文は次の形式で返されます。

{
  "values": [
    {
      "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files/2dd180a1-434e-4368-a1ac-37350700284f",
      "name": "contenturl_0.json",
      "kind": "Transcription",
      "properties": {
        "size": 3407
      },
      "createdDateTime": "2022-09-10T18:39:09Z",
      "links": {
        "contentUrl": "https://spsvcprodeus.blob.core.windows.net/bestor-c6e3ae79-1b48-41bf-92ff-940bea3e5c2d/TranscriptionData/637d9333-6559-47a6-b8de-c7d732c1ddf3_0_0.json?sv=2021-08-06&st=2022-09-10T18%3A36%3A01Z&se=2022-09-11T06%3A41%3A01Z&sr=b&sp=rl&sig=AobsqO9DH9CIOuGC5ifFH3QpkQay6PjHiWn5G87FcIg%3D"
      }
    },
    {
      "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files/c027c6a9-2436-4303-b64b-e98e3c9fc2e3",
      "name": "contenturl_1.json",
      "kind": "Transcription",
      "properties": {
        "size": 8233
      },
      "createdDateTime": "2022-09-10T18:39:09Z",
      "links": {
        "contentUrl": "https://spsvcprodeus.blob.core.windows.net/bestor-c6e3ae79-1b48-41bf-92ff-940bea3e5c2d/TranscriptionData/637d9333-6559-47a6-b8de-c7d732c1ddf3_1_0.json?sv=2021-08-06&st=2022-09-10T18%3A36%3A01Z&se=2022-09-11T06%3A41%3A01Z&sr=b&sp=rl&sig=wO3VxbhLK4PhT3rwLpJXBYHYQi5EQqyl%2Fp1lgjNvfh0%3D"
      }
    },
    {
      "self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.1/transcriptions/637d9333-6559-47a6-b8de-c7d732c1ddf3/files/faea9a41-c95c-4d91-96ff-e39225def642",
      "name": "report.json",
      "kind": "TranscriptionReport",
      "properties": {
        "size": 279
      },
      "createdDateTime": "2022-09-10T18:39:09Z",
      "links": {
        "contentUrl": "https://spsvcprodeus.blob.core.windows.net/bestor-c6e3ae79-1b48-41bf-92ff-940bea3e5c2d/TranscriptionData/637d9333-6559-47a6-b8de-c7d732c1ddf3_report.json?sv=2021-08-06&st=2022-09-10T18%3A36%3A01Z&se=2022-09-11T06%3A41%3A01Z&sr=b&sp=rl&sig=gk1k%2Ft5qa1TpmM45tPommx%2F2%2Bc%2FUUfsYTX5FoSa1u%2FY%3D"
      }
    }
  ]
}

各文字起こしの場所および文字起こしレポート ファイルの詳細が、応答本文で返されます。 このcontentUrlプロパティには、 文字起こし ("kind": "Transcription") または 文字起こしレポート ("kind": "TranscriptionReport") ファイルの URL が含まれています。

既定では、結果は Microsoft によって管理されるコンテナーに格納されます。 文字起こしジョブを削除すると、文字起こしの結果データも削除されます。

文字起こしレポート ファイル

送信されたバッチ文字起こしジョブごとに、1 つの文字起こしレポート ファイルが提供されます。

この例に示すように、各文字起こし結果ファイルの内容は JSON として書式設定されます。

{
  "successfulTranscriptionsCount": 2,
  "failedTranscriptionsCount": 0,
  "details": [
    {
      "source": "https://crbn.us/hello.wav",
      "status": "Succeeded"
    },
    {
      "source": "https://crbn.us/whatstheweatherlike.wav",
      "status": "Succeeded"
    }
  ]
}

文字起こしの結果ファイル

正常に文字起こしされたオーディオ ファイルごとに 1 つの文字起こし結果ファイルが提供されます。

この例に示すように、各文字起こし結果ファイルの内容は JSON として書式設定されます。

{
  "source": "...",
  "timestamp": "2023-07-10T14:28:16Z",
  "durationInTicks": 25800000,
  "duration": "PT2.58S",
  "combinedRecognizedPhrases": [
    {
      "channel": 0,
      "lexical": "hello world",
      "itn": "hello world",
      "maskedITN": "hello world",
      "display": "Hello world."
    }
  ],
  "recognizedPhrases": [
    {
      "recognitionStatus": "Success",
      "channel": 0,
      "offset": "PT0.76S",
      "duration": "PT1.32S",
      "offsetInTicks": 7600000.0,
      "durationInTicks": 13200000.0,
      "nBest": [
        {
          "confidence": 0.5643338,
          "lexical": "hello world",
          "itn": "hello world",
          "maskedITN": "hello world",
          "display": "Hello world.",
          "displayWords": [
            {
              "displayText": "Hello",
              "offset": "PT0.76S",
              "duration": "PT0.76S",
              "offsetInTicks": 7600000.0,
              "durationInTicks": 7600000.0
            },
            {
              "displayText": "world.",
              "offset": "PT1.52S",
              "duration": "PT0.56S",
              "offsetInTicks": 15200000.0,
              "durationInTicks": 5600000.0
            }
          ]
        },
        {
          "confidence": 0.1769063,
          "lexical": "helloworld",
          "itn": "helloworld",
          "maskedITN": "helloworld",
          "display": "helloworld"
        },
        {
          "confidence": 0.49964225,
          "lexical": "hello worlds",
          "itn": "hello worlds",
          "maskedITN": "hello worlds",
          "display": "hello worlds"
        },
        {
          "confidence": 0.4995761,
          "lexical": "hello worm",
          "itn": "hello worm",
          "maskedITN": "hello worm",
          "display": "hello worm"
        },
        {
          "confidence": 0.49418187,
          "lexical": "hello word",
          "itn": "hello word",
          "maskedITN": "hello word",
          "display": "hello word"
        }
      ]
    }
  ]
}

文字起こしジョブの作成時に設定された要求パラメーターによっては、文字起こしファイルに次の結果プロパティを含めることができます。

プロパティ 説明
channel 結果のチャネル番号。 ステレオ オーディオ ストリームの場合、文字起こし中に左チャンネルと右チャンネルが分離されます。 入力オーディオ ファイルごとに JSON 結果ファイルが作成されます。
combinedRecognizedPhrases チャネルのすべてのフレーズの連結された結果。
confidence 認識の信頼度値。
display 認識されたテキストの表示形式。 追加された句読点と大文字化が含まれます。
displayWords 文字起こしの各単語のタイムスタンプ。 displayFormWordLevelTimestampsEnabled 要求プロパティが true に設定されている必要があります。そうでない場合、このプロパティは存在しません。

: このプロパティは、音声テキスト変換 REST API バージョン 3.1 でのみ使用できます。
duration オーディオ継続時間。 値は ISO 8601 でエンコードされた継続時間です。
durationInTicks ティック単位のオーディオ継続時間 (1 ティックは 100 ナノ秒)。
itn 認識されたテキストの逆テキスト正規化 (ITN) 形式。 略語 ("Doctor Smith" から "Dr Smith" など)、電話番号、およびその他の変換が適用されます。
lexical 実際に認識された単語。
locale オーディオの入力から識別されるロケール。 languageIdentification 要求プロパティが設定されている必要があります。そうでない場合、このプロパティは存在しません。

: このプロパティは、音声テキスト変換 REST API バージョン 3.1 でのみ使用できます。
maskedITN 不適切表現のマスキングを適用した ITN 形式。
nBest 現在のフレーズで使用できる文字起こしの一覧。信頼度が高くなります。
offset このフレーズのオーディオでのオフセット。 値は ISO 8601 でエンコードされた継続時間です。
offsetInTicks このフレーズのオーディオのオフセットをティック単位で指定します (1 ティックは 100 ナノ秒です)。
recognitionStatus 認識状態。 たとえば、"Success" または "Failure" です。
recognizedPhrases 各フレーズの結果の一覧。
source 入力オーディオ ソースとして指定された URL。 ソースは、 contentUrls または contentContainerUrl 要求プロパティに対応します。 この source プロパティは、文字起こしのオーディオ入力を確認する唯一の方法です。
speaker 識別された話者。 diarizationdiarizationEnabled 要求プロパティが設定されている必要があります。そうでない場合、このプロパティは存在しません。
timestamp 文字起こしの作成日時。 値は ISO 8601 でエンコードされたタイムスタンプです。
words フレーズの各単語の構文テキストを含む結果の一覧。 wordLevelTimestampsEnabled 要求プロパティが true に設定されている必要があります。そうでない場合、このプロパティは存在しません。

次のステップ