# Lowercase all the words (to ensure "Sure" and "sure" are matched together)
# Also word_tokenize splits each element in individual tokens
mobyDictText = nltk.word_tokenize(mobyDictText.lower())

# Remove any words that isn't a word
mobyDictText = [word for word in mobyDictText if word[0].isalpha()]

# Iterate through each word and save its length
mobyDictTextWordLength = [len(w) for w in mobyDictText]

# Sort the list from smallest to greatest word length
mobyDictTextWordLength = list(sorted(nltk.FreqDist(mobyDictTextWordLength).items()))

# Grabs all the word lengths (0 -&gt; 21)
mobyDictWordLength = [f[0] for f in mobyDictTextWordLength]

# Grabs all the values for all the word length that is assoicated with them
mobyDictWordLengthValues = [f[1] for f in mobyDictTextWordLength]

# Create a plot of the values
plt.plot(mobyDictWordLength, mobyDictWordLengthValues)

# Set labels and values
plt.xlabel('Word Length')
plt.ylabel('Word Count')
plt.title("Moby Dick Word Length")