Browse Source

Merge pull request #52 from gitabtion/master

修复文本摘要句子数量小于topsen时的报错问题
master
Yener GitHub 5 years ago
parent
commit
2c06bf7aeb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      jiagu/textrank.py

+ 1
- 1
jiagu/textrank.py View File

@@ -115,7 +115,7 @@ class Summarize(object):
scores = utils.weight_map_rank(graph, self.__max_iter, self.__tol)
sent_selected = nlargest(n, zip(scores, count()))
sent_index = []
for i in range(n):
for i in range(min(n, len(sent_selected))):
sent_index.append(sent_selected[i][1])
return [sentences[i] for i in sent_index]



Loading…
Cancel
Save