public void TestKataToRomaAllSilentVowel()
        {
            string kata     = "ッヲッロットッヨッポッソッドッフッゴッホッジョッコッゾッコンオッモッ";
            string actual   = RomaConvert.ConvertKataToRomaFullLoop(kata);
            string expected = "wworrottoyyoppossoddoffuggohhojjokkozzokkonommo";

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
        public void TestKataToRomaSilentVowel()
        {
            string kata     = "「カエッタデスカ?」 トイッテイマス。";
            string actual   = RomaConvert.ConvertKataToRomaFullLoop(kata);
            string expected = "「kaettadesuka?」 toitteimasu。";

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
        public void TestKataToRomaPhrase()
        {
            string kata     = "ソノコトバニジークハケンソンヲスルコトモナク、マタ、コウテイヲスルコトモナク、オダヤカナビエミノヒョウジョウダケヲミセテクレタ。";
            string actual   = RomaConvert.ConvertKataToRomaFullLoop(kata);
            string expected = "sonokotobaniji-kuhakensonwosurukotomonaku、mata、kouteiwosurukotomonaku、odayakanabieminohyoujoudakewomisetekureta。";

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }
 public void TestFullTableKataToRoma()
 {
     using (var file = File.OpenRead("./ConvertClasses/Resource/TableTest.txt"))
         using (var reader = new StreamReader(file))
         {
             while (!reader.EndOfStream)
             {
                 var    line     = reader.ReadLine().Split('@');
                 string actual   = RomaConvert.ConvertKataToRomaFullLoop(line[2].Trim());
                 string expected = line[0].Trim();
                 Assert.AreEqual(expected, actual);
             }
         }
 }
Exemple #5
0
        private static string[] MakeSureCorrectWords(List <WordInformation> words, string[] results)
        {
            if (results.Length != words.Count)
            {
                Debug.WriteLine("WordInformationViewModel.ConvertPronunicationToRomaji: String contains token word -> use extreme slow method");
                results = new string[words.Count];
                //WARNING: This is very slow
                for (int i = 0; i < words.Count; i++)
                {
                    results[i] = RomaConvert.ConvertKataToRomaFullLoop(words[i].Pronunciation);
                }
            }

            return(results);
        }
Exemple #6
0
        private static string[] ConvertPronunicationToRomaji(List <WordInformation> words)
        {
            StringBuilder builder = new StringBuilder();

            for (int i = 0; i < words.Count - 1; i++)
            {
                builder.Append(words[i].Pronunciation);
                builder.Append("\nRomaji\n");
            }
            builder.Append(words[words.Count - 1].Pronunciation);

            var results = RomaConvert.ConvertKataToRomaFullLoop(builder)
                          .Split(new string[] { "\nRomaji\n" }, StringSplitOptions.None);

            results = MakeSureCorrectWords(words, results);
            return(results);
        }
        public void TestKataExtend()
        {
            string roma     = "fafifefofyuwiwevavivevotsatsitsocheshejetelitoluyeulodelidelyukwavu";
            string actual   = RomaConvert.ConvertRomaToHiraFullLoop(roma);
            string expected = "ふぁふぃふぇふぉふゅうぃうぇヴぁヴぃヴぇヴぉつぁつぃつぉちぇしぇじぇてぃとぅいぇうぉでぃでゅくぁヴ";

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }

            string kata = "ファフィフェフォフュウィウェヴァヴィヴェヴォツァツィツォチェシェジェティトゥイェウォディデュクァヴ";

            actual   = RomaConvert.ConvertKataToRomaFullLoop(kata);
            expected = "fafifefofyuwiwevavivevotsatsitsocheshejetituyewodidukwavu";
            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], actual[i]);
            }
        }