From 68e88f0856704eac879108bac1ab4a310cc787a4 Mon Sep 17 00:00:00 2001 From: Christian Landsiedel <42998057+chlandsi@users.noreply.github.com> Date: Mon, 26 Aug 2019 12:31:21 +0200 Subject: [PATCH] python & C# batch sample tune (#364) * tune python samples * C# batch sample --- samples/batch/csharp/program.cs | 13 ++++++++----- samples/python/console/intent_sample.py | 5 ++++- samples/python/console/main.py | 4 ++-- samples/python/console/speech_sample.py | 3 +++ samples/python/console/translation_sample.py | 3 +++ 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/samples/batch/csharp/program.cs b/samples/batch/csharp/program.cs index e4d6300ed..92d7940eb 100644 --- a/samples/batch/csharp/program.cs +++ b/samples/batch/csharp/program.cs @@ -18,7 +18,7 @@ class Program // // Replace with your subscription key private const string SubscriptionKey = ""; - + // Update with your service region private const string HostName = ".cris.ai"; private const int Port = 443; @@ -26,7 +26,6 @@ class Program // recordings and locale private const string Locale = "en-US"; private const string RecordingsBlobUri = ""; - // For usage of baseline models, no acoustic and language model needs to be specified. private static Guid[] modelList = new Guid[0]; @@ -99,11 +98,11 @@ static async Task TranscribeAsync() } completed++; - // if the transcription was successfull, check the results + // if the transcription was successful, check the results if (transcription.Status == "Succeeded") { var resultsUri0 = transcription.ResultsUrls["channel_0"]; - + WebClient webClient = new WebClient(); var filename = Path.GetTempFileName(); @@ -111,10 +110,14 @@ static async Task TranscribeAsync() var results0 = File.ReadAllText(filename); var resultObject0 = JsonConvert.DeserializeObject(results0); Console.WriteLine(results0); - + Console.WriteLine("Transcription succeeded. Results: "); Console.WriteLine(results0); } + else + { + Console.WriteLine("Transcription failed. Status: {0}", transcription.StatusMessage); + } break; case "Running": diff --git a/samples/python/console/intent_sample.py b/samples/python/console/intent_sample.py index e7f6b245a..ea38b448f 100644 --- a/samples/python/console/intent_sample.py +++ b/samples/python/console/intent_sample.py @@ -3,6 +3,9 @@ # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root for full license information. +""" +Intent recognition samples for the Microsoft Cognitive Services Speech SDK +""" import time @@ -188,7 +191,7 @@ def recognizing_callback(evt): def recognize_intent_continuous(): - """performs one-shot intent recognition from input from an audio file""" + """performs continuous intent recognition from input from an audio file""" # intent_config = speechsdk.SpeechConfig(subscription=intent_key, region=intent_service_region) audio_config = speechsdk.audio.AudioConfig(filename=lampfilename) diff --git a/samples/python/console/main.py b/samples/python/console/main.py index 113b4e573..387dab0f7 100755 --- a/samples/python/console/main.py +++ b/samples/python/console/main.py @@ -41,7 +41,7 @@ def select(): print('select sample module, {} to abort'.format(eofkey)) modules = list(samples.keys()) for i, module in enumerate(modules): - print(i, module.__name__) + print("{}: {}\n\t{}".format(i, module.__name__, module.__doc__.strip())) try: num = int(input()) @@ -54,7 +54,7 @@ def select(): print('select sample function, {} to abort'.format(eofkey)) for i, fun in enumerate(samples[selected_module]): - print(i, fun.__name__) + print("{}: {}\n\t{}".format(i, fun.__name__, fun.__doc__)) try: num = int(input()) diff --git a/samples/python/console/speech_sample.py b/samples/python/console/speech_sample.py index 17bd7699e..3124d4759 100644 --- a/samples/python/console/speech_sample.py +++ b/samples/python/console/speech_sample.py @@ -3,6 +3,9 @@ # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root for full license information. +""" +Speech recognition samples for the Microsoft Cognitive Services Speech SDK +""" import time import wave diff --git a/samples/python/console/translation_sample.py b/samples/python/console/translation_sample.py index de0ffe6b7..ecc11e0fd 100644 --- a/samples/python/console/translation_sample.py +++ b/samples/python/console/translation_sample.py @@ -3,6 +3,9 @@ # Copyright (c) Microsoft. All rights reserved. # Licensed under the MIT license. See LICENSE.md file in the project root for full license information. +""" +Translation recognition samples for the Microsoft Cognitive Services Speech SDK +""" import time