diff --git a/lib/index.js b/lib/index.js index 6d75e81..f7a0b3a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -15,9 +15,13 @@ var spoken = require('spoken-numbers'); function GrammarGenerator() { //(function constructor(self) {})(this); } +GrammarGenerator.prototype.normalizeTextValue = function (value) { + return (value + '').toLocaleLowerCase().trim(); +}; GrammarGenerator.prototype.replaceTopicReferenceWithValue = function (model, topicReference, value) { + var self = this; var topicReferenceToken = '{' + topicReference + '}'; - var valueToken = '{' + value + '|' + topicReference + '}'; + var valueToken = '{' + self.normalizeTextValue(value) + ' | ' + topicReference + '}'; return model.replace(topicReferenceToken, valueToken); }; GrammarGenerator.prototype.getNextTopicReference = function (model) {