def make_words(text):
"""
make a list of words from a large bunch of text
strips all the punctuation and other stuff from a string
"""
text = strip_punctuation(text)
# lower-case everything to remove that complication:
text = text.lower()
# split into words
words = text.split()
# remove the bare single quotes: "'" is both a quote and an apostrophe
# and capitalize "i"
words2 = []
for word in words:
if word != "'": # remove quote by itself
# "i" by itself should be capitalized
words2.append("I" if word == 'i' else word)
# could be done with list comprehension too -- next week!
# words2 = [("I" if word == 'i' else word) for word in words if word != "'"]
return words2
评论列表
文章目录