Skip to content

Instantly share code, notes, and snippets.

View wilkens's full-sized avatar

Matthew Wilkens wilkens

View GitHub Profile
@wilkens
wilkens / count_syllables.py
Last active July 16, 2018 19:40
Count syllables
# Function to calculate the syllables in a word
'''Calculate number of syllables in word. Returns a list of possible values.
Generally, will want the first item in that list.'''
from nltk.corpus import cmudict
d = cmudict.dict()
def nsyl(word):
return [len(list(y for y in x if y[-1].isdigit())) for x in d[word.lower()]]

Keybase proof

I hereby claim:

  • I am wilkens on github.
  • I am mattwilkens (https://keybase.io/mattwilkens) on keybase.
  • I have a public key whose fingerprint is 467D C948 E276 DBA5 F3DB 51C2 A53A B7AE 9F46 7061

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
city year population literature
0 New York 1790 33100.0 10603
1 Washington 1790 2800.0 5079
2 Boston 1790 18300.0 4568
3 Philadelphia 1790 44100.0 2086
4 New Orleans 1790 5300.0 1590
5 Richmond 1790 3800.0 1172
6 Albany 1790 3500.0 1105
7 Buffalo 1790 0.0 927
8 Charleston 1790 16400.0 901