utils.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tRECS 作者: TeeOhh 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号