From df5928628eb181951936456deb8099edd1ec96b5 Mon Sep 17 00:00:00 2001 From: WZ <2072401390@qq.com> Date: Fri, 1 Dec 2023 22:44:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AB=98=E7=89=88=E6=9C=ACne?= =?UTF-8?q?tworks=20=E4=BD=BF=E7=94=A8nx.from=5Fnumpy=5Farray=20=E4=BB=A3?= =?UTF-8?q?=E6=9B=BF=20from=5Fnumpy=5Fmatrix=20=E9=94=99=E8=AF=AF=E5=A6=82?= =?UTF-8?q?=E4=B8=8B:=20AttributeError:=20module=20'networkx'=20has=20no?= =?UTF-8?q?=20attribute=20'from=5Fnumpy=5Fmatrix'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- textrank4zh/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/textrank4zh/util.py b/textrank4zh/util.py index f9e356f..fa32f8d 100644 --- a/textrank4zh/util.py +++ b/textrank4zh/util.py @@ -186,7 +186,7 @@ def sort_sentences(sentences, words, sim_func = get_similarity, pagerank_config graph[x, y] = similarity graph[y, x] = similarity - nx_graph = nx.from_numpy_matrix(graph) + nx_graph = nx.from_numpy_array(graph) scores = nx.pagerank(nx_graph, **pagerank_config) # this is a dict sorted_scores = sorted(scores.items(), key = lambda item: item[1], reverse=True)