예제 #1
0
        public async Task Execute_ReturnsNonEmptyRecognitionResult_WhenGivenValidIntent()
        {
            var testEntities = new List <LuisEntity>
            {
                new LuisEntity {
                    Name = "", Type = "", Score = 0
                }
            };

            var settingsMock = new Mock <ISettings>();

            settingsMock.Setup(x => x.TranslateApiKey).Returns("key");

            var translateIntentMock = new Mock <ITranslateIntent>();

            translateIntentMock.Setup(x => x.Execute(testEntities))
            .Returns(Task.FromResult(new RecognitionResult
            {
                Message = "translated text"
            }));

            var homeAutomationMock = new Mock <IHomeAutomationIntent>();

            var nonIntentMock = new Mock <INonIntent>();

            var intentService = new IntentService(translateIntentMock.Object, nonIntentMock.Object, homeAutomationMock.Object);

            var result = await intentService.Execute("Translate", testEntities);

            Assert.IsNotNull(result);
            Assert.AreNotEqual(result.Message, string.Empty);
        }
예제 #2
0
 /// <param name="subscriptionKey">LUIS Authoring Key</param>
 /// <param name="region">Regions currently available in West US, West Europe and Australia East".</param>
 public LuisProgClient(string subscriptionKey, Regions region)
 {
     Apps       = new AppService(subscriptionKey, region);
     Entities   = new EntityService(subscriptionKey, region);
     Examples   = new ExampleService(subscriptionKey, region);
     Intents    = new IntentService(subscriptionKey, region);
     Publishing = new PublishService(subscriptionKey, region);
     Versions   = new VersionService(subscriptionKey, region);
     Training   = new TrainingService(subscriptionKey, region);
 }
예제 #3
0
        public JsonResult Delete(int id)
        {
            IntentService intentService = new IntentService();

            intentService.Delete(id);
            return(Json(new ResponseMessage()
            {
                Message = "Đã tạo thành công", Success = true
            }));
        }
예제 #4
0
파일: Program.cs 프로젝트: mihaistancu/T4
        private static void Translate()
        {
            var translation = GoogleTranslateService.Translate("vegetable", "de");

            System.Console.WriteLine(translation);

            var intent = IntentService.GetIntent("schedule a meeting with Mary on Saturday");

            System.Console.WriteLine(intent.TopScoringIntent.Name);
        }
예제 #5
0
파일: Client.cs 프로젝트: KonH/BattlerGame
        public Client AddServerApiService()
        {
            var env = new EnvironmentService {
                IsDebugMode = true
            };
            var users    = new InMemoryUserRepository();
            var states   = new InMemoryGameStateRepository();
            var register = new GameLogics.Server.Service.RegisterService(users);
            var config   = new FileConfigRepository(Convert, "Config.json");
            var auth     = new GameLogics.Server.Service.AuthService(Logger, new MockTokenService(), Time, users, states, config, new StateInitService());
            var intent   = new IntentService(env, Logger, Time, users, states, config);

            Api = new ConvertedServerApiService(Convert, Logger, new TerminateErrorHandleStrategy(Logger), register, auth, intent);

            AddCommon();

            return(this);
        }
예제 #6
0
        public JsonResult Update(int id, string name, int[] patterns, int[] groups)
        {
            IntentService service = new IntentService();

            try
            {
                service.Update(id, name, patterns, groups);
                return(Json(new ResponseMessage()
                {
                    Message = "Đã tạo thành công", Success = true
                }));
            }
            catch (Exception e)
            {
                return(Json(new ResponseMessage()
                {
                    Message = "Đã có lỗi xảy ra", Success = false
                }));
            }
        }
        public ActionResult Intents()
        {
            var intents = new IntentService().GetAll();

            return(View(intents));
        }
예제 #8
0
 protected void IsInvalidOnServer(TCommand cmd)
 {
     Assert.False(IntentService.IsValidAsFirstCommand(cmd));
 }
예제 #9
0
        public ActionResult Edit(int id)
        {
            var intent = new IntentService().GetEditViewModel(id);

            return(PartialView(intent));
        }
예제 #10
0
 /// <summary>
 /// Creates new instance of this class.
 /// </summary>
 /// <param name="logService">Logging intent service.</param>
 public AndroidLogMethod(IntentService logService)
 {
     this.logService = logService;
 }
 public IntentController()
 {
     intentService = new IntentService();
 }
예제 #12
0
 public UtteranceController()
 {
     intentService = new IntentService();
 }
        public ActionResult Create()
        {
            var intents = new IntentService().GetAllForCreatingDialog();

            return(PartialView(intents));
        }