Exemplo n.º 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 uppercase(AIMLBot.Bot bot,
                  AIMLBot.User user,
                  AIMLBot.Utils.SubQuery query,
                  AIMLBot.Request request,
                  AIMLBot.Result result,
                  XmlNode templateNode)
     : base(bot, user, query, request, result, templateNode)
 {
 }
Exemplo n.º 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(AIMLBot.Bot bot,
                  AIMLBot.User user,
                  AIMLBot.Utils.SubQuery query,
                  AIMLBot.Request request,
                  AIMLBot.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(AIMLBot.Bot bot,
                       AIMLBot.User user,
                       AIMLBot.Utils.SubQuery query,
                       AIMLBot.Request request,
                       AIMLBot.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");
 }
Exemplo n.º 4
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, AIMLBot.Bot bot)
 {
     if (UserID.Length > 0)
     {
         this.id         = UserID;
         this.bot        = bot;
         this.Predicates = new AIMLBot.Utils.SettingsDictionary(this.bot);
         this.bot.DefaultPredicates.Clone(this.Predicates);
         this.Predicates.AddSetting("topic", "*");
     }
     else
     {
         throw new Exception("The UserID cannot be empty");
     }
 }
Exemplo n.º 5
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(AIMLBot.Bot bot, AIMLBot.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, ""));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see>Galatea.ChatBots.Alice</see> class.
        /// </summary>
        public Alice(Galatea.AI.Abstract.IUser user, string chatbotName, string chatbotAliceConfigFolder, string chatbotResourcesFolder) : base(chatbotName)
        {
            userName = user.Name;
            aimlBot  = new AIMLBot.Bot();

            // Validate Folders
            ValidateFolders(chatbotAliceConfigFolder, chatbotResourcesFolder);

            // Initialize AIMLBot2.5 Properties
            aimlBot.LoadSettings(chatbotAliceConfigFolder);
            aimlBot.PathToAIML = Path.Combine(chatbotResourcesFolder, "alice");

            aimlBot.LoadAIMLFromFiles();
            aimlBot.DefaultPredicates.UpdateSetting("name", userName);

            // Initialize Chat runtime
            aimlUser = new AIMLBot.User(userName, aimlBot);
        }
 public MakeCaseInsensitive(AIMLBot.Bot bot, string inputString) : base(bot, inputString)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot for whom this is a settings dictionary</param>
 public SettingsDictionary(AIMLBot.Bot bot)
 {
     this.bot = bot;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot this sentence splitter is associated with</param>
 public SplitIntoSentences(AIMLBot.Bot bot)
 {
     this.bot = bot;
 }
 /// <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(AIMLBot.Bot bot, string inputString)
 {
     this.bot         = bot;
     this.inputString = inputString;
 }
Exemplo n.º 11
0
 public ApplySubstitutions(AIMLBot.Bot bot, string inputString)
     : base(bot, inputString)
 {
 }
Exemplo n.º 12
0
 /// <summary>
 /// Default ctor for used as part of late binding mechanism
 /// </summary>
 public TextTransformer()
 {
     this.bot         = null;
     this.inputString = string.Empty;
 }
Exemplo n.º 13
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="bot">The bot this transformer is a part of</param>
 public TextTransformer(AIMLBot.Bot bot)
 {
     this.bot         = bot;
     this.inputString = string.Empty;
 }
Exemplo n.º 14
0
 /// <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(AIMLBot.Bot bot, string inputString)
 {
     this.bot         = bot;
     this.inputString = inputString;
 }
 public MakeCaseInsensitive(AIMLBot.Bot bot) : base(bot)
 {
 }
Exemplo n.º 16
0
 public ApplySubstitutions(AIMLBot.Bot bot)
     : base(bot)
 {
 }
Exemplo n.º 17
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="bot">The bot whose brain is being processed</param>
 public AIMLLoader(AIMLBot.Bot bot)
 {
     this.bot = bot;
 }
Exemplo n.º 18
0
 public StripIllegalCharacters(AIMLBot.Bot bot)
     : base(bot)
 {
 }
Exemplo n.º 19
0
 public StripIllegalCharacters(AIMLBot.Bot bot, string inputString) : base(bot, inputString)
 {
 }