public void TestWhisper() { var trans = new WhisperTranslator(); var result = trans.Whisper("The quick brown fox jumps over the lazy dogs."); Console.WriteLine(result); }
public void TestTranslations() { var trans = new WhisperTranslator() { CookieJar = new CookieContainer() }; Console.WriteLine(trans.TranslatePhrase("en", "fr", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "bn", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "ceb", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "zh-CN", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "cs", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "gl", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "ht", "The quick brown fox jumps over the lazy dog")); Console.WriteLine(trans.TranslatePhrase("en", "id", "The quick brown fox jumps over the lazy dog")); }
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 })); }