0

I am currently working on a project where visitors are normally using both English and Chinese to talk to each other.

Since LUIS did not support multi-language very well (Yes I know it can support in certain ways but I want a better service), I would like to build my own Neural Network as a REST API so that, when someone submits their text, we can simply predict the "Intent", while we are still using MS BotFramework (NodeJS).

By doing this we can bypass MS LUIS and using our own Language understanding service.

Here are my two questions:

  • Has anyone done that before? Any GitHub link I can reference to?
  • If I did that, what is the BotFramework API I should use? There is a recognizer called "Custom Recognizer" and I wonder if it really works.

Thank you very much in advance for all your help.

2 Answers 2

1

Another option apart from Alexandru's suggestions is to add a middleware which will call the NLP service of your choosing everytime the bot receive a chat/request.

Botbuilder allows middleware functions to be applied before handling any dialogs, I created a sample code for a better understanding below.

const bot = new builder.UniversalBot(connector, function(session) {
  //pass to root
  session.replaceDialog('root_dialog');
})

//custom middleware
bot.use({
  botbuilder: specialCommandHandler
});

//dummy call NLP service
let callNLP = (text) => {
  return new Promise((resolve, reject) => {
    // do your NLP service API call here and resolve the result

    resolve({});
  });
}

let specialCommandHandler = (session, next) => {
  //user message here
  let userMessage = session.message.text;

  callNLP.then(NLPresult => {
    // you can save your NLP result to a session
    session.conversationData.nlpResult = NLPResult;

    // this will continue to the bot dialog, in this case it will continue to root
    // dialog
    next();
  }).catch(err => {
    //handle errors
  })
}

//root dialog
bot.dialog('root_dialog', [(session, args, next) => {
  // your NLP call result
  let nlpResult = session.conversationData.nlpResult;

  // do any operations with the result here, either redirecting to a new dialog
  // for specific intent/entity, etc.

}]);

Sign up to request clarification or add additional context in comments.

1 Comment

Good thought. Thank you.
0

For Nodejs botframework implementation you have at least two ways:

  1. With LuisRecognizer as a starting point to create your own Recognizer. This approach works with single intent NLU's and entities arrays (just like LUIS);
  2. Create a SimpleDialog with a single handler function that calls the desired NLU API;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.