Microsoft Cognitive Challenge Bot Strategy

The template code provide will perform some basic functions using the Microsoft Cognitive Services including reading the text from image and a basic spell check.

Here are some further suggestions of strategies to improve your bots performance.

Word breaking

Use the Web Language Model API word breaking function to split words when you think one or more spaces have been removed.

https://westus.api.cognitive.microsoft.com/text/weblm/v1.0/breakIntoWords?model=title&text=thequickbrownfox&order=5&maxNumOfCandidatesReturned=5

This would return a result of:

{
  "candidates": [{
    "words": "the quick brown fox",
    "probability": -7.5340000000000007
  }, {
    "words": "the quickbrownfox",
    "probability": -11.758999999999999
  }, {
    "words": "t h e quick brown fox",
    "probability": -14.189
  }, {
    "words": "th e quick brown fox",
    "probability": -14.531
  }, {
    "words": "th e quickbrownfox",
    "probability": -16.1
  }]
}

In the above example you can see the text "thequickbrownfox" was submitted to the function and it correctly identifies the most likely correct sentence would be "the quick brown fox".

Next word completions

Use the Web Language Model API Generate Next Words function to see if the next word in the sentence matches.
For example you have the sentence "the quick brown ofxx" after you have applied the spell check. You could take the first 3 words of the sentence to see what might come next.

https://westus.api.cognitive.microsoft.com/text/weblm/v1.0/generateNextWords?model=title&words=the quick brown&order=5&maxNumOfCandidatesReturned=5

This would return a result of:

{
  "candidates": [{
    "word": "fox",
    "probability": -0.014
  }]
}

If this matches the next word move on if it doesn't try replacing it and see if your answer is any better.

Keep a track of your score

If your distance is small don't make too many changes. If your distance is exactly 2 you could try swapping common two letter words with other possibilities eg replace 'to' with 'at'. You could also try adding in two letter words.

There are only two words 'A' and 'I' that are one letter long

If you have any other letter on its own you know it is wrong so try removing spaces either to the left or right of it.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License