public override bool CallRescue(Coderack coderack, IParsedPhrase input, PatternTemplateSource patternTemplateSource, string reason, IContinuation skip, IContinuation succ, IFailure fail) { List <string> words = GroupPhrase.PhraseToTexts(input); bool changed = false; List <string> corrected = new List <string>(); foreach (string word in words) { string correct = comparer.GetCorrects(word)[0]; if (correct.ToLower() != word.ToLower()) { changed = true; } corrected.Add(correct); } if (changed) { IParsedPhrase correct = parser.Parse(StringUtilities.JoinWords(corrected)); IFailure fallfail = fallback.MakeFailure(input, patternTemplateSource, succ, fail, coderack); patternTemplateSource.Generate(coderack, correct, succ, fallfail, weight); return(true); } else { return(fallback.CallRescue(coderack, input, patternTemplateSource, reason, skip, succ, fail)); } }
bool FailToTryToRescue(IArena arena, double salience, string reason, IContinuation skip, params object[] args) { TryToRescueMatch tryToRescueMatch = (TryToRescueMatch)args[0]; IParsedPhrase input = (IParsedPhrase)args[1]; PatternTemplateSource patternTemplateSource = (PatternTemplateSource)args[2]; IContinuation succ = (IContinuation)args[3]; IFailure fail = (IFailure)args[4]; Coderack coderack = (Coderack)args[5]; return(tryToRescueMatch.CallRescue(coderack, input, patternTemplateSource, reason, skip, succ, fail)); }