Search code examples
botframeworkspell-checkingazure-language-understandingazure-qna-maker

Can the bing spell check api via integration with LUIS.AI be used with the dispatch pattern for QnA knowledge based questions?


From what I am understanding the bing spellcheck api via azure can be integrated with LUIS queries but not qna queries on their own. However, when you use the dispatch multi-model pattern with a parent LUIS app and child apps the overall query or top level query coming from luis can run the bing spellcheck api.

Is this the suggested method for assuring some spellchecking is applied to a qna knowledge base?


Solution

  • Yes, you can do this with Dispatch Bot. When you get the results back from the recognizer, there will be an alteredText value if spell check made a correction. What you're wanting to do is replace the original text with this new value.

    const recognizerResult = await this.dispatchRecognizer.recognize(context);
    if (recognizerResult.alteredText) {
        context.activity.text = recognizerResult.alteredText;
    }
    
    <code to select intent>
    
    var processResult = await this.qnaDialog.processAsync(userDialog.qnaState, context.activity)
    

    QnA Maker should now receive the query with the altered text. I don't have this implementation exactly but I had to do something similar where I modified context.activity.text and removed or @ mentions from Teams, which were affecting intent identification and QnA answers.