

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

# 處理收到的 Amazon Chime SDK 即時文字記錄事件
<a name="delivery-examples"></a>

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

**注意**  
確切的輸出取決於幾個因素，包括個人說話的速度和停頓時間。

## 範例 1：StartMeetingTranscription
<a name="example-1"></a>

此範例顯示典型`StartMeetingTranscription`的操作。

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

操作會產生 `TranscriptEvent`。

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

## 範例 2：部分文字記錄結果
<a name="example-2"></a>

在這個範例中，一位出席者說：「快速的棕色狐狸跳過鬆散的狗。」 請注意，在此範例中，`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：最終文字記錄結果
<a name="example-3"></a>

如果發生部分文字記錄，系統會再次處理該片語。此範例`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
                }]
            }]
        }]
    }
}
```