Browse Source

add keyword try

master
Yener 6 years ago
parent
commit
d4803fe558
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      jiagu/textrank.py

+ 4
- 1
jiagu/textrank.py View File

@@ -79,7 +79,10 @@ class Keywords(object):
sent_selected = nlargest(n, zip(scores, count())) sent_selected = nlargest(n, zip(scores, count()))
sent_index = [] sent_index = []
for i in range(n): for i in range(n):
sent_index.append(sent_selected[i][1])
try:
sent_index.append(sent_selected[i][1])
except:
pass
return [index_word[i] for i in sent_index] return [index_word[i] for i in sent_index]






Loading…
Cancel
Save