You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Bing-Spell-Check/quickstarts/csharp.md
+15-12Lines changed: 15 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,28 +8,31 @@ manager: nitinme
8
8
ms.service: cognitive-services
9
9
ms.subservice: bing-spell-check
10
10
ms.topic: quickstart
11
-
ms.date: 12/16/2019
11
+
ms.date: 05/19/2020
12
12
ms.author: aahi
13
13
---
14
14
15
15
# Quickstart: Check spelling with the Bing Spell Check REST API and C#
16
16
17
-
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple C# application sends a request to the API and returns a list of suggested corrections. While this application is written in C#, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingAutosuggestv7.cs).
17
+
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple C# application sends a request to the API and returns a list of suggested corrections.
18
+
19
+
Although this application is written in C#, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingAutosuggestv7.cs).
18
20
19
21
## Prerequisites
20
22
21
23
* Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).
22
-
* To install `Newtonsoft.Json` as a NuGet package in Visual studio:
23
-
1. In **Solution Explorer**, right-click the Solution file.
24
-
1. Select **Manage NuGet Packages for Solution**.
25
-
1. Search for `Newtonsoft.Json` and install the package.
24
+
* The Newtonsoft.Json NuGet package.
25
+
To install this package in Visual studio:
26
+
1. In **Solution Explorer**, right-click the Solution file.
27
+
1. Select **Manage NuGet Packages for Solution**.
28
+
1. Search for *Newtonsoft.Json* and install the package.
26
29
* If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
1. Create a new console solution named `SpellCheckSample` in Visual Studio. Then add the following namespaces into the main code file.
35
+
1. Create a new console solution named SpellCheckSample in Visual Studio. Then, add the following namespaces into the main code file:
33
36
34
37
```csharp
35
38
usingSystem;
@@ -41,7 +44,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
41
44
usingNewtonsoft.Json;
42
45
```
43
46
44
-
2. Createvariablesfor 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) endpointdisplayedintheAzureportalfor your resource.
47
+
2. Createvariablesfor the API endpoint, your subscription key, and the text to be spell checked. You can use the global endpoint in the following code, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpointdisplayedintheAzureportalfor your resource.
45
48
46
49
```csharp
47
50
namespace SpellCheckSample
@@ -57,15 +60,15 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
57
60
}
58
61
```
59
62
60
-
3. Createavariablefor your search parameters. Append your market code after `mkt=`. The market code is the country you make the request from. Also, append your spell-check mode after `&mode=`. Mode is either `proof` (catches most spelling/grammarerrors) or `spell` (catchesmostspellingbutnotasmanygrammarerrors).
63
+
3. Createavariablefor your search parameters. Append your market code to the `mkt=` parameter. The market code is the code of the country you make the request from. Append your spell-check mode to the `&mode=` parameter. The mode is either `proof` (catches most spelling/grammarerrors) or `spell` (catchesmostspellingerrors,butnotasmanygrammarerrors).
Copy file name to clipboardExpand all lines: articles/cognitive-services/Bing-Spell-Check/quickstarts/java.md
+15-13Lines changed: 15 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,25 +9,27 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-spell-check
11
11
ms.topic: quickstart
12
-
ms.date: 12/16/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: aahi
14
14
---
15
15
16
16
# Quickstart: Check spelling with the Bing Spell Check REST API and Java
17
17
18
-
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple Java application sends a request to the API and returns a list of suggested corrections. While this application is written in Java, the API is a RESTful web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingSpellCheck.java).
18
+
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple Java application sends a request to the API and returns a list of suggested corrections.
19
+
20
+
Although this application is written in Java, the API is a RESTful web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingSpellCheck.java).
19
21
20
22
## Prerequisites
21
23
22
24
* The Java Development Kit(JDK) 7 or later.
23
25
24
-
* Import the [gson-2.8.5.jar](https://libraries.io/maven/com.google.code.gson%3Agson) or the most current [Gson](https://github.com/google/gson) version. For commandline execution, add the `.jar` to your Java folder with the main class.
26
+
* Import the [gson-2.8.5.jar](https://libraries.io/maven/com.google.code.gson%3Agson) or the most current [Gson](https://github.com/google/gson) version. For command-line execution, add the `.jar` to your Java folder with the main class.
1. Create a new Java Project in your favorite IDE or editor with a class name of your choosing, and then import the following packages.
32
+
1. Create a new Java Project in your favorite IDE or editor with a class name of your choosing, and then import the following packages:
31
33
32
34
```java
33
35
importjava.io.*;
@@ -36,7 +38,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
36
38
importjavax.net.ssl.HttpsURLConnection;
37
39
```
38
40
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.
41
+
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 in the following code, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
@@ -51,7 +53,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
51
53
52
54
## Create and send an API request
53
55
54
-
1. Create a function called `check()` to create and send the API request. Within it, follow these steps. Create a string for the request parameters. append the `?mkt=` parameter to your market string, and the `&mode=` parameter to your spell check mode.
56
+
1. Create a function called `check()` to create and send the API request. Within it, follow the next steps. Create a string for the request parameters. Append your market string to the `?mkt=` parameter, and the spell-check mode to the `&mode=` parameter.
55
57
56
58
```java
57
59
public static void check () throws Exception {
@@ -60,14 +62,14 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
60
62
}
61
63
```
62
64
63
-
2. Create a URL by combining the endpoint host, path and parameters string. Create a new `HttpsURLConnection` object.
65
+
2. Create a URL by combining the endpoint host, path, and parameters string. Create a new `HttpsURLConnection` object.
3. Open a connection to the URL. Set the request method to `POST`. Add your request parameters. Make sure to add your subscription key to the `Ocp-Apim-Subscription-Key` header.
72
+
3. Open a connection to the URL. Set the request method to `POST` and add your request parameters. Be sure to add your subscription key to the `Ocp-Apim-Subscription-Key` header.
71
73
72
74
```java
73
75
connection.setRequestMethod("POST");
@@ -76,7 +78,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
76
78
connection.setDoOutput(true);
77
79
```
78
80
79
-
4. Create a new `DataOutputStream` object and Send the request to the API.
81
+
4. Create a new `DataOutputStream` object and send the request to the API.
80
82
81
83
```java
82
84
DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
@@ -87,7 +89,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
87
89
88
90
## Format and read the API response
89
91
90
-
1. Add this method to your class. It formats the JSON for a more readable output.
92
+
1. Add the `prettify()` method to your class. It formats the JSON for a more readable output.
91
93
92
94
``` java
93
95
// This function prettifies the json response.
@@ -113,7 +115,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
113
115
114
116
## Call the API
115
117
116
-
In the main function of your application, call your check() method created above.
118
+
In the main function of your application, call your check() method created previously.
117
119
```java
118
120
public static void main(String[] args) {
119
121
try {
@@ -129,7 +131,7 @@ In the main function of your application, call your check() method created above
129
131
130
132
Build and run your project.
131
133
132
-
If you're using the command line, use the following commands to build and run the application.
134
+
If you're using the command line, use the following commands to build and run the application:
133
135
134
136
**Build:**
135
137
```bash
@@ -189,4 +191,4 @@ A successful response is returned in JSON, as shown in the following example:
189
191
> [Create a single-page web app](../tutorials/spellcheck.md)
190
192
191
193
-[What is the Bing Spell Check API?](../overview.md)
192
-
-[Bing Spell Check API v7 Reference](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
194
+
-[Bing Spell Check API v7 reference](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
Copy file name to clipboardExpand all lines: articles/cognitive-services/Bing-Spell-Check/quickstarts/nodejs.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,15 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-spell-check
11
11
ms.topic: quickstart
12
-
ms.date: 12/16/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: aahi
14
14
---
15
15
16
16
# Quickstart: Check spelling with the Bing Spell Check REST API and Node.js
17
17
18
-
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple Node application sends a request to the API and returns a list of words it didn't recognize, followed by suggested corrections. While this application is written in Node.js, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingSpellCheckv7.js).
18
+
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple JavaScript application sends a request to the API and returns a list of suggested corrections.
19
+
20
+
Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages. The source code for this application is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingSpellCheckv7.js).
19
21
20
22
## Prerequisites
21
23
@@ -26,7 +28,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
26
28
27
29
## Create and initialize a project
28
30
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.
31
+
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 in the following code, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
30
32
31
33
```javascript
32
34
'use strict';
@@ -37,7 +39,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
37
39
let key ='<ENTER-KEY-HERE>';
38
40
```
39
41
40
-
2. Create variables for your search parameters and the text you want to check. Append your market code after `mkt=`. The market code is the country you make the request from. Also, append your spell-check mode after `&mode=`. Modeis either `proof` (catches most spelling/grammar errors) or `spell` (catches most spelling but not as many grammar errors).
42
+
2. Create variables for your search parameters and the text you want to check. Append your market code to the `mkt=`parameter. The market code is code forthe country you make the request from. Appendyour spell-check mode to the `&mode=`parameter. The mode is either `proof` (catches most spelling/grammar errors) or `spell` (catches most spelling errors but not as many grammar errors).
41
43
42
44
```javascript
43
45
let mkt = "en-US";
@@ -48,7 +50,7 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
48
50
49
51
## Create the request parameters
50
52
51
-
Create your request parameters by creating a newobjectwith a `POST`method. Add your path by appending your endpoint path, and query string. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
53
+
1.Create your request parameters by creating a newobjectwith a `POST`method. Add your path by appending your endpoint path, and query string. Then, add your subscription key to the `Ocp-Apim-Subscription-Key` header.
52
54
53
55
```javascript
54
56
let request_params = {
@@ -85,7 +87,7 @@ let response_handler = function (response) {
85
87
86
88
## Send the request
87
89
88
-
Call the API using `https.request()` with your request parameters, and response handler. Write your text to the API, and end the request afterwards.
90
+
Call the API using `https.request()` with your request parameters and response handler. Write your text to the API, and end the request afterwards.
89
91
90
92
```javascript
91
93
let req =https.request (request_params, response_handler);
@@ -96,13 +98,13 @@ req.end ();
96
98
97
99
## Run the application
98
100
99
-
Build and run your project.
101
+
1.Build and run your project.
100
102
101
-
If you're using the command line, use the following commands to build and run the application.
103
+
1.If you're using the command line, use the following commands to build and run the application:
102
104
103
-
```bash
104
-
node <FILE_NAME>.js
105
-
```
105
+
```bash
106
+
node <FILE_NAME>.js
107
+
```
106
108
107
109
108
110
## Example JSON response
@@ -150,7 +152,7 @@ A successful response is returned in JSON, as shown in the following example:
150
152
## Next steps
151
153
152
154
> [!div class="nextstepaction"]
153
-
> [Create a singlepage web-app](../tutorials/spellcheck.md)
155
+
> [Create a single-page webapp](../tutorials/spellcheck.md)
154
156
155
157
-[What is the Bing Spell Check API?](../overview.md)
156
158
-[Bing Spell Check API v7 Reference](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
Copy file name to clipboardExpand all lines: articles/cognitive-services/Bing-Spell-Check/quickstarts/php.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,14 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-spell-check
11
11
ms.topic: quickstart
12
-
ms.date: 12/16/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: aahi
14
14
---
15
15
# Quickstart: Check spelling with the Bing Spell Check REST API and PHP
16
16
17
-
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple PHP application sends a request to the API and returns a list of suggested corrections. While this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
17
+
Use this quickstart to make your first call to the Bing Spell Check REST API. This simple PHP application sends a request to the API and returns a list of suggested corrections.
18
+
19
+
Although this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
18
20
19
21
## Prerequisites
20
22
@@ -23,12 +25,12 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
3. Replace the `subscriptionKey` value with an access key valid for your subscription.
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.
33
+
4. You can use the global endpoint in the following code, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
32
34
5. Run the program.
33
35
34
36
```php
@@ -135,7 +137,7 @@ A successful response is returned in JSON, as shown in the following example:
135
137
## Next steps
136
138
137
139
> [!div class="nextstepaction"]
138
-
> [Create a singlepage web-app](../tutorials/spellcheck.md)
140
+
> [Create a single-page webapp](../tutorials/spellcheck.md)
139
141
140
142
-[What is the Bing Spell Check API?](../overview.md)
141
143
-[Bing Spell Check API v7 Reference](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-spell-check-api-v7-reference)
0 commit comments