33import networkx as nx
44import matplotlib .pyplot as plt
55
6- from textplot .matrix import TextMatrix
76from abc import ABCMeta , abstractmethod
87from clint .textui .progress import bar
98
@@ -70,7 +69,7 @@ def write_graphml(self, path):
7069class Skimmer (Graph ):
7170
7271
73- def build (self , matrix , skim_depth = 10 , d_weights = False ):
72+ def build (self , text , matrix , skim_depth = 10 , d_weights = False ):
7473
7574 """
7675 1. For each term in the passed matrix, score its KDE similarity with
@@ -80,14 +79,15 @@ def build(self, matrix, skim_depth=10, d_weights=False):
8079 pairs and add them as edges.
8180
8281 Args:
83- matrix (TextMatrix): An indexed term matrix.
82+ text (Text): The source text instance.
83+ matrix (Matrix): An indexed term matrix.
8484 skim_depth (int): The number of siblings for each term.
8585 d_weights (bool): If true, give "close" words low edge weights.
8686 """
8787
8888 for anchor in bar (matrix .keys ):
8989
90- n1 = matrix . text .unstem (anchor )
90+ n1 = text .unstem (anchor )
9191
9292 # Heaviest pair scores:
9393 pairs = matrix .anchored_pairs (anchor ).items ()
@@ -97,7 +97,7 @@ def build(self, matrix, skim_depth=10, d_weights=False):
9797 # score, so that similar words are connected by "short" edges.
9898 if d_weights : weight = 1 - weight
9999
100- n2 = matrix . text .unstem (term )
100+ n2 = text .unstem (term )
101101
102102 # NetworkX does not handle numpy types when writing graphml,
103103 # so we cast the weight to a regular float.
0 commit comments