Esempio n. 1
0
        public void ut_171222_test_spellcheck_bing_and_google_on_mispelled_word_ex_uniqement()
        {
            String arabizi  = "uniqement";
            String expected = "uniquement";

            // consume bing apis
            var BingSpellcheckAPIKey = "1e14edea7a314d469541e8ced0af38c9";

            arabizi = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);

            Assert.AreEqual(expected, arabizi);

            // google
            var GoogleTranslationApiKey = "AIzaSyBqnBEi2fRhKRRpcPCJ-kwTl0cJ2WcQRJI";
            var translatedLatinWord     = new GoogleTranslationApiTools(GoogleTranslationApiKey).getArabicTranslatedWord(arabizi);

            expected = "فقط";
            Assert.AreEqual(expected, translatedLatinWord);

            // 2nd pass : longer
            arabizi  = "apeel urgent uniqement";
            expected = "appel urgent uniquement";
            arabizi  = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);
            Assert.AreEqual(expected, arabizi);

            // 3rd pass : longer
            arabizi  = "katla3li apeel urgent uniqement";
            expected = "katla3li appel urgent uniquement";
            arabizi  = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);
            Assert.AreEqual(expected, arabizi);
        }
Esempio n. 2
0
        public void ut_171023_test_firstpass_bing_should_work_when_no_suggestions_available()
        {
            String arabizi  = "Salam Houditta Houda, inwi fi khidmatikoum.Bach telghiw techghil l automatiqui dyal bedel sotek, ma3likoum ghir tresslou STOP f sms l ra9m 789.";
            String expected = "Salam Houditta Houda, inwi fi khidmatikoum.Bach telghiw techghil l automatiqui dyal bedel sotek, ma3likoum ghir tresslou STOP f sms l ra9m 789.";

            // consume google/bing apis
            var BingSpellcheckAPIKey = "1e14edea7a314d469541e8ced0af38c9";
            var correctedWord        = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);

            // bing finds nothing so no change
            Assert.AreEqual(expected, correctedWord);
        }
Esempio n. 3
0
        public void ut_171023_test_firstpass_bing_on_text_with_quote()
        {
            String arabizi = "Bsahtek 7biba dyali btol l3mer inchalah wbax matmaniti lah ykhalilek marwan w ya39ob walidik khotek je t'embrasse bonne voyage bb	";
            // String expected = "Bsahtek 7biba dyali btol l3mer inchalah wbax matmaniti lah ykhalilek marwan w ya39ob walidik khotek je t'embrasse bonne voyage bb";
            String expected = "Bsahtek 7biba dyali bitola 3amer inchallah wbaxmatmaniti lah ykhalik marwan w ya39ob walidik khotek je t'embrasse bonne voyage bb";

            // consume google/bing apis
            var BingSpellcheckAPIKey = "1e14edea7a314d469541e8ced0af38c9";
            var correctedWord        = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);

            Assert.AreEqual(expected, correctedWord);
        }
Esempio n. 4
0
        public void ut_171023_test_firstpass_bing_should_work_when_one_suggestion_available()
        {
            //
            String arabizi  = "je t'emebrasse bonne voyage";
            String expected = "je t'embrasse bonne voyage";

            // consume google/bing apis
            var BingSpellcheckAPIKey = "1e14edea7a314d469541e8ced0af38c9";
            var correctedWord        = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);

            // bing finds one so change
            Assert.AreEqual(expected, correctedWord);
        }
Esempio n. 5
0
        public void ut_171023_test_firstpass_bing_and_google_on_mispelled_word_ex_automatiqui()
        {
            String arabizi  = "automatiqui";
            String expected = "تلقائي";

            // consume bing apis
            var BingSpellcheckAPIKey = "1e14edea7a314d469541e8ced0af38c9";

            arabizi = new BingSpellCheckerApiTools().bingSpellcheckApi(arabizi, BingSpellcheckAPIKey);

            // google
            var GoogleTranslationApiKey = "AIzaSyBqnBEi2fRhKRRpcPCJ-kwTl0cJ2WcQRJI";
            var translatedLatinWord     = new GoogleTranslationApiTools(GoogleTranslationApiKey).getArabicTranslatedWord(arabizi);

            Assert.AreEqual(expected, translatedLatinWord);
        }