Last active
April 18, 2020 20:26
-
-
Save luisfredgs/7f3bb184909050989ccb762c75b7030b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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