Skip to content

Commit 5bd08ed

Browse files
authored
Merge pull request #101077 from IEvangelist/addFileInstructions
[CogSvcs] added instructions to quickstart
2 parents 49189df + 8344bf8 commit 5bd08ed

File tree

9 files changed

+188
-191
lines changed

9 files changed

+188
-191
lines changed

articles/cognitive-services/Speech-Service/includes/quickstarts/from-file/cpp/linux.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: nitinme
77
ms.service: cognitive-services
88
ms.subservice: speech-service
99
ms.topic: include
10-
ms.date: 12/17/2019
10+
ms.date: 01/14/2020
1111
ms.author: wolfma
1212
---
1313

@@ -16,7 +16,7 @@ ms.author: wolfma
1616
Before you get started, make sure to:
1717

1818
> [!div class="checklist"]
19-
> * [Create an Azure Speech Resource](../../../../get-started.md)
19+
> * [Create an Azure Speech resource](../../../../get-started.md)
2020
> * [Setup your development environment](../../../../quickstarts/setup-platform.md?tabs=linux)
2121
> * [Create an empty sample project](../../../../quickstarts/create-project.md?tabs=linux)
2222
@@ -26,8 +26,7 @@ Before you get started, make sure to:
2626

2727
1. Create a C++ source file named `helloworld.cpp`, and paste the following code into it.
2828

29-
````C++
30-
29+
```cpp
3130
// Creates an instance of a speech config with specified subscription key and service region.
3231
// Replace with your own subscription key and service region (e.g., "westus").
3332
auto config = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
@@ -47,28 +46,27 @@ Before you get started, make sure to:
4746
auto result = recognizer->RecognizeOnceAsync().get();
4847

4948
// Checks result.
50-
if (result->Reason == ResultReason::RecognizedSpeech)
51-
{
52-
cout << "RECOGNIZED: Text=" << result->Text << std::endl;
53-
}
54-
else if (result->Reason == ResultReason::NoMatch)
49+
switch (result->Reason)
5550
{
56-
cout << "NOMATCH: Speech could not be recognized." << std::endl;
51+
case ResultReason::RecognizedSpeech:
52+
cout << "RECOGNIZED: Text=" << result->Text << std::endl;
53+
break;
54+
case ResultReason::NoMatch:
55+
cout << "NOMATCH: Speech could not be recognized." << std::endl;
56+
break;
57+
case ResultReason::Canceled:
58+
auto cancellation = CancellationDetails::FromResult(result);
59+
cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
60+
61+
if (cancellation->Reason == CancellationReason::Error)
62+
{
63+
cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
64+
cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
65+
cout << "CANCELED: Did you update the subscription info?" << std::endl;
66+
}
67+
break;
5768
}
58-
else if (result->Reason == ResultReason::Canceled)
59-
{
60-
auto cancellation = CancellationDetails::FromResult(result);
61-
cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
62-
63-
if (cancellation->Reason == CancellationReason::Error)
64-
{
65-
cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
66-
cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
67-
cout << "CANCELED: Did you update the subscription info?" << std::endl;
68-
}
69-
}
70-
71-
````
69+
```
7270
7371
1. In this new file, replace the string `YourSubscriptionKey` with your Speech service subscription key.
7472

articles/cognitive-services/Speech-Service/includes/quickstarts/from-file/cpp/macos.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: nitinme
77
ms.service: cognitive-services
88
ms.subservice: speech-service
99
ms.topic: include
10-
ms.date: 12/17/2019
10+
ms.date: 01/14/2020
1111
ms.author: wolfma
1212
---
1313

@@ -16,7 +16,7 @@ ms.author: wolfma
1616
Before you get started, make sure to:
1717

1818
> [!div class="checklist"]
19-
> * [Create an Azure Speech Resource](../../../../get-started.md)
19+
> * [Create an Azure Speech resource](../../../../get-started.md)
2020
> * [Setup your development environment](../../../../quickstarts/setup-platform.md?tabs=macos)
2121
> * [Create an empty sample project](../../../../quickstarts/create-project.md?tabs=macos)
2222
@@ -26,8 +26,7 @@ Before you get started, make sure to:
2626

2727
1. Create a C++ source file named `helloworld.cpp`, and paste the following code into it.
2828

