Esempio n. 1
0
        private int iterationResult; // Stores result of iteration

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="_iterationResult"></param>
        /// <param name="_category"></param>
        /// <param name="_callerData"></param>
        /// <param name="_calleeData"></param>
        /// <param name="_spResult"></param>
        private IterationResult(int _iterationResult, CallerIterationInfo _callerData, CalleeIterationInfo _calleeData, SpeechRecognizerResult _callerSpResult, SpeechRecognizerResult _calleeSpResult)
        {
            iterationResult = _iterationResult;
            callerData = _callerData;
            calleeData = _calleeData;
            callerSpeechResult = _callerSpResult;
            calleeSpeechResult = _calleeSpResult;

            audioPowerResult = AudioVolume.NOT_ATTENUATED;
            audioVolConf = AudioVolumeConfidence.GOOD_CONFIDENCE;

            // determine the classification (category) for IterationResult
            if (iterationResult == ValidationErrors.NO_ERROR)
                category = TestIterationCategory.PASSED;
            else
                if (conditionExists(iterationResult, ValidationErrors.FAILED_CALL) || conditionExists(iterationResult, ValidationErrors.MISSING_HANGUP) ||
                    conditionExists(iterationResult, ValidationErrors.ECHO_DETECTED) || conditionExists(iterationResult, ValidationErrors.CALLER_NOISE_DETECTED) ||
                    conditionExists(iterationResult, ValidationErrors.CALLEE_NOISE_DETECTED) || conditionExists(iterationResult, ValidationErrors.CALLEE_NOT_HEARD) ||
                    conditionExists(iterationResult, ValidationErrors.CALLER_NOT_HEARD))
                    category = TestIterationCategory.FAILED;

            //if(iterationResult == ValidationErrors.FAILED_CALL || iterationResult == ValidationErrors.NOISE_DETECTED || iterationResult == ValidationErrors.ECHO_DETECTED)
                //    category = TestIterationCategory.FAILED;
                else
                {
                    // Use invalid for all others errors such as callee could not play prompt, execution error etc
                    category = TestIterationCategory.INVALID;
                }
        }
