(content_lst, window_size=20, threshold=0.)
| 74 | |
| 75 | |
| 76 | def get_pmi_edge(content_lst, window_size=20, threshold=0.): |
| 77 | if isinstance(content_lst, str): |
| 78 | content_lst = list(open(content_lst, "r")) |
| 79 | print("pmi read file len:", len(content_lst)) |
| 80 | |
| 81 | pmi_start = time() |
| 82 | word_window_freq, word_pair_count, windows_len = get_window(content_lst, |
| 83 | window_size=window_size) |
| 84 | |
| 85 | pmi_edge_lst = count_pmi(windows_len, word_pair_count, word_window_freq, threshold) |
| 86 | print("Total number of edges between word:", len(pmi_edge_lst)) |
| 87 | pmi_time = time() - pmi_start |
| 88 | return pmi_edge_lst, pmi_time |
| 89 | |
| 90 | |
| 91 | class BuildGraph: |
no test coverage detected