File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 11#Copyright (c) Microsoft Corporation. All rights reserved.
22#Licensed under the MIT License.
33
4- import http .client , urllib .parse , json
4+ import http .client
5+ import json
56import os
7+ from pprint import pprint
8+ import urllib .parse
9+
10+ '''
11+ This sample uses the Bing Spell Check API to check the spelling of query words and then suggests corrections.
12+ Bing Spell Check API: https://dev.cognitive.microsoft.com/docs/services/5f7d486e04d2430193e1ca8f760cd7ed/operations/57855119bca1df1c647bc358
13+ '''
614
715text = 'Hollo, wrld!'
816
1321
1422# Add your Bing Spell Check endpoint to your environment variables.
1523host = os .environ ['BING_SPELL_CHECK_ENDPOINT' ]
24+ host = host .replace ('https://' , '' )
1625path = '/bing/v7.0/spellcheck'
1726
1827headers = {'Ocp-Apim-Subscription-Key' : key ,
2938params = urllib .parse .urlencode (params )
3039conn .request ("POST" , path , params , headers )
3140response = conn .getresponse ()
32- print ( response .read ( ))
41+ pprint ( json . loads ( response .read () ))
You can’t perform that action at this time.
0 commit comments