Skip to content

Commit eb8bed5

Browse files
authored
Updated and fixed bug
1 parent f02d0af commit eb8bed5

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

python/Language/BingSpellCheckv7.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
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
56
import 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

715
text = 'Hollo, wrld!'
816

@@ -13,6 +21,7 @@
1321

1422
# Add your Bing Spell Check endpoint to your environment variables.
1523
host = os.environ['BING_SPELL_CHECK_ENDPOINT']
24+
host = host.replace('https://', '')
1625
path = '/bing/v7.0/spellcheck'
1726

1827
headers = {'Ocp-Apim-Subscription-Key': key,
@@ -29,4 +38,4 @@
2938
params = urllib.parse.urlencode (params)
3039
conn.request ("POST", path, params, headers)
3140
response = conn.getresponse ()
32-
print (response.read ())
41+
pprint(json.loads(response.read()))

0 commit comments

Comments
 (0)