def __init__(self, method='degree', analyzer=NltkNormalizer().split_and_normalize):
self.analyze = analyzer
self.method = method
self.methods_on_digraph = {'hits', 'pagerank', 'katz'}
self._get_scores = {'degree': nx.degree, 'betweenness': nx.betweenness_centrality,
'pagerank': nx.pagerank_scipy, 'hits': self._hits, 'closeness': nx.closeness_centrality,
'katz': nx.katz_centrality}[method]
# Add a new value when a new vocabulary item is seen
self.vocabulary = defaultdict()
self.vocabulary.default_factory = self.vocabulary.__len__
评论列表
文章目录