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_171025_test_google_translate_api_on_notranslate()
        {
            String arabizi  = "Ana khdit f7alom mn <span class='notranslate'>pull and bear</span>";
            String expected = "khdit آنا f7alom دقيقة <span class='notranslate'>pull and bear</span>";

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

            Assert.AreEqual(expected, translatedLatinWord);
        }
Esempio n. 3
0
        public void ut_171023_test_firstpass_google_on_mispelled_word_ex_automatiqui_make_sure_it_does_not_work()
        {
            String arabizi  = "automatiqui";
            String expected = "automatiqui";

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

            Assert.AreEqual(expected, translatedLatinWord);
        }
Esempio n. 4
0
        public void ut_171023_test_firstpass_google_on_text_with_lah_and_w()
        {
            // FAIL : should work when we add a bidict preprocess before google/bing
            // See VSO 562 (https://namatedev.visualstudio.com/170105OADRJNLP/_workitems/edit/562)

            String arabizi            = "btol l3mer inchalah wbax matmaniti lah ykhalilek marwan w ya39ob bonne voyage bb	";
            String minexpected        = "btol l3mer inchalah wbax matmaniti لاه ykhalilek مروان ث ya39ob جيدة ب رحلة";
            String preferablyexpected = "btol l3mer inchalah wbax matmaniti الله ykhalilek مروان و ya39ob جيدة bébé رحلة";

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

            Assert.AreEqual(minexpected, translatedLatinWord);
            Assert.AreEqual(preferablyexpected, translatedLatinWord);
        }
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);
        }