29-
````C++
30-
29+
```cpp
3130
// Creates an instance of a speech config with specified subscription key and service region.
3231
// Replace with your own subscription key and service region (e.g., "westus").
3332
auto config = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
@@ -47,28 +46,27 @@ Before you get started, make sure to:
4746
auto result = recognizer->RecognizeOnceAsync().get();
4847

4948
// Checks result.
50-
if (result->Reason == ResultReason::RecognizedSpeech)
51-
{
52-
cout << "RECOGNIZED: Text=" << result->Text << std::endl;
53-
}
54-
else if (result->Reason == ResultReason::NoMatch)
49+
switch (result->Reason)
5550
{
56-
cout << "NOMATCH: Speech could not be recognized." << std::endl;
51+
case ResultReason::RecognizedSpeech:
52+
cout << "RECOGNIZED: Text=" << result->Text << std::endl;
53+
break;
54+
case ResultReason::NoMatch:
55+
cout << "NOMATCH: Speech could not be recognized." << std::endl;
56+
break;
57+
case ResultReason::Canceled:
58+
auto cancellation = CancellationDetails::FromResult(result);
59+
cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
60+
61+
if (cancellation->Reason == CancellationReason::Error)
62+
{
63+
cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
64+
cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
65+
cout << "CANCELED: Did you update the subscription info?" << std::endl;
66+
}
67+
break;
5768
}
58-
else if (result->Reason == ResultReason::Canceled)
59-
{
60-
auto cancellation = CancellationDetails::FromResult(result);
61-
cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
62-
63-
if (cancellation->Reason == CancellationReason::Error)
64-
{
65-
cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
66-
cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
67-
cout << "CANCELED: Did you update the subscription info?" << std::endl;
68-
}
69-
}
70-
71-
````
69+
```
7270
7371
1. In this new file, replace the string `YourSubscriptionKey` with your Speech service subscription key.
7472

articles/cognitive-services/Speech-Service/includes/quickstarts/from-file/cpp/windows.md

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: nitinme
77
ms.service: cognitive-services
88
ms.subservice: speech-service
99
ms.topic: include
10-
ms.date: 12/17/2019
10+
ms.date: 01/14/2020
1111
ms.author: wolfma61
1212
---
1313

@@ -16,7 +16,7 @@ ms.author: wolfma61
1616
Before you get started, make sure to:
1717

1818
> [!div class="checklist"]
19-
> * [Create an Azure Speech Resource](../../../../get-started.md)
19+
> * [Create an Azure Speech resource](../../../../get-started.md)
2020
> * [Setup your development environment](../../../../quickstarts/setup-platform.md?tabs=windows)
2121
> * [Create an empty sample project](../../../../quickstarts/create-project.md?tabs=windows)
2222
@@ -28,8 +28,7 @@ Before you get started, make sure to:
2828

2929
1. Replace all the code with the following snippet:
3030

31-
````C++
32-
31+
```cpp
3332
// Creates an instance of a speech config with specified subscription key and service region.
3433
// Replace with your own subscription key and service region (e.g., "westus").
3534
auto config = SpeechConfig::FromSubscription("YourSubscriptionKey", "YourServiceRegion");
@@ -49,28 +48,27 @@ Before you get started, make sure to:
4948
auto result = recognizer->RecognizeOnceAsync().get();
5049

5150
// Checks result.
52-
if (result->Reason == ResultReason::RecognizedSpeech)
53-
{
54-
cout << "RECOGNIZED: Text=" << result->Text << std::endl;
55-
}
56-
else if (result->Reason == ResultReason::NoMatch)
51+
switch (result->Reason)
5752
{
58-
cout << "NOMATCH: Speech could not be recognized." << std::endl;
53+
case ResultReason::RecognizedSpeech:
54+
cout << "RECOGNIZED: Text=" << result->Text << std::endl;
55+
break;
56+
case ResultReason::NoMatch:
57+
cout << "NOMATCH: Speech could not be recognized." << std::endl;
58+
break;
59+
case ResultReason::Canceled:
60+
auto cancellation = CancellationDetails::FromResult(result);
61+
cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
62+
63+
if (cancellation->Reason == CancellationReason::Error)
64+
{
65+
cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
66+
cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
67+
cout << "CANCELED: Did you update the subscription info?" << std::endl;
68+
}
69+
break;
5970
}
60-
else if (result->Reason == ResultReason::Canceled)
61-
{
62-
auto cancellation = CancellationDetails::FromResult(result);
63-
cout << "CANCELED: Reason=" << (int)cancellation->Reason << std::endl;
64-
65-
if (cancellation->Reason == CancellationReason::Error)
66-
{
67-
cout << "CANCELED: ErrorCode=" << (int)cancellation->ErrorCode << std::endl;
68-
cout << "CANCELED: ErrorDetails=" << cancellation->ErrorDetails << std::endl;
69-
cout << "CANCELED: Did you update the subscription info?" << std::endl;
70-
}
71-
}
72-
73-
````
71+
```
7472
7573
1. In the same file, replace the string `YourSubscriptionKey` with your subscription key.
7674

0 commit comments

Comments
 (0)