(self)
| 121 | print_graph_detail(self.g) |
| 122 | |
| 123 | def get_tfidf_edge(self): |
| 124 | # 获得tfidf权重矩阵(sparse)和单词列表 |
| 125 | tfidf_vec = self.get_tfidf_vec() |
| 126 | |
| 127 | count_lst = list() # 统计每个句子的长度 |
| 128 | for ind, row in tqdm(enumerate(tfidf_vec), |
| 129 | desc="generate tfidf edge"): |
| 130 | count = 0 |
| 131 | for col_ind, value in zip(row.indices, row.data): |
| 132 | word_ind = self.node_num + col_ind |
| 133 | self.g.add_edge(ind, word_ind, weight=value) |
| 134 | count += 1 |
| 135 | count_lst.append(count) |
| 136 | |
| 137 | print_graph_detail(self.g) |
| 138 | |
| 139 | def get_tfidf_vec(self): |
| 140 | """ |
no test coverage detected