question

LuciaCasucci-9483 avatar image
0 Votes"
LuciaCasucci-9483 asked DSPatrick edited

How to call bing spell check API from qnA knowledge base to correct the user typos

Hello!

I am trying to build a bot from a qNa service in Azure.
I would like to implement some type of spell check of the user to make sure a wrong typed word will still lead the user to what they are trying to find.
From my research I saw that bing spell check could be a possible solution.
However, while it seems pretty straighforward to implement into a LUIS , I do not see an easy way to implement it in the qnA knowledgebase.

What is the best practice to achieve this? I am not an expert coder and the only documentation to send a post request to the bing API that I was able to find was just few lines out code that were not helpful, especially since the bot source code has a ton of sub files.

Any help is appreciated, and if the bing spell check is too advanced, I would also appreciate some work around alternatives.

azure-cognitive-servicesazure-bot-serviceazure-bing-spellcheck
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YutongTie-MSFT avatar image
0 Votes"
YutongTie-MSFT answered

Hello,

Hope you have seen this document for how to integrate it will QnA maker. https://docs.microsoft.com/en-us/azure/cognitive-services/luis/luis-tutorial-bing-spellcheck

Then 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. Try to modify context.activity.text and removed or @ mentions from Teams, which were affecting intent identification and QnA answers.

Regards,
Yutong

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LuciaCasucci-9483 avatar image
0 Votes"
LuciaCasucci-9483 answered

@YutongTie-MSFT - Thank you in advance!

I did not configure LUIS from scratch since I had a lot of documents to extract questions from and it would have been too long to type every entry in the intent and utterances. That file link seems to be more effective in the case i started right from LUIS, not the QnA.


What I am not sure, do I need to add that code snippet in the QnA.cs bot file?
Also, how do I connect the bing service to it, do I need to embed the API key and endpoint somewhere in the QnA service?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.