File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,15 @@ def dynamic_graph_to_gephi_graph(graphs: List[nx.Graph]) -> nx.Graph:
124
124
G = nx .Graph ()
125
125
126
126
for H_i , H in enumerate (graphs ):
127
+
128
+ # update node attributes
129
+ for u in H .nodes :
130
+ G .add_node (u )
131
+ for key , value in H .nodes [u ].items ():
132
+ # format : (VALUE, START, END)
133
+ series = G .nodes [u ].get (key , [])
134
+ G .nodes [u ][key ] = series + [(value , H_i , H_i + 1 )]
135
+
127
136
for u , v in H .edges :
128
137
# create a new edge between two characters if it doesn't
129
138
# exist yet
Original file line number Diff line number Diff line change @@ -306,8 +306,11 @@ def _extract_graph(
306
306
307
307
# * Construct graph from co-occurence matrix
308
308
G = nx .Graph ()
309
- for character , _ in mentions :
310
- G .add_node (character )
309
+ for character , mention in mentions :
310
+ # NOTE: we add an 'entity_type' attribute. This is useful
311
+ # when using the 'additional_ner_classes' option, to
312
+ # differentiate between different entity types.
313
+ G .add_node (character , entity_type = mention .tag )
311
314
312
315
for i , (char1 , mention1 ) in enumerate (mentions ):
313
316
for j , (char2 , mention2 ) in enumerate (mentions ):
You can’t perform that action at this time.
0 commit comments