From 038e4ed146e5a29933cc8dc34004f0962d1c9987 Mon Sep 17 00:00:00 2001 From: Owen Date: Thu, 7 Aug 2014 15:22:31 +0300 Subject: Issue #26 nodes didn't appear because the type selection index was undefined in the 0 to N_1 loop --- scripts/textanalysis.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'scripts/textanalysis.js') diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index cde4c937..77c158be 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -225,6 +225,9 @@ function TextAnalyser2(newtext, finalize) { //0-N ORDER STACK for (var m = 0; m < orderStack.length - 1; m++) { switch (orderStack[m]) { + case "START": + if(!typeStack[nodeindex])typeStack[nodeindex]=nodetypes[typeindex]; + break; case "NODE": graph.addNode(newnodes[nodeindex], typeStack[nodeindex], typesetter); if (!abnormalGraph) graph.addLink(newnodes[nodeindex - 1], newnodes[nodeindex], newlinks[linkindex], typesetter); @@ -254,7 +257,7 @@ function TextAnalyser2(newtext, finalize) { case "LINK": linkindex++; graph.addNode("new node", "empty", "temp"); - if (!abnormalGraph) graph.addLink(newnodes[nodeindex - 1], "new node", newlinks[linkindex], "temp"); + if (!abnormalGraph)graph.addLink(newnodes[nodeindex - 1], "new node", newlinks[linkindex], "temp"); ANDcase = ANDconnect("new node"); break; } @@ -265,12 +268,17 @@ function TextAnalyser2(newtext, finalize) { if (newnodes[nodeindex - 2]) if (newlinks[linkindex - 1].replace(/ /g, "") == "and" && newlinks[linkindex].replace(/ /g, "") !== "and") { if (!abnormalGraph) - if(finalize)graph.addLink(newnodes[nodeindex - 2], node, newlinks[linkindex], typesetter); + //if(finalize)graph.addLink(newnodes[nodeindex - 2], node, newlinks[linkindex], typesetter); + if(finalize)graph.editLink(newnodes[nodeindex - 2], newnodes[nodeindex - 1], completeSentence); else graph.addLink(newnodes[nodeindex - 2], node, newlinks[linkindex], "temp"); return true; } } + console.log(sentence); + console.log(completeSentence); + console.log(orderStack); + //STAR CASE var verb = ""; if (abnormalGraph) { -- cgit v1.3.1