protected override string ProcessChange() { if (this.templateNode.Name.ToLower() == "gender") { if (this.templateNode.InnerText.Length > 0) { // non atomic version of the node return(KAIMLBot.Normalize.ApplySubstitutions.Substitute(this.bot, this.bot.GenderSubstitutions, this.templateNode.InnerText)); } else { // atomic version of the node XmlNode starNode = Utils.AIMLTagHandler.getNode("<star/>"); star recursiveStar = new star(this.bot, this.user, this.query, this.request, this.result, starNode); this.templateNode.InnerText = recursiveStar.Transform(); if (this.templateNode.InnerText.Length > 0) { return(this.ProcessChange()); } else { return(string.Empty); } } } return(string.Empty); }
protected override string ProcessChange() { if (this.templateNode.Name.ToLower() == "sentence") { if (this.templateNode.InnerText.Length > 0) { StringBuilder result = new StringBuilder(); char[] letters = this.templateNode.InnerText.Trim().ToCharArray(); bool doChange = true; for (int i = 0; i < letters.Length; i++) { string letterAsString = Convert.ToString(letters[i]); if (this.bot.Splitters.Contains(letterAsString)) { doChange = true; } Regex lowercaseLetter = new Regex("[a-zA-Z]"); if (lowercaseLetter.IsMatch(letterAsString)) { if (doChange) { result.Append(letterAsString.ToUpper(this.bot.Locale)); doChange = false; } else { result.Append(letterAsString.ToLower(this.bot.Locale)); } } else { result.Append(letterAsString); } } return(result.ToString()); } else { // atomic version of the node XmlNode starNode = Utils.AIMLTagHandler.getNode("<star/>"); star recursiveStar = new star(this.bot, this.user, this.query, this.request, this.result, starNode); this.templateNode.InnerText = recursiveStar.Transform(); if (this.templateNode.InnerText.Length > 0) { return(this.ProcessChange()); } else { return(string.Empty); } } } return(string.Empty); }
protected override string ProcessChange() { if (this.templateNode.Name.ToLower() == "sr") { XmlNode starNode = Utils.AIMLTagHandler.getNode("<star/>"); star recursiveStar = new star(this.bot, this.user, this.query, this.request, this.result, starNode); string starContent = recursiveStar.Transform(); XmlNode sraiNode = KAIMLBot.Utils.AIMLTagHandler.getNode("<srai>" + starContent + "</srai>"); srai sraiHandler = new srai(this.bot, this.user, this.query, this.request, this.result, sraiNode); return(sraiHandler.Transform()); } return(string.Empty); }