Пример #1
0
        public string RecogniseSpeech(string text)
        {
            string response = null;

            if (text == "speechToText")
            {
                response = Functionality.SpeechToText(speechToTextKey, language);
                if (response != null)
                {
                    return(response);
                }
            }

            response = text.Process();
            if (response == null)
            {
                response = Functionality.BingSearch(text, bingSearchKey, language);
                if (response != null)
                {
                    var         res = JsonConvert.DeserializeObject <Demo>(response);
                    WebResponse web = new WebResponse();
                    web.Type  = "BingSearch";
                    web.Value = res.webPages.value;
                    var webSeatch = JsonConvert.SerializeObject(web);
                    return(webSeatch);
                }
            }
            else
            {
                LocalResponse local = new LocalResponse();
                local.Type    = "Local";
                local.Message = response;
                return(JsonConvert.SerializeObject(local));
            }
            return(response);
        }