コード例 #1
0
        protected uint AddProfile(uint index, SpeechEnroller.Profile profile)
        {
            Profiles.Add(index, profile);

            if (Codec == WaveFormatEncoding.Unknown)
            {
                Codec = profile.Codec;
            }

            Logger?.LogDebug("SpeechEnrollerBase.AddProfile(): Codec: {0}", profile.Codec);
            Logger?.LogDebug("SpeechEnrollerBase.AddProfile(): MinimumSecondsOfSpeech: {0}", profile.MinimumSecondsOfSpeech);
            Logger?.LogDebug("SpeechEnrollerBase.AddProfile(): Index: {0}", index);

            SpeechRequired = profile.MinimumSecondsOfSpeech;

            return(index);
        }
コード例 #2
0
        protected void AddResult(uint index, string name, SpeechEnroller.InstanceResult result)
        {
            SpeechEnroller.Profile profile = Profiles[index];

            if (result.SpeechExtracted.HasValue)
            {
                result.SpeechTrained = 0.0;
                if (result.SpeechExtracted.Value >= profile.MinimumSecondsOfSpeech)
                {
                    result.Result = SpeechEnroller.Result.Success;
                }
                else
                {
                    result.Result = SpeechEnroller.Result.NeedMore;
                }
            }
            else if (result.SpeechTrained.HasValue)
            {
                result.Result          = SpeechEnroller.Result.Success;
                result.SpeechExtracted = 0.0;
            }
            else
            {
                // Error
                result.Result = SpeechEnroller.Result.Invalid;
            }

            Logger?.LogDebug("SpeechEnrollerBase.AddResult(): {0} - ErrorCode: {1}", name, result.ErrorCode);
            Logger?.LogDebug("SpeechEnrollerBase.AddResult(): {0} - SpeechExtracted: {1}", name, result.SpeechExtracted);
            Logger?.LogDebug("SpeechEnrollerBase.AddResult(): {0} - SpeechTrained: {1}", name, result.SpeechTrained);
            Logger?.LogDebug("SpeechEnrollerBase.AddResult(): {0} - Result: {1}", name, result.Result);

            foreach (var extra in result.Extra)
            {
                Logger?.LogDebug("SpeechEnrollerBase.AddResult(): {0} - {1}: {2}", name, extra.Key, extra.Value);
            }

            EnrollResults.Add(name, result);
        }