generatefeedvector.py 文件源码

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

项目:PCInotes 作者: ahangchen 项目源码 文件源码
def getwordcounts(url):
    # Parse the feed
    d = feedparser.parse(url)
    wc = {}

    # Loop over all the entries
    for e in d.entries:
        if 'summary' in e:
            summary = e.summary
        else:
            summary = e.description

        # Extract a list of words
        words = getwords(e.title + ' ' + summary)
        for word in words:
            wc.setdefault(word, 0)
            wc[word] += 1
    return d.feed.title, wc
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号