protected CompiledKnowledgeBase(SerializationInfo info, StreamingContext context) { this.synonyms = (Dictionary <string, Synonym>)info.GetValue("s", typeof(Dictionary <string, Synonym>)); this.replacements = (List <Replacement>)info.GetValue("r", typeof(List <Replacement>)); this.inputs = (Dictionary <string, List <InputRecognizer> >)info.GetValue("i", typeof(Dictionary <string, List <InputRecognizer> >)); this.outputs = (Dictionary <string, List <Output> >)info.GetValue("o", typeof(Dictionary <string, List <Output> >)); this.knowledgeBaseItem = (KnowledgeBaseItem)info.GetValue("k", typeof(KnowledgeBaseItem)); this.knowledgeBaseInfo = (KnowledgeBaseInfo)info.GetValue("kbi", typeof(KnowledgeBaseInfo)); this.build = info.GetInt32("b"); this.random = new Random(); this.recentOutputsByRule = new Dictionary <string, List <string> >(); //use a try/catch block around any new vales try { this.inputReplacements = (List <InputReplacement>)info.GetValue("ir", typeof(List <InputReplacement>)); } catch { this.inputReplacements = new List <InputReplacement>(); } this.initializeCSToolbox(); try { this.csToolbox.CodeModules = (List <CodeModule>)info.GetValue("cm", typeof(List <CodeModule>)); } catch { this.csToolbox.CodeModules = new List <CodeModule>(); } }
public KnowledgeBase() { this.Rules = new List <Rule>(); this.ResourceFiles = new List <ResourceFile>(); this.version = "1.0"; this.build = 0; this.Changed = false; this.Info = new KnowledgeBaseInfo(); }
public KnowledgeBaseItem() { this.Filename = ""; this.Fullpath = ""; this.Used = false; this.Trusted = false; this.Build = -1; this.Info = null; }
protected KnowledgeBaseItem(SerializationInfo info, StreamingContext context) { this.Filename = info.GetString("fn"); this.Fullpath = info.GetString("fp"); this.Used = info.GetBoolean("u"); this.Trusted = info.GetBoolean("t"); this.Build = info.GetInt32("b"); this.Info = null; //use a try/catch block around any new vales }
public CompiledKnowledgeBase() { this.synonyms = new Dictionary<string,Synonym>(); this.replacements = new List<Replacement>(); this.inputReplacements = new List<InputReplacement>(); this.inputs = new Dictionary<string,List<InputRecognizer>>(); this.outputs = new Dictionary<string,List<Output>>(); this.knowledgeBaseItem = new KnowledgeBaseItem(); this.knowledgeBaseInfo = new KnowledgeBaseInfo(); this.build = -1; this.Name = ""; this.random = new Random(); this.recentOutputsByRule = new Dictionary<string,List<string>>(); this.initializeCSToolbox(); }
public CompiledKnowledgeBase() { this.synonyms = new Dictionary <string, Synonym>(); this.replacements = new List <Replacement>(); this.inputReplacements = new List <InputReplacement>(); this.inputs = new Dictionary <string, List <InputRecognizer> >(); this.outputs = new Dictionary <string, List <Output> >(); this.knowledgeBaseItem = new KnowledgeBaseItem(); this.knowledgeBaseInfo = new KnowledgeBaseInfo(); this.build = -1; this.Name = ""; this.random = new Random(); this.recentOutputsByRule = new Dictionary <string, List <string> >(); this.initializeCSToolbox(); }
public void LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem) { this.knowledgeBaseItem = knowledgeBaseItem; this.knowledgeBaseInfo = kb.Info; this.LoadResourceFiles(kb.ResourceFiles); KnowledgeBase decompressedKB = kb.DecompressTemplates(knowledgeBaseItem.Fullpath); if (decompressedKB != null) { this.compileRules("_root", decompressedKB.Rules); } else { this.compileRules("_root", kb.Rules); } this.csToolbox.Compile(); }
public KnowledgeBase() { this.Rules = new List<Rule>(); this.ResourceFiles = new List<ResourceFile>(); this.version = "1.0"; this.build = 0; this.Changed = false; this.Info = new KnowledgeBaseInfo(); }
protected CompiledKnowledgeBase(SerializationInfo info, StreamingContext context) { this.synonyms = (Dictionary<string, Synonym>)info.GetValue("s", typeof(Dictionary<string, Synonym>)); this.replacements = (List<Replacement>)info.GetValue("r", typeof(List<Replacement>)); this.inputs = (Dictionary<string, List<InputRecognizer>>)info.GetValue("i", typeof(Dictionary<string, List<InputRecognizer>>)); this.outputs = (Dictionary<string, List<Output>>)info.GetValue("o", typeof(Dictionary<string, List<Output>>)); this.knowledgeBaseItem = (KnowledgeBaseItem)info.GetValue("k", typeof(KnowledgeBaseItem)); this.knowledgeBaseInfo = (KnowledgeBaseInfo)info.GetValue("kbi", typeof(KnowledgeBaseInfo)); this.build = info.GetInt32("b"); this.random = new Random(); this.recentOutputsByRule = new Dictionary<string, List<string>>(); //use a try/catch block around any new vales try { this.inputReplacements = (List<InputReplacement>)info.GetValue("ir", typeof(List<InputReplacement>)); } catch { this.inputReplacements = new List<InputReplacement>(); } this.initializeCSToolbox(); try { this.csToolbox.CodeModules = (List<CodeModule>)info.GetValue("cm", typeof(List<CodeModule>)); } catch { this.csToolbox.CodeModules = new List<CodeModule>(); } }
public void LoadKnowledgeBase(KnowledgeBase kb, KnowledgeBaseItem knowledgeBaseItem) { this.knowledgeBaseItem = knowledgeBaseItem; this.knowledgeBaseInfo = kb.Info; this.LoadResourceFiles(kb.ResourceFiles); KnowledgeBase decompressedKB = kb.DecompressTemplates(knowledgeBaseItem.Fullpath); if(decompressedKB != null) this.compileRules("_root", decompressedKB.Rules); else this.compileRules("_root", kb.Rules); this.csToolbox.Compile(); }