處理收到的轉錄事件 - Amazon Chime SDK

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

處理收到的轉錄事件

下列範例示範如何處理收到的 TranscriptEvent

注意

確切的輸出取決於幾個因素,包括個人說話速度和暫停時間。

範例 1: StartMeetingTranscription

此範例顯示典型StartMeetingTranscription操作。

meeting.StartMeetingTranscription( { EngineTranscribeSettings: { Languagecode: ‘en-US’ } } );

操作會產生 TranscriptEvent

{ status: { type: 'started', eventTimeMs: 1620118800000, transcriptionConfig: { LanguageCode: 'en-US' } } }

範例 2:部分轉錄結果

在此範例中,出席者說:「快速棕色狐狸跳過懶惰犬」。請注意,在此範例中,isPartial值為 true。如果您更深入地查看訊息,您可以看到系統已將「fox」一詞處理為「facts」。系統會使用相同的 resultId 來更新文字記錄。

{ transcript: { results: [{ resultId:"1", isPartial: true, startTimeMs: 1620118800000, endTimeMs: 1620118801000, alternatives: [{ items:[{ type: 'pronunciation', startTimeMs: 1620118800000, endTimeMs: 1620118800200, attendee: { attendeeId: "1", externalUserId: "A"}, content: "the", vocabularyFilterMatch: false }, { type: 'pronunciation', startTimeMs: 1620118800200, endTimeMs: 1620118800400, attendee: { attendeeId: "1", externalUserId: "A" }, content:"quick", vocabularyFilterMatch: false }, { type:'pronunciation', startTimeMs: 1620118800400, endTimeMs: 1620118800750, attendee: { attendeeId: "1", externalUserId: "A" }, content:"brown", vocabularyFilterMatch: false }, { type:'pronunciation', startTimeMs: 1620118800750, endTimeMs: 1620118801000, attendee:{ attendeeId: "1", externalUserId: "A" }, content:"facts", vocabularyFilterMatch: false }, { type:'punctuation', startTimeMs: 1620118801000, endTimeMs: 1620118801500, attendee:{ attendeeId: "1", externalUserId: "A" }, content: ",", vocabularyFilterMatch: false }] }] }] } }

範例 3:最終轉錄結果

發生部分轉錄時,系統會再次處理該片語。此範例isPartial的值為 false,且訊息包含「fox」而非「facts」。系統會使用相同的 ID 重新發出訊息。

{ transcript: { results: [{ resultId:"1", isPartial: false, startTimeMs: 1620118800000, endTimeMs: 1620118801000, alternatives: [{ items:[{ type: 'pronunciation', startTimeMs: 1620118800000, endTimeMs: 1620118800200, attendee: { attendeeId: "1", externalUserId: "A"}, content: "the", vocabularyFilterMatch: false }, { type: 'pronunciation', startTimeMs: 1620118800200, endTimeMs: 1620118800400, attendee: { attendeeId: "1", externalUserId: "A" }, content:"quick", vocabularyFilterMatch: false }, { type:'pronunciation', startTimeMs: 1620118800400, endTimeMs: 1620118800750, attendee: { attendeeId: "1", externalUserId: "A" }, content:"brown", vocabularyFilterMatch: false }, { type:'pronunciation', startTimeMs: 1620118800750, endTimeMs: 1620118801000, attendee: { attendeeId: "1", externalUserId: "A" }, content:"fox", vocabularyFilterMatch: false }, { type:'punctuation', startTimeMs: 1620118801000, endTimeMs: 1620118801500, attendee: { attendeeId: "1", externalUserId: "A" }, content: ",", vocabularyFilterMatch: false }] }] }] } }