feedfilter.py 文件源码

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

项目:PCInotes 作者: ahangchen 项目源码 文件源码
def read(feed, classifier):
    # Get feed entries and loop over them
    f = feedparser.parse(feed)
    for entry in f['entries']:
        print
        print '-----'
        # Print the contents of the entry
        print 'Title:     ' + entry['title'].encode('utf-8')
        print 'Publisher: ' + entry['publisher'].encode('utf-8')
        print
        print entry['summary'].encode('utf-8')

        # Combine all the text to create one item for the classifier
        fulltext = '%s\n%s\n%s' % (entry['title'], entry['publisher'], entry['summary'])

        # Print the best guess at the current category
        print 'Guess: ' + str(classifier.classify(entry))

        # Ask the user to specify the correct category and train on that
        cl = raw_input('Enter category: ')
        classifier.train(entry, cl)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号