Example #1
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public star(ABPS.Aiml.Bot bot,
             ABPS.Aiml.User user,
             ABPS.Aiml.Utils.SubQuery query,
             ABPS.Aiml.Request request,
             ABPS.Aiml.Result result,
             XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
 }
Example #2
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request inputted into the system</param>
 /// <param name="result">The result to be passed to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public condition(ABPS.Aiml.Bot bot,
                  ABPS.Aiml.User user,
                  ABPS.Aiml.Utils.SubQuery query,
                  ABPS.Aiml.Request request,
                  ABPS.Aiml.Result result,
                  XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
     this.isRecursive = false;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot involved in this request</param>
 /// <param name="user">The user making the request</param>
 /// <param name="query">The query that originated this node</param>
 /// <param name="request">The request itself</param>
 /// <param name="result">The result to be passed back to the user</param>
 /// <param name="templateNode">The node to be processed</param>
 public AIMLTagHandler(ABPS.Aiml.Bot bot,
                       ABPS.Aiml.User user,
                       ABPS.Aiml.Utils.SubQuery query,
                       ABPS.Aiml.Request request,
                       ABPS.Aiml.Result result,
                       XmlNode templateNode) : base(bot, templateNode.OuterXml)
 {
     this.user         = user;
     this.query        = query;
     this.request      = request;
     this.result       = result;
     this.templateNode = templateNode;
     this.templateNode.Attributes.RemoveNamedItem("xmlns");
 }
Example #4
0
        /// <summary>
        /// Static helper that applies replacements from the passed dictionary object to the
        /// target string
        /// </summary>
        /// <param name="bot">The bot for whom this is being processed</param>
        /// <param name="dictionary">The dictionary containing the substitutions</param>
        /// <param name="target">the target string to which the substitutions are to be applied</param>
        /// <returns>The processed string</returns>
        public static string Substitute(ABPS.Aiml.Bot bot, ABPS.Aiml.Utils.SettingsDictionary dictionary, string target)
        {
            string marker = ApplySubstitutions.getMarker(5);
            string result = target;

            foreach (string pattern in dictionary.SettingNames)
            {
                string p2 = ApplySubstitutions.makeRegexSafe(pattern);
                //string match = "\\b"[email protected]().Replace(" ","\\s*")+"\\b";
                string match       = "\\b" + p2.TrimEnd().TrimStart() + "\\b";
                string replacement = marker + dictionary.grabSetting(pattern).Trim() + marker;
                result = Regex.Replace(result, match, replacement, RegexOptions.IgnoreCase);
            }

            return(result.Replace(marker, ""));
        }
Example #5
0
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="UserID">The GUID of the user</param>
        /// <param name="bot">the bot the user is connected to</param>
        public User(string UserID, ABPS.Aiml.Bot bot, string bot_path)
        {
            //    if (UserID.Length > 0)
            //    {
            //        this.id = UserID;
            //        this.bot = bot;
            //        this.Predicates = new ABPS.Aiml.Utils.SettingsDictionary(this.bot);
            //        this.bot.DefaultPredicates.Clone(this.Predicates);
            //        this.Predicates.addSetting("topic", "*");
            //    }
            //    else
            //    {
            //        throw new Exception("The UserID cannot be empty");
            //    }

            if (UserID.Length > 0)
            {
                this.id         = UserID;
                this.bot        = bot;
                this.Predicates = new SettingsDictionary(this.bot);

                if (!File.Exists(bot_path + @"\users\" + UserID + ".xml"))
                {
                    this.bot.DefaultPredicates.Clone(this.Predicates);
                    this.Predicates.addSetting("topic", "*");
                    this.Predicates.updateSetting("name", UserID);
                }
                else
                {
                    this.Predicates = new SettingsDictionary(this.bot);
                    this.Predicates.loadSettings(bot_path + @"\users\" + UserID + ".xml");
                }
            }
            else
            {
                throw new Exception("The UserID cannot be empty");
            }
        }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot this sentence splitter is associated with</param>
 /// <param name="inputString">The raw input string to be processed</param>
 public SplitIntoSentences(ABPS.Aiml.Bot bot, string inputString)
 {
     this.bot         = bot;
     this.inputString = inputString;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot for whom this is a settings dictionary</param>
 public SettingsDictionary(ABPS.Aiml.Bot bot)
 {
     this.bot = bot;
 }
Example #8
0
 public ApplySubstitutions(ABPS.Aiml.Bot bot)
     : base(bot)
 {
 }
Example #9
0
 public ApplySubstitutions(ABPS.Aiml.Bot bot, string inputString)
     : base(bot, inputString)
 {
 }
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="bot">The bot this transformer is a part of</param>
 public TextTransformer(ABPS.Aiml.Bot bot)
 {
     this.bot         = bot;
     this.inputString = string.Empty;
 }
 public StripIllegalCharacters(ABPS.Aiml.Bot bot)
     : base(bot)
 {
 }
 public StripIllegalCharacters(ABPS.Aiml.Bot bot, string inputString) : base(bot, inputString)
 {
 }
Example #13
0
 public MakeCaseInsensitive(ABPS.Aiml.Bot bot) : base(bot)
 {
 }
Example #14
0
 public MakeCaseInsensitive(ABPS.Aiml.Bot bot, string inputString) : base(bot, inputString)
 {
 }
 /// <summary>
 /// Default ctor for used as part of late binding mechanism
 /// </summary>
 public TextTransformer()
 {
     this.bot         = null;
     this.inputString = string.Empty;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot this sentence splitter is associated with</param>
 public SplitIntoSentences(ABPS.Aiml.Bot bot)
 {
     this.bot = bot;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot whose brain is being processed</param>
 public AIMLLoader(ABPS.Aiml.Bot bot)
 {
     this.bot = bot;
 }
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="bot">The bot this transformer is a part of</param>
 /// <param name="inputString">The input string to be transformed</param>
 public TextTransformer(ABPS.Aiml.Bot bot, string inputString)
 {
     this.bot         = bot;
     this.inputString = inputString;
 }