diff --git a/javascript/gflib.js b/javascript/gflib.js index ce2b0267..faf7b1d6 100644 --- a/javascript/gflib.js +++ b/javascript/gflib.js @@ -410,6 +410,10 @@ Parser.prototype.showRules = function () { }; Parser.prototype.parseString = function (string, cat) { var tokens = string.split(" "); + // remove empty tokens + for (var i = tokens.length - 1; i >= 0; i--) { + if (tokens[i] == "") { tokens.splice(i, 1); } + } chart = new Chart(true); predict(this.rules, tokens); while (chart.updated) {