<commit_before>ACCESS_KEY_ID = "<KEY>"
SECRET_KEY = "<KEY>"
ASSOC_TAG = "pst037-20"

import bottlenose
from lxml import objectify
from amazon.api import AmazonAPI
import amazon_scraper
import json
from pprint import pprint

amazon = AmazonAPI(ACCESS_KEY_ID, SECRET_KEY, ASSOC_TAG)
#search_item=raw_input()
search_item='nail cutter'
products = amazon.search_n(5, Keywords=search_item, SearchIndex='All')
#products=products[0:10]
asinlist=[]
for product in products:
	asinlist.append(product.asin)
	print product.title

#amazon.call(asinlist[0])
amazon_scraper.ReadAsin(asinlist)

data=open('data.json','r')
reviews = json.loads(data.read())
data.close()
#pprint(reviews)
#a=reviews[1]['reviews'][0]
#print a['review_text']
review_list=[]
a=reviews[0]['reviews'][0]
print len(a)
#print reviews[4]['reviews'][4]['review_text']
count =1
for i in range(5):
	for j in range(len(reviews[i]['reviews'])):
		print count,reviews[i]['reviews'][j]['review_text']
		count=count+1

<commit_msg>Fuuusionn Haaaa!<commit_after>ACCESS_KEY_ID = "<KEY>"
SECRET_KEY = "<KEY>"
ASSOC_TAG = "pst037-20"

import bottlenose
from lxml import objectify
from amazon.api import AmazonAPI
import amazon_scraper
import json
from pprint import pprint
from textblob import TextBlob
from nltk import sent_tokenize

amazon = AmazonAPI(ACCESS_KEY_ID, SECRET_KEY, ASSOC_TAG)
#search_item=raw_input()
search_item='iphone 6'
products = amazon.search_n(5, Keywords=search_item, SearchIndex='All')
#products=products[0:10]
asinlist=[]
for product in products:
	asinlist.append(product.asin)
	print product.title

#amazon.call(asinlist[0])
#amazon_scraper.ReadAsin(asinlist)

data=open('data.json','r')
reviews = json.loads(data.read())
data.close()
#pprint(reviews)
#a=reviews[1]['reviews'][0]
#print a['review_text']
review_list=[]
a=reviews[0]['reviews'][0]
#print reviews[4]['reviews'][4]['review_text']
count =0
for i in range(5):
	for j in range(len(reviews[i]['reviews'])):
		#print count,reviews[i]['reviews'][j]['review_text']
		review_list.append(reviews[i]['reviews'][j]['review_text'])
		count=count+1


n=0
review_count=0
total=[]

for i in review_list:
	review=sent_tokenize(i)
	pos=[]
	count=0
	for line in review:
		line=TextBlob(line)
		count=count+1
		pos.append(line.sentiment.polarity)

	polar_mean=0
	for j in pos:
		polar_mean=polar_mean+j
	polar_mean=polar_mean/count

	print i
	print ("Positivity for review"+ "= " + str(polar_mean*100) +"%"+"\n")
	total.append(polar_mean*100)
	n=n+1
overall_score=0
for i in total:
	overall_score=overall_score+i
overall_score=overall_score/(n)
print("Overall user satisfaction for this product: "+ str(overall_score) +"%")

{'fraction_non_alphanumeric': 0.15378787878787878, 'fraction_numerical': 0.019696969696969695, 'mean_word_length': 7.745033112582782, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3970073', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1032, 'n_words': 202}