Skip to content

Instantly share code, notes, and snippets.

@Joshuaek
Created November 14, 2017 06:24
Show Gist options
  • Save Joshuaek/0580067c8c983a7b361f812549faaa38 to your computer and use it in GitHub Desktop.
Save Joshuaek/0580067c8c983a7b361f812549faaa38 to your computer and use it in GitHub Desktop.
import feedparser
potential_posts = {}
for url in ['https://feeds.feedburner.com/CoinDesk', 'http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/technology/rss.xml','http://i.perezhilton.com/?feed=rss2']:
feed = feedparser.parse(url)
for article in feed.entries:
sentence = prepareSentence(article.title)
bag = toBOW(sentence, final_words)
potential_posts[article.title] = nnet.predict([bag])[0]
x = sorted(potential_posts.items(), key=itemgetter(1), reverse=True)
print("Top posts")
for i in x[:5]:
print(i)
x = sorted(potential_posts.items(), key=itemgetter(1), reverse=False)
print("Bottom posts")
for i in x[:5]:
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment