From 30b0d934244cfea632b9de3ebc91256a18567b40 Mon Sep 17 00:00:00 2001 From: Nima Poulad Date: Tue, 11 Jun 2019 16:14:15 -0700 Subject: [PATCH 1/2] Enable creation of models with pronunciation files --- SpeechCLI/Commands/ModelCommand.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/SpeechCLI/Commands/ModelCommand.cs b/SpeechCLI/Commands/ModelCommand.cs index 4edcb0d..49d4628 100644 --- a/SpeechCLI/Commands/ModelCommand.cs +++ b/SpeechCLI/Commands/ModelCommand.cs @@ -45,6 +45,10 @@ class Create : ParamActionCommandBase [Guid] string LanguageDataset { get; set; } + [Option(ShortName = "pro", ValueName = "GUID", Description = "ID of the pronunciation dataset used to train language model. Required when '--audio-dataset' not provided.")] + [Guid] + string PronunciationDataset { get; set; } + [Option(ValueName = "GUID", Description = "(Required) ID of base acoustic model. To get available scenarios for given locale, run 'model list-scenarios --locale en-us'.")] [Guid] [Required] @@ -58,7 +62,9 @@ class Create : ParamActionCommandBase int OnExecute() { - if (string.IsNullOrWhiteSpace(AudioDataset) && string.IsNullOrWhiteSpace(LanguageDataset)) + if (string.IsNullOrWhiteSpace(AudioDataset) + && string.IsNullOrWhiteSpace(LanguageDataset) + && string.IsNullOrWhiteSpace(PronunciationDataset)) { _console.Error.WriteLine("Either --audio-dataset or --language-dataset has to be provided."); return -1; @@ -81,7 +87,15 @@ int OnExecute() else { modelDefinition.ModelKind = "Language"; - modelDefinition.Datasets = new List() { new DatasetIdentity(Guid.Parse(LanguageDataset)) }; + if (string.IsNullOrWhiteSpace(PronunciationDataset)) + { + modelDefinition.Datasets = new List() { new DatasetIdentity(Guid.Parse(LanguageDataset)) }; + } else + { + modelDefinition.Datasets = new List() { new DatasetIdentity(Guid.Parse(LanguageDataset)), + new DatasetIdentity(Guid.Parse(PronunciationDataset))}; + } + } _console.WriteLine("Creating model..."); From f9a974d9eced86a594e03994782118a9a2c870de Mon Sep 17 00:00:00 2001 From: Nima Poulad Date: Thu, 13 Jun 2019 15:43:46 -0700 Subject: [PATCH 2/2] Address PR feedback --- SpeechCLI/Commands/ModelCommand.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SpeechCLI/Commands/ModelCommand.cs b/SpeechCLI/Commands/ModelCommand.cs index 49d4628..06cd42c 100644 --- a/SpeechCLI/Commands/ModelCommand.cs +++ b/SpeechCLI/Commands/ModelCommand.cs @@ -63,8 +63,7 @@ class Create : ParamActionCommandBase int OnExecute() { if (string.IsNullOrWhiteSpace(AudioDataset) - && string.IsNullOrWhiteSpace(LanguageDataset) - && string.IsNullOrWhiteSpace(PronunciationDataset)) + && string.IsNullOrWhiteSpace(LanguageDataset)) { _console.Error.WriteLine("Either --audio-dataset or --language-dataset has to be provided."); return -1;