Comprehending text

Introducción a AWS Boto en Python

Maksim Pecherskiy

Data engineer

AWS Translate console

AWS translate console

Introducción a AWS Boto en 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')
Introducción a AWS Boto en Python

Translating text

Translating text

Introducción a AWS Boto en Python

Translating text

translated_text = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')['TranslatedText']
Introducción a AWS Boto en 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.")
Introducción a AWS Boto en Python

Detecting language

Detecting language

Introducción a AWS Boto en Python

Understanding sentiment

Understanding sentiment

Introducción a AWS Boto en Python

Understanding sentiment

Detect text sentiment

response = comprehend.detect_sentiment(
  Text="DataCamp students are amazing.", 
  LanguageCode='en')
Introducción a AWS Boto en Python

Understanding sentiment

Understanding sentiment

Introducción a AWS Boto en Python

Understanding sentiment

sentiment = comprehend.detect_sentiment(
  Text='Maksim is amazing.', 
  LanguageCode='en')['Sentiment']
Introducción a AWS Boto en 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')
Introducción a AWS Boto en 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.")
Introducción a AWS Boto en Python

Review

Detect text sentiment

response = comprehend.detect_sentiment(
  Text="Maksim is amazing.", 
  LanguageCode='en')
Introducción a AWS Boto en Python

Let's practice!

Introducción a AWS Boto en Python

Preparing Video For Download...