def stemmer(text):
# '''Description: This function takes in the string of descriptions and return string with all words stemmed
# Parameters: String of descriptions
# Output: String with all words stemmed (ex. "meeting" and "meetings" to "meeting")'''
stemmer = PorterStemmer()
lis = unicode(str(text), 'utf-8').split(" ")
stemmed_words = [str(stemmer.stem(word)) for word in lis]
return " ".join(stemmed_words)
评论列表
文章目录