public Match Matches(string input, Hashtable vars, CSharpToolbox csToolbox) { Match match = new Match(); if (this.regex.IsMatch(input)) { //copy shortTermMemory vars to inputVars Hashtable inputVars = new Hashtable(); foreach (object key in vars.Keys) { inputVars[key] = vars[key]; } //captures the variables and adds them to the inputVars object this.CaptureVars(input, inputVars); if (csToolbox.ExecuteCondition(this.inputId, inputVars)) { double noise = InputRecognizer.random.NextDouble() * 0.0001; double usageBonus = (0.01 / (this.usageCount + 1)); //goes lower the more it's used double cf = 0; if (this.length == 0) //is this ever true? yes, when input is * { cf = usageBonus + noise + 0.0001; } else { cf = usageBonus + noise + (this.length / (double)input.Length); } match.InputRecognizer = this; match.Vars = inputVars; match.ConfidenceFactor = cf; } } //if(this.regex.IsMatch(input)) return(match); } //Matches(string input)
private void initializeCSToolbox() { this.csToolbox = new CSharpToolbox(); this.csToolbox.OnCompileError += new Conversive.DevBot5.CSharpToolbox.CompileError(csToolbox_OnCompileError); this.csToolbox.OnCompileWarning += new Conversive.DevBot5.CSharpToolbox.CompileWarning(csToolbox_OnCompileWarning); }