public CorrectAnswerHelper(CorrectAnswer rightAnswer)
 {
     _owner = rightAnswer;
 }
 public CorrectAnswerHelperUsingRegex(CorrectAnswer rightAnswer)
     : base(rightAnswer)
 {
     RegexPattern = MondaiWord.GetRegexPattern(Owner.Text);
 }
        private static List<MondaiWord> 正解探索(CorrectAnswer rightAnswer, List<MondaiWord> a)
        {
            int i = 0;
            var b = new List<MondaiWord>();
            var stack = new Stack<Local>();
            stack.Push(new Local(i, a, b));
            while (stack.Any())
            {
                var temp = stack.Pop();
                i = temp._i;
                a = temp._a;
                b = temp._b;

                while (i < a.Count())
                {
                    var bb = new List<MondaiWord>(b.Count() + 1);
                    bb.AddRange(b);
                    bb.Add(a[i]);
                    if (!rightAnswer.StartsWith(bb))
                    {
                        i++;
                        continue;
                    }
                    if (rightAnswer.IsMatch(bb))
                    {
                        return bb;
                    }
                    var aa = new List<MondaiWord>(a);
                    aa.RemoveAt(i);

                    stack.Push(new Local(i + 1, a, b));
                    i = 0;
                    a = aa;
                    b = bb;
                }
            }
            return null;

            /*			for (int i = 0; i < a.Count(); i++)
            {
                if (!b.Any() && !a[i].HasLeftJoint && !rightAnswer.Text.StartsWith(a[i].Text, StringComparison.Ordinal))
                {
                    continue;
                }

                var aa = new List<MondaiWord>(a);
                aa.RemoveAt(i);

                var bb = new List<MondaiWord>(b);
                bb.Add(a[i]);

                if (!rightAnswer.StartsWith(bb))
                {
                    continue;
                }
                if (rightAnswer.IsMatch(bb))
                {
                    return bb;
                }

                var result = 正解探索(rightAnswer, aa, bb);
                if (null != result) return result;
            }
            return null;*/
        }
 public CorrectAnswerHelperUsingNormalizer(CorrectAnswer rightAnswer)
     : base(rightAnswer)
 {
     _normalizedText = Normalize(rightAnswer.Text);
 }
 public static MondaiWord[] 正解探索(CorrectAnswer rightAnswer, IEnumerable<MondaiWord> mondaiWords)
 {
     var result = 正解探索(rightAnswer, mondaiWords.ToList());
     return null == result ? null : result.ToArray();
 }