Jovian
⭐️
Sign In
In [1]:
!pip install request
!pip install bs4
Requirement already satisfied: request in /opt/anaconda3/lib/python3.7/site-packages (2019.4.13) Requirement already satisfied: setuptools in /opt/anaconda3/lib/python3.7/site-packages (from request) (41.4.0) Requirement already satisfied: get in /opt/anaconda3/lib/python3.7/site-packages (from request) (2019.4.13) Requirement already satisfied: post in /opt/anaconda3/lib/python3.7/site-packages (from request) (2019.4.13) Requirement already satisfied: query-string in /opt/anaconda3/lib/python3.7/site-packages (from get->request) (2019.4.13) Requirement already satisfied: public in /opt/anaconda3/lib/python3.7/site-packages (from query-string->get->request) (2019.4.13) Requirement already satisfied: bs4 in /opt/anaconda3/lib/python3.7/site-packages (0.0.1) Requirement already satisfied: beautifulsoup4 in /opt/anaconda3/lib/python3.7/site-packages (from bs4) (4.8.0) Requirement already satisfied: soupsieve>=1.2 in /opt/anaconda3/lib/python3.7/site-packages (from beautifulsoup4->bs4) (1.9.3)
In [2]:
import requests
from bs4 import BeautifulSoup
In [3]:
search_query="nike+women+running-shoes"
base_url="https://www.amazon.in/s?k="
In [11]:
url=base_url+search_query
print(url)
In [12]:
search_response=requests.get(url)
In [13]:
search_response.status_code
Out[13]:
503
In [14]:
search_response.text
Out[14]:
'<!DOCTYPE html>\n<!--[if lt IE 7]> <html lang="en-us" class="a-no-js a-lt-ie9 a-lt-ie8 a-lt-ie7"> <![endif]-->\n<!--[if IE 7]>    <html lang="en-us" class="a-no-js a-lt-ie9 a-lt-ie8"> <![endif]-->\n<!--[if IE 8]>    <html lang="en-us" class="a-no-js a-lt-ie9"> <![endif]-->\n<!--[if gt IE 8]><!-->\n<html class="a-no-js" lang="en-us"><!--<![endif]--><head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n<meta charset="utf-8">\n<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">\n<title dir="ltr">Robot Check</title>\n<meta name="viewport" content="width=device-width">\n<link rel="stylesheet" href="https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUI-3c913031596ca78a3768f4e934b1cc02ce238101.secure.min._V1_.css">\n<script>\n\nif (true === true) {\n    var ue_t0 = (+ new Date()),\n        ue_csm = window,\n        ue = { t0: ue_t0, d: function() { return (+new Date() - ue_t0); } },\n        ue_furl = "fls-eu.amazon.in",\n        ue_mid = "A21TJRUUN4KGV",\n        ue_sid = (document.cookie.match(/session-id=([0-9-]+)/) || [])[1],\n        ue_sn = "opfcaptcha.amazon.in",\n        ue_id = \'VV312A2ECR028TYWZ5MH\';\n}\n</script>\n</head>\n<body>\n\n<!--\n        To discuss automated access to Amazon data please contact api-services-support@amazon.com.\n        For information about migrating to our APIs refer to our Marketplace APIs at https://developer.amazonservices.in/ref=rm_c_sv, or our Product Advertising API at https://affiliate-program.amazon.in/gp/advertising/api/detail/main.html/ref=rm_c_ac for advertising use cases.\n-->\n\n<!--\nCorreios.DoNotSend\n-->\n\n<div class="a-container a-padding-double-large" style="min-width:350px;padding:44px 0 !important">\n\n    <div class="a-row a-spacing-double-large" style="width: 350px; margin: 0 auto">\n\n        <div class="a-row a-spacing-medium a-text-center"><i class="a-icon a-logo"></i></div>\n\n        <div class="a-box a-alert a-alert-info a-spacing-base">\n            <div class="a-box-inner">\n                <i class="a-icon a-icon-alert"></i>\n                <h4>Enter the characters you see below</h4>\n                <p class="a-last">Sorry, we just need to make sure you\'re not a robot. For best results, please make sure your browser is accepting cookies.</p>\n                </div>\n            </div>\n\n            <div class="a-section">\n\n                <div class="a-box a-color-offset-background">\n                    <div class="a-box-inner a-padding-extra-large">\n\n                        <form method="get" action="/errors/validateCaptcha" name="">\n                            <input type=hidden name="amzn" value="LMA/tdlA4wfdjOE8JGhYDQ==" /><input type=hidden name="amzn-r" value="&#047;s?k&#061;nike&#043;women&#043;running&#045;shoes" />\n                            <div class="a-row a-spacing-large">\n                                <div class="a-box">\n                                    <div class="a-box-inner">\n                                        <h4>Type the characters you see in this image:</h4>\n                                        <!-- For automated access to price change or offer listing change events,\n                                             please refer to the MWS Subscription API:\n                                             https://developer.amazonservices.in/gp/mws/api.html/276-5247872-0590350?ie=UTF8&section=subscriptions&group=subscriptions&version=latest\n                                        -->\n                                        <div class="a-row a-text-center">\n                                            <img src="https://images-na.ssl-images-amazon.com/captcha/derqnxxq/Captcha_wrwyfoueys.jpg">\n                                        </div>\n                                        <div class="a-row a-spacing-base">\n                                            <div class="a-row">\n                                                <div class="a-column a-span6">\n                                                </div>\n                                                <div class="a-column a-span6 a-span-last a-text-right">\n                                                    <a onclick="window.location.reload()">Try different image</a>\n                                                </div>\n                                            </div>\n                                            <input autocomplete="off" spellcheck="false" placeholder="Type characters" id="captchacharacters" name="field-keywords" class="a-span12" autocapitalize="off" autocorrect="off" type="text">\n                                        </div>\n                                    </div>\n                                </div>\n                            </div>\n\n                            <div class="a-section a-spacing-extra-large">\n\n                                <div class="a-row">\n                                    <span class="a-button a-button-primary a-span12">\n                                        <span class="a-button-inner">\n                                            <button type="submit" class="a-button-text">Continue shopping</button>\n                                        </span>\n                                    </span>\n                                </div>\n\n                            </div>\n                        </form>\n\n                    </div>\n                </div>\n\n            </div>\n\n        </div>\n\n        <div class="a-divider a-divider-section"><div class="a-divider-inner"></div></div>\n\n        <div class="a-text-center a-spacing-small a-size-mini">\n            <a href="https://www.amazon.in/gp/help/customer/display.html/ref=footer_cou?ie=UTF8&nodeId=200545940">Conditions of Use &amp; Sale</a>\n            <span class="a-letter-space"></span>\n            <span class="a-letter-space"></span>\n            <span class="a-letter-space"></span>\n            <span class="a-letter-space"></span>\n            <a href="https://www.amazon.in/gp/help/customer/display.html/ref=footer_privacy?ie=UTF8&nodeId=200534380">Privacy Notice</a>\n        </div>\n\n        <div class="a-text-center a-size-mini a-color-secondary">\n          &copy; 1996-2015, Amazon.com, Inc. or its affiliates\n          <script>\n           if (true === true) {\n             document.write(\'<img src="https://fls-eu.amaz\'+\'on.in/\'+\'1/oc-csi/1/OP/requestId=VV312A2ECR028TYWZ5MH&js=1" />\');\n           };\n          </script>\n          <noscript>\n            <img src="https://fls-eu.amazon.in/1/oc-csi/1/OP/requestId=VV312A2ECR028TYWZ5MH&js=0" />\n          </noscript>\n        </div>\n    </div>\n    <script>\n    if (true === true) {\n        var elem = document.createElement("script");\n        elem.src = "https://images-eu.ssl-images-amazon.com/images/G/01/csminstrumentation/csm-captcha-instrumentation.min._V" + (+ new Date()) + "_.js";\n        document.getElementsByTagName(\'head\')[0].appendChild(elem);\n    }\n    </script>\n</body></html>\n'
In [15]:
headers={'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36'}
In [16]:
search_response=requests.get(url,headers=headers)
In [17]:
search_response.status_code
Out[17]:
200
In [18]:
search_response.text
Out[18]:
'<!DOCTYPE html>\n<!--[if lt IE 7]> <html lang="en-us" class="a-no-js a-lt-ie9 a-lt-ie8 a-lt-ie7"> <![endif]-->\n<!--[if IE 7]>    <html lang="en-us" class="a-no-js a-lt-ie9 a-lt-ie8"> <![endif]-->\n<!--[if IE 8]>    <html lang="en-us" class="a-no-js a-lt-ie9"> <![endif]-->\n<!--[if gt IE 8]><!-->\n<html class="a-no-js" lang="en-us"><!--<![endif]--><head>\n<meta http-equiv="content-type" content="text/html; charset=UTF-8">\n<meta charset="utf-8">\n<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">\n<title dir="ltr">Robot Check</title>\n<meta name="viewport" content="width=device-width">\n<link rel="stylesheet" href="https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUI-3c913031596ca78a3768f4e934b1cc02ce238101.secure.min._V1_.css">\n<script>\n\nif (true === true) {\n    var ue_t0 = (+ new Date()),\n        ue_csm = window,\n        ue = { t0: ue_t0, d: function() { return (+new Date() - ue_t0); } },\n        ue_furl = "fls-eu.amazon.in",\n        ue_mid = "A21TJRUUN4KGV",\n        ue_sid = (document.cookie.match(/session-id=([0-9-]+)/) || [])[1],\n        ue_sn = "opfcaptcha.amazon.in",\n        ue_id = \'9BS82PBW28YRXRC65JT0\';\n}\n</script>\n</head>\n<body>\n\n<!--\n        To discuss automated access to Amazon data please contact api-services-support@amazon.com.\n        For information about migrating to our APIs refer to our Marketplace APIs at https://developer.amazonservices.in/ref=rm_c_sv, or our Product Advertising API at https://affiliate-program.amazon.in/gp/advertising/api/detail/main.html/ref=rm_c_ac for advertising use cases.\n-->\n\n<!--\nCorreios.DoNotSend\n-->\n\n<div class="a-container a-padding-double-large" style="min-width:350px;padding:44px 0 !important">\n\n    <div class="a-row a-spacing-double-large" style="width: 350px; margin: 0 auto">\n\n        <div class="a-row a-spacing-medium a-text-center"><i class="a-icon a-logo"></i></div>\n\n        <div class="a-box a-alert a-alert-info a-spacing-base">\n            <div class="a-box-inner">\n                <i class="a-icon a-icon-alert"></i>\n                <h4>Enter the characters you see below</h4>\n                <p class="a-last">Sorry, we just need to make sure you\'re not a robot. For best results, please make sure your browser is accepting cookies.</p>\n                </div>\n            </div>\n\n            <div class="a-section">\n\n                <div class="a-box a-color-offset-background">\n                    <div class="a-box-inner a-padding-extra-large">\n\n                        <form method="get" action="/errors/validateCaptcha" name="">\n                            <input type=hidden name="amzn" value="/VczRyIHU2StmtNh187JPw==" /><input type=hidden name="amzn-r" value="&#047;s?k&#061;nike&#043;women&#043;running&#045;shoes" />\n                            <div class="a-row a-spacing-large">\n                                <div class="a-box">\n                                    <div class="a-box-inner">\n                                        <h4>Type the characters you see in this image:</h4>\n                                        <!-- For automated access to price change or offer listing change events,\n                                             please refer to the MWS Subscription API:\n                                             https://developer.amazonservices.in/gp/mws/api.html/276-5247872-0590350?ie=UTF8&section=subscriptions&group=subscriptions&version=latest\n                                        -->\n                                        <div class="a-row a-text-center">\n                                            <img src="https://images-na.ssl-images-amazon.com/captcha/wxvwzfzh/Captcha_efzstuifnq.jpg">\n                                        </div>\n                                        <div class="a-row a-spacing-base">\n                                            <div class="a-row">\n                                                <div class="a-column a-span6">\n                                                </div>\n                                                <div class="a-column a-span6 a-span-last a-text-right">\n                                                    <a onclick="window.location.reload()">Try different image</a>\n                                                </div>\n                                            </div>\n                                            <input autocomplete="off" spellcheck="false" placeholder="Type characters" id="captchacharacters" name="field-keywords" class="a-span12" autocapitalize="off" autocorrect="off" type="text">\n                                        </div>\n                                    </div>\n                                </div>\n                            </div>\n\n                            <div class="a-section a-spacing-extra-large">\n\n                                <div class="a-row">\n                                    <span class="a-button a-button-primary a-span12">\n                                        <span class="a-button-inner">\n                                            <button type="submit" class="a-button-text">Continue shopping</button>\n                                        </span>\n                                    </span>\n                                </div>\n\n                            </div>\n                        </form>\n\n                    </div>\n                </div>\n\n            </div>\n\n        </div>\n\n        <div class="a-divider a-divider-section"><div class="a-divider-inner"></div></div>\n\n        <div class="a-text-center a-spacing-small a-size-mini">\n            <a href="https://www.amazon.in/gp/help/customer/display.html/ref=footer_cou?ie=UTF8&nodeId=200545940">Conditions of Use &amp; Sale</a>\n            <span class="a-letter-space"></span>\n            <span class="a-letter-space"></span>\n            <span class="a-letter-space"></span>\n            <span class="a-letter-space"></span>\n            <a href="https://www.amazon.in/gp/help/customer/display.html/ref=footer_privacy?ie=UTF8&nodeId=200534380">Privacy Notice</a>\n        </div>\n\n        <div class="a-text-center a-size-mini a-color-secondary">\n          &copy; 1996-2015, Amazon.com, Inc. or its affiliates\n          <script>\n           if (true === true) {\n             document.write(\'<img src="https://fls-eu.amaz\'+\'on.in/\'+\'1/oc-csi/1/OP/requestId=9BS82PBW28YRXRC65JT0&js=1" />\');\n           };\n          </script>\n          <noscript>\n            <img src="https://fls-eu.amazon.in/1/oc-csi/1/OP/requestId=9BS82PBW28YRXRC65JT0&js=0" />\n          </noscript>\n        </div>\n    </div>\n    <script>\n    if (true === true) {\n        var elem = document.createElement("script");\n        elem.src = "https://images-eu.ssl-images-amazon.com/images/G/01/csminstrumentation/csm-captcha-instrumentation.min._V" + (+ new Date()) + "_.js";\n        document.getElementsByTagName(\'head\')[0].appendChild(elem);\n    }\n    </script>\n</body></html>\n'
In [19]:
soup=BeautifulSoup(search_response.content)
In [20]:
soup.prettify
Out[20]:
<bound method Tag.prettify of <!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en-us" class="a-no-js a-lt-ie9 a-lt-ie8 a-lt-ie7"> <![endif]--><!--[if IE 7]>    <html lang="en-us" class="a-no-js a-lt-ie9 a-lt-ie8"> <![endif]--><!--[if IE 8]>    <html lang="en-us" class="a-no-js a-lt-ie9"> <![endif]--><!--[if gt IE 8]><!--><html class="a-no-js" lang="en-us"><!--<![endif]--><head>
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<meta charset="utf-8"/>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
<title dir="ltr">Robot Check</title>
<meta content="width=device-width" name="viewport"/>
<link href="https://images-na.ssl-images-amazon.com/images/G/01/AUIClients/AmazonUI-3c913031596ca78a3768f4e934b1cc02ce238101.secure.min._V1_.css" rel="stylesheet"/>
<script>

if (true === true) {
    var ue_t0 = (+ new Date()),
        ue_csm = window,
        ue = { t0: ue_t0, d: function() { return (+new Date() - ue_t0); } },
        ue_furl = "fls-eu.amazon.in",
        ue_mid = "A21TJRUUN4KGV",
        ue_sid = (document.cookie.match(/session-id=([0-9-]+)/) || [])[1],
        ue_sn = "opfcaptcha.amazon.in",
        ue_id = '9BS82PBW28YRXRC65JT0';
}
</script>
</head>
<body>
<!--
        To discuss automated access to Amazon data please contact api-services-support@amazon.com.
        For information about migrating to our APIs refer to our Marketplace APIs at https://developer.amazonservices.in/ref=rm_c_sv, or our Product Advertising API at https://affiliate-program.amazon.in/gp/advertising/api/detail/main.html/ref=rm_c_ac for advertising use cases.
-->
<!--
Correios.DoNotSend
-->
<div class="a-container a-padding-double-large" style="min-width:350px;padding:44px 0 !important">
<div class="a-row a-spacing-double-large" style="width: 350px; margin: 0 auto">
<div class="a-row a-spacing-medium a-text-center"><i class="a-icon a-logo"></i></div>
<div class="a-box a-alert a-alert-info a-spacing-base">
<div class="a-box-inner">
<i class="a-icon a-icon-alert"></i>
<h4>Enter the characters you see below</h4>
<p class="a-last">Sorry, we just need to make sure you're not a robot. For best results, please make sure your browser is accepting cookies.</p>
</div>
</div>
<div class="a-section">
<div class="a-box a-color-offset-background">
<div class="a-box-inner a-padding-extra-large">
<form action="/errors/validateCaptcha" method="get" name="">
<input name="amzn" type="hidden" value="/VczRyIHU2StmtNh187JPw=="/><input name="amzn-r" type="hidden" value="/s?k=nike+women+running-shoes"/>
<div class="a-row a-spacing-large">
<div class="a-box">
<div class="a-box-inner">
<h4>Type the characters you see in this image:</h4>
<!-- For automated access to price change or offer listing change events,
                                             please refer to the MWS Subscription API:
                                             https://developer.amazonservices.in/gp/mws/api.html/276-5247872-0590350?ie=UTF8&section=subscriptions&group=subscriptions&version=latest
                                        -->
<div class="a-row a-text-center">
<img src="https://images-na.ssl-images-amazon.com/captcha/wxvwzfzh/Captcha_efzstuifnq.jpg"/>
</div>
<div class="a-row a-spacing-base">
<div class="a-row">
<div class="a-column a-span6">
</div>
<div class="a-column a-span6 a-span-last a-text-right">
<a onclick="window.location.reload()">Try different image</a>
</div>
</div>
<input autocapitalize="off" autocomplete="off" autocorrect="off" class="a-span12" id="captchacharacters" name="field-keywords" placeholder="Type characters" spellcheck="false" type="text"/>
</div>
</div>
</div>
</div>
<div class="a-section a-spacing-extra-large">
<div class="a-row">
<span class="a-button a-button-primary a-span12">
<span class="a-button-inner">
<button class="a-button-text" type="submit">Continue shopping</button>
</span>
</span>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="a-divider a-divider-section"><div class="a-divider-inner"></div></div>
<div class="a-text-center a-spacing-small a-size-mini">
<a href="https://www.amazon.in/gp/help/customer/display.html/ref=footer_cou?ie=UTF8&amp;nodeId=200545940">Conditions of Use &amp; Sale</a>
<span class="a-letter-space"></span>
<span class="a-letter-space"></span>
<span class="a-letter-space"></span>
<span class="a-letter-space"></span>
<a href="https://www.amazon.in/gp/help/customer/display.html/ref=footer_privacy?ie=UTF8&amp;nodeId=200534380">Privacy Notice</a>
</div>
<div class="a-text-center a-size-mini a-color-secondary">
          © 1996-2015, Amazon.com, Inc. or its affiliates
          <script>
           if (true === true) {
             document.write('<img src="https://fls-eu.amaz'+'on.in/'+'1/oc-csi/1/OP/requestId=9BS82PBW28YRXRC65JT0&js=1" />');
           };
          </script>
<noscript>
<img src="https://fls-eu.amazon.in/1/oc-csi/1/OP/requestId=9BS82PBW28YRXRC65JT0&amp;js=0"/>
</noscript>
</div>
</div>
<script>
    if (true === true) {
        var elem = document.createElement("script");
        elem.src = "https://images-eu.ssl-images-amazon.com/images/G/01/csminstrumentation/csm-captcha-instrumentation.min._V" + (+ new Date()) + "_.js";
        document.getElementsByTagName('head')[0].appendChild(elem);
    }
    </script>
</body></html>
>
In [21]:
soup.title
Out[21]:
<title dir="ltr">Robot Check</title>
In [22]:
soup.find("span",attrs={'class':'a-size-base-plus a-color-base a-text-normal'})
In [23]:
product_list_tag=soup.findAll("span",attrs={'class':'a-size-base-plus a-color-base a-text-normal'})
In [24]:
product_list_tag
Out[24]:
[]
In [25]:
product_tag=product_list_tag[0]
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-25-2fe4843124b4> in <module> ----> 1 product_tag=product_list_tag[0] IndexError: list index out of range
In [26]:
product_tag=product_list_tag[1]
--------------------------------------------------------------------------- IndexError Traceback (most recent call last) <ipython-input-26-6cda4dcd6925> in <module> ----> 1 product_tag=product_list_tag[1] IndexError: list index out of range
In [27]:
product_tag
--------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-27-75588414b38d> in <module> ----> 1 product_tag NameError: name 'product_tag' is not defined
In [28]:
product_list=[]
for i in range(len(product_list_tag)):
    product_list.append(product_list_tag[i].text)
In [29]:
product_list
Out[29]:
[]
In [30]:
soup.find("span",attrs={'class':'a-price-symbol'})
In [31]:
soup.find("span",attrs={'class':'a-price-whole'})
In [32]:
p=product_list_tag=soup.findAll("span",attrs={'class':'a-price-whole'})
In [33]:
p
Out[33]:
[]
In [34]:
s=product_list_tag=soup.find("span",attrs={'class':'a-price-symbol'})
In [35]:
product_list=[]
for i in range(len(p)):
    product_list.append(s+p[i].text)
In [36]:
import string
from nltk.corpus import stopwords
from nltk import PorterStemmer as Stemmer
In [37]:
stopwords=stopwords.words("english")
In [38]:
import matplotlib.pyplot as plt
import seaborn as sns
In [39]:
stopwords
Out[39]:
['i',
 'me',
 'my',
 'myself',
 'we',
 'our',
 'ours',
 'ourselves',
 'you',
 "you're",
 "you've",
 "you'll",
 "you'd",
 'your',
 'yours',
 'yourself',
 'yourselves',
 'he',
 'him',
 'his',
 'himself',
 'she',
 "she's",
 'her',
 'hers',
 'herself',
 'it',
 "it's",
 'its',
 'itself',
 'they',
 'them',
 'their',
 'theirs',
 'themselves',
 'what',
 'which',
 'who',
 'whom',
 'this',
 'that',
 "that'll",
 'these',
 'those',
 'am',
 'is',
 'are',
 'was',
 'were',
 'be',
 'been',
 'being',
 'have',
 'has',
 'had',
 'having',
 'do',
 'does',
 'did',
 'doing',
 'a',
 'an',
 'the',
 'and',
 'but',
 'if',
 'or',
 'because',
 'as',
 'until',
 'while',
 'of',
 'at',
 'by',
 'for',
 'with',
 'about',
 'against',
 'between',
 'into',
 'through',
 'during',
 'before',
 'after',
 'above',
 'below',
 'to',
 'from',
 'up',
 'down',
 'in',
 'out',
 'on',
 'off',
 'over',
 'under',
 'again',
 'further',
 'then',
 'once',
 'here',
 'there',
 'when',
 'where',
 'why',
 'how',
 'all',
 'any',
 'both',
 'each',
 'few',
 'more',
 'most',
 'other',
 'some',
 'such',
 'no',
 'nor',
 'not',
 'only',
 'own',
 'same',
 'so',
 'than',
 'too',
 'very',
 's',
 't',
 'can',
 'will',
 'just',
 'don',
 "don't",
 'should',
 "should've",
 'now',
 'd',
 'll',
 'm',
 'o',
 're',
 've',
 'y',
 'ain',
 'aren',
 "aren't",
 'couldn',
 "couldn't",
 'didn',
 "didn't",
 'doesn',
 "doesn't",
 'hadn',
 "hadn't",
 'hasn',
 "hasn't",
 'haven',
 "haven't",
 'isn',
 "isn't",
 'ma',
 'mightn',
 "mightn't",
 'mustn',
 "mustn't",
 'needn',
 "needn't",
 'shan',
 "shan't",
 'shouldn',
 "shouldn't",
 'wasn',
 "wasn't",
 'weren',
 "weren't",
 'won',
 "won't",
 'wouldn',
 "wouldn't"]
In [41]:
import spacy
In [43]:
!pip install vaderSentiment
Collecting vaderSentiment Downloading https://files.pythonhosted.org/packages/86/9e/c53e1fc61aac5ee490a6ac5e21b1ac04e55a7c2aba647bb8411c9aadf24e/vaderSentiment-3.2.1-py2.py3-none-any.whl (125kB) |████████████████████████████████| 133kB 58kB/s eta 0:00:01 Installing collected packages: vaderSentiment Successfully installed vaderSentiment-3.2.1
In [44]:
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
analyzer= SentimentIntensityAnalyzer()
In [45]:
def sentiment_analyzer_scores(sentence):
    score = analyzer.polarity_scores(sentence)
    return score
In [46]:
t=(sentiment_analyzer_scores("nice watch expect economic deliver day thank amazon"))
In [47]:
t.values()
Out[47]:
dict_values([0.0, 0.417, 0.583, 0.7184])
In [ ]: