Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Commit

Permalink
Merge pull request #6 from HobbyProjects/HobbyProjects/Models
Browse files Browse the repository at this point in the history
Enable creation of models with pronunciation files
  • Loading branch information
msimecek authored Jun 14, 2019
2 parents c93812a + f9a974d commit 6dbff2f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions SpeechCLI/Commands/ModelCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -58,7 +62,8 @@ class Create : ParamActionCommandBase

int OnExecute()
{
if (string.IsNullOrWhiteSpace(AudioDataset) && string.IsNullOrWhiteSpace(LanguageDataset))
if (string.IsNullOrWhiteSpace(AudioDataset)
&& string.IsNullOrWhiteSpace(LanguageDataset))
{
_console.Error.WriteLine("Either --audio-dataset or --language-dataset has to be provided.");
return -1;
Expand All @@ -81,7 +86,15 @@ int OnExecute()
else
{
modelDefinition.ModelKind = "Language";
modelDefinition.Datasets = new List<DatasetIdentity>() { new DatasetIdentity(Guid.Parse(LanguageDataset)) };
if (string.IsNullOrWhiteSpace(PronunciationDataset))
{
modelDefinition.Datasets = new List<DatasetIdentity>() { new DatasetIdentity(Guid.Parse(LanguageDataset)) };
} else
{
modelDefinition.Datasets = new List<DatasetIdentity>() { new DatasetIdentity(Guid.Parse(LanguageDataset)),
new DatasetIdentity(Guid.Parse(PronunciationDataset))};
}

}

_console.WriteLine("Creating model...");
Expand Down

0 comments on commit 6dbff2f

Please sign in to comment.