Skip to content

Commit 3919691

Browse files
committed
Updated LKG build and package.json version.
1 parent 1df7282 commit 3919691

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

Node/core/lib/dialogs/EntityRecognizer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ var EntityRecognizer = (function () {
120120
if (match) {
121121
return Number(match[0]);
122122
}
123-
var oWordMatch = this.findBestMatch(this.ordinalWords, entity.entity, 0);
123+
var oWordMatch = this.findBestMatch(this.ordinalWords, entity.entity, 1.0);
124124
if (oWordMatch) {
125125
return oWordMatch.index + 1;
126126
}
@@ -171,7 +171,7 @@ var EntityRecognizer = (function () {
171171
});
172172
score = matched.length / value.length;
173173
}
174-
if (score > threshold) {
174+
if (score >= threshold) {
175175
matches.push({ index: index, entity: choice, score: score });
176176
}
177177
});

Node/core/lib/dialogs/Prompts.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ var SimplePromptRecognizer = (function () {
3434
function SimplePromptRecognizer() {
3535
}
3636
SimplePromptRecognizer.prototype.recognize = function (args, callback, session) {
37+
function findChoice(args, text) {
38+
var best = entities.EntityRecognizer.findBestMatch(args.enumValues, text);
39+
if (!best) {
40+
var n = entities.EntityRecognizer.parseNumber(text);
41+
if (!isNaN(n) && n > 0 && n <= args.enumValues.length) {
42+
best = { index: n - 1, entity: args.enumValues[n - 1], score: 1.0 };
43+
}
44+
}
45+
return best;
46+
}
3747
var score = 0.0;
3848
var response;
3949
var text = args.utterance.trim();
@@ -53,9 +63,9 @@ var SimplePromptRecognizer = (function () {
5363
case PromptType.confirm:
5464
var b = entities.EntityRecognizer.parseBoolean(text);
5565
if (typeof b !== 'boolean') {
56-
var n = entities.EntityRecognizer.parseNumber(text);
57-
if (!isNaN(n) && n > 0 && n <= 2) {
58-
b = (n === 1);
66+
var best = findChoice(args, text);
67+
if (best) {
68+
b = (best.index === 0);
5969
}
6070
}
6171
if (typeof b == 'boolean') {
@@ -71,13 +81,7 @@ var SimplePromptRecognizer = (function () {
7181
}
7282
break;
7383
case PromptType.choice:
74-
var best = entities.EntityRecognizer.findBestMatch(args.enumValues, text);
75-
if (!best) {
76-
var n = entities.EntityRecognizer.parseNumber(text);
77-
if (!isNaN(n) && n > 0 && n <= args.enumValues.length) {
78-
best = { index: n - 1, entity: args.enumValues[n - 1], score: 1.0 };
79-
}
80-
}
84+
var best = findChoice(args, text);
8185
if (best) {
8286
score = best.score;
8387
response = best;
@@ -173,7 +177,7 @@ var Prompts = (function (_super) {
173177
if (Channel.supportsKeyboards(session, args.enumValues.length)) {
174178
style = ListStyle.button;
175179
}
176-
else if (!retry) {
180+
else if (!retry && args.promptType == PromptType.choice) {
177181
style = args.enumValues.length < 3 ? ListStyle.inline : ListStyle.list;
178182
}
179183
else {

Node/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "botbuilder",
33
"author": "Microsoft Corp.",
44
"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.",
5-
"version": "3.3.1",
5+
"version": "3.3.2",
66
"license": "MIT",
77
"keywords": [
88
"botbuilder",

0 commit comments

Comments
 (0)