diff options
| author | Alon Levy <alon@pobox.com> | 2014-09-28 15:04:05 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-09-28 15:04:05 +0300 |
| commit | 9d4ada6425effb1223a74810646fe0a380c91008 (patch) | |
| tree | 043f34a462c10e1a35658c71bd00185208975906 /scripts/textanalysis.js | |
| parent | 77987826027b26b528f0b3dcbdc898395bf677c1 (diff) | |
textanalysis: move graph touching function to non ui part
Diffstat (limited to 'scripts/textanalysis.js')
| -rw-r--r-- | scripts/textanalysis.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index 7ac32277..ecebdbeb 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -284,5 +284,21 @@ var textAnalyser2 = function (newtext, finalize) { //FOR THE EXTERNAL ARROW-TYPE CHANGER lastnode = newnodes[nodeindex]; + ret.applyToGraph = function(graph) { + //REINITIALISE GRAPH (DUMB BUT IT WORKS) + graph.removeNodes("temp"); + graph.removeLinks("temp"); + for (var k in ret.nodes) { + var n = ret.nodes[k]; + graph.addNode(n.id, n.type, n.state); + } + for (var k in ret.links) { + var l = ret.links[k]; + graph.addLink(l.sourceId, l.targetId, l.name, l.state, ret.drop_conjugator_links); + } + //UPDATE GRAPH ONCE + graph.update(); + } + return ret; } |
