理解文字

Python 中的 AWS Boto 入門

Maksim Pecherskiy

Data engineer

AWS Translate 主控台

AWS Translate 主控台

Python 中的 AWS Boto 入門

翻譯文字

初始化用戶端

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

翻譯文字

response = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')
Python 中的 AWS Boto 入門

翻譯文字

翻譯文字

Python 中的 AWS Boto 入門

翻譯文字

translated_text = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')['TranslatedText']
Python 中的 AWS Boto 入門

偵測語言

初始化 boto3 Comprehend 用戶端

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

偵測主要語言

response = comprehend.detect_dominant_language(
  Text="Hay basura por todas partes a lo largo de la carretera.")
Python 中的 AWS Boto 入門

偵測語言

偵測語言

Python 中的 AWS Boto 入門

理解情感

情感分析

Python 中的 AWS Boto 入門

理解情感

偵測文字情感

response = comprehend.detect_sentiment(
  Text="DataCamp students are amazing.", 
  LanguageCode='en')
Python 中的 AWS Boto 入門

理解情感

情感分析

Python 中的 AWS Boto 入門

理解情感

sentiment = comprehend.detect_sentiment(
  Text='Maksim is amazing.', 
  LanguageCode='en')['Sentiment']
Python 中的 AWS Boto 入門

重點回顧

初始化用戶端

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

翻譯文字

response = translate.translate_text(
    Text='Hello, how are you?', 
    SourceLanguageCode='auto', 
    TargetLanguageCode='es')
Python 中的 AWS Boto 入門

重點回顧

初始化 boto3 Comprehend 用戶端

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

偵測主要語言

response = comprehend.detect_dominant_language(
  Text="Hay basura por todas partes a lo largo de la carretera.")
Python 中的 AWS Boto 入門

重點回顧

偵測文字情感

response = comprehend.detect_sentiment(
  Text="Maksim is amazing.", 
  LanguageCode='en')
Python 中的 AWS Boto 入門

一起來練習吧!

Python 中的 AWS Boto 入門

Preparing Video For Download...