取得批次謄寫結果
若要取得謄寫結果,請先檢查謄寫作業的狀態。 如果作業已完成,您可以擷取謄寫和謄寫報表。
取得謄寫狀態
若要取得謄寫作業的狀態,請呼叫語音轉換文字 REST API 的 Transcriptions_Get 作業。
重要
批次轉譯作業會盡力進行排程。 在尖峰時段,謄寫作業可能需要 30 分鐘或更長的時間才能開始處理。 執行期間的大部分時間,轉譯狀態將會是 Running
。 這是因為作業在移至批次轉譯後端系統的那一刻會指派 Running
狀態。 使用基底模型時,幾乎會立即進行此指派:自定義模型會稍微慢一點。 因此,謄寫作業花費在 Running
狀態的時間量不會對應到實際的轉譯時間,但也包含內部佇列中的等候時間。
使用 URI 提出 HTTP GET 要求,如下列範例所示。 以謄寫識別碼取代 YourTranscriptionId
、以語音資源金鑰取代 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
參數設定為您要取得謄寫的識別碼。
以下是要取得謄寫狀態的範例語音 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 作業會傳回謄寫結果檔案的清單。 系統會針對每個提交的批次謄寫作業提供謄寫報表檔案。 此外,系統會為每個成功謄寫的音訊檔案提供一個謄寫檔案 (最終結果)。
使用先前回應本文中的「檔案」URI,提出 HTTP GET 要求。 以謄寫識別碼取代 YourTranscriptionId
、以語音資源金鑰取代 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
命令會傳回謄寫的結果檔案清單。 系統會針對每個提交的批次謄寫作業提供謄寫報表檔案。 此外,系統會為每個成功謄寫的音訊檔案提供一個謄寫檔案 (最終結果)。
- 設定必要的
files
旗標。 - 將必要的
transcription
參數設定為您要取得記錄的謄寫識別碼。
以下是範例語音 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 管理的容器中。 刪除謄寫作業時,也會一併刪除謄寫結果資料。
謄寫報表檔案
系統會針對每個提交的批次謄寫作業提供謄寫報表檔案。
如本範例所示,每個謄寫結果檔案的內容都會格式化為 JSON。
{
"successfulTranscriptionsCount": 2,
"failedTranscriptionsCount": 0,
"details": [
{
"source": "https://crbn.us/hello.wav",
"status": "Succeeded"
},
{
"source": "https://crbn.us/whatstheweatherlike.wav",
"status": "Succeeded"
}
]
}
謄寫結果檔案
系統會為每個成功謄寫的音訊檔案提供一個謄寫結果檔。
如本範例所示,每個謄寫結果檔案的內容都會格式化為 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 |
刻度中的音訊持續時間(一個刻度為100奈秒)。 |
itn |
已辨識文字的反向文字正規化 (ITN) 形式。 已套用縮寫,例如 "Doctor Smith" 縮寫為 "dr smith"、電話號碼和其他轉換。 |
lexical |
實際辨識的文字。 |
locale |
從輸入音訊識別的地區設定。 必須 languageIdentification 設定要求屬性,否則這個屬性不存在。注意:此屬性僅適用於語音轉換文字 REST API 3.1 版。 |
maskedITN |
已套用包含粗話遮罩的 ITN 形式。 |
nBest |
具有信賴度之目前片語的可能謄寫清單。 |
offset |
此片語音訊中的位移。 此值是 ISO 8601 編碼的持續時間。 |
offsetInTicks |
此片語音訊中刻度的位移(一個刻度為100奈秒)。 |
recognitionStatus |
辨識的狀態。 例如:「成功」或「失敗」。 |
recognizedPhrases |
每個片語的結果清單。 |
source |
提供作為輸入音訊來源的 URL。 來源會對應至 contentUrls 或 contentContainerUrl 要求屬性。 屬性 source 是確認謄寫音訊輸入的唯一方式。 |
speaker |
識別的說話者。 必須 diarization 設定 和 diarizationEnabled 要求屬性,否則這個屬性不存在。 |
timestamp |
謄寫的建立日期和時間。 此值是 ISO 8601 編碼的時間戳記。 |
words |
結果清單,其中包含片語每個單字的語彙文字。 要求 wordLevelTimestampsEnabled 屬性必須設定為 true ,否則這個屬性不存在。 |