botbuilder
Advanced tools
Comparing version 3.8.2 to 3.8.3
@@ -563,3 +563,3 @@ "use strict"; | ||
ChatConnector.prototype.addUserAgent = function (options) { | ||
if (options.headers == null) { | ||
if (!options.headers) { | ||
options.headers = {}; | ||
@@ -573,5 +573,6 @@ } | ||
if (!err && token) { | ||
options.headers = { | ||
'Authorization': 'Bearer ' + token | ||
}; | ||
if (!options.headers) { | ||
options.headers = {}; | ||
} | ||
options.headers['Authorization'] = 'Bearer ' + token; | ||
cb(null); | ||
@@ -578,0 +579,0 @@ } |
@@ -5,3 +5,3 @@ "use strict"; | ||
var consts = require("../consts"); | ||
var simpleTokenizer = /\w+/ig; | ||
var breakingChars = " \n\r~`!@#$%^&*()-+={}|[]\\:\";'<>?,./"; | ||
var PromptRecognizers = (function () { | ||
@@ -168,3 +168,3 @@ function PromptRecognizers() { | ||
} | ||
var match = PromptRecognizers.findTopEntity(PromptRecognizers.recognizeValues(utterance, values)); | ||
var match = PromptRecognizers.findTopEntity(PromptRecognizers.recognizeValues(utterance, values, options)); | ||
if (match) { | ||
@@ -219,3 +219,3 @@ entities.push({ | ||
var text = utterance.trim().toLowerCase(); | ||
var tokens = matchAll(simpleTokenizer, text); | ||
var tokens = tokenize(text); | ||
var maxDistance = options.hasOwnProperty('maxTokenDistance') ? options.maxTokenDistance : 2; | ||
@@ -225,3 +225,3 @@ values.forEach(function (value, index) { | ||
var topScore = 0.0; | ||
var vTokens = matchAll(simpleTokenizer, value.trim().toLowerCase()); | ||
var vTokens = tokenize(value.trim().toLowerCase()); | ||
for (var i = 0; i < tokens.length; i++) { | ||
@@ -285,1 +285,23 @@ var score = matchValue(vTokens, i); | ||
} | ||
function tokenize(text) { | ||
var tokens = []; | ||
if (text && text.length > 0) { | ||
var token = ''; | ||
for (var i = 0; i < text.length; i++) { | ||
var chr = text[i]; | ||
if (breakingChars.indexOf(chr) >= 0) { | ||
if (token.length > 0) { | ||
tokens.push(token); | ||
} | ||
token = ''; | ||
} | ||
else { | ||
token += chr; | ||
} | ||
} | ||
if (token.length > 0) { | ||
tokens.push(token); | ||
} | ||
} | ||
return tokens; | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.", | ||
"version": "3.8.2", | ||
"version": "3.8.3", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "keywords": [ |
624622
13541