/// <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 result = target;//MakeCaseInsensitive.TransformInput(target); foreach (string pattern in dictionary.SettingNames) { string p2 = ApplySubstitutions.makeRegexSafe(pattern); //string match = "\\b" + @p2.Trim() + "\\b"; string match = @p2; string replacement = dictionary.grabSetting(pattern); if (replacement.StartsWith(" ")) { replacement = " ||" + replacement.TrimStart(); } else { replacement = "||" + replacement; } if (replacement.EndsWith(" ")) { replacement = replacement.TrimEnd() + "|| "; } else { replacement = replacement + "||"; } result = Regex.Replace(result, match, replacement, RegexOptions.IgnoreCase); } return result.Replace("||", ""); }
/// <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 srai(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) { }
//private int cnt = 0; public METAbrain(METAboltInstance instance, AIMLbot.Bot myBot) { this.instance = instance; //client = this.instance.Client; netcom = this.instance.Netcom; this.myBot = myBot; answer = new mBrain(); }
/// <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 random(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; }
/// <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"); } }
/// <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, ""); }
/// <summary> /// Ctor /// </summary> /// <param name="bot">The bot for whom this is a settings dictionary</param> public SettingsDictionary(AIMLbot.Bot bot) { this.bot = bot; }
public ApplySubstitutions(AIMLbot.Bot bot) : base(bot) { }
public ApplySubstitutions(AIMLbot.Bot bot, string inputString) : base(bot, inputString) { }
public mockTextTransformer(AIMLbot.Bot bot, string inputString) : base(bot, inputString) { }
public MakeCaseInsensitive(AIMLbot.Bot bot, string inputString) : base(bot, inputString) { }
public StripIllegalCharacters(AIMLbot.Bot bot) : base(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(AIMLbot.Bot bot, string inputString) { this.bot = bot; this.inputString = inputString; }
public StripIllegalCharacters(AIMLbot.Bot bot, string inputString) : base(bot, inputString) { }
/// <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; }
/// <summary> /// Ctor /// </summary> /// <param name="bot">The bot whose brain is being processed</param> public AIMLLoader(AIMLbot.Bot bot) { this.bot = bot; }
public MakeCaseInsensitive(AIMLbot.Bot bot) : base(bot) { }
/// <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; }
public mockTextTransformer(AIMLbot.Bot bot) : base(bot) { }