예제 #1
0
        public bool Match(AliceRequest request, Matching matching, FillingData fillingData, ConcurrentDictionary <string, SuperHeroDaySession> concurrentDictionary)
        {
            var heroContext = fillingData.FillingHeroContext();

            var prepositional = heroContext.Select(x => x.Prepositional).ToArray();

            var otherCases = heroContext.Select(x => x.OtherCases).ToArray();

            foreach (var i in heroContext)
            {
                if (matching.ContainOneOf(request.Request.Command, i.Prepositional))
                {
                    SuperHeroDaySession tempHero = concurrentDictionary[request.Session.SessionId];
                    tempHero.Hero = i.Id;
                    concurrentDictionary.TryUpdate(request.Session.SessionId, tempHero, concurrentDictionary[request.Session.SessionId]);
                    return(true);
                }
            }
            foreach (var i in heroContext)
            {
                if (matching.ContainOneOf(request.Request.Command, i.OtherCases))
                {
                    SuperHeroDaySession tempHero = concurrentDictionary[request.Session.SessionId];
                    tempHero.Hero = i.Id;
                    concurrentDictionary.TryUpdate(request.Session.SessionId, tempHero, concurrentDictionary[request.Session.SessionId]);
                    return(true);
                }
            }
            SuperHeroDaySession isNullHero = concurrentDictionary[request.Session.SessionId];

            return(isNullHero.Hero != 0);
        }
예제 #2
0
        public AnswerManagement Match(string request, Matching matching, FillingData fillingData)
        {
            var activationWords = fillingData.FillingManagement().Where(manag => manag.IsEnd == true).ToList();

            foreach (var i in activationWords)
            {
                if (matching.ContainOneOf(request, i.WordsActivators))
                {
                    return(i.Answers);
                }
            }
            return(null);
        }
예제 #3
0
        public bool Match(AliceRequest request, Matching matching, FillingData fillingData, ConcurrentDictionary <string, SuperHeroDaySession> concurrentDictionary)
        {
            var dialogueContext = fillingData.FillingDialogueContext();

            foreach (var i in dialogueContext)
            {
                if (matching.ContainOneOf(request.Request.Command, i.WordsIsContext))
                {
                    SuperHeroDaySession temp = concurrentDictionary[request.Session.SessionId];
                    temp.Context = i.Title;
                    concurrentDictionary.TryUpdate(request.Session.SessionId, temp, concurrentDictionary[request.Session.SessionId]);
                    return(true);
                }
            }
            return(false);
        }