public virtual bool ParseIntent(CUIContext context, DateTime time, string input) { var intent = NLUEngine.GetIntent(input); if (Controller.DebugEnabled) { DebugIntent(intent); } if (!intent.IsNone && intent.Top.Label == "menu" && intent.Top.Score > 0.7) { Menu(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 CUIPackage(string name, NLUEngine engine, CUIController controller, CancellationToken ct, params CUIPackage[] subPackages) : base(ct) { Name = name; NLUEngine = engine; Controller = controller; Intents.Add("help", Help); Intents.Add("menu", Menu); 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); ItemsPageSize.Add(Prefixed(i), 10); ItemsCurrentPage.Add(Prefixed(i), 1); ItemsSelection.Add(Prefixed(i), -1); ItemsDescriptionHandlers.Add(Prefixed(i), null); } foreach (var m in MenuNames) { MenuHandlers.Add(Prefixed(m), null); MenuIndexes.Add(Prefixed(m), 0); } }
public CUIPackage(string name, NLUEngine engine, CUIController controller, params CUIPackage[] subPackages) : this(name, engine, controller, Ct, subPackages) { }