Esempio n. 2
0
 /// <summary>
 /// Method to create an instance of IterationResult.
 /// </summary>
 /// <param name="_iterationResult"></param>
 /// <param name="_category"></param>
 /// <param name="_callerData"></param>
 /// <param name="_calleeData"></param>
 /// <param name="_spResult"></param>
 /// <returns></returns>
 public static IterationResult getInstance(int _iterationResult, CallerIterationInfo _callerData, CalleeIterationInfo _calleeData, SpeechRecognizerResult _callerSpResult, SpeechRecognizerResult _calleeSpResult)
 {
     try
     {
         return new IterationResult(_iterationResult, _callerData, _calleeData, _callerSpResult, _calleeSpResult);
     }
     catch (Exception e)
     {
         return null;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Method to apply speech recognition rule. This method can 
        /// 1) detect caller side echoes as long as the recognizer on the caller recognizes its own speech.
        /// 2) detect callee side echoes if the callee recognizer recognizes its own speech
        /// 3) identifies whether caller or callee recognized/mis-recognized or did not recognize speech
        /// </summary>
        /// <param name="calleeSpeechResult">Callee's speech recognizer result</param>
        /// <param name="callerSpeechResult">Caller's speech recognizer result</param>
        /// <returns></returns>
        private int applySpeechRecognitionRule(out SpeechRecognizerResult calleeSpeechResult, out SpeechRecognizerResult callerSpeechResult)
        {
            DateTime uninitDate = new DateTime();
            int result = ValidationErrors.NO_ERROR;
            string grammarPropertyNameCallerPlayed = null;       // Property name in callee's grammar for file played by caller
            string grammarPropertyNameCalleePlayed = null;       // Property name in callee's grammar for file played by callee
            List<string> callerRecognizedPropNames = null;       // List of property names recognized by caller
            List<string> calleeRecognizedPropNames = null;       // List of property names recognized by callee

            calleeSpeechResult = null;
            callerSpeechResult = null;

            // Obtain grammar property name for wav file played by caller and callee
            if (callerData.speakTime != uninitDate)
                grammarPropertyNameCallerPlayed = wInfo.getGrammarPropertyName(callerData.wavFilePlayed);

            if (calleeData.speakTime != uninitDate)
                grammarPropertyNameCalleePlayed = wInfo.getGrammarPropertyName(calleeData.wavFilePlayed);

               /**
            * ASSUMPTIONS:
            * 1) The wav file played by caller and callee is recognizable by other party (i.e.) it has
            *      a) Representation in each other's grammar
            *      b) Representation in mapfile (WavFileName mapped to grammar tag in caller and callee's grammar
            *      Thus, no validation is required.
            * 2) Caller and the callee ALWAYS use different set of wav files. Thus, if callee recognizes a file
            *    played by itself, that situation is considered as an echo on callee side. If a caller recognizes
            *    a file played by itself, that is considered as an echo on the caller side.
            */
            callerRecognizedPropNames = callerData.getRecognizedGrammarPropertyNames();

            /**
             * We apply caller's speech recognition rule only if the caller detected speech from the callee
             */
            if (callerData.speechDetectionTime != uninitDate)
            {
                if (callerRecognizedPropNames.Count == 0)
                {
                    // This means that caller could not recognize anything.
                    callerSpeechResult = new SpeechRecognizerResult();
                    callerSpeechResult.speechOutcome = SpeechRecognizerQuality.UNRECOGNIZED;
                    callerSpeechResult.msg = "Caller did not recognize speech";
                }
                else
                if (grammarPropertyNameCallerPlayed != null && callerRecognizedPropNames.Contains(grammarPropertyNameCallerPlayed))
                {
                    // This means that the caller heard self. This is an echo on the caller side
                    result = ValidationErrors.ECHO_DETECTED;
                    callerSpeechResult = new SpeechRecognizerResult();
                    callerSpeechResult.speechOutcome = SpeechRecognizerQuality.CALLER_ECHO;
                    callerSpeechResult.msg = "Caller heard its own audio";
                }
                else
                if (grammarPropertyNameCalleePlayed != null && callerRecognizedPropNames.Contains(grammarPropertyNameCalleePlayed))
                {
                    // This means that the caller correctly heard the callee. Thus, speech is considered to be "recognized" here.
                    callerSpeechResult = new SpeechRecognizerResult();
                    callerSpeechResult.speechOutcome = SpeechRecognizerQuality.RECOGNIZED;
                    callerSpeechResult.msg = "Caller recognized the callee";
                    callerSpeechResult.property = grammarPropertyNameCalleePlayed;
                    callerSpeechResult.confidence = callerData.getConfidence(grammarPropertyNameCalleePlayed);
                }
                else
                {
                    // Caller recognized something other than its own audio and audio from the callee. We treat this "misrecognized".
                    callerSpeechResult = new SpeechRecognizerResult();
                    callerSpeechResult.speechOutcome = SpeechRecognizerQuality.MISRECOGNIZED;
                    callerSpeechResult.msg = "Caller mis-recognized speech.";
                }
            }
            calleeRecognizedPropNames = calleeData.getRecognizedGrammarPropertyNames();

            /**
             * We apply callee's speech recognition rule only if the callee detected speech from the caller
             */
            if (calleeData.speechDetectionTime != uninitDate)
            {
                if (calleeRecognizedPropNames.Count == 0)
                {
                    // Callee did not recognize anything
                    calleeSpeechResult = new SpeechRecognizerResult();
                    calleeSpeechResult.speechOutcome = SpeechRecognizerQuality.UNRECOGNIZED;
                    calleeSpeechResult.msg = "Callee did not recognize speech";
                }
                else
                if (grammarPropertyNameCalleePlayed != null && calleeRecognizedPropNames.Contains(grammarPropertyNameCalleePlayed))
                {
                    // Callee heard self. This is an echo.
                    calleeSpeechResult = new SpeechRecognizerResult();
                    result = ValidationErrors.ECHO_DETECTED;
                    calleeSpeechResult.speechOutcome = SpeechRecognizerQuality.CALLEE_ECHO;
                    calleeSpeechResult.msg = "Callee heard its own audio";
                }
                else
                if (grammarPropertyNameCallerPlayed != null && calleeRecognizedPropNames.Contains(grammarPropertyNameCallerPlayed))
                {
                    // Callee recognized the callee. This is considered as "speech recognized".
                    calleeSpeechResult = new SpeechRecognizerResult();
                    calleeSpeechResult.speechOutcome = SpeechRecognizerQuality.RECOGNIZED;
                    calleeSpeechResult.msg = "Callee recognized the caller";
                    calleeSpeechResult.property = grammarPropertyNameCallerPlayed;
                    calleeSpeechResult.confidence = calleeData.getConfidence(grammarPropertyNameCallerPlayed);
                }
                else
                {
                    // Callee heard something besides its own speech or caller's speech. This is considered "mis-recognized".
                    calleeSpeechResult = new SpeechRecognizerResult();
                    calleeSpeechResult.speechOutcome = SpeechRecognizerQuality.MISRECOGNIZED;
                    calleeSpeechResult.msg = "Callee mis-recognized speech";
                }
            }
            return result;
        }