Bing 拼写检查 API 是否对 mode = spell 有额外的长度限制?
Does Bing spell check API have an additional length restriction for mode = spell?
Bing spell check API 对请求要进行拼写检查 [mode=spell] 或校对 [mode=proof(default)] 的文本块有 10,000 个字符的限制。
然而,我 运行 遇到了一个问题,其中一大块拼写错误的文本明显低于 10k 的限制,return 没有在拼写检查请求中返回带标记的标记,但是 return 返回校对请求。
什么给了?拼写检查是否有下限?
以下两个请求的输出。我在两种情况下都使用 POST 并且两种响应都 return a 200 OK
模式:拼写
要求:
POST
https://api.cognitive.microsoft.com/bing/v5.0/spellcheck/?mode=spell
HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host:
api.cognitive.microsoft.com Ocp-Apim-Subscription-Key:
••••••••••••••••••••••••••••••••
Text=This is a long sentance with some mistakes in here. its supposed
to be a question but i can’t think of a long question. maybe that
means i don’t have something selious to ask?
响应:
Vary: Accept-Encoding BingAPIs-TraceId:
2802E335D1A04D22865FCA6039E61233 X-MSEdge-ClientID:
3F1CA016365F6B862DF6AA10376E6A50 X-MSAPI-UserState: 97c3
BingAPIs-Market: en-US X-MSEdge-Ref: Ref A:
2802E335D1A04D22865FCA6039E61233 Ref B:
E62A760E2E5891B3D022742C51159258 Ref C: Tue Jan 10 13:44:58 2017 PST
apim-request-id: 7b94e044-d1fe-4bbc-a153-4d4e5ef30586
Strict-Transport-Security: max-age=31536000; includeSubDomains;
preload Cache-Control: max-age=0, private Date: Tue, 10 Jan 2017
21:44:57 GMT P3P: CP="NON UNI COM NAV STA LOC CURa DEVa PSAa PSDa OUR
IND" Content-Length: 44 Content-Type: application/json; charset=utf-8
Expires: Tue, 10 Jan 2017 21:43:57 GMT
{ "_type": "SpellCheck", "flaggedTokens": [] }
模式:证明
要求:
POST
https://api.cognitive.microsoft.com/bing/v5.0/spellcheck/?mode=proof
HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host:
api.cognitive.microsoft.com Ocp-Apim-Subscription-Key:
••••••••••••••••••••••••••••••••
Text=This is a long sentance with some mistakes in here. its supposed
to be a question but i can’t think of a long question. maybe that
means i don’t have something selious to ask?
响应:
Vary: Accept-Encoding BingAPIs-TraceId:
627B24C4E6D148E1B441F29A4872942B X-MSEdge-ClientID:
33F31CBFF80462EB27B316B9F935630A X-MSAPI-UserState: 983f
BingAPIs-Market: en-US X-MSEdge-Ref: Ref A:
627B24C4E6D148E1B441F29A4872942B Ref B:
79AB388A3DFCBD481B71DB909B097DC3 Ref C: Tue Jan 10 13:46:16 2017 PST
apim-request-id: 645f3de5-6823-40d1-aea6-312e10d1eee2
Strict-Transport-Security: max-age=31536000; includeSubDomains;
preload Cache-Control: max-age=0, private Date: Tue, 10 Jan 2017
21:46:16 GMT P3P: CP="NON UNI COM NAV STA LOC CURa DEVa PSAa PSDa OUR
IND" Content-Length: 700 Content-Type: application/json; charset=utf-8
Expires: Tue, 10 Jan 2017 21:45:16 GMT
{
"_type": "SpellCheck",
"flaggedTokens": [
{
"offset": 15,
"token": "sentance",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "sentence",
"score": 0.687877624668787
}
]
},
{
"offset": 86,
"token": "i",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "I",
"score": 0
}
]
},
{
"offset": 137,
"token": "i",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "I",
"score": 0
}
]
},
{
"offset": 52,
"token": "its",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "it's",
"score": 0.830337199488689
}
]
},
{
"offset": 160,
"token": "selious",
"type": "UnknownToken",
"suggestions": [
{
"suggestion": "serious",
"score": 0.897224156828521
},
{
"suggestion": "delicious",
"score": 0.687622047694618
}
]
}
]
}
这是 Bing 的 API 的不同来源,但可能是真实来源:
https://dev.cognitive.microsoft.com/docs/services/56e73033cf5ff80c2008c679/operations/56e73036cf5ff81048ee6727
Spell - Meant to provide Search engine like spelling corrections. It
will correct small queries(up to length 9 tokens) without any casing
changes and will be more optimized (perf and relevance) towards search
like queries.
Bing spell check API 对请求要进行拼写检查 [mode=spell] 或校对 [mode=proof(default)] 的文本块有 10,000 个字符的限制。
然而,我 运行 遇到了一个问题,其中一大块拼写错误的文本明显低于 10k 的限制,return 没有在拼写检查请求中返回带标记的标记,但是 return 返回校对请求。
什么给了?拼写检查是否有下限?
以下两个请求的输出。我在两种情况下都使用 POST 并且两种响应都 return a 200 OK
模式:拼写
要求:
POST https://api.cognitive.microsoft.com/bing/v5.0/spellcheck/?mode=spell HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host: api.cognitive.microsoft.com Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
Text=This is a long sentance with some mistakes in here. its supposed to be a question but i can’t think of a long question. maybe that means i don’t have something selious to ask?
响应:
Vary: Accept-Encoding BingAPIs-TraceId: 2802E335D1A04D22865FCA6039E61233 X-MSEdge-ClientID: 3F1CA016365F6B862DF6AA10376E6A50 X-MSAPI-UserState: 97c3 BingAPIs-Market: en-US X-MSEdge-Ref: Ref A: 2802E335D1A04D22865FCA6039E61233 Ref B: E62A760E2E5891B3D022742C51159258 Ref C: Tue Jan 10 13:44:58 2017 PST apim-request-id: 7b94e044-d1fe-4bbc-a153-4d4e5ef30586 Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Cache-Control: max-age=0, private Date: Tue, 10 Jan 2017 21:44:57 GMT P3P: CP="NON UNI COM NAV STA LOC CURa DEVa PSAa PSDa OUR IND" Content-Length: 44 Content-Type: application/json; charset=utf-8 Expires: Tue, 10 Jan 2017 21:43:57 GMT
{ "_type": "SpellCheck", "flaggedTokens": [] }
模式:证明
要求:
POST https://api.cognitive.microsoft.com/bing/v5.0/spellcheck/?mode=proof HTTP/1.1 Content-Type: application/x-www-form-urlencoded Host: api.cognitive.microsoft.com Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
Text=This is a long sentance with some mistakes in here. its supposed to be a question but i can’t think of a long question. maybe that means i don’t have something selious to ask?
响应:
Vary: Accept-Encoding BingAPIs-TraceId: 627B24C4E6D148E1B441F29A4872942B X-MSEdge-ClientID: 33F31CBFF80462EB27B316B9F935630A X-MSAPI-UserState: 983f BingAPIs-Market: en-US X-MSEdge-Ref: Ref A: 627B24C4E6D148E1B441F29A4872942B Ref B: 79AB388A3DFCBD481B71DB909B097DC3 Ref C: Tue Jan 10 13:46:16 2017 PST apim-request-id: 645f3de5-6823-40d1-aea6-312e10d1eee2 Strict-Transport-Security: max-age=31536000; includeSubDomains; preload Cache-Control: max-age=0, private Date: Tue, 10 Jan 2017 21:46:16 GMT P3P: CP="NON UNI COM NAV STA LOC CURa DEVa PSAa PSDa OUR IND" Content-Length: 700 Content-Type: application/json; charset=utf-8 Expires: Tue, 10 Jan 2017 21:45:16 GMT
{
"_type": "SpellCheck",
"flaggedTokens": [
{ "offset": 15, "token": "sentance", "type": "UnknownToken", "suggestions": [ { "suggestion": "sentence", "score": 0.687877624668787 } ] }, { "offset": 86, "token": "i", "type": "UnknownToken", "suggestions": [ { "suggestion": "I", "score": 0 } ] }, { "offset": 137, "token": "i", "type": "UnknownToken", "suggestions": [ { "suggestion": "I", "score": 0 } ] }, { "offset": 52, "token": "its", "type": "UnknownToken", "suggestions": [ { "suggestion": "it's", "score": 0.830337199488689 } ] }, { "offset": 160, "token": "selious", "type": "UnknownToken", "suggestions": [ { "suggestion": "serious", "score": 0.897224156828521 }, { "suggestion": "delicious", "score": 0.687622047694618 } ] }
]
}
这是 Bing 的 API 的不同来源,但可能是真实来源: https://dev.cognitive.microsoft.com/docs/services/56e73033cf5ff80c2008c679/operations/56e73036cf5ff81048ee6727
Spell - Meant to provide Search engine like spelling corrections. It will correct small queries(up to length 9 tokens) without any casing changes and will be more optimized (perf and relevance) towards search like queries.