コード例 #1
0
        public void ListCustomPrebuiltEntities()
        {
            UseClientFor(async client =>
            {
                var testAppId = await client.Apps.AddAsync(new ApplicationCreateObject
                {
                    Name          = "New LUIS App",
                    Description   = "New LUIS App",
                    Culture       = "en-us",
                    Domain        = "Comics",
                    UsageScenario = "IoT"
                });
                var versionsApp    = await client.Versions.ListAsync(testAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Communication"
                };

                var results          = await client.Model.AddCustomPrebuiltDomainAsync(testAppId, version, prebuiltDomain);
                var prebuiltEntities = await client.Model.ListCustomPrebuiltEntitiesAsync(testAppId, version);
                await client.Model.DeleteCustomPrebuiltDomainAsync(testAppId, version, "Communication");
                await client.Apps.DeleteAsync(testAppId);

                Assert.Contains(prebuiltEntities, entity => entity.CustomPrebuiltDomainName == prebuiltDomain.DomainName);
            });
        }
コード例 #2
0
        public void ListCustomPrebuiltModels()
        {
            UseClientFor(async client =>
            {
                var testAppId = await client.Apps.AddAsync(new ApplicationCreateObject
                {
                    Name          = "New LUIS App",
                    Description   = "New LUIS App",
                    Culture       = "en-us",
                    Domain        = "Comics",
                    UsageScenario = "IoT"
                });
                var versionsApp    = await client.Versions.ListAsync(testAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Calendar"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(testAppId, version, prebuiltDomain);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(testAppId, version);
                await client.Model.DeleteCustomPrebuiltDomainAsync(testAppId, version, "Communication");
                await client.Apps.DeleteAsync(testAppId);

                var validTypes = new string[] { "Intent Classifier", "Closed List Entity Extractor", "Entity Extractor" };

                Assert.True(prebuiltModels.All(m => validTypes.Contains(m.ReadableType)));
            });
        }
コード例 #3
0
        public void AddCustomPrebuiltDomain()
        {
            UseClientFor(async client =>
            {
                var testAppId = await client.Apps.AddAsync(new ApplicationCreateObject
                {
                    Name          = "New LUIS App",
                    Description   = "New LUIS App",
                    Culture       = "en-us",
                    Domain        = "Comics",
                    UsageScenario = "IoT"
                });
                var versionsApp         = await client.Versions.ListAsync(testAppId);
                var version             = versionsApp.FirstOrDefault().Version;
                var prebuiltDomainToAdd = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Communication"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(testAppId, version, prebuiltDomainToAdd);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(testAppId, version);
                await client.Model.DeleteCustomPrebuiltDomainAsync(testAppId, version, "Communication");
                await client.Apps.DeleteAsync(testAppId);

                foreach (var result in prebuiltModels)
                {
                    Assert.Contains(results, m => m == result.Id);
                }
            });
        }
コード例 #4
0
        public void ListCustomPrebuiltIntents()
        {
            UseClientFor(async client =>
            {
                var versionsApp    = await client.Versions.ListAsync(GlobalAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Gaming"
                };

                var results         = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain);
                var prebuiltIntents = await client.Model.ListCustomPrebuiltIntentsAsync(GlobalAppId, version);

                Assert.Contains(prebuiltIntents, entity => entity.CustomPrebuiltDomainName == prebuiltDomain.DomainName);
            });
        }
コード例 #5
0
        public void ListCustomPrebuiltModels()
        {
            UseClientFor(async client =>
            {
                var versionsApp    = await client.Versions.ListAsync(GlobalAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Calendar"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                var validTypes = new string[] { "Intent Classifier", "Entity Extractor" };

                Assert.True(prebuiltModels.All(m => validTypes.Contains(m.ReadableType)));
            });
        }
コード例 #6
0
        public void AddCustomPrebuiltDomain()
        {
            UseClientFor(async client =>
            {
                var versionsApp         = await client.Versions.ListAsync(GlobalAppId);
                var version             = versionsApp.FirstOrDefault().Version;
                var prebuiltDomainToAdd = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Gaming"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomainToAdd);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                foreach (var result in results)
                {
                    Assert.True(result != Guid.Empty);
                    Assert.Contains(prebuiltModels, m => m.Id.Equals(result));
                }
            });
        }
コード例 #7
0
        public void DeleteCustomPrebuiltDomain()
        {
            UseClientFor(async client =>
            {
                var versionsApp    = await client.Versions.ListAsync(GlobalAppId);
                var version        = versionsApp.FirstOrDefault().Version;
                var prebuiltDomain = new PrebuiltDomainCreateBaseObject
                {
                    DomainName = "Gaming"
                };

                var results        = await client.Model.AddCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain);
                var prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                Assert.Contains(prebuiltModels, o => o.CustomPrebuiltDomainName == "Gaming");

                await client.Model.DeleteCustomPrebuiltDomainAsync(GlobalAppId, version, prebuiltDomain.DomainName);

                prebuiltModels = await client.Model.ListCustomPrebuiltModelsAsync(GlobalAppId, version);

                Assert.DoesNotContain(prebuiltModels, o => o.CustomPrebuiltDomainName == "Gaming");
            });
        }