

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Menggunakan deteksi ucapan beracun
<a name="toxicity-using"></a>

## Menggunakan deteksi ucapan beracun dalam transkripsi batch
<a name="toxicity-using-batch"></a>

Untuk menggunakan deteksi ucapan beracun dengan transkripsi batch, lihat contoh berikut ini:

### Konsol Manajemen AWS
<a name="toxicity-using-console-batch"></a>

1. Masuk ke [Konsol Manajemen AWS](https://console.aws.amazon.com/transcribe/).

1. Di panel navigasi, pilih **Pekerjaan transkripsi**, lalu pilih **Buat pekerjaan** (kanan atas). Ini membuka halaman **Tentukan detail pekerjaan**.  
![Amazon Transcribe tangkapan layar konsol: halaman 'tentukan detail pekerjaan'.](http://docs.aws.amazon.com/id_id/transcribe/latest/dg/images/toxicity-batch-details-1.png)

1.  Pada halaman **Tentukan detail pekerjaan**, Anda juga dapat mengaktifkan redaksi PII jika Anda mau. Perhatikan bahwa opsi lain yang tercantum tidak didukung dengan deteksi Toksisitas. Pilih **Selanjutnya**. Ini membawa Anda ke halaman **Konfigurasi pekerjaan - opsional**. Di panel **Pengaturan audio**, pilih **Deteksi toksisitas**.   
![Amazon Transcribe tangkapan layar konsol: halaman 'konfigurasi pekerjaan'.](http://docs.aws.amazon.com/id_id/transcribe/latest/dg/images/toxicity-batch-details-2.png)

1. Pilih **Buat pekerjaan** untuk menjalankan pekerjaan transkripsi Anda.

1. Setelah pekerjaan transkripsi Anda selesai, Anda dapat mengunduh transkrip Anda dari **Unduh menu tarik-turun** di halaman detail pekerjaan transkripsi.

### AWS CLI
<a name="toxicity-using-cli-batch"></a>

Contoh ini menggunakan [start-transcription-job](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/transcribe/start-transcription-job.html)perintah dan `ToxicityDetection` parameter. Untuk informasi selengkapnya, silakan lihat [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html) dan [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_ToxicityDetection.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_ToxicityDetection.html). 

```
aws transcribe start-transcription-job \
--region {{us-west-2}} \
--transcription-job-name {{my-first-transcription-job}} \
--media MediaFileUri={{s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac}} \
--output-bucket-name {{amzn-s3-demo-bucket}} \
--output-key {{my-output-files/}} \
--language-code en-US \
--toxicity-detection ToxicityCategories=ALL
```

Berikut contoh lain menggunakan [start-transcription-job](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/transcribe/start-transcription-job.html)perintah, dan badan permintaan yang menyertakan deteksi toksisitas.

```
aws transcribe start-transcription-job \
--region {{us-west-2}} \
--cli-input-json {{file://filepath/my-first-toxicity-job.json}}
```

File *my-first-toxicity-job.json* berisi badan permintaan berikut.

```
{
  "TranscriptionJobName": "{{my-first-transcription-job}}",
  "Media": {
        "MediaFileUri": "{{s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac}}"
  },
  "OutputBucketName": "{{amzn-s3-demo-bucket}}",
  "OutputKey": "{{my-output-files/}}", 
  "LanguageCode": "en-US",
  "ToxicityDetection": [ 
      { 
         "ToxicityCategories": [ "ALL" ]
      }
   ]
}
```

### AWS SDK untuk Python (Boto3)
<a name="toxicity-using-python-batch"></a>

 Contoh ini menggunakan AWS SDK untuk Python (Boto3) `ToxicityDetection` untuk mengaktifkan metode [start\_transcription\_job](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/transcribe.html#TranscribeService.Client.start_transcription_job). Untuk informasi selengkapnya, silakan lihat [https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/API_StartTranscriptionJob.html) dan [https://docs.aws.amazon.com/transcribe/latest/APIReference/Welcome.html](https://docs.aws.amazon.com/transcribe/latest/APIReference/Welcome.html). 

Untuk contoh tambahan menggunakan AWS SDKs, termasuk contoh khusus fitur, skenario, dan lintas layanan, lihat bagian ini. [Contoh kode untuk Amazon Transcribe menggunakan AWS SDKs](service_code_examples.md)

```
from __future__ import print_function
import time
import boto3
transcribe = boto3.client('transcribe', '{{us-west-2}}')
job_name = "{{my-first-transcription-job}}"
job_uri = "{{s3://amzn-s3-demo-bucket/my-input-files/my-media-file.flac}}"
transcribe.start_transcription_job(
    TranscriptionJobName = job_name,
    Media = {
        'MediaFileUri': job_uri
    },
    OutputBucketName = '{{amzn-s3-demo-bucket}}',
    OutputKey = '{{my-output-files/}}', 
    LanguageCode = 'en-US', 
    ToxicityDetection = [ 
        { 
            'ToxicityCategories': ['ALL']
        }
    ]
)

while True:
    status = transcribe.get_transcription_job(TranscriptionJobName = job_name)
    if status['TranscriptionJob']['TranscriptionJobStatus'] in ['COMPLETED', 'FAILED']:
        break
    print("Not ready yet...")
    time.sleep(5)
print(status)
```

## Contoh Output
<a name="toxicity-using-output"></a>

 Pidato beracun ditandai dan dikategorikan dalam keluaran transkripsi Anda. Setiap contoh ucapan beracun dikategorikan dan diberi skor kepercayaan (nilai antara 0 dan 1). Nilai kepercayaan yang lebih besar menunjukkan kemungkinan yang lebih besar bahwa konten tersebut adalah ucapan beracun dalam kategori yang ditentukan. 

### Contoh keluaran (JSON)
<a name="toxicity-using-output-json"></a>

 Berikut ini adalah contoh keluaran dalam format JSON yang menunjukkan ucapan beracun yang dikategorikan dengan skor kepercayaan terkait. 

```
{
    "jobName": "{{my-toxicity-job}}",
    "accountId": "{{111122223333}}",
    "results": {
        "transcripts": [...],
        "items":[...],
        "toxicity_detection": [
            {
                "text": "What the * are you doing man? That's why I didn't want to play with your * .  man it was a no, no I'm not calming down * man. I well I spent I spent too much * money on this game.",
                "toxicity": 0.7638,
                "categories": {
                    "profanity": 0.9913,
                    "hate_speech": 0.0382,
                    "sexual": 0.0016,
                    "insult": 0.6572,
                    "violence_or_threat": 0.0024,
                    "graphic": 0.0013,
                    "harassment_or_abuse": 0.0249
                },
                "start_time": 8.92,
                "end_time": 21.45
            },
            Items removed for brevity
            {
                "text": "What? Who? What the * did you just say to me? What's your address? What is your * address? I will pull up right now on your * * man. Take your * back to , tired of this **.",
                "toxicity": 0.9816,
                "categories": {
                    "profanity": 0.9865,
                    "hate_speech": 0.9123,
                    "sexual": 0.0037,
                    "insult": 0.5447,
                    "violence_or_threat": 0.5078,
                    "graphic": 0.0037,
                    "harassment_or_abuse": 0.0613
                },
                "start_time": 43.459,
                "end_time": 54.639
            },
        ]
    },
    ...
    "status": "COMPLETED"
}
```