(self, dataset)
| 90 | |
| 91 | class BuildGraph: |
| 92 | def __init__(self, dataset): |
| 93 | clean_corpus_path = "data/text_dataset/clean_corpus" |
| 94 | self.graph_path = "data/graph" |
| 95 | if not os.path.exists(self.graph_path): |
| 96 | os.makedirs(self.graph_path) |
| 97 | |
| 98 | self.word2id = dict() # 单词映射 |
| 99 | self.dataset = dataset |
| 100 | print(f"\n==> 现在的数据集是:{dataset}<==") |
| 101 | |
| 102 | self.g = nx.Graph() |
| 103 | |
| 104 | self.content = f"{clean_corpus_path}/{dataset}.txt" |
| 105 | |
| 106 | self.get_tfidf_edge() |
| 107 | self.get_pmi_edge() |
| 108 | self.save() |
| 109 | |
| 110 | def get_pmi_edge(self): |
| 111 | pmi_edge_lst, self.pmi_time = get_pmi_edge(self.content, window_size=20, threshold=0.0) |
nothing calls this directly
no test coverage detected