summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2014-11-17 13:37:57 +0200
committerAlon Levy <alon@pobox.com>2014-11-19 23:21:42 +0200
commit8f4a44e04b7b96e3cd4327faa6c4d147b91b2cb1 (patch)
tree77a116b2119f91e8fc24c2301a201223e502c4cc /src
parent31328d7f2ed3de8362cebf9358a9f331fe1abaff (diff)
misc
Diffstat (limited to 'src')
-rw-r--r--src/textanalysis.js27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/textanalysis.js b/src/textanalysis.js
index 2d03d239..f212d07d 100644
--- a/src/textanalysis.js
+++ b/src/textanalysis.js
@@ -208,7 +208,7 @@ var textAnalyser = function (newtext, finalize) {
//Build the words and cuts the main elements
sentence = tokenize(newtext, '#', '"');
- //BUILD NEW NODE AND LINK ARRAYS WITH ORDER OF APPEARENCE
+ // build new node,link arrays in order of appearance
for (m = 0; m < sentence.length; m++) {
switch (sentence[m]) {
case "#":
@@ -383,21 +383,20 @@ var textAnalyser = function (newtext, finalize) {
ret.applyToGraph = function(graph, backend_commit) {
window.ret = ret;
- var comp = graph.compareSubset('temp',
- ret.nodes.filter(
- function(node) {
- return !graph.hasNodeByName(node.name, "perm")
+
+ /*
+ * generate fitered node set who:
+ * - are not name-present in graph
+ * - are not of type 'bubble'
+ */
+ var n_set = ret.node_set_add.filter(function(node) {
+ return false == graph.hasNodeByName(node.name, "perm")
&& node.type !== 'bubble';
- }).map(function (node) {
- return {name: node.name};
- }),
- ret.links.map(
- function (link) {
- return [link.sourceName, link.targetName];
- }));
+ });
+
+ var comp = graph.compareSubset('temp', n_set, ret.link_set_add);
- var k, n, l;
- if (comp.graph_same && !finalize) {
+ if (false == finalize && comp.graph_same) {
if (comp.old_name && comp.new_name) {
up_to_two_renames(graph, comp.old_name, comp.new_name);
}