LoginSignup
1

More than 1 year has passed since last update.

Amazon Comprehendの使い方メモ

Last updated at Posted at 2022-02-10

Amazon Comprehendの使い方メモ

◆AWSのIAMでcomprehendへのアクセス権限を付与しておく
↓検索窓で「IAM」を検索&押下
image.png

↓左ペインの「ユーザ」
 「アクセス権限の追加」押下
image.png

「既存のポリシーに・・・」を選択
image.png

「ComprehendFullAccess」を検索
「次のステップ:確認」押下
image.png

「アクセス権限の追加」押下
image.png

◆pythonでamazon comprehend実行
anaconda起動
anacondaのjupyter notebook起動

image.png

以下を入力して実行(RUN押下)

import boto3
import json

client = boto3.client('comprehend', region_name='us-east-1')

text = '空気階段の踊り場が大好きです'

response = client.detect_dominant_language(Text=text)
print(json.dumps(response, indent=2))

image.png

以上😊っす!

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1