Skip to content

Commit e7c19df

Browse files
committed
adding fixes
1 parent f02be44 commit e7c19df

File tree

6 files changed

+111
-67
lines changed

6 files changed

+111
-67
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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/nodejs.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 62 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -30,63 +30,68 @@ Use this quickstart to make your first call to the Bing Spell Check REST API. Th
3030
3. Replace the `subscriptionKey` value with an access key valid for your subscription.
3131
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.
3232
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-
**Response**
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
9095

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

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ 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'
@@ -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: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)