Skip to content

Commit 0feeaaa

Browse files
authored
Merge pull request #99092 from aahill/bing-spell-check-setup
[CogSvcs] Spell Check API setup instructions
2 parents cd878c0 + e7c19df commit 0feeaaa

File tree

8 files changed

+142
-82
lines changed

8 files changed

+142
-82
lines changed

articles/cognitive-services/Bing-Spell-Check/quickstarts/csharp.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: nitinme
88
ms.service: cognitive-services
99
ms.subservice: bing-spell-check
1010
ms.topic: quickstart
11-
ms.date: 04/11/2019
11+
ms.date: 12/16/2019
1212
ms.author: aahi
1313
---
1414

@@ -41,7 +41,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
4141
using Newtonsoft.Json;
4242
```
4343

44-
2. Create variables for the API endpoint, your subscription key, and the text to be spell checked.
44+
2. Create variables for the API endpoint, your subscription key, and the text to be spell checked. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
4545

4646
```csharp
4747
namespace SpellCheckSample
@@ -132,6 +132,10 @@ static void Main(string[] args)
132132
}
133133
```
134134

135+
## Run the application
136+
137+
Build and run your project. If you're using Visual Studio, press **F5** to debug the file.
138+
135139
## Example JSON response
136140

137141
A successful response is returned in JSON, as shown in the following example:

articles/cognitive-services/Bing-Spell-Check/quickstarts/java.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-spell-check
1111
ms.topic: quickstart
12-
ms.date: 04/11/2019
12+
ms.date: 12/16/2019
1313
ms.author: aahi
1414
---
1515

@@ -36,7 +36,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
3636
import javax.net.ssl.HttpsURLConnection;
3737
```
3838

