public virtual bool ParseIntent(Context context, DateTime time, string input) { var intent = NLUEngine.GetIntent(input); if (Controller.DebugEnabled) { DebugIntent(intent); } if (intent.Top.Score < 0.8) { return(false); } else { if (Intents.ContainsKey(intent.Top.Label)) { DispatchIntent(intent, Intents[intent.Top.Label]); } else { SayErrorLine("This package recognizes intent {0} but does not have handler for it.", intent.Top.Label); DebugIntent(intent); } return(true); } }
public Package(string name, NLUEngine engine, Controller controller, CancellationToken ct, params Package[] subPackages) : base(ct) { Name = name; NLUEngine = engine; Controller = controller; Intents.Add("info", Info); Intents.Add("help", Help); Intents.Add("menu", Menu); Intents.Add("enable", Enable); Intents.Add("disable", Disable); Intents.Add("back", Back); Intents.Add("page", Page); Intents.Add("list", List); if (subPackages != null && subPackages.Length > 0) { SubPackages = subPackages.ToList(); } foreach (var vn in VariableNames) { Variables.Add(Prefixed(vn), null); } foreach (var i in ItemNames) { Items.Add(Prefixed(i), null); } foreach (var m in MenuNames) { Menus.Add(Prefixed(m), null); } }
public Package(string name, NLUEngine engine, Controller controller, params Package[] subPackages) : this(name, engine, controller, Ct, subPackages) { }