using System; using System.Collections.Generic; using System.IO; using System.Xml; using M17N; using M17N.Core; using M17N.Input; using Xex = System.Xml.Xexpression; public class Test { public static void Main(string[] args) { // M17n.debug = true; // Xex.DebugDepth = 10; int argc = 0; if (args[0] == "xml") { MDatabase.ApplicationDir = "/usr/local/share/m17n-xml"; argc++; } else MDatabase.ApplicationDir = "/usr/local/share/m17n"; MInputMethod im = MInputMethod.Find (args[argc], args[argc + 1]); MText mt = new MText (); MInputMethod.Session session = new MInputMethod.Session (im, mt, 0); MText str = args[argc + 2]; for (int i = 0; i < str.Length; i++) { MInputMethod.Key key = new MInputMethod.Key (str[i]); session.HandleKey (key); int pos = session.CurrentPos; Console.WriteLine ("{0} -> \"{1}|{2}|{3}\"", str[i, i + 1], mt[0, pos], session.Preedit, mt[pos, mt.Length]); } } }