

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 处理收到的 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`。如果更深入地研究消息，您会发现系统将“狐狸”一词处理为“事实”。系统使用相同的 `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>

如果转录不完整，系统会再次处理该短语。此示例的 `false` 值为 `isPartial`，消息包含“狐狸”而不是“事实”。系统使用相同的 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
                }]
            }]
        }]
    }
}
```