Skip to content

Instantly share code, notes, and snippets.

@luisfredgs
Last active April 18, 2020 20:26
Show Gist options
  • Save luisfredgs/7f3bb184909050989ccb762c75b7030b to your computer and use it in GitHub Desktop.
Save luisfredgs/7f3bb184909050989ccb762c75b7030b to your computer and use it in GitHub Desktop.
sentence_rank={}
for sent in doc.sents:
for word in sent :
if word.text.lower() in word_frequency.keys():
if sent in sentence_rank.keys():
sentence_rank[sent]+=word_frequency[word.text.lower()]
else:
sentence_rank[sent]=word_frequency[word.text.lower()]
top_sentences=(sorted(sentence_rank.values())[::-1])
top_sent=top_sentences[:3]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment