Commit 2c85abc2 authored by delanoe's avatar delanoe

Merge branch 'samuel' into merge

parents 20f0882a ab9356bf
...@@ -150,12 +150,13 @@ def get_cooc(request=None, corpus=None ...@@ -150,12 +150,13 @@ def get_cooc(request=None, corpus=None
try: try:
#node,type(labels[node]) #node,type(labels[node])
G.node[node_id]['pk'] = ids[node_id][1] G.node[node_id]['pk'] = ids[node_id][1]
the_label = session.query(Ngram.terms).filter(Ngram.id==node_id).first()
the_label = ", ".join(the_label)
# TODO the query below is not optimized (do it do_distance). # TODO the query below is not optimized (do it do_distance).
G.node[node_id]['label'] = session.query(Ngram.terms).filter(Ngram.id==node_id).first() G.node[node_id]['label'] = the_label
G.node[node_id]['size'] = weight[node_id] G.node[node_id]['size'] = weight[node_id]
G.node[node_id]['type'] = ids[node_id][0] G.node[node_id]['type'] = ids[node_id][0].replace("ngrams","terms")
G.node[node_id]['attributes'] = { "clust_default": partition[node_id]} # new format G.node[node_id]['attributes'] = { "clust_default": partition[node_id]} # new format
# G.add_edge(node, "cluster " + str(partition[node]), weight=3) # G.add_edge(node, "cluster " + str(partition[node]), weight=3)
except Exception as error: except Exception as error:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment