Beispiel #1
0
        private IDajare connectWithDoshi(IWord doshi)
        {
            if (doshi.GetHinshi() != Hinshi.Doshi)
            {
                throw new Exception();
            }
            IDajare       res = new Dajare();
            WordEvaluator we  = WordEvaluator.GetInstance();

            IWord[] 助詞s =
            {
                new Word("を", Hinshi.Joshi),
                new Word("へ", Hinshi.Joshi),
                new Word("が", Hinshi.Joshi)
            };
            IWord best助詞 = null;
            long  max    = 0;

            foreach (IWord j in 助詞s)
            {
                long e1   = we.Evaluate(meishi.ToKanji() + j.ToKanji());
                long e2   = we.Evaluate(j.ToKanji() + doshi.ToKanji());
                long eval = e1 * e1 + e2 * e2;
                if (max > eval)
                {
                    max    = eval;
                    best助詞 = j;
                }
            }
            res.Add(this.meishi);
            res.Add(best助詞);
            res.Add(doshi);
            return(res);
        }
Beispiel #2
0
 public double GetEvalution()
 {
     return((double)WordEvaluator.GetInstance().Evaluate(_word.ToKanji()));
 }