- Newest
- Most votes
- Most comments
Here's a sample Python script that demonstrates how to enable automatic language identification:
`import boto3 import json import os
Define the required parameters
language_options = ['en-US', 'es-US'] # Define the possible languages you want to identify media_sample_rate_hz = 16000 # Common sample rate for streaming audio media_encoding = 'pcm' # Encoding type for the audio stream
Create a client for the Transcribe service
transcribe_client = boto3.client('transcribe')
Start the transcription stream with automatic language identification enabled
response = transcribe_client.start_stream_transcription( LanguageCode='auto', MediaSampleRateHertz=media_sample_rate_hz, MediaEncoding=media_encoding, IdentifyLanguage=True, # Enable automatic language identification LanguageOptions=language_options, # Provide a list of potential languages VocabularyName=None, SessionId='my-session-id', EnablePartialResultsStabilization=True, PartialResultsStability='medium', ShowSpeakerLabel=False, EnableChannelIdentification=False, NumberOfChannels=1, VocabularyFilterMethod='mask', VocabularyFilterName=None, LanguageModelName=None )
Print the response to check the status of the transcription stream
print(json.dumps(response, indent=4)) `
Relevant content
- asked a year ago
- asked 6 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 2 months ago
HI ehsanonyx, I got the error 'start_stream_transcription() got an unexpected keyword argument 'IdentifyLanguage'. I referred to https://docs.aws.amazon.com/transcribe/latest/dg/getting-started-sdk.html and added the 'IdentifyLanguage' you mentioned, but then I got this error.