Comprehending text

Introduction to AWS Boto in Python

Maksim Pecherskiy

Data engineer

AWS Translate console

AWS translate console

Introduction to AWS Boto in Python

Translating text

Initialize client

translate = boto3.client('translate', 
    region_name='us-east-1', 
    aws_access_key_id=AWS_KEY_ID, aws_secret_access_key=AWS_SECRET)

Translate text

response = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')
Introduction to AWS Boto in Python

Translating text

Translating text

Introduction to AWS Boto in Python

Translating text

translated_text = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')['TranslatedText']
Introduction to AWS Boto in Python

Detecting language

Initialize boto3 Comprehend client

comprehend = boto3.client('comprehend', 
    region_name='us-east-1', 
    aws_access_key_id=AWS_KEY_ID, aws_secret_access_key=AWS_SECRET)

Detect dominant language

response = comprehend.detect_dominant_language(
  Text="Hay basura por todas partes a lo largo de la carretera.")
Introduction to AWS Boto in Python

Detecting language

Detecting language

Introduction to AWS Boto in Python

Understanding sentiment

Understanding sentiment

Introduction to AWS Boto in Python

Understanding sentiment

Detect text sentiment

response = comprehend.detect_sentiment(
  Text="DataCamp students are amazing.", 
  LanguageCode='en')
Introduction to AWS Boto in Python

Understanding sentiment

Understanding sentiment

Introduction to AWS Boto in Python

Understanding sentiment

sentiment = comprehend.detect_sentiment(
  Text='Maksim is amazing.', 
  LanguageCode='en')['Sentiment']
Introduction to AWS Boto in Python

Review

Initialize client

translate = boto3.client('translate', 
    region_name='us-east-1', 
    aws_access_key_id=AWS_KEY_ID, aws_secret_access_key=AWS_SECRET)

Translate text

response = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')
Introduction to AWS Boto in Python

Review

Initialize boto3 Comprehend client

comprehend = boto3.client('comprehend', 
    region_name='us-east-1', 
    aws_access_key_id=AWS_KEY_ID, aws_secret_access_key=AWS_SECRET)

Detect dominant language

response = comprehend.detect_dominant_language(
  Text="Hay basura por todas partes a lo largo de la carretera.")
Introduction to AWS Boto in Python

Review

Detect text sentiment

response = comprehend.detect_sentiment(
  Text="Maksim is amazing.", 
  LanguageCode='en')
Introduction to AWS Boto in Python

Let's practice!

Introduction to AWS Boto in Python

Preparing Video For Download...