public void ParseScenarioSettings(List <ScenarioSetting> kgSettings, List <Vertex> rootVertexes) { Dictionary <string, ScenarioSetting> scenarioCache = new Dictionary <string, ScenarioSetting>(); if (kgSettings != null && kgSettings.Count > 0) { foreach (ScenarioSetting setting in kgSettings) { scenarioCache.Add(setting.scenarioName, setting); } } foreach (Vertex vertex in rootVertexes) { if (vertex.nodeType == "ROOT" && vertex.scenarios != null) { foreach (string scenarioName in vertex.scenarios) { if (scenarioCache.ContainsKey(scenarioName)) { scenarioCache[scenarioName].root = vertex; } else { ScenarioSetting defaultSetting = new ScenarioSetting(scenarioName, vertex); scenarioCache.Add(scenarioName, defaultSetting); } } } } NLUStore.GetInstance().SetSceanrioCache(scenarioCache); }
public void Load(string dsName) { KnowledgeGraphStore.GetInstance().Clean(); NLUStore.GetInstance().Clean(); this.currentDataStoreName = dsName; (this.vList, this.eList, this.vcList, this.iList, this.enList, this.eaList) = this.dataAccessor.Load(dsName); if (this.vcList == null || this.vList == null || this.eList == null) { throw new Exception("Cannot load KG data from persistance."); } DataPersistanceKGParser kgParser = new DataPersistanceKGParser(this.vList, this.eList, this.vcList); kgParser.ParseKG(); log.Information("Knowledge Graph is parsed."); Console.WriteLine("Knowledge Graph is parsed."); if (this.iList == null || this.enList == null) { log.Here().Warning("No NLU Data loaded from persistence"); } else { DataPersistanceNLUParser nluParser = new DataPersistanceNLUParser(this.iList, this.enList, this.eaList); nluParser.Parse(); List <Vertex> roots = KnowledgeGraphStore.GetInstance().GetAllVertexes(); nluParser.ParseScenarioSettings(this.settings, roots); log.Information("NLU materials is parsed."); Console.WriteLine("NLU materials is parsed."); } }