Created
January 6, 2019 21:08
-
-
Save raztud/3a021e2ba155638ff9be0b328261692c to your computer and use it in GitHub Desktop.
check sentiment aws
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
client = boto3.client('comprehend') | |
dataset = ["Food is good and not too expensive. Serving is just right for adult. Ambient is nice too.", | |
"Used to be good. Chicken soup was below average, bbq used to be good.", | |
"Food was good, standouts were the spicy beef soup and seafood pancake! ", | |
"Good office lunch or after work place to go to with a big group as they have a lot of private areas with large tables", | |
"As a Korean person, it was very disappointing food quality and very pricey for what you get. I won't go back there again. ", | |
"Not great quality food for the price. Average food at premium prices really.", | |
"Fast service. Prices are reasonable and food is decent.", | |
"Extremely long waiting time. Food is decent but definitely not worth the wait.", | |
"Clean premises, tasty food. My family favourites are the clear Tom yum soup, stuffed chicken wings, chargrilled squid.", | |
"really good and authentic Thai food! in particular, we loved their tom yup clear soup with sliced fish. it's so well balanced that we can have it just on its own. " | |
] | |
for text in dataset: | |
response = client.detect_sentiment( | |
Text=text, | |
LanguageCode='en' | |
) | |
print(text[:100], response['Sentiment'], response['SentimentScore']) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment