from IPython.core.display import display, HTML
import mwapi
import re
import pymysql
import os
from collections import OrderedDict
from nltk.stem import PorterStemmer
!python -m spacy download en
Collecting https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz
  Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.0.0/en_core_web_sm-2.0.0.tar.gz (37.4MB)
    100% |████████████████████████████████| 37.4MB 20.8MB/s ta 0:00:01    30% |█████████▉                      | 11.5MB 31.1MB/s eta 0:00:01    42% |█████████████▊                  | 16.0MB 20.3MB/s eta 0:00:02    61% |███████████████████▊            | 23.0MB 20.6MB/s eta 0:00:01
Installing collected packages: en-core-web-sm
  Running setup.py install for en-core-web-sm ... done
Successfully installed en-core-web-sm-2.0.0

    Linking successful
    /srv/paws/lib/python3.6/site-packages/en_core_web_sm -->
    /srv/paws/lib/python3.6/site-packages/spacy/data/en

    You can now load the model via spacy.load('en')

session = mwapi.Session('https://en.wikipedia.org', 'mwapi (python) -- default user-agent')
prog = re.compile(r'\b([a-zA-Z]+|\-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[Ee][+-]?\d+)?)\b')
nlp = spacy.load('en')
doc2 = nlp(LONG_NEWS_ARTICLE)
displacy.render(doc2, style='ent')
options = {'compact': True, 'color': 'blue'}
page = session.get(action='query',format='json',titles="Kantian_ethics",prop='extracts',explaintext='false',exsectionformat='plain',exlimit='1')['query']['pages']

them = {}

uniqueWords = 0
repeatedWords = 0
sumz = 0

for n in page:
    article = page[n]['extract']
    for word in nltk.tokenize.word_tokenize(article):
        sumz += len(word)
        stem = nltk.stem.PorterStemmer().stem(word).lower()
        
        if stem not in them:
            them[stem] = []
        
        if word.lower() not in them[stem]:
            uniqueWords += 1
            them[stem].append(word.lower())
        else:
            repeatedWords += 1
        
    #results = re.findall(prog, article)
    #doc = nlp(article)
    #print(doc.sentiment)
    #for sent in doc.sents:
        #display(HTML(displacy.render(sent.as_doc(), style='dep')))
    
    #for result in list(OrderedDict.fromkeys(results)):
        #count = len(re.findall(result, page[n]['extract']))
        #if count > 1:
            #them[result] = count

print(round(len(them) / sumz * 100 * 1e2) / 1e2, '%', uniqueWords / (uniqueWords + repeatedWords))
3.22 % 0.19216664221798446
conn = pymysql.connect(
    host=os.environ['MYSQL_HOST'],
    user=os.environ['MYSQL_USERNAME'],
    password=os.environ['MYSQL_PASSWORD'],
    database='enwiki_p',
    charset='utf8'
)
with conn.cursor() as cur:
    cur.execute('use enwiki_p')
    cur.execute("""SELECT * from user where user_name = '10.68.23.135'""")
    jtmorgan = cur.fetchall()
    cur.execute("""SELECT * from user where user_name = 'HostBot'""")
    hostbot = cur.fetchall()
    print(jtmorgan)
    print(hostbot)
()
((16596082, b'HostBot', b'', None, None, None, None, None, None, None, None, None, b'20120404202435', None, 258567, None),)
username = jtmorgan[0][1]
#decode byte string to UTF to make it compatible with most other strings you'll be using
print(username.decode("utf8") + ' is great')
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-70-30d2e29e9706> in <module>()
----> 1 username = jtmorgan[0][1]
      2 #decode byte string to UTF to make it compatible with most other strings you'll be using
      3 print(username.decode("utf8") + ' is great')

IndexError: tuple index out of range
#you can access the CSCW workshop datasets, including the Teahouse dataset
conn2 = pymysql.connect(
    host=os.environ['MYSQL_HOST'],
    user=os.environ['MYSQL_USERNAME'],
    password=os.environ['MYSQL_PASSWORD'],
    database='datasets_p',
    charset='utf8' #doesn't actually do anything right now. still returns byte strings
)
with conn2.cursor() as cur:
    cur.execute('use datasets_p')
    cur.execute('show tables')
    dbs = cur.fetchall()
    print(dbs)
---------------------------------------------------------------------------
OperationalError                          Traceback (most recent call last)
<ipython-input-65-6f1cc64d9fc3> in <module>()
      1 with conn2.cursor() as cur:
----> 2     cur.execute('use datasets_p')
      3     cur.execute('show tables')
      4     dbs = cur.fetchall()
      5     print(dbs)

/srv/paws/lib/python3.6/site-packages/pymysql/cursors.py in execute(self, query, args)
    163         query = self.mogrify(query, args)
    164 
--> 165         result = self._query(query)
    166         self._executed = query
    167         return result

/srv/paws/lib/python3.6/site-packages/pymysql/cursors.py in _query(self, q)
    319         conn = self._get_db()
    320         self._last_executed = q
--> 321         conn.query(q)
    322         self._do_get_result()
    323         return self.rowcount

/srv/paws/lib/python3.6/site-packages/pymysql/connections.py in query(self, sql, unbuffered)
    858                 sql = sql.encode(self.encoding, 'surrogateescape')
    859         self._execute_command(COMMAND.COM_QUERY, sql)
--> 860         self._affected_rows = self._read_query_result(unbuffered=unbuffered)
    861         return self._affected_rows
    862 

/srv/paws/lib/python3.6/site-packages/pymysql/connections.py in _read_query_result(self, unbuffered)
   1059         else:
   1060             result = MySQLResult(self)
-> 1061             result.read()
   1062         self._result = result
   1063         if result.server_status is not None:

/srv/paws/lib/python3.6/site-packages/pymysql/connections.py in read(self)
   1347     def read(self):
   1348         try:
-> 1349             first_packet = self.connection._read_packet()
   1350 
   1351             if first_packet.is_ok_packet():

/srv/paws/lib/python3.6/site-packages/pymysql/connections.py in _read_packet(self, packet_type)
    989         buff = b''
    990         while True:
--> 991             packet_header = self._read_bytes(4)
    992             #if DEBUG: dump_packet(packet_header)
    993 

/srv/paws/lib/python3.6/site-packages/pymysql/connections.py in _read_bytes(self, num_bytes)
   1035             self._force_close()
   1036             raise err.OperationalError(
-> 1037                 CR.CR_SERVER_LOST, "Lost connection to MySQL server during query")
   1038         return data
   1039 

OperationalError: (2013, 'Lost connection to MySQL server during query')
print(session.get(action='query', meta='userinfo'))
{'batchcomplete': '', 'query': {'userinfo': {'id': 0, 'name': '10.68.23.135', 'anon': ''}}}
!pip install git+https://github.com/mediawiki-utilities/python-mwviews.git
Collecting git+https://github.com/mediawiki-utilities/python-mwviews.git
  Cloning https://github.com/mediawiki-utilities/python-mwviews.git to /tmp/pip-6hm1f7ns-build
  Ignoring futures: markers 'python_version < "3.0"' don't match your environment
Requirement already satisfied: requests in /srv/paws/lib/python3.6/site-packages (from mwviews==0.1.0)
Requirement already satisfied: mwcli in /srv/paws/lib/python3.6/site-packages (from mwviews==0.1.0)
Requirement already satisfied: mwapi in /srv/paws/lib/python3.6/site-packages (from mwviews==0.1.0)
Requirement already satisfied: certifi>=2017.4.17 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews==0.1.0)
Requirement already satisfied: idna<2.7,>=2.5 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews==0.1.0)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews==0.1.0)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /srv/paws/lib/python3.6/site-packages (from requests->mwviews==0.1.0)
Requirement already satisfied: docopt in /srv/paws/lib/python3.6/site-packages (from mwcli->mwviews==0.1.0)
Requirement already satisfied: para in /srv/paws/lib/python3.6/site-packages (from mwcli->mwviews==0.1.0)
Installing collected packages: mwviews
  Running setup.py install for mwviews ... done
Successfully installed mwviews-0.1.0
import mwviews
from mwviews.api import PageviewsClient
p = PageviewsClient('mwapi (python) -- default user-agent')

p.article_views('en.wikipedia', ['Selfie', 'Cat', 'Dog'])
p.project_views(['ro.wikipedia', 'de.wikipedia', 'commons.wikimedia'])

for each in p.top_articles('en.wikipedia', limit=100):
    session = mwapi.Session('https://en.wikipedia.org', 'mwapi (python) paws/jupyter-notebook -- User/Announcement (xxv9xx@gmail.com)')
    page = session.get(action='query',format='json',titles=each['article'],prop='extracts',explaintext='false',exsectionformat='plain',exlimit='1')['query']['pages']
    them = {}
    for n in page:
        if ('extract' in page[n]):
            results = re.findall(prog, page[n]['extract'])
            for result in list(OrderedDict.fromkeys(results)):
                count = len(re.findall(result, page[n]['extract']))
                if count > 1:
                    them[result] = count
    value = 0
    amount = 0
    
    for k in them:
        value = value + len(k) * them[k]
        amount = amount + them[k]
    
    if amount > 0:
        print(value / amount, each['article'])
2.167822692518631 Avengers:_Infinity_War
2.40886524822695 Donald_Glover
2.5795880149812733 XHamster
2.242571582928147 Met_Gala
2.216242242670661 Malaysian_general_election,_2018
2.192215968711247 Sonam_Kapoor
2.6314731020613373 Gina_Haspel
2.765486725663717 Iran_nuclear_deal_framework
2.3863050944476245 List_of_Marvel_Cinematic_Universe_films
2.0105936879276096 Grimes_(musician)
2.3232911392405065 HTTP_404
2.0074420582606844 Eurovision_Song_Contest_2018
2.2998256827425916 Savitri_(actress)
2.139337112952464 Deaths_in_2018
2.196365533965681 Elon_Musk
2.7518618121638396 List_of_highest-grossing_films
2.1476997578692494 XXX_(franchise)
2.5629032258064517 Mahathir_Mohamad
2.4518938700823423 Leicester
2.2966523689789478 Carol_Danvers
2.084675815433572 Exo_(band)
2.258753328730644 Black_Panther_(film)
2.359696884647769 Thanos
2.4209395973154364 Gemini_Ganesan
2.081621382814226 Cardi_B
2.213248407643312 Meghan_Markle
2.6400287976961843 Pakatan_Harapan
2.2278040288485452 Pauley_Perrette
2.38818359375 Jhené_Aiko
2.3607888631090486 Michael_Avenatti
2.4041178558750445 Elizabeth_Blackwell
4.940789473684211 Results_of_the_Malaysian_general_election,_2013_by_parliamentary_constituency
2.7147707979626485 Money_in_the_Bank_(2018)
2.4797909883210827 Atomic_bombings_of_Hiroshima_and_Nagasaki
2.583167660702452 Home
2.337619334308076 Darth_Vader
1.8135593220338984 List_of_United_States_stand-up_comedians
1.9846153846153847 List_of_stand-up_comedians
3.064516129032258 List_of_Australian_stand-up_comedians
1.3081761006289307 List_of_Canadian_stand-up_comedians
2.311413043478261 Mahanati
2.3490187466309966 Marvel_Cinematic_Universe
2.134893324156917 June_and_Jennifer_Gibbons
2.75129246676514 Malaysian_general_election,_2013
2.4950248756218905 Elizabeth_Olsen
2.376154806491885 Jim_Crow_laws
2.754956383822363 Prime_Minister_of_Malaysia
2.265625 Untitled_Avengers_film
2.2427184466019416 Hailey_Baldwin
2.304743687834736 Deadpool_2
2.4686147186147185 List_of_Steven_Universe_episodes
2.4761904761904763 Clayne_Crawford
2.4717711400925535 Chris_Paul
2.75506132269233 Najib_Razak
2.1651130272663717 Anil_Kapoor
2.5170092133238837 Tom_Holland_(actor)
2.822658513035082 2018_in_film
2.323196605374823 Taylor_Swift's_Reputation_Stadium_Tour
2.3565564156697163 Shawn_Mendes
2.381846662911856 Donald_Trump
2.0875452984932292 Eric_Schneiderman
2.2749234032524157 United_States
2.152167494956453 Mother's_Day
2.456575682382134 Cobra_Kai
2.387112447238165 LeBron_James
2.3024115130299494 Post_Malone
2.517407237746221 2018_FIFA_World_Cup
2.334315458652524 Captain_Marvel_(film)
2.84398181383106 Victory_Day_(9_May)
1.9979338842975207 The_Rain_(TV_series)
2.392437241817604 Flipkart
2.0634221537106363 Ronan_Farrow
2.2492072643413086 Scarlett_Johansson
2.4930046635576284 The_Handmaid's_Tale_(TV_series)
2.2621206148994877 Michael_B._Jordan
2.494722536806342 Elizabeth_II
1.9962490081511939 May_9
2.293222683264177 Chadwick_Boseman
2.2700483635136655 NCIS_(TV_series)
2.2009886529603415 Will_Smith
2.179993728441518 James_Paxton_(baseball)
2.200150489089541 Josh_Brolin
2.406497292794669 Avicii
2.3885761934542424 Don_Blankenship
2.297347480106101 Lethal_Weapon_(TV_series)
2.6815286624203822 The_Voice_(U.S._season_14)
2.81025069637883 Fortnite
2.130876849947746 Joint_Comprehensive_Plan_of_Action
2.3891317926296063 Mary-Kate_and_Ashley_Olsen
import wdqs
import requests
import csv
import json
from operator import itemgetter
import time
requests.get('http://en.wikipedia.org/w/api.php', action="query", "titles"="Main Page")
session.get('titles="Main Page')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-88-9d80563407a1> in <module>()
----> 1 session.get('titles="Main Page')

/srv/paws/lib/python3.6/site-packages/mwapi/session.py in get(self, query_continue, auth, continuation, **params)
    307         return self.request('GET', params=params, auth=auth,
    308                             query_continue=query_continue,
--> 309                             continuation=continuation)
    310 
    311     def post(self, query_continue=None, upload_file=None, auth=None,

/srv/paws/lib/python3.6/site-packages/mwapi/session.py in request(self, method, params, query_continue, files, auth, continuation)
    163             `continuation == True`)
    164         """
--> 165         normal_params = _normalize_params(params, query_continue)
    166         if continuation:
    167             return self._continuation(method, params=normal_params, auth=auth,

/srv/paws/lib/python3.6/site-packages/mwapi/session.py in _normalize_params(params, query_continue)
    356 
    357     if query_continue is not None:
--> 358         normal_params.update(query_continue)
    359 
    360     return normal_params

ValueError: dictionary update sequence element #0 has length 1; 2 is required
def countBackwards (i):
    print(i - 1)
    if i > 0:
        countBackwards(i - 1)
countBackwards(4)
#def sort(list):
 #   for h in range(1, len(list)):
  #      f
    
4
3
2
1
0
!pip install wheel
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl (41kB)
    100% |████████████████████████████████| 51kB 1.3MB/s ta 0:00:011
Installing collected packages: wheel
Successfully installed wheel-0.31.0
!python setup.py bdist_wheel 
python: can't open file 'setup.py': [Errno 2] No such file or directory
!pip install spacy
Collecting spacy
  Using cached https://files.pythonhosted.org/packages/3c/31/e60f88751e48851b002f78a35221d12300783d5a43d4ef12fbf10cca96c3/spacy-2.0.11.tar.gz
Requirement already satisfied: numpy>=1.7 in /srv/paws/lib/python3.6/site-packages (from spacy)
Collecting murmurhash<0.29,>=0.28 (from spacy)
  Using cached https://files.pythonhosted.org/packages/5e/31/c8c1ecafa44db30579c8c457ac7a0f819e8b1dbc3e58308394fff5ff9ba7/murmurhash-0.28.0.tar.gz
Collecting cymem<1.32,>=1.30 (from spacy)
  Using cached https://files.pythonhosted.org/packages/f8/9e/273fbea507de99166c11cd0cb3fde1ac01b5bc724d9a407a2f927ede91a1/cymem-1.31.2.tar.gz
Collecting preshed<2.0.0,>=1.0.0 (from spacy)
  Using cached https://files.pythonhosted.org/packages/1b/ac/7c17b1fd54b60972785b646d37da2826311cca70842c011c4ff84fbe95e0/preshed-1.0.0.tar.gz
Collecting thinc<6.11.0,>=6.10.1 (from spacy)
  Using cached https://files.pythonhosted.org/packages/55/fd/e9f36081e6f53699943381858848f3b4d759e0dd03c43b98807dde34c252/thinc-6.10.2.tar.gz
Collecting plac<1.0.0,>=0.9.6 (from spacy)
  Using cached https://files.pythonhosted.org/packages/9e/9b/62c60d2f5bc135d2aa1d8c8a86aaf84edb719a59c7f11a4316259e61a298/plac-0.9.6-py2.py3-none-any.whl
Collecting pathlib (from spacy)
  Using cached https://files.pythonhosted.org/packages/ac/aa/9b065a76b9af472437a0059f77e8f962fe350438b927cb80184c32f075eb/pathlib-1.0.1.tar.gz
Collecting ujson>=1.35 (from spacy)
  Using cached https://files.pythonhosted.org/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz
Collecting dill<0.3,>=0.2 (from spacy)
  Using cached https://files.pythonhosted.org/packages/91/a0/19d4d31dee064fc553ae01263b5c55e7fb93daff03a69debbedee647c5a0/dill-0.2.7.1.tar.gz
Collecting regex==2017.4.5 (from spacy)
  Using cached https://files.pythonhosted.org/packages/36/62/c0c0d762ffd4ffaf39f372eb8561b8d491a11ace5a7884610424a8b40f95/regex-2017.04.05.tar.gz
Requirement already satisfied: wrapt in /srv/paws/lib/python3.6/site-packages (from thinc<6.11.0,>=6.10.1->spacy)
Collecting tqdm<5.0.0,>=4.10.0 (from thinc<6.11.0,>=6.10.1->spacy)
  Using cached https://files.pythonhosted.org/packages/d8/ca/6524dfba7a0e850d3fda223693779035ddc8bf5c242acd9ee4eb9e52711a/tqdm-4.23.3-py2.py3-none-any.whl
Collecting cytoolz<0.9,>=0.8 (from thinc<6.11.0,>=6.10.1->spacy)
  Using cached https://files.pythonhosted.org/packages/0f/e6/ccc124714dcc1bd511e64ddafb4d5d20ada2533b92e3173a4cf09e0d0831/cytoolz-0.8.2.tar.gz
Requirement already satisfied: six<2.0.0,>=1.10.0 in /srv/paws/lib/python3.6/site-packages (from thinc<6.11.0,>=6.10.1->spacy)
Collecting termcolor (from thinc<6.11.0,>=6.10.1->spacy)
  Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
Collecting msgpack-python (from thinc<6.11.0,>=6.10.1->spacy)
  Using cached https://files.pythonhosted.org/packages/8a/20/6eca772d1a5830336f84aca1d8198e5a3f4715cd1c7fc36d3cc7f7185091/msgpack-python-0.5.6.tar.gz
Collecting msgpack-numpy==0.4.1 (from thinc<6.11.0,>=6.10.1->spacy)
  Using cached https://files.pythonhosted.org/packages/2e/43/393e30e2768b0357541ac95891f96b80ccc4d517e0dd2fa3042fc8926538/msgpack_numpy-0.4.1-py2.py3-none-any.whl
Collecting toolz>=0.8.0 (from cytoolz<0.9,>=0.8->thinc<6.11.0,>=6.10.1->spacy)
  Using cached https://files.pythonhosted.org/packages/14/d0/a73c15bbeda3d2e7b381a36afb0d9cd770a9f4adc5d1532691013ba881db/toolz-0.9.0.tar.gz
Building wheels for collected packages: spacy, murmurhash, cymem, preshed, thinc, pathlib, ujson, dill, regex, cytoolz, termcolor, msgpack-python, toolz
  Running setup.py bdist_wheel for spacy ... done
  Stored in directory: /home/paws/.cache/pip/wheels/fb/00/28/75c85d5135e7d9a100639137d1847d41e914ed16c962d467e4
  Running setup.py bdist_wheel for murmurhash ... done
  Stored in directory: /home/paws/.cache/pip/wheels/b8/94/a4/f69f8664cdc1098603df44771b7fec5fd1b3d8364cdd83f512
  Running setup.py bdist_wheel for cymem ... done
  Stored in directory: /home/paws/.cache/pip/wheels/55/8d/4a/f6328252aa2aaec0b1cb906fd96a1566d77f0f67701071ad13
  Running setup.py bdist_wheel for preshed ... done
  Stored in directory: /home/paws/.cache/pip/wheels/8f/85/06/2d132fb649a6bbcab22487e4147880a55b0dd0f4b18fdfd6b5
  Running setup.py bdist_wheel for thinc ... done
  Stored in directory: /home/paws/.cache/pip/wheels/d8/5c/3e/9acf5d9974fb1c9e7b467563ea5429c9325f67306e93147961
  Running setup.py bdist_wheel for pathlib ... done
  Stored in directory: /home/paws/.cache/pip/wheels/f9/b2/4a/68efdfe5093638a9918bd1bb734af625526e849487200aa171
  Running setup.py bdist_wheel for ujson ... done
  Stored in directory: /home/paws/.cache/pip/wheels/28/77/e4/0311145b9c2e2f01470e744855131f9e34d6919687550f87d1
  Running setup.py bdist_wheel for dill ... done
  Stored in directory: /home/paws/.cache/pip/wheels/99/c4/ed/1b64d2d5809e60d5a3685530432f6159d6a9959739facb61f2
  Running setup.py bdist_wheel for regex ... done
  Stored in directory: /home/paws/.cache/pip/wheels/75/07/38/3c16b529d50cb4e0cd3dbc7b75cece8a09c132692c74450b01
  Running setup.py bdist_wheel for cytoolz ... done
  Stored in directory: /home/paws/.cache/pip/wheels/f8/b1/86/c92e4d36b690208fff8471711b85eaa6bc6d19860a86199a09
  Running setup.py bdist_wheel for termcolor ... done
  Stored in directory: /home/paws/.cache/pip/wheels/7c/06/54/bc84598ba1daf8f970247f550b175aaaee85f68b4b0c5ab2c6
  Running setup.py bdist_wheel for msgpack-python ... done
  Stored in directory: /home/paws/.cache/pip/wheels/d5/de/86/7fa56fda12511be47ea0808f3502bc879df4e63ab168ec0406
  Running setup.py bdist_wheel for toolz ... done
  Stored in directory: /home/paws/.cache/pip/wheels/f4/0c/f6/ce6b2d1aa459ee97cc3c0f82236302bd62d89c86c700219463
Successfully built spacy murmurhash cymem preshed thinc pathlib ujson dill regex cytoolz termcolor msgpack-python toolz
Installing collected packages: murmurhash, cymem, preshed, tqdm, toolz, cytoolz, plac, dill, termcolor, pathlib, msgpack-python, msgpack-numpy, thinc, ujson, regex, spacy
  Found existing installation: regex 2018.2.21
    Uninstalling regex-2018.2.21:
      Successfully uninstalled regex-2018.2.21
Successfully installed cymem-1.31.2 cytoolz-0.8.2 dill-0.2.7.1 msgpack-numpy-0.4.1 msgpack-python-0.5.6 murmurhash-0.28.0 pathlib-1.0.1 plac-0.9.6 preshed-1.0.0 regex-2017.4.5 spacy-2.0.11 termcolor-1.1.0 thinc-6.10.2 toolz-0.9.0 tqdm-4.23.3 ujson-1.35
!pip install -U nltk
Collecting nltk
  Using cached https://files.pythonhosted.org/packages/50/09/3b1755d528ad9156ee7243d52aa5cd2b809ef053a0f31b53d92853dd653a/nltk-3.3.0.zip
Requirement already up-to-date: six in /srv/paws/lib/python3.6/site-packages (from nltk)
Building wheels for collected packages: nltk
  Running setup.py bdist_wheel for nltk ... error
  Complete output from command /srv/paws/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-fnrh5i37/nltk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpozth8fd0pip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help
  
  error: invalid command 'bdist_wheel'
  
  ----------------------------------------
  Failed building wheel for nltk
  Running setup.py clean for nltk
Failed to build nltk
Installing collected packages: nltk
  Running setup.py install for nltk ... done
Successfully installed nltk-3.3
!pip install -U numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/71/90/ca61e203e0080a8cef7ac21eca199829fa8d997f7c4da3e985b49d0a107d/numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: numpy
  Found existing installation: numpy 1.14.1
    Uninstalling numpy-1.14.1:
      Successfully uninstalled numpy-1.14.1
Successfully installed numpy-1.14.3
import nltk
nltk.download()
NLTK Downloader
---------------------------------------------------------------------------
    d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
---------------------------------------------------------------------------
Downloader> d

Download which package (l=list; x=cancel)?
  Identifier> all
    Downloading collection 'all'
       | 
       | Downloading package abc to /home/paws/nltk_data...
       |   Package abc is already up-to-date!
       | Downloading package alpino to /home/paws/nltk_data...
       |   Package alpino is already up-to-date!
       | Downloading package biocreative_ppi to
       |     /home/paws/nltk_data...
       |   Package biocreative_ppi is already up-to-date!
       | Downloading package brown to /home/paws/nltk_data...
       |   Package brown is already up-to-date!
       | Downloading package brown_tei to /home/paws/nltk_data...
       |   Package brown_tei is already up-to-date!
       | Downloading package cess_cat to /home/paws/nltk_data...
       |   Package cess_cat is already up-to-date!
       | Downloading package cess_esp to /home/paws/nltk_data...
       |   Package cess_esp is already up-to-date!
       | Downloading package chat80 to /home/paws/nltk_data...
       |   Package chat80 is already up-to-date!
       | Downloading package city_database to /home/paws/nltk_data...
       |   Package city_database is already up-to-date!
       | Downloading package cmudict to /home/paws/nltk_data...
       |   Package cmudict is already up-to-date!
       | Downloading package comparative_sentences to
       |     /home/paws/nltk_data...
       |   Package comparative_sentences is already up-to-date!
       | Downloading package comtrans to /home/paws/nltk_data...
       |   Package comtrans is already up-to-date!
       | Downloading package conll2000 to /home/paws/nltk_data...
       |   Package conll2000 is already up-to-date!
       | Downloading package conll2002 to /home/paws/nltk_data...
       |   Package conll2002 is already up-to-date!
       | Downloading package conll2007 to /home/paws/nltk_data...
       |   Package conll2007 is already up-to-date!
       | Downloading package crubadan to /home/paws/nltk_data...
       |   Package crubadan is already up-to-date!
       | Downloading package dependency_treebank to
       |     /home/paws/nltk_data...
       |   Package dependency_treebank is already up-to-date!
       | Downloading package dolch to /home/paws/nltk_data...
       |   Package dolch is already up-to-date!
       | Downloading package europarl_raw to /home/paws/nltk_data...
       |   Package europarl_raw is already up-to-date!
       | Downloading package floresta to /home/paws/nltk_data...
       |   Package floresta is already up-to-date!
       | Downloading package framenet_v15 to /home/paws/nltk_data...
       |   Package framenet_v15 is already up-to-date!
       | Downloading package framenet_v17 to /home/paws/nltk_data...
       |   Package framenet_v17 is already up-to-date!
       | Downloading package gazetteers to /home/paws/nltk_data...
       |   Package gazetteers is already up-to-date!
       | Downloading package genesis to /home/paws/nltk_data...
       |   Package genesis is already up-to-date!
       | Downloading package gutenberg to /home/paws/nltk_data...
       |   Package gutenberg is already up-to-date!
       | Downloading package ieer to /home/paws/nltk_data...
       |   Package ieer is already up-to-date!
       | Downloading package inaugural to /home/paws/nltk_data...
       |   Package inaugural is already up-to-date!
       | Downloading package indian to /home/paws/nltk_data...
       |   Package indian is already up-to-date!
       | Downloading package jeita to /home/paws/nltk_data...
       |   Package jeita is already up-to-date!
       | Downloading package kimmo to /home/paws/nltk_data...
       |   Package kimmo is already up-to-date!
       | Downloading package knbc to /home/paws/nltk_data...
       |   Package knbc is already up-to-date!
       | Downloading package lin_thesaurus to /home/paws/nltk_data...
       |   Package lin_thesaurus is already up-to-date!
       | Downloading package mac_morpho to /home/paws/nltk_data...
       |   Package mac_morpho is already up-to-date!
       | Downloading package machado to /home/paws/nltk_data...
       |   Package machado is already up-to-date!
       | Downloading package masc_tagged to /home/paws/nltk_data...
       |   Package masc_tagged is already up-to-date!
       | Downloading package moses_sample to /home/paws/nltk_data...
       |   Package moses_sample is already up-to-date!
       | Downloading package movie_reviews to /home/paws/nltk_data...
       |   Package movie_reviews is already up-to-date!
       | Downloading package names to /home/paws/nltk_data...
       |   Package names is already up-to-date!
       | Downloading package nombank.1.0 to /home/paws/nltk_data...
       |   Package nombank.1.0 is already up-to-date!
       | Downloading package nps_chat to /home/paws/nltk_data...
       |   Package nps_chat is already up-to-date!
       | Downloading package omw to /home/paws/nltk_data...
       |   Package omw is already up-to-date!
       | Downloading package opinion_lexicon to
       |     /home/paws/nltk_data...
       |   Package opinion_lexicon is already up-to-date!
       | Downloading package paradigms to /home/paws/nltk_data...
       |   Package paradigms is already up-to-date!
       | Downloading package pil to /home/paws/nltk_data...
       |   Package pil is already up-to-date!
       | Downloading package pl196x to /home/paws/nltk_data...
       |   Package pl196x is already up-to-date!
       | Downloading package ppattach to /home/paws/nltk_data...
       |   Package ppattach is already up-to-date!
       | Downloading package problem_reports to
       |     /home/paws/nltk_data...
       |   Package problem_reports is already up-to-date!
       | Downloading package propbank to /home/paws/nltk_data...
       |   Package propbank is already up-to-date!
       | Downloading package ptb to /home/paws/nltk_data...
       |   Package ptb is already up-to-date!
       | Downloading package product_reviews_1 to
       |     /home/paws/nltk_data...
       |   Package product_reviews_1 is already up-to-date!
       | Downloading package product_reviews_2 to
       |     /home/paws/nltk_data...
       |   Package product_reviews_2 is already up-to-date!
       | Downloading package pros_cons to /home/paws/nltk_data...
       |   Package pros_cons is already up-to-date!
       | Downloading package qc to /home/paws/nltk_data...
       |   Package qc is already up-to-date!
       | Downloading package reuters to /home/paws/nltk_data...
       |   Package reuters is already up-to-date!
       | Downloading package rte to /home/paws/nltk_data...
       |   Package rte is already up-to-date!
       | Downloading package semcor to /home/paws/nltk_data...
       |   Package semcor is already up-to-date!
       | Downloading package senseval to /home/paws/nltk_data...
       |   Package senseval is already up-to-date!
       | Downloading package sentiwordnet to /home/paws/nltk_data...
       |   Package sentiwordnet is already up-to-date!
       | Downloading package sentence_polarity to
       |     /home/paws/nltk_data...
       |   Package sentence_polarity is already up-to-date!
       | Downloading package shakespeare to /home/paws/nltk_data...
       |   Package shakespeare is already up-to-date!
       | Downloading package sinica_treebank to
       |     /home/paws/nltk_data...
       |   Package sinica_treebank is already up-to-date!
       | Downloading package smultron to /home/paws/nltk_data...
       |   Package smultron is already up-to-date!
       | Downloading package state_union to /home/paws/nltk_data...
       |   Package state_union is already up-to-date!
       | Downloading package stopwords to /home/paws/nltk_data...
       |   Package stopwords is already up-to-date!
       | Downloading package subjectivity to /home/paws/nltk_data...
       |   Package subjectivity is already up-to-date!
       | Downloading package swadesh to /home/paws/nltk_data...
       |   Package swadesh is already up-to-date!
       | Downloading package switchboard to /home/paws/nltk_data...
       |   Package switchboard is already up-to-date!
       | Downloading package timit to /home/paws/nltk_data...
       |   Package timit is already up-to-date!
       | Downloading package toolbox to /home/paws/nltk_data...
       |   Package toolbox is already up-to-date!
       | Downloading package treebank to /home/paws/nltk_data...
       |   Package treebank is already up-to-date!
       | Downloading package twitter_samples to
       |     /home/paws/nltk_data...
       |   Package twitter_samples is already up-to-date!
       | Downloading package udhr to /home/paws/nltk_data...
       |   Package udhr is already up-to-date!
       | Downloading package udhr2 to /home/paws/nltk_data...
       |   Package udhr2 is already up-to-date!
       | Downloading package unicode_samples to
       |     /home/paws/nltk_data...
       |   Package unicode_samples is already up-to-date!
       | Downloading package universal_treebanks_v20 to
       |     /home/paws/nltk_data...
       |   Package universal_treebanks_v20 is already up-to-date!
       | Downloading package verbnet to /home/paws/nltk_data...
       |   Package verbnet is already up-to-date!
       | Downloading package webtext to /home/paws/nltk_data...
       |   Package webtext is already up-to-date!
       | Downloading package wordnet to /home/paws/nltk_data...
       |   Package wordnet is already up-to-date!
       | Downloading package wordnet_ic to /home/paws/nltk_data...
       |   Package wordnet_ic is already up-to-date!
       | Downloading package words to /home/paws/nltk_data...
       |   Package words is already up-to-date!
       | Downloading package ycoe to /home/paws/nltk_data...
       |   Package ycoe is already up-to-date!
       | Downloading package rslp to /home/paws/nltk_data...
       |   Package rslp is already up-to-date!
       | Downloading package maxent_treebank_pos_tagger to
       |     /home/paws/nltk_data...
       |   Package maxent_treebank_pos_tagger is already up-to-date!
       | Downloading package universal_tagset to
       |     /home/paws/nltk_data...
       |   Package universal_tagset is already up-to-date!
       | Downloading package maxent_ne_chunker to
       |     /home/paws/nltk_data...
       |   Package maxent_ne_chunker is already up-to-date!
       | Downloading package punkt to /home/paws/nltk_data...
       |   Package punkt is already up-to-date!
       | Downloading package book_grammars to /home/paws/nltk_data...
       |   Package book_grammars is already up-to-date!
       | Downloading package sample_grammars to
       |     /home/paws/nltk_data...
       |   Package sample_grammars is already up-to-date!
       | Downloading package spanish_grammars to
       |     /home/paws/nltk_data...
       |   Package spanish_grammars is already up-to-date!
       | Downloading package basque_grammars to
       |     /home/paws/nltk_data...
       |   Package basque_grammars is already up-to-date!
       | Downloading package large_grammars to /home/paws/nltk_data...
       |   Package large_grammars is already up-to-date!
       | Downloading package tagsets to /home/paws/nltk_data...
       |   Package tagsets is already up-to-date!
       | Downloading package snowball_data to /home/paws/nltk_data...
       |   Package snowball_data is already up-to-date!
       | Downloading package bllip_wsj_no_aux to
       |     /home/paws/nltk_data...
       |   Package bllip_wsj_no_aux is already up-to-date!
       | Downloading package word2vec_sample to
       |     /home/paws/nltk_data...
       |   Package word2vec_sample is already up-to-date!
       | Downloading package panlex_swadesh to /home/paws/nltk_data...
       |   Package panlex_swadesh is already up-to-date!
       | Downloading package mte_teip5 to /home/paws/nltk_data...
       |   Package mte_teip5 is already up-to-date!
       | Downloading package averaged_perceptron_tagger to
       |     /home/paws/nltk_data...
       |   Package averaged_perceptron_tagger is already up-to-date!
       | Downloading package perluniprops to /home/paws/nltk_data...
       |   Package perluniprops is already up-to-date!
       | Downloading package nonbreaking_prefixes to
       |     /home/paws/nltk_data...
       |   Package nonbreaking_prefixes is already up-to-date!
       | Downloading package vader_lexicon to /home/paws/nltk_data...
       |   Package vader_lexicon is already up-to-date!
       | Downloading package porter_test to /home/paws/nltk_data...
       |   Package porter_test is already up-to-date!
       | Downloading package wmt15_eval to /home/paws/nltk_data...
       |   Package wmt15_eval is already up-to-date!
       | Downloading package mwa_ppdb to /home/paws/nltk_data...
       |   Package mwa_ppdb is already up-to-date!
       | 
     Done downloading collection all

---------------------------------------------------------------------------
    d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
---------------------------------------------------------------------------
Downloader> q
True
print('hi')
hi
import spacy
from spacy import displacy
 
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-59-3e72d7f98d6f> in <module>()
----> 1 nltk.riding

AttributeError: module 'nltk' has no attribute 'riding'