From 8a276a3e94f3a6227e766b41e94119e0001ab5bc Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Tue, 6 Jan 2015 21:42:22 +0200 Subject: client/analyzeSentence: use spec --- src/client/textanalysis.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/client/textanalysis.js') diff --git a/src/client/textanalysis.js b/src/client/textanalysis.js index 67778b81..12e6e0de 100644 --- a/src/client/textanalysis.js +++ b/src/client/textanalysis.js @@ -179,8 +179,11 @@ function tokenize(text, node_token, quote) * marks). * */ -var textAnalyser = function (newtext, finalize) { - var sentence, +var textAnalyser = function (spec) { + var newtext = spec.sentence, + finalize = spec.finalize, + cursor = spec.cursor, + sentence, token_set_new_node_names = [], // token set representing new node names token_set_new_link_names = [], // token set representing new link names linkindex = 0, @@ -204,6 +207,11 @@ var textAnalyser = function (newtext, finalize) { links = [], ret = model_diff.new_topo_diff(); + util.assert(spec.sentence !== undefined && + spec.finalize !== undefined && + spec.cursor !== undefined, + "bad input"); + function __addNode(name, type) { if (type === undefined) { console.log('bug: textanalyser.addNode of type undefined'); -- cgit v1.3.1