Skip to content

Commit

Permalink
fix pagerank API
Browse files Browse the repository at this point in the history
  • Loading branch information
blmoistawinde authored Jan 16, 2023
1 parent ef197a8 commit 96f951d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions harvesttext/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ def get_summary(self, sents, topK=5, stopwords=None, with_importance=False, stan
for u, v in combinations(range(len(sent_tokens)), 2):
G.add_edge(u, v, weight=sim_func(sent_tokens[u], sent_tokens[v]))

try:
pr = nx.pagerank_scipy(G) # sometimes fail to converge
except:
pr = nx.pagerank_numpy(G)
pr = nx.pagerank(G) # sometimes fail to converge

pr_sorted = sorted(pr.items(), key=lambda x: x[1], reverse=True)
if not avoid_repeat:
ret = []
Expand Down

0 comments on commit 96f951d

Please sign in to comment.