private IDajare connectWithMeishi(IWord meishi) { if (meishi.GetHinshi() != Hinshi.Meishi) { throw new Exception(); } IDajare res = new Dajare(); WordEvaluator we = WordEvaluator.GetInstance(); IWord[] testers = { new Word("な", Hinshi.Joshi), new Word("は", Hinshi.Joshi) }; long max = -114514; IWord better助詞 = null; foreach (IWord j in testers) { long eval = we.Evaluate(this.meishi.ToKanji() + j.ToKanji()); if (max < eval) { max = eval; better助詞 = j; } } if (better助詞.ToHiragana() == "な") { res.Add(this.meishi); res.Add(better助詞); res.Add(meishi); return(res); } IWord[] 助詞s = { new Word("は", Hinshi.Joshi), new Word("と", Hinshi.Joshi), new Word("より", Hinshi.Joshi), new Word("の", Hinshi.Joshi) }; Random random = new Random(); res.Add(this.meishi); res.Add(助詞s[random.Next(助詞s.Length)]); res.Add(meishi); return(res); }
public string ToHiragana() { return(_word.ToHiragana()); }