private async Task <DeviceCommand> CallLuisAsync(string input)
        {
            var parsedMessage = await luisClient.parseInput(input);

            CommandBase command;

            switch (parsedMessage.topScoringIntent.intent)
            {
            case "Count":
                command = new CountCommand(parsedMessage.entities);
                break;

            case "Location":
                command = new LocationCommand(parsedMessage.entities);
                break;

            case "Calculation":
                command = new CalculationCommand(parsedMessage.entities);
                break;

            case "Timer":
                command = new TimerCommand(parsedMessage.entities);
                break;

            default:
                command = new NoneCommand();
                break;
            }

            return(await command.Run());
        }
Beispiel #2
0
        /// <inheritdoc />
        public double Solve(CalculationCommand command)
        {
            IBinaryCalculation calculator = _strategies
                                            .FirstOrDefault(x => x.Operation == command.Operation);

            if (calculator == null)
            {
                throw new ArgumentException($"No strategy found for operator {command.Operation}");
            }
            return(calculator.Apply(command.LeftOperand, command.RightOperand));
        }
Beispiel #3
0
 public IntersectionPart GetIntersectionWith(IFeature other)
 {
     return(CalculationCommand.Execute(other));
 }
Beispiel #4
0
 public double Solve([FromUri] CalculationCommand command)
 => _calculator.Solve(command);