public override IEnumerator RunTest() { if (Config.Instance.FindCredentials(m_SpeechToText.GetServiceID()) == null) { yield break; } m_SpeechToText.GetModels(OnGetModels); while (!m_GetModelsTested) { yield return(null); } yield break; }
public override IEnumerator RunTest() { if (Config.Instance.FindCredentials(m_SpeechToText.GetServiceID()) == null) { yield break; } m_CustomCorpusFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-corpus.txt"; m_CustomWordsFilePath = Application.dataPath + "/Watson/Examples/ServiceExamples/TestData/test-stt-words.json"; // GetModels Log.Debug("TestSpeechToText", "********** Attempting to to GetModels"); m_SpeechToText.GetModels(HandleGetModels); while (!m_GetModelsTested) { yield return(null); } // GetModel Log.Debug("TestSpeechToText", "********** Attempting to to GetModel {0}", m_SpeechToTextModelEnglish); m_SpeechToText.GetModel(HandleGetModel, m_SpeechToTextModelEnglish); while (!m_GetModelTested) { yield return(null); } // GetCustomizations Log.Debug("TestSpeechToText", "********** Attempting to to get customizations"); m_SpeechToText.GetCustomizations(HandleGetCustomizations); while (!m_GetCustomizationsTested) { yield return(null); } // CreateCustomization Log.Debug("TestSpeechToText", "********** Attempting to to create customization {0}", m_CreatedCustomizationName); m_SpeechToText.CreateCustomization(HandleCreateCustomization, m_CreatedCustomizationName); while (!m_CreateCustomizationTested) { yield return(null); } // GetCustomization Log.Debug("TestSpeechToText", "********** Attempting to to get customization {0}", m_CreatedCustomizationID); m_SpeechToText.GetCustomization(HandleGetCustomization, m_CreatedCustomizationID); while (!m_GetCustomizationTested) { yield return(null); } // GetCustomCorpora Log.Debug("TestSpeechToText", "********** Attempting to to get custom corpora"); m_SpeechToText.GetCustomCorpora(HandleGetCustomCorpora, m_CreatedCustomizationID); while (!m_GetCustomCorporaTested) { yield return(null); } // AddCustomCorpus Log.Debug("TestSpeechToText", "********** Attempting to to add custom corpus {0}", m_CreatedCorpusName); m_SpeechToText.AddCustomCorpus(HandleAddCustomCorpus, m_CreatedCustomizationID, m_CreatedCorpusName, m_AllowOverwrite, m_CustomCorpusFilePath); while (!m_AddCustomCorpusTested) { yield return(null); } Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); while (m_IsCustomizationBusy) { yield return(null); } // GetCustomWords Log.Debug("TestSpeechToText", "********** Attempting to to get custom words"); m_SpeechToText.GetCustomWords(HandleGetCustomWords, m_CreatedCustomizationID); while (!m_GetCustomWordsTested) { yield return(null); } // AddCustomWordsUsingFile Log.Debug("TestSpeechToText", "********** Attempting to to add custom words using file {0}", m_CustomWordsFilePath); m_SpeechToText.AddCustomWords(HandleAddCustomWordsUsingFile, m_CreatedCustomizationID, true, m_CustomWordsFilePath); while (!m_AddCustomWordsUsingFileTested) { yield return(null); } Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); while (m_IsCustomizationBusy) { yield return(null); } // AddCustomWordsUsingObject Words words = new Words(); Word w0 = new Word(); List <Word> wordList = new List <Word>(); w0.word = "mikey"; w0.sounds_like = new string[1]; w0.sounds_like[0] = "my key"; w0.display_as = "Mikey"; wordList.Add(w0); Word w1 = new Word(); w1.word = "charlie"; w1.sounds_like = new string[1]; w1.sounds_like[0] = "char lee"; w1.display_as = "Charlie"; wordList.Add(w1); Word w2 = new Word(); w2.word = "bijou"; w2.sounds_like = new string[1]; w2.sounds_like[0] = "be joo"; w2.display_as = "Bijou"; wordList.Add(w2); words.words = wordList.ToArray(); Log.Debug("TestSpeechToText", "********** Attempting to to add custom words using object"); m_SpeechToText.AddCustomWords(HandleAddCustomWordsUsingObject, m_CreatedCustomizationID, words); while (!m_AddCustomWordsUsingObjectTested) { yield return(null); } Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); while (m_IsCustomizationBusy) { yield return(null); } // GetCustomWord Log.Debug("TestSpeechToText", "********** Attempting to to get custom word {0}", m_WordToGet); m_SpeechToText.GetCustomWord(HandleGetCustomWord, m_CreatedCustomizationID, m_WordToGet); while (!m_GetCustomWordTested) { yield return(null); } // TrainCustomization Log.Debug("TestSpeechToText", "********** Attempting to to train customization {0}", m_CreatedCustomizationID); m_SpeechToText.TrainCustomization(HandleTrainCustomization, m_CreatedCustomizationID); while (!m_TrainCustomizationTested) { yield return(null); } Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); while (m_IsCustomizationBusy) { yield return(null); } // DeleteCustomCorpus Log.Debug("TestSpeechToText", "********** Attempting to to delete custom corpus {0}", m_CreatedCorpusName); m_SpeechToText.DeleteCustomCorpus(HandleDeleteCustomCorpus, m_CreatedCustomizationID, m_CreatedCorpusName); while (!m_DeleteCustomCorpusTested) { yield return(null); } Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); while (m_IsCustomizationBusy) { yield return(null); } // DeleteCustomWord Log.Debug("TestSpeechToText", "********** Attempting to to delete custom word {0}", m_WordToGet); m_SpeechToText.DeleteCustomWord(HandleDeleteCustomWord, m_CreatedCustomizationID, m_WordToGet); while (!m_DeleteCustomWordTested) { yield return(null); } Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); while (m_IsCustomizationBusy) { yield return(null); } // ResetCustomization Log.Debug("TestSpeechToText", "********** Attempting to to reset customization {0}", m_CreatedCustomizationID); m_SpeechToText.ResetCustomization(HandleResetCustomization, m_CreatedCustomizationID); while (!m_ResetCustomizationTested) { yield return(null); } // The customization is always pending after reset for some reason! //Runnable.Run(CheckCustomizationStatus(m_CreatedCustomizationID)); //while (m_IsCustomizationBusy) // yield return null; // DeleteCustomization //Log.Debug("TestSpeechToText", "********** Attempting to to delete customization {0}", m_CreatedCustomizationID); //m_SpeechToText.DeleteCustomization(HandleDeleteCustomization, m_CreatedCustomizationID); //while (!m_DeleteCustomizationTested) // yield return null; yield break; }