Exemplo n.º 1
0
        public EEContext Understand(string userId, string userInput)
        {
            EEContext context = cStore.GetContext(userId);

            if ((context == null) || (!IsValid(context)))
            {
                log.Info("No valid EEContxt exists. Create new EEContext.");
                LUInfo luinfo = this.Parse(userInput);

                context = CreateContext(userId, luinfo);
                cStore.SetContext(userId, context);
            }
            else
            {
                log.Info("EEContxt exists. \r\n" + JsonConvert.SerializeObject(context));
                MergeContext(userId, userInput, ref context);
                cStore.SetContext(userId, context);
            }

            return(context);
        }