From ad91922925714aa251e5efd99e49196b9cd4764a Mon Sep 17 00:00:00 2001 From: Victor Zimmermann <zimmermann@cl.uni-heidelberg.de> Date: Tue, 6 Mar 2018 17:07:18 +0100 Subject: [PATCH] All in one if no root hubs, singletons if no cluster matches. --- code/absinth_nx.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/absinth_nx.py b/code/absinth_nx.py index 8b76553..14726b1 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 -- GitLab