Bing Spell Check API, stops working after 128 characters

I am trying to use the Bing Spell Check API v5, but am encountering many problems.

When requesting spell or proof with the sentence below, it does not return marked tokens .

This is a long time with some errors here. It should be a question, but I can't come up with a long question. maybe it means that I don’t have anything shameful?

 {"_type": "SpellCheck", "flaggedTokens": []} 

If I limit the request text to 128 characters, it will work though . I tested this in the Bing API testing console , this works.

I call the API with recommendations for PHP ( Http_Request2 ) with a variation of POST . In addition, at the moment I am using a free subscription , but I will be updated if the application works. Otherwise, it seems that I will have to find another API, and this is a shame.

I tried to request this in many different ways to make sure that this is not just my code. I used cURL and the PostMan application, but all return the same problem .

Any insight into why this is happening would be greatly appreciated as it gave me hours of confusion!

+6
source share
2 answers

Code work, text unreliable, 128 is not the maximum size. I don’t know why the Bing api test processes your text without any problems.

How to get to these findings? Copy your favorite implementation from here or use Postman (yes, it works). Using Post or Get does not matter for the size of the text.

Try with the text “Bill Gatas” formatted with% 20 or +, it has the same result as in the example. Confirmation of the work of your code.

Then try the following text: more than 128 characters (162). And he must return the result.

% 20is% 20a% 20long% 20Bill% 20Gatas% 20.Bill% 20Gatas% 20.Bill% 20Gatas% 20.Bill% 20Gatas% 20.Bill% 20Gatas% 20.Bill% 20Gatas% 20.Bill% 20Gatas% 20. % 20.Bill% 20Gatas% 20. % 20.Bill% 20

All that this has is an empty result. (try adding gatas to the end). Now the spec says the maximum value is 1500 characters in the URL, and "The combined length of the text string, preContextText and postContextText cannot exceed 10,000 characters." And as indicated here , the spell was designed for about 9 tokens.

So, whatever the Bing test website does, this is probably some kind of batch job. Or they got an evidence-based implementation for the job.

  • (Which I tried, same result, not tokens)
  • (And again I tried all this for v7, the same result, without tokens)
0
source

Well, that’s not entirely true. For GET requests, there is usually a restriction imposed by the server. Most security configurations limit the length of the query string. If you have a large text string, you should use a mail request. https://app.pluralsight.com/library/courses/microsoft-azure-cognitive-services-bing-spell-check-api/table-of-contents

0
source

Source: https://habr.com/ru/post/1264496/


All Articles