public void Method_Exhibit() { var obj = new WordProvider(); obj.LoadAll("./words.tsv"); var result = obj.Exhibit(); }
public void Method_LoadAll() { var obj = new WordProvider(); obj.LoadAll("./words.tsv"); Assert.AreEqual(5, obj.Count); }
static void Main(string[] args) { var repo = new WordProvider(); repo.LoadAll("./condenced3.tsv"); var decoder = new AnagramDecoder <WordNode>(repo.Exhibit(), x => x.Kana); Stopwatch stopwatch = new Stopwatch(); while (true) { Console.Write("文章を入力(空値入力で終了) >> "); var accepted = Console.ReadLine(); if (accepted.Length == 0) { break; } stopwatch.Start(); var result = decoder.Analyze(accepted); var count = 0; foreach (var set in result.AsParallel()) { Console.WriteLine(string.Join(" + ", set.Select(x => x.Surface))); count++; } Console.WriteLine($"{count} 件見つかりました。({stopwatch.Elapsed.TotalMilliseconds:0.000} ms)\n"); stopwatch.Reset(); } Console.WriteLine("プログラムを終了"); }
public void Method_TakeById_SingleNode() { var obj = new WordProvider(); obj.LoadAll("./words.tsv"); IEnumerable <WordNode> nodes = obj.TakeById(1); Assert.AreEqual(1, nodes.Count()); Assert.AreEqual("で", nodes.First().Surface); }
public void Method_TakeById_Nexts() { var obj = new WordProvider(); obj.LoadAll("./words.tsv"); IEnumerable <WordNode> nodes = obj.TakeById(0); Assert.AreEqual(2, nodes.Count()); Assert.AreEqual(2, nodes.First().Chains.Count()); Assert.AreEqual(1, nodes.First().Chains.First().Nodes.Count()); Assert.AreEqual("で", nodes.First().Chains.First().Nodes.First().Kana); Assert.AreEqual("に", nodes.First().Chains.Last().Nodes.First().Kana); }
public void Method_TakeById_DoubleNode() { var obj = new WordProvider(); obj.LoadAll("./words.tsv"); IEnumerable <WordNode> nodes = obj.TakeById(0); Assert.AreEqual(2, nodes.Count()); Assert.AreEqual("うえの", nodes.First().Kana); Assert.AreEqual("こうずけ", nodes.Last().Kana); Assert.AreEqual("上野", nodes.First().Surface); Assert.AreEqual("上野", nodes.Last().Surface); }