Exemple #1
0
        public void TestWhisper()
        {
            var trans  = new WhisperTranslator();
            var result = trans.Whisper("The quick brown fox jumps over the lazy dogs.");

            Console.WriteLine(result);
        }
Exemple #2
0
        public HttpResponseMessage GetDecision()
        {
            var question = Request.GetQueryNameValuePairs().Where(q => q.Key == "q").Select(q => q.Value).FirstOrDefault();

            if (question == null)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "Bad Request"));
            }
            var translator  = new WhisperTranslator();
            var translation = translator.Whisper(question);
            var hash        = translation.GetHashCode();
            var yes         = hash % 2 == 0;

            return(Request.CreateResponse(HttpStatusCode.OK, new Decision()
            {
                IsYes = yes,
                Translation = translation
            }));
        }