// // Standalone Language Detection (SourceLanguageRecognizer) samples // private static void LanguageDetectionSamples() { ConsoleKeyInfo x; do { Console.WriteLine(""); Console.WriteLine(" Speech SDK - Stand-alone Spoken Language Detection Samples"); Console.WriteLine(""); Console.WriteLine(choose); Console.WriteLine(""); Console.WriteLine(" 1. Language detection with microphone input."); Console.WriteLine(" 2. SingleShot language detection with file input."); Console.WriteLine(" 3. Continuous language detection with multi-lingual audio input."); Console.WriteLine(""); Console.Write(prompt); x = Console.ReadKey(); Console.WriteLine("\n"); bool sampleWasRun = true; switch (x.Key) { case ConsoleKey.D1: case ConsoleKey.NumPad1: StandaloneLanguageDetectionSamples.DetectionWithMicrophoneAsync().Wait(); break; case ConsoleKey.D2: case ConsoleKey.NumPad2: StandaloneLanguageDetectionSamples.LanguageDetectionWithFileAsync().Wait(); break; case ConsoleKey.D3: case ConsoleKey.NumPad3: StandaloneLanguageDetectionSamples.ContinuousLanguageDetectionWithFileAsync().Wait(); break; case ConsoleKey.D0: case ConsoleKey.NumPad0: Console.WriteLine(back); sampleWasRun = false; break; default: Console.WriteLine(invalid); sampleWasRun = false; break; } if (sampleWasRun) { Console.WriteLine(done); } } while (x.Key != ConsoleKey.D0); }
/// <summary> /// Language Detection (SourceLanguageRecognizer) samples /// </summary> private static void LanguageDetectionSamples() { var prompt = "Your choice (0: Stop): "; Console.WriteLine("1. Language detection with microphone input."); Console.WriteLine("2. SingleShot language detection with file input."); Console.WriteLine("3. Continuous language detection with multi-lingual audio input."); Console.Write(prompt); ConsoleKeyInfo x; x = Console.ReadKey(); Console.WriteLine(""); switch (x.Key) { case ConsoleKey.D1: StandaloneLanguageDetectionSamples.DetectionWithMicrophoneAsync().Wait(); break; case ConsoleKey.D2: StandaloneLanguageDetectionSamples.LanguageDetectionWithFileAsync().Wait(); break; case ConsoleKey.D3: StandaloneLanguageDetectionSamples.ContinuousLanguageDetectionWithFileAsync().Wait(); break; case ConsoleKey.D0: Console.WriteLine("Exiting..."); break; default: Console.WriteLine("Invalid input."); break; } Console.WriteLine("\nExecution done. " + prompt); }