summaryrefslogtreecommitdiff
path: root/src/client/textanalysis.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-28 12:34:31 +0200
committerAlon Levy <alon@pobox.com>2014-12-28 12:34:31 +0200
commit7ae51db3a74814fd14a12d4a1a00970a6d63e1d6 (patch)
tree432931203fcd38ab13e92bb9810b9da9c22d8dfd /src/client/textanalysis.js
parent1b3d680ba284b4344de3df58b3908fe7e1c790ad (diff)
client/textanalysis: fix #241 - return spaces to chained sentence chain node
Diffstat (limited to 'src/client/textanalysis.js')
-rw-r--r--src/client/textanalysis.js13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/client/textanalysis.js b/src/client/textanalysis.js
index 63287913..1e691154 100644
--- a/src/client/textanalysis.js
+++ b/src/client/textanalysis.js
@@ -205,6 +205,7 @@ var textAnalyser = function (newtext, finalize) {
m,
word,
completeSentence,
+ completeSentenceParts,
typesetter, starGraph,
n,
link_hash = {},
@@ -320,18 +321,18 @@ var textAnalyser = function (newtext, finalize) {
linkindex = 0;
nodeindex = 0;
word = "";
- completeSentence = prefix.length > 0 ? String(prefix) + " " : "";
+ completeSentenceParts = prefix.length > 0 ? [String(prefix)] : [];
for (m = 0; m < orderStack.length; m++) {
if (orderStack[m] === NODE) {
word += " (" + token_set_new_node_names[nodeindex] + ") ";
- completeSentence += token_set_new_node_names[nodeindex] + " ";
+ completeSentenceParts.push(token_set_new_node_names[nodeindex]);
nodeindex++;
} else if (orderStack[m] === LINK) {
word += " -->" + token_set_new_link_names[nodeindex] + " --> ";
- completeSentence += token_set_new_link_names[nodeindex];
+ completeSentenceParts.push(token_set_new_link_names[nodeindex]);
}
}
- completeSentence = completeSentence.trim();
+ completeSentence = completeSentenceParts.join(" ").trim();
//REBUILD GRAPH
linkindex = 0;
@@ -426,10 +427,6 @@ var textAnalyser = function (newtext, finalize) {
}
}
- /*console.log(sentence);
- console.log(completeSentence);
- console.log(orderStack);*/
-
//STAR CASE
if (starGraph) {
addNode(completeSentence, "chainlink", typesetter);