39-
2. Create variables for the API endpoint's host, path, and your subscription key. Then create variables for your market, the text you want to spell check, and a string for the spell check mode.
39+
2. Create variables for the API endpoint's host, path, and your subscription key. Then create variables for your market, the text you want to spell check, and a string for the spell check mode. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
4040
4141
```java
4242
static String host = "https://api.cognitive.microsoft.com";

articles/cognitive-services/Bing-Spell-Check/quickstarts/nodejs.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-spell-check
1111
ms.topic: quickstart
12-
ms.date: 04/02/2019
12+
ms.date: 12/16/2019
1313
ms.author: aahi
1414
---
1515

@@ -26,7 +26,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
2626

2727
## Create and initialize a project
2828

29-
1. Create a new JavaScript file in your favorite IDE or editor. Set the strictness, and require `https`. Then create variables for your API endpoint's host, path, and your subscription key.
29+
1. Create a new JavaScript file in your favorite IDE or editor. Set the strictness, and require `https`. Then create variables for your API endpoint's host, path, and your subscription key. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
3030

3131
```javascript
3232
'use strict';
@@ -93,6 +93,18 @@ req.write ("text=" + text);
9393
req.end ();
9494
```
9595

96+
97+
## Run the application
98+
99+
Build and run your project.
100+
101+
If you're using the command line, use the following commands to build and run the application.
102+
103+
```bash
104+
node <FILE_NAME>.js
105+
```
106+
107+
96108
## Example JSON response
97109

98110
A successful response is returned in JSON, as shown in the following example:

articles/cognitive-services/Bing-Spell-Check/quickstarts/php.md

Lines changed: 65 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-spell-check
1111
ms.topic: quickstart
12-
ms.date: 02/20/2019
12+
ms.date: 12/16/2019
1313
ms.author: aahi
1414
---
1515
# Quickstart: Check spelling with the Bing Spell Check REST API and PHP
@@ -28,64 +28,70 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
2828
1. Create a new PHP project in your favorite IDE.
2929
2. Add the code provided below.
3030
3. Replace the `subscriptionKey` value with an access key valid for your subscription.
31-
4. Run the program.
32-
33-
```php
34-
<?php
35-
36-
// NOTE: Be sure to uncomment the following line in your php.ini file.
37-
// ;extension=php_openssl.dll
38-
39-
// These properties are used for optional headers (see below).
40-
// define("CLIENT_ID", "<Client ID from Previous Response Goes Here>");
41-
// define("CLIENT_IP", "999.999.999.999");
42-
// define("CLIENT_LOCATION", "+90.0000000000000;long: 00.0000000000000;re:100.000000000000");
43-
44-
$host = 'https://api.cognitive.microsoft.com';
45-
$path = '/bing/v7.0/spellcheck?';
46-
$params = 'mkt=en-us&mode=proof';
47-
48-
$input = "Hollo, wrld!";
49-
50-
$data = array (
51-
'text' => urlencode ($input)
52-
);
53-
54-
// NOTE: Replace this example key with a valid subscription key.
55-
$key = 'ENTER KEY HERE';
56-
57-
// The following headers are optional, but it is recommended
58-
// that they are treated as required. These headers will assist the service
59-
// with returning more accurate results.
60-
//'X-Search-Location' => CLIENT_LOCATION
61-
//'X-MSEdge-ClientID' => CLIENT_ID
62-
//'X-MSEdge-ClientIP' => CLIENT_IP
63-
64-
$headers = "Content-type: application/x-www-form-urlencoded\r\n" .
65-
"Ocp-Apim-Subscription-Key: $key\r\n";
66-
67-
// NOTE: Use the key 'http' even if you are making an HTTPS request. See:
68-
// https://php.net/manual/en/function.stream-context-create.php
69-
$options = array (
70-
'http' => array (
71-
'header' => $headers,
72-
'method' => 'POST',
73-
'content' => http_build_query ($data)
74-
)
75-
);
76-
$context = stream_context_create ($options);
77-
$result = file_get_contents ($host . $path . $params, false, $context);
78-
79-
if ($result === FALSE) {
80-
/* Handle error */
81-
}
82-
83-
$json = json_encode(json_decode($result), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
84-
echo $json;
85-
?>
86-
```
87-
88-
**Response**
31+
4. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
32+
5. Run the program.
33+
34+
```php
35+
<?php
36+
37+
// NOTE: Be sure to uncomment the following line in your php.ini file.
38+
// ;extension=php_openssl.dll
39+
40+
// These properties are used for optional headers (see below).
41+
// define("CLIENT_ID", "<Client ID from Previous Response Goes Here>");
42+
// define("CLIENT_IP", "999.999.999.999");
43+
// define("CLIENT_LOCATION", "+90.0000000000000;long: 00.0000000000000;re:100.000000000000");
44+
45+
$host = 'https://api.cognitive.microsoft.com';
46+
$path = '/bing/v7.0/spellcheck?';
47+
$params = 'mkt=en-us&mode=proof';
48+
49+
$input = "Hollo, wrld!";
50+
51+
$data = array (
52+
'text' => urlencode ($input)
53+
);
54+
55+
// NOTE: Replace this example key with a valid subscription key.
56+
$key = 'ENTER KEY HERE';
57+
58+
// The following headers are optional, but it is recommended
59+
// that they are treated as required. These headers will assist the service
60+
// with returning more accurate results.
61+
//'X-Search-Location' => CLIENT_LOCATION
62+
//'X-MSEdge-ClientID' => CLIENT_ID
63+
//'X-MSEdge-ClientIP' => CLIENT_IP
64+
65+
$headers = "Content-type: application/x-www-form-urlencoded\r\n" .
66+
"Ocp-Apim-Subscription-Key: $key\r\n";
67+
68+
// NOTE: Use the key 'http' even if you are making an HTTPS request. See:
69+
// https://php.net/manual/en/function.stream-context-create.php
70+
$options = array (
71+
'http' => array (
72+
'header' => $headers,
73+
'method' => 'POST',
74+
'content' => http_build_query ($data)
75+
)
76+
);
77+
$context = stream_context_create ($options);
78+
$result = file_get_contents ($host . $path . $params, false, $context);
79+
80+
if ($result === FALSE) {
81+
/* Handle error */
82+
}
83+
84+
$json = json_encode(json_decode($result), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
85+
echo $json;
86+
?>
87+
```
88+
89+
90+
## Run the application
91+
92+
Run your application by starting a web server and navigating to your file.
93+
94+
## Example JSON response
8995

9096
A successful response is returned in JSON, as shown in the following example:
9197

articles/cognitive-services/Bing-Spell-Check/quickstarts/python.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-spell-check
1111
ms.topic: quickstart
12-
ms.date: 09/13/2019
12+
ms.date: 12/16/2019
1313
ms.author: aahi
1414
---
1515
# Quickstart: Check spelling with the Bing Spell Check REST API and Python
@@ -31,7 +31,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
3131
import json
3232
```
3333

34-
2. Create variables for the text you want to spell check, your subscription key, and your Bing Spell Check endpoint.
34+
2. Create variables for the text you want to spell check, your subscription key, and your Bing Spell Check endpoint. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
3535

3636
```python
3737
api_key = "<ENTER-KEY-HERE>"
@@ -80,6 +80,15 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
8080
print(json.dumps(json_response, indent=4))
8181
```
8282

83+
84+
## Run the application
85+
86+
If you're using the command line, use the following command to run the application.
87+
88+
```bash
89+
python <FILE_NAME>.py
90+
```
91+
8392
## Example JSON response
8493

8594
A successful response is returned in JSON, as shown in the following example:

articles/cognitive-services/Bing-Spell-Check/quickstarts/ruby.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-spell-check
1111
ms.topic: quickstart
12-
ms.date: 09/13/2019
12+
ms.date: 12/16/2019
1313
ms.author: aahi
1414
---
1515
# Quickstart: Check spelling with the Bing Spell Check REST API and Ruby
@@ -27,13 +27,13 @@ Use this quickstart to make your first call to the Bing Spell Check REST API usi
2727

2828
1. Create a new Ruby file in your favorite editor or IDE, and add the following requirements.
2929

30-
```javascript
30+
```ruby
3131
require 'net/http'
3232
require 'uri'
3333
require 'json'
3434
```
3535

36-
2. Create variables for your subscription key, endpoint URI and path. Create your request parameters by appending the `mkt=` parameter to your market, and `&mode` to the `proof` proof mode.
36+
2. Create variables for your subscription key, endpoint URI and path. Create your request parameters by appending the `mkt=` parameter to your market, and `&mode` to the `proof` proof mode. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
3737

3838
```ruby
3939
key = 'ENTER YOUR KEY HERE'
@@ -77,6 +77,16 @@ Use this quickstart to make your first call to the Bing Spell Check REST API usi
7777
puts result
7878
```
7979

80+
## Run the application
81+
82+
Build and run your project.
83+
84+
If you're using the command line, use the following command to run the application.
85+
86+
```bash
87+
ruby <FILE_NAME>.rb
88+
```
89+
8090
## Example JSON response
8191
8292
A successful response is returned in JSON, as shown in the following example:

articles/cognitive-services/Bing-Spell-Check/sdk-quickstart-spell-check.md

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-spell-check
1111
ms.topic: quickstart
12-
ms.date: 09/13/2019
12+
ms.date: 12/16/2019
1313
ms.author: aahi
1414
---
1515

@@ -79,15 +79,19 @@ To add the Bing Spell Check SDK to your project, select **Manage NuGet Packages*
7979
3. Get the first suggested correction, if there is one. Print the suggestion score, and the suggested word.
8080

8181
```csharp
82-
var suggestions = firstspellCheckResult.Suggestions;
83-
84-
if (suggestions?.Count > 0)
85-
{
86-
var firstSuggestion = suggestions.FirstOrDefault();
87-
Console.WriteLine("First SpellCheck Suggestion Score: {0} ", firstSuggestion.Score);
88-
Console.WriteLine("First SpellCheck Suggestion : {0} ", firstSuggestion.Suggestion);
89-
}
90-
}
82+
var suggestions = firstspellCheckResult.Suggestions;
83+
84+
if (suggestions?.Count > 0)
85+
{
86+
var firstSuggestion = suggestions.FirstOrDefault();
87+
Console.WriteLine("First SpellCheck Suggestion Score: {0} ", firstSuggestion.Score);
88+
Console.WriteLine("First SpellCheck Suggestion : {0} ", firstSuggestion.Suggestion);
89+
}
90+
```
91+
92+
## Run the application
93+
94+
Build and run your project. If you're using Visual Studio, press **F5** to debug the file.
9195

9296
## Next steps
9397

includes/cognitive-services-bing-spell-check-signup-requirements.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@ author: aahill
33
ms.author: aahi
44
ms.service: cognitive-services
55
ms.topic: include
6-
ms.date: 02/12/2019
6+
ms.date: 12/16/2019
77
---
88

9-
You must have a [Cognitive Services API account](https://docs.microsoft.com/azure/cognitive-services/cognitive-services-apis-create-account) with access to the Bing Spell Check API. If you don't have an Azure subscription, you can [create an account](https://azure.microsoft.com/try/cognitive-services/?api=text-analytics) for free. Before continuing, You will need the access key [provided after activating your free trial](https://azure.microsoft.com/try/cognitive-services/my-apis/), or a paid subscription key from your Azure dashboard.
9+
## Create an Azure resource
10+
11+
Start using the Bing Spell Check API by creating one of the Azure resources below.
12+
13+
* [Create a trial resource](https://azure.microsoft.com/try/cognitive-services/?api=spellcheck-api-v7):
14+
* No Azure subscription needed.
15+
* Valid for seven days, for free. After signing up, a trial key and endpoint will be available on the [Azure website](https://azure.microsoft.com/try/cognitive-services/my-apis/).
16+
17+
* [Create a Bing Spell Check resource](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesBingSpellCheck-v7):
18+
* Available through the Azure portal until you delete the resource.
19+
* Use the free pricing tier to try the service, and upgrade later to a paid tier for production.
20+
* Bing Spell Check API is also offered in some tiers of the [Bing Search v7 resource](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesBingSearch-v7).
21+
22+
* [Create a Multi-Service resource](https://ms.portal.azure.com/#create/Microsoft.CognitiveServicesAllInOne):
23+
* Available through the Azure portal until you delete the resource.
24+
* Use the same key and endpoint for your applications, across multiple Cognitive Services.

0 commit comments

Comments
 (0)