コード例 #1
0
 public void TestMPinyin()
 {
     foreach (string s in sylStrings)
     {
         int    idx = 0;
         MSyl   ms  = Bopomofo.Inst.MunchSyllable(s, ref idx);
         string mpy = Pinyin.Inst.Transcribe(ms);
         idx = 0;
         MSyl ms1 = Pinyin.Inst.MunchSyllable(mpy, ref idx);
         if (!ms.Equals(ms1))
         {
             Console.WriteLine("{3},{0},{1},{2}", ms, ms1, mpy, s);
         }
         Assert.AreEqual(ms, ms1);
     }
 }
コード例 #2
0
 public void TestGwoRo()
 {
     foreach (string s in sylStrings)
     {
         int    idx = 0;
         MSyl   ms  = Bopomofo.Inst.MunchSyllable(s, ref idx);
         string gr  = GwoRo.Inst.Transcribe(ms);
         idx = 0;
         MSyl ms1 = GwoRo.Inst.MunchSyllable(gr, ref idx);
         if (!ms.Equals(ms1))
         {
             Console.WriteLine("{3},{0},{1},{2}", ms, ms1, gr, s);
         }
         Assert.AreEqual(ms, ms1);
     }
     foreach (IList <string> lst in bpmfGworo)
     {
         int  idx = 0;
         MSyl syl = Bopomofo.Inst.MunchSyllable(lst[0], ref idx);
         Assert.AreEqual(lst[1], GwoRo.Inst.Transcribe(syl));
         idx = 0;
         Assert.AreEqual(syl, GwoRo.Inst.MunchSyllable(lst[1], ref idx));
         syl.Tone = TONE.MUDDY;
         Assert.AreEqual(lst[2], GwoRo.Inst.Transcribe(syl));
         idx = 0;
         Assert.AreEqual(syl, GwoRo.Inst.MunchSyllable(lst[2], ref idx));
         syl.Tone = TONE.RISING;
         Assert.AreEqual(lst[3], GwoRo.Inst.Transcribe(syl));
         idx = 0;
         Assert.AreEqual(syl, GwoRo.Inst.MunchSyllable(lst[3], ref idx));
         syl.Tone = TONE.GOING;
         Assert.AreEqual(lst[4], GwoRo.Inst.Transcribe(syl));
         idx = 0;
         Assert.AreEqual(syl, GwoRo.Inst.MunchSyllable(lst[4], ref idx));
     }
 }