diff options
| author | Alon Levy <alon@pobox.com> | 2015-02-25 00:32:44 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-02-27 08:14:09 +0200 |
| commit | 01643a809f69a39fb4981b104e14ea75a4428769 (patch) | |
| tree | 5f663e5de0f49f3a94b921c857660be7ea7584c7 | |
| parent | edc2ac61b3eb44d3628d52ca0d554d491a31dda9 (diff) | |
client: rename separator_symbol to separator_string and move to rz_config
| -rw-r--r-- | res/templates/index.html | 2 | ||||
| -rw-r--r-- | src/client/textanalysis.js | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/res/templates/index.html b/res/templates/index.html index c1b19da7..05130f13 100644 --- a/res/templates/index.html +++ b/res/templates/index.html @@ -12,6 +12,8 @@ var rz_config = { // set as a global variable 'backend__maintain_ws_connection': true, 'feedback_url': '/feedback', 'optimized_main': {{ rz_config__optimized_main }}, + 'node_edge_separator': true, + 'separator_string': ' ' }; </script> <script data-main='/static/app.js' src="/static/lib/require.js"></script> diff --git a/src/client/textanalysis.js b/src/client/textanalysis.js index 02f24211..4ce45795 100644 --- a/src/client/textanalysis.js +++ b/src/client/textanalysis.js @@ -3,8 +3,8 @@ function(rz_core, model_core, model_util, model_diff, consts, util) { "use strict"; // Constants -var node_edge_separator = true; -var separator_symbol = ' '; //'#'; //' '; +var node_edge_separator = rz_config.node_edge_separator; +var separator_string = rz_config.separator_string; var typeindex = 0, nodetypes = consts.nodetypes, @@ -151,7 +151,7 @@ function obj_field_not_equal(field, value) { */ function tokens_to_graph_elements_with_separator(tokens) { return reduce(tokens, [[] /* no prefix */, []], function (data, token) { - if (token.token === separator_symbol) { + if (token.token === separator_string) { data.push([]); } else { data[data.length - 1].push(token); @@ -163,7 +163,7 @@ function tokens_to_graph_elements_with_separator(tokens) { function tokens_to_graph_elements_with_node_sign(tokens) { var ret = [[]]; // prefix is the first element for (var i = 0 ; i < tokens.length;) { - if (tokens[i].token === separator_symbol) { + if (tokens[i].token === separator_string) { if (tokens.length == i + 1) { tokens.push({end: tokens[i].end + 1 + NEW_NODE_NAME.length, token: NEW_NODE_NAME}); @@ -425,7 +425,7 @@ var textAnalyser = function (spec) { //Sentence Sequencing //Build the words and cuts the main elements - tokens = tokenize(cleanup(newtext), separator_symbol, '"'); + tokens = tokenize(cleanup(newtext), separator_string, '"'); tokens.forEach(function (token) { switch (token.token) { case "and": |
