diff --git a/code/absinth_nx.py b/code/absinth_nx.py index 8b7655306dfbf7199ba1a5c2e0ae1472e40f1f6d..14726b16367fac1c79645058c2cf3e6d2bdf0de6 100644 --- a/code/absinth_nx.py +++ b/code/absinth_nx.py @@ -9,7 +9,7 @@ import numpy as np # for calculations nlp = spacy.load('en') # standard english nlp -def frequencies(corpus_path, target, stop_words=['utc', 'new', 'other'], allowed_tags=['NN','NNS','JJ','JJS','JJR','NNP'], min_context_size = 4, max_nodes=10000, max_edges=1000000): +def frequencies(corpus_path, target, stop_words=['utc', 'new', 'other'], allowed_tags=['NN','NNS','JJ','JJS','JJR','NNP'], min_context_size = 4, max_nodes=100000, max_edges=10000000): node_freq = dict() edge_freq = dict() @@ -201,14 +201,12 @@ def disambiguate(mst, hubs, contexts): try: if max(vector) == 0: - result.append((backup_cluster, idx)) - backup_cluster += 1 + pass else: cluster = np.argmax(vector) result.append((cluster, idx)) except: - result.append((backup_cluster, idx)) - backup_cluster += 1 + result.append((0, idx)) return result