import sys import feedparser from model import Model # Can be a file or URL FEED_SOURCE = ('http://feeds.feedburner.com/newsyc20?format=xml' if len(sys.argv) < 2 else sys.argv[1]) MODEL_FILE = 'model.json' model = Model(MODEL_FILE) d = feedparser.parse(FEED_SOURCE) for story in [entry for entry in d.entries if not model.seen_id(entry.id)]: print story.title prediction = model.predict_story(story.title) action = 'x' while action not in ['y', 'n', 's', 'q']: if action == 'h' or action == '?': print "" print "y: yes, story is interesting" print "n: no, story is boring" print "s: skip classifying this story" print "q: quit" print "h: display help" action = raw_input("interesting? [ynsqh] ") if action == 'q': break