protected void AddResult(uint index, string name, SpeechVerifier.InstanceResult result) { SpeechVerifier.Profile profile = Profiles[index]; if (result.Result == SpeechVerifier.Result.Unknown) { if (result.Score == 0.0) { result.Result = SpeechVerifier.Result.NotScored; } else if (result.Score >= profile.PassThreshold) { result.Result = SpeechVerifier.Result.Pass; } else if (result.Score <= profile.FailThreshold) { result.Result = SpeechVerifier.Result.Fail; } else { result.Result = SpeechVerifier.Result.Ambiguous; } } Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - Index: {1}", name, index); Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - Error: {1}", name, result.ErrorCode); Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - Score: {1}", name, result.Score); Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - SpeechExtracted: {1}", name, result.SpeechExtracted); Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - Result: {1}", name, result.Result); if (result.IsOverridable.HasValue) { IsOverridable = result.IsOverridable.Value; Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - IsOverridable: {1}", name, IsOverridable); } if (result.IsAuthorized.HasValue) { IsAuthorized = result.IsAuthorized.Value; Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - IsAuthorized: {1}", name, IsAuthorized); } foreach (var extra in result.Extra) { Logger?.LogDebug("SpeechVerifierBase.AddResult(): {0} - {1}: {2}", name, extra.Key, extra.Value); } VerifyResults.Add(name, result); }
protected uint AddProfile(uint index, SpeechVerifier.Profile profile) { if (!profile.MinimumSecondsOfSpeech.HasValue) { profile.MinimumSecondsOfSpeech = 0; } SpeechRequired = profile.MinimumSecondsOfSpeech.Value; Profiles.Add(index, profile); if (Codec == WaveFormatEncoding.Unknown) { Codec = profile.Codec; } Logger?.LogDebug("SpeechVerifierBase.AddProfile(): Type: {0}", profile.Type); Logger?.LogDebug("SpeechVerifierBase.AddProfile(): Codec: {0}", profile.Codec); Logger?.LogDebug("SpeechVerifierBase.AddProfile(): MinimumSecondsOfSpeech: {0}", profile.MinimumSecondsOfSpeech); Logger?.LogDebug("SpeechVerifierBase.AddProfile(): Pass Threshold: {0}", profile.PassThreshold); Logger?.LogDebug("SpeechVerifierBase.AddProfile(): Fail Threshold: {0}", profile.FailThreshold); Logger?.LogDebug("SpeechVerifierBase.AddProfile(): Index: {0}", index); return(index); }