コード例 #1
0
        /// <summary>
        /// Expand a template with given name and scope.
        /// Return all possible responses instead of random one.
        /// </summary>
        /// <param name="templateName">Template name to be evaluated.</param>
        /// <param name="scope">The state visible in the evaluation.</param>
        /// <returns>Expand result.</returns>
        public IList <object> ExpandTemplate(string templateName, object scope = null)
        {
            CheckErrors();
            var expander = new Expander(AllTemplates.ToList(), ExpressionParser, StrictMode);

            return(expander.ExpandTemplate(templateName, scope));
        }
コード例 #2
0
 /// <summary>
 /// Expand a template with given name and scope.
 /// Return all possible responses instead of random one.
 /// </summary>
 /// <param name="templateName">Template name to be evaluated.</param>
 /// <param name="scope">The state visible in the evaluation.</param>
 /// <param name="opt">The evaluation option for current expander.</param>
 /// <returns>Expand result.</returns>
 public IList<object> ExpandTemplate(string templateName, object scope = null, EvaluationOptions opt = null)
 {
     CheckErrors();
     var evalOpt = opt ?? LgOptions;
     var expander = new Expander(AllTemplates.ToList(), ExpressionParser, evalOpt);
     return expander.ExpandTemplate(templateName, scope);
 }
コード例 #3
0
        /// <summary>
        /// Expands a template with given name and scope.
        /// Return all possible responses instead of random one.
        /// </summary>
        /// <param name="templateName">Template name to be evaluated.</param>
        /// <param name="scope">State visible in the evaluation.</param>
        /// <param name="opt">EvaluationOptions in expanding a template.</param>
        /// <returns>Expanded result.</returns>
        public IList <object> ExpandTemplate(string templateName, object scope = null, EvaluationOptions opt = null)
        {
            CheckErrors();
            var evalOpt = opt != null?opt.Merge(LgOptions) : LgOptions;

            var expander = new Expander(this, evalOpt);

            return(expander.ExpandTemplate(templateName, scope));
        }