Ashkan S
Ashkan S

Reputation: 11491

Bing-Spellcheck Api doesn't work for languages other than English (en-US)

The error

When I call the Api with mkt or language set to da, the response list is empty no matter what I do.

What have I done until now

Nuget package and tried with English (worked)

I've added the service to my Azure subscription and tried the c# code for it for English:

   var text = "he wil be their in 5 minut";
   var result = client.SpellCheckerWithHttpMessagesAsync(text: text, mode: "proof", acceptLanguage: "en-US").GetAwaiter().GetResult();

and I get 3 results back which is expected:

results on English

Nuget (c#) with danish returns empty

Now I change the language to Danish as it is in the supported languages with Language code da.

var text = "De er pa dansk";
var result = client.SpellCheckerWithHttpMessagesAsync(text: text, mode: "proof", /*acceptLanguage: "da",*/ market:"da").GetAwaiter().GetResult();

I've tried with both market and acceptLanguage set to "da" (both separated and together) but it didn't work. and the results is empty.

danish results

I have also tried the Api using postman but the same thing happened

Api call directly for English (worked)

English

Api call directly for English (not working)

enter image description here I also receive BingAPIs-Market →da-DK in the response headers back.

Update

As Ronak has suggested, I've changed mode to spell but it mostly doesn't catch a thing.

If I run it with bil gate in Danish market it returns 1 token so at least I know it is checking something bil gate danish

But when I write a misspelled Danish sentence it returns nothing. The original sentence is this:

Fra på søndag kan der komme ekstra meget fart på cykelstierne

which I have changed to

ra på søndag ka der komme ekssra meget fart pa cykelstierne

Fra => ra
kan => ka
ekstra =>ekssra
på=> pa

Url encoded to

ra%20pa%20sondag%20ka%20der%20komme%20ekssra%20meget%20fart%20på%20cykelstierne

wrong danish url encoded wrong danish

Update 2

It seems that there is a limitation or something on the number of the words. When I try the sentence as Ronak mentioned "ra%20pa%20sondag%20ka%20der%20komme%20ekssra%20meget%20fart" I get the results back, but when I add one more word (like ra%20pa%20sondag%20ka%20der%20komme%20ekssra%20meget%20fart%20pa), the response will be empty again. partial sentence adding 1 more word

Upvotes: 2

Views: 1081

Answers (2)

Tobias P. G.
Tobias P. G.

Reputation: 820

A) The documentation still seems to say the limit is 65 characters, but mine varies and often cut-offs at ~50.

B) The preContextText and postContextText parameters doesn't seem to work, at least not with any of the tests I did that were very similar to those on the documentation page.

https://learn.microsoft.com/en-us/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference

Upvotes: 0

Ronak
Ronak

Reputation: 736

mode=proof is only supported for the en-us market.

Please use the mode=spell. Here is the reference to that:

https://learn.microsoft.com/en-us/rest/api/cognitiveservices/bing-spell-check-api-v7-reference.

Please also provide mkt parameter in the query, if possible.

Upvotes: 3

Related Questions