Beispiel #1
0
        // Token: 0x06001D38 RID: 7480 RVA: 0x00074628 File Offset: 0x00072828
        internal static SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetCombinedPeopleSearchResult(SpeechRecognition galRecoHelper, SpeechRecognition personalContactsRecoHelper, MobileSpeechRecoResultType highestRecoResultType)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>(0L, "Gal Result response text:'{0}'", galRecoHelper.Results.ResponseText);
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>(0L, "Personal Contacts Result response text:'{0}'", personalContactsRecoHelper.Results.ResponseText);
            string galResults = string.Empty;
            string personalContactsResults = string.Empty;

            if (galRecoHelper.Results.HttpStatus == SpeechRecognitionProcessor.SpeechHttpStatus.Success && galRecoHelper.ResultType == highestRecoResultType)
            {
                galResults = galRecoHelper.Results.ResponseText;
            }
            if (personalContactsRecoHelper.Results.HttpStatus == SpeechRecognitionProcessor.SpeechHttpStatus.Success && personalContactsRecoHelper.ResultType == highestRecoResultType)
            {
                personalContactsResults = personalContactsRecoHelper.Results.ResponseText;
            }
            string text = SpeechRecognitionUtils.CombineGALandPersonalContactXMLResults(galResults, personalContactsResults, highestRecoResultType);

            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>(0L, "Response Text to send to ResultHandler:'{0}'", text);
            SpeechRecognitionProcessor.SpeechHttpStatus httpStatus = SpeechRecognitionProcessor.SpeechHttpStatus.Success;
            if (galRecoHelper.Results.HttpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success && personalContactsRecoHelper.Results.HttpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success)
            {
                httpStatus = personalContactsRecoHelper.Results.HttpStatus;
                text       = string.Empty;
            }
            return(new SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs(text, httpStatus));
        }
Beispiel #2
0
        protected void GetHighestConfidenceValueAndResultTypeFromResult(string results)
        {
            double highestConfidenceResult = 0.0;

            this.ResultType = SpeechRecognitionUtils.ParseMobileScenarioXML(results);
            if (this.ResultType != MobileSpeechRecoResultType.None)
            {
                highestConfidenceResult = SpeechRecognition.GetHighestConfidence(results);
            }
            this.HighestConfidenceResult = highestConfidenceResult;
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <MobileSpeechRecoRequestType, double, MobileSpeechRecoResultType>((long)this.GetHashCode(), "HighestConfidence value for Request Type:'{0}', HighestConfidence:'{1}', Result Type: '{2}'", this.RequestType, this.HighestConfidenceResult, this.ResultType);
        }
Beispiel #3
0
        // Token: 0x06001D3A RID: 7482 RVA: 0x0007478C File Offset: 0x0007298C
        private static string CombineGALandPersonalContactXMLResults(string galResults, string personalContactsResults, MobileSpeechRecoResultType resultType)
        {
            string text  = SpeechRecognitionUtils.ExtractResultsFromXML(galResults, resultType);
            string text2 = SpeechRecognitionUtils.ExtractResultsFromXML(personalContactsResults, resultType);

            return(string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><MobileReco ResultType=\"{4}\"><{0}>{1}</{0}><{2}>{3}</{2}></MobileReco>", new object[]
            {
                "GALSearch",
                text,
                "PersonalContactSearch",
                text2,
                resultType.ToString()
            }));
        }
Beispiel #4
0
        // Token: 0x06001D39 RID: 7481 RVA: 0x00074728 File Offset: 0x00072928
        internal static MobileSpeechRecoResultType ParseMobileScenarioXML(string result)
        {
            string parsedResultType = string.Empty;

            using (XmlReader xmlReader = XmlReader.Create(new StringReader(result)))
            {
                if (xmlReader.ReadToFollowing("MobileReco"))
                {
                    xmlReader.MoveToAttribute("ResultType");
                    parsedResultType = xmlReader.ReadContentAsString();
                }
            }
            return(SpeechRecognitionUtils.GetMobileSpeechResultType(parsedResultType));
        }
Beispiel #5
0
        protected override SpeechRecognitionProcessor.SpeechProcessorAsyncCompletedArgs GetFormattedResultsForHighestConfidenceProcessor(SpeechRecognition recognitionWithHighestConfidence)
        {
            switch (recognitionWithHighestConfidence.RequestType)
            {
            case MobileSpeechRecoRequestType.FindInGAL:
            case MobileSpeechRecoRequestType.FindInPersonalContacts:
            {
                SpeechRecognition galRecoHelper = base.RecognitionHelpers[MobileSpeechRecoRequestType.FindInGAL];
                SpeechRecognition personalContactsRecoHelper = base.RecognitionHelpers[MobileSpeechRecoRequestType.FindInPersonalContacts];
                return(SpeechRecognitionUtils.GetCombinedPeopleSearchResult(galRecoHelper, personalContactsRecoHelper, recognitionWithHighestConfidence.ResultType));
            }

            default:
                throw new ArgumentOutOfRangeException("RequestType", recognitionWithHighestConfidence.RequestType, "Invalid parameter");
            }
        }
Beispiel #6
0
        public void ProcessAndFormatSpeechRecognitionResults(string result, out string jsonResponse, out SpeechRecognitionProcessor.SpeechHttpStatus httpStatus)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "Entering CombinedScenariosRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults with results '{0}'", result);
            jsonResponse = null;
            httpStatus   = SpeechRecognitionProcessor.SpeechHttpStatus.Success;
            MobileSpeechRecoResultType            mobileSpeechRecoResultType           = SpeechRecognitionUtils.ParseMobileScenarioXML(result);
            IMobileSpeechRecognitionResultHandler mobileSpeechRecognitionResultHandler = null;

            switch (mobileSpeechRecoResultType)
            {
            case MobileSpeechRecoResultType.DaySearch:
                mobileSpeechRecognitionResultHandler = new DaySearchRecognitionResultHandler(this.parameters.TimeZone);
                break;

            case MobileSpeechRecoResultType.AppointmentCreation:
                mobileSpeechRecognitionResultHandler = new DateTimeandDurationRecognitionResultHandler(this.parameters.TimeZone);
                break;

            case MobileSpeechRecoResultType.FindPeople:
                mobileSpeechRecognitionResultHandler = new FindPeopleSpeechRecognitionResultHandler(this.parameters, this.userContext, this.httpContext);
                break;

            case MobileSpeechRecoResultType.EmailPeople:
                mobileSpeechRecognitionResultHandler = new EmailPeopleSpeechRecognitionResultHandler(this.parameters, this.userContext, this.httpContext);
                break;

            case MobileSpeechRecoResultType.None:
                mobileSpeechRecognitionResultHandler = null;
                break;

            default:
                ExAssert.RetailAssert(false, "Invalid result type '{0}'", new object[]
                {
                    mobileSpeechRecoResultType.ToString()
                });
                break;
            }
            string text = string.Empty;

            CombinedScenarioRecoResult[] obj;
            if (mobileSpeechRecoResultType == MobileSpeechRecoResultType.None)
            {
                obj = new CombinedScenarioRecoResult[0];
            }
            else
            {
                mobileSpeechRecognitionResultHandler.ProcessAndFormatSpeechRecognitionResults(result, out jsonResponse, out httpStatus);
                if (httpStatus != SpeechRecognitionProcessor.SpeechHttpStatus.Success)
                {
                    return;
                }
                CombinedScenarioRecoResult combinedScenarioRecoResult = new CombinedScenarioRecoResult();
                combinedScenarioRecoResult.RequestId = this.parameters.RequestId.ToString("N", CultureInfo.InvariantCulture);
                text = this.GetResultTextForLogging(result);
                combinedScenarioRecoResult.Text         = text;
                combinedScenarioRecoResult.JsonResponse = jsonResponse;
                combinedScenarioRecoResult.ResultType   = CombinedScenarioRecoResult.MapSpeechRecoResultTypeToCombinedRecoResultType(mobileSpeechRecoResultType);
                obj = new CombinedScenarioRecoResult[]
                {
                    combinedScenarioRecoResult
                };
            }
            jsonResponse = CombinedScenarioRecoResult.JsonSerialize(obj);
            this.CollectAndLogStatisticsInformation(mobileSpeechRecoResultType, text);
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <string>((long)this.GetHashCode(), "Return json from CombinedScenarioResult: '{0}'", jsonResponse);
        }