4
votes

I need to make a bilingual bot using Node.js and Microsoft Bot Framework. The bot uses LUIS for natural language.

I use the standard way to plug in LUIS:

// Create bot, send welcome message:
let bot = new builder.UniversalBot(connector, NoneIntentHandler);

// Plug in LUIS:
bot.recognizer(new builder.LuisRecognizer(config.luis.url));

However, I need to support two languages, English and Chinese. It's not a problem for me to detect a language. I have two separate LUIS apps, one for English and one for Chinese, and they return the same intents and entities.

But the problem is how to dynamically switch between two different apps, depending on the language of the user's input. The bot.recognizer doesn't accept two URLs or any other parameters. So it seems there is no built in support for that.

Is there some way to dynamically kill and recreate the bot object with another recognizer? Or reassign the recognizer depending on the LUIS language? Or any other way to do it?

1

1 Answers

2
votes

You can try the following:

var recognizer1 = new builder.LuisRecognizer('<model 1>');
var recognizer2 = new builder.LuisRecognizer('<model 2>');
var intents = new builder.IntentDialog({ recognizers: [recognizer1, recognizer2] });