Does Bing spell check API have an additional length restriction for mode = spell? - bing-api

The Bing spell check API has a 10,000 char limit for the chunk of text that the request would like to do a spell check [mode=spell] or proof read [mode=proof(default)].
However I am running into an issue where a chunk of misspelt text clearly under the limit of 10k, does not return back with flagged tokens in a spell check request, but does return back in the proof read request.
What gives? Is there a lower limit for Spell check?
Output for both requests below. I am using POST in both cases and both responses return a 200 OK
Mode: spell
Request:
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?
Response:
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": [] }
Mode: proof
Request:
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?
Response:
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
}
]
}
]
}

This is a different source of Bing's API, but is probably the source of truth:
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.

Related

ms bot service, Is it possible to update both text and attachments? Encounter with `Activity resulted into multiple skype activities`

I have a demand to update past chat items which is send to bot.
I use the following API to update activity.
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#update-activity
I successfully updated the message when I request like this.
~~~ REQUEST ~~~
PUT /jp/v3/conversations/conversationID/activities/activityID HTTP/1.1
HOST : smba.trafficmanager.net
HEADERS:
Accept: application/json;charset=utf-8
Authorization: Bearer Token
Content-Type: application/json;charset=utf-8
User-Agent: go-resty/2.3.0 (https://github.com/go-resty/resty)
BODY :
{
"text": "lllllll\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\\n\u003cdiv\u003e\u003cimg width=\"386\" height=\"476\" src=\"https://host.jp.ngrok.io/api/v1/images?item_id=01TPIDETFC2MITU7PJFJHYUZEZYJBOMWCL\u0026group_id=f64dd886-4edf-4b23-8f51-c6720042807d\u0026token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJib3RfaWQiOjEsImdyb3VwX2lkIjoiZjY0ZGQ4ODYtNGVkZi00YjIzLThmNTEtYzY3MjAwNDI4MDdkIiwiaXRlbV9pZCI6IjAxVFBJREVURkMyTUlUVTdQSkZKSFlVWkVaWUpCT01XQ0wiLCJhdWQiOiJ3b3JrcGxhY2UuYmVkb3JlLmpwIiwiaWF0IjoxNjY0MzQzNDg2LCJpc3MiOiJ3b3JrcGxhY2UuYmVkb3JlLmpwIiwibmJmIjoxNjY0MzQzNDg2fQ.MZKEurQeBqP71iEcdxuiG342ZDvhMZ-QxqYnJYvbhmM\"/\u003e\u003c/div\u003e\\n\u003cp\u003e\u003cbr\u003e\u003c/p\u003e",
"type": "message",
"id": "1664769144846"
}
------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS : 200 OK
PROTO : HTTP/1.1
RECEIVED AT : 2022-10-03T15:30:50.642248+09:00
TIME DURATION: 434.921ms
HEADERS :
Content-Length: 22
Content-Type: application/json; charset=utf-8
Date: Mon, 03 Oct 2022 06:30:49 GMT
Ms-Cv: QxMPXxpyPk2IcBQOtkyErA.0
Server: Microsoft-HTTPAPI/2.0
BODY :
{
"id": "1664769144846"
}
And I failed when I request like this.
2022/10/03 15:32:45.241320 DEBUG RESTY
==============================================================================
~~~ REQUEST ~~~
PUT /jp/v3/conversations/conversationID/activities/activityID HTTP/1.1
HOST : smba.trafficmanager.net
HEADERS:
Accept: application/json;charset=utf-8
Authorization: Bearer Token
Content-Type: application/json;charset=utf-8
User-Agent: go-resty/2.3.0 (https://github.com/go-resty/resty)
BODY :
{
"text": "lllllll\u003cp\u003e\u003cbr\u003e\u003c/p\u003e\\n\u003cdiv\u003e\u003cimg width=\"386\" height=\"476\" src=\"https://host.jp.ngrok.io/api/v1/images?item_id=01TPIDETFC2MITU7PJFJHYUZEZYJBOMWCL\u0026group_id=f64dd886-4edf-4b23-8f51-c6720042807d\u0026token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJib3RfaWQiOjEsImdyb3VwX2lkIjoiZjY0ZGQ4ODYtNGVkZi00YjIzLThmNTEtYzY3MjAwNDI4MDdkIiwiaXRlbV9pZCI6IjAxVFBJREVURkMyTUlUVTdQSkZKSFlVWkVaWUpCT01XQ0wiLCJhdWQiOiJ3b3JrcGxhY2UuYmVkb3JlLmpwIiwiaWF0IjoxNjY0MzQzNDg2LCJpc3MiOiJ3b3JrcGxhY2UuYmVkb3JlLmpwIiwibmJmIjoxNjY0MzQzNDg2fQ.MZKEurQeBqP71iEcdxuiG342ZDvhMZ-QxqYnJYvbhmM\"/\u003e\u003c/div\u003e\\n\u003cp\u003e\u003cbr\u003e\u003c/p\u003e",
"type": "message",
"id": "1664769144846",
"attachments": [
{
"contentType": "image/png",
"contentUrl": "https://via.placeholder.com/750",
"name": "placeholder"
}
]
}
------------------------------------------------------------------------------
~~~ RESPONSE ~~~
STATUS : 400 Bad Request
PROTO : HTTP/1.1
RECEIVED AT : 2022-10-03T15:32:45.241272+09:00
TIME DURATION: 84.414125ms
HEADERS :
Content-Length: 91
Content-Type: application/json; charset=utf-8
Date: Mon, 03 Oct 2022 06:32:44 GMT
Ms-Cv: kn6QMv/UH0iJhMXfL0s1HA.0
Server: Microsoft-HTTPAPI/2.0
BODY :
{
"error": {
"code": "BadSyntax",
"message": "Activity resulted into multiple skype activities"
}
}
It looks that it is impossible to update text and attachments at the same time. It is necessary for us to update both text and attachments within one request for sending only attachments will erase text info.
Does anyone know the reason about **Activity resulted into multiple skype activities**?

Consul:Cannot list event with tag

If I fire event with a tag and service, I cannot list the events
PUT http://127.0.0.1:8500/v1/event/fire/eee?tag=t&&service=abc
Content-Type: application/json
{
"ask":"how much"
}
It's ok:
HTTP/1.1 200 OK
Content-Type: application/json
Vary: Accept-Encoding
X-Consul-Default-Acl-Policy: allow
Date: Tue, 08 Mar 2022 12:28:13 GMT
Content-Length: 247
Connection: close
{
"ID": "d1b228a8-8d04-d837-c0d0-6b853ec6e7e9",
"Name": "eee",
"Payload": "ew0KICAgICJhc2siOiJob3cgbXVjaCINCn0NCg0KDQoNCg0KR0VUIGh0dHA6Ly8xMjcuMC4wLjE6ODUwMC92MS9ldmVudC9saXN0",
"NodeFilter": "",
"ServiceFilter": "abc",
"TagFilter": "t",
"Version": 1,
"LTime": 0
}
However I cannot list the event.
GET http://127.0.0.1:8500/v1/event/list
It returns
HTTP/1.1 200 OK
Content-Type: application/json
Vary: Accept-Encoding
X-Consul-Default-Acl-Policy: allow
X-Consul-Index: 1
Date: Tue, 08 Mar 2022 12:23:29 GMT
Content-Length: 2
Connection: close
[]
If I fire event without tag and service, everything will be ok. So i want to know what's the problem?
I checked the code and found the answer, the service must be registered with the same tag, otherwise the event will not generate, and the list query returns empty later.

Google Fitness API returning Error 500

Is someone aware that the Google Fitness API is returning Error 500, at least for the endpoint:
https://www.googleapis.com/fitness/v1/users/me/dataset ?
I was testing my app, and keep getting Error 500 since about 7 hours ago. also have tried the Google API Explorer for the same method (taken the necessary previews steps for authorisation):
https://developers.google.com/apis-explorer/?hl=en_US#p/fitness/v1/fitness.users.dataset.aggregate?userId=me&_h=2&resource=%257B%250A++%2522aggregateBy%2522%253A+%250A++%255B%250A++%255D%252C%250A++%2522endTimeMillis%2522%253A+%25221529467200000%2522%252C%250A++%2522startTimeMillis%2522%253A+%25221529899200000%2522%250A%257D&
And this is the reponse:
cache-control: private, max-age=0
content-encoding: gzip
content-length: 122
content-type: application/json; charset=UTF-8
date: Thu, 28 Jun 2018 17:12:12 GMT
expires: Thu, 28 Jun 2018 17:12:12 GMT
server: GSE
vary: Origin, X-Origin
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
I landed here when I was navigating looking for Google Support from the Google API Explorer page. So, I hope someone sees this :)

devstack - how to reduce openstack keystone X-Subject-Token size

Through devstack I have installed openstack.
I issued following command to get token
curl -i -H "Content-Type: application/json" -d '{ "auth": { "identity": { "methods": ["password"], "password": { "user": { "name": "admin", "domain": { "id": "default" }, "password": "test123" } } } } }' "http://localhost/identity/v3/auth/tokens" ; echo
HTTP/1.1 201 Created
Date: Fri, 04 May 2018 10:45:28 GMT
Server: Apache/2.4.18 (Ubuntu)
X-Subject-Token: gAAAAABa7DnIU_mCvOZ6voN53Ff41dzhTZd1k4-6aju6nVmgmjwgFYe5NioTK6mkCoRP29BIzwXcAMElFU1X9Pc119f16Y98fFMKzh14Rol4TEtLasxl5x4L7oKgnbLGXD-STMbq8MGq860B1a4xPAU0YyDsFu3ERw
Vary: X-Auth-Token
Content-Type: application/json
Content-Length: 312
x-openstack-request-id: req-8a0cf0e2-70a1-40dd-8318-890ada890a64
Connection: close
How do i reduce X-Subject-Token size to 32 bit.
I have tried to reduce the size by setting max_token_size from lib/keystone config file by changing default value to 32 size
iniset $KEYSTONE_CONF DEFAULT max_token_size 16384
to
iniset $KEYSTONE_CONF DEFAULT max_token_size 32
After changing token size getting same token length.
Could anyone help me on how to reduce the size.
Thanks.

How to create a Git repository through projects.repos.create api?

The question is very simple but I’m only getting errors :
POST https://sourcerepo.googleapis.com/v1/projects/<example>/repos?key={YOUR_API_KEY}
{
"name": ">repos>"
}
Which gives :
HTTP/400
cache-control: private
content-encoding: gzip
content-length: 251
content-type: application/json; charset=UTF-8
date: Thu, 15 Feb 2018 22:46:47 GMT
server: ESF
vary: Origin, X-Origin, Referer
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.LocalizedMessage",
"locale": "en-US",
"message": "Invalid repo name: repos. Must be of the form projects/<project>/repos/<repo>"
}
]
}
}
Where example is an existing project and repos is the repository name I want to create.
What am I missing ? I failed to find an example of working code.
This is the most important part of the error:
{
....
"message": "Invalid repo name: repos. Must be of the form projects/<project>/repos/<repo>"
....
}
Which tells you that the format of the name field is not correct. Let's say you have this settings:
Project: your-project-name
Repo: desired-repo-name
Then your request body must be:
{
"name": "projects/your-project-name/repos/desired-repo-name"
}
After executing you'll receive the confirmation:
200
cache-control: private
content-encoding: gzip
content-length: 77
content-type: application/json; charset=UTF-8
date: Wed, 21 Feb 2018 11:12:46 GMT
server: ESF
vary: Origin, X-Origin, Referer
{
"name": "projects/your-project-name/repos/desired-repo-name"
}

Resources