public MainWindow() { InitializeComponent(); definitionWindow = new DefinitionWindow(); browser.ObjectForScripting = new JavascriptInterface(this, definitionWindow); browser.Navigate("file://" + Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "html", "translation.html"))); contextMenu.Items.Add("Test", null, Test_Click); contextMenu.Items.Add("Test 2", null, Test2_Click); EdictReader edict = new EdictReader(@"C:\Users\Mattias\Downloads\JMdict_e"); //SampleEdict.xml JMdict_e parser = new TextParser(edict); WordHistory = new WordHistory(); //List<Word> words = parser.ProcessText("薪人「哀しいなら哀しいって、寂しいなら寂しいって、言ってくれていいんだ」"); /*List<Word> words = parser.ProcessText("オーバック偸閑食べ"); * //List<Word> words = parser.ProcessText("澄"); * if (words.Count > 0) * { * Console.WriteLine(words.Count + " words found:"); * for (int i = 0; i < words.Count; i++) * { * Console.WriteLine("Word " + (i+1) + ":\n" + words[i]); * } * } * else * { * Console.WriteLine("No results found"); * }*/ }
public TextParser(EdictReader edict) { this.edict = edict; if (inflections == null) { XDocument inflectionsDoc; inflectionsDoc = XDocument.Load(@"data/inflections.xml"); XmlSerializer xmlSerializer = new XmlSerializer(typeof(Inflections)); Inflections root = (Inflections)xmlSerializer.Deserialize(inflectionsDoc.CreateReader()); inflections = root.InflectionList; } }