public void ClassifyCollection()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            NaturalLanguageClassifierService service = new NaturalLanguageClassifierService(authenticator);

            service.SetServiceUrl("{serviceUrl}");

            var collection = new List <ClassifyInput>()
            {
                new ClassifyInput()
                {
                    Text = "How hot will it be today?"
                },
                new ClassifyInput()
                {
                    Text = "Is it hot outside?"
                }
            };

            var result = service.ClassifyCollection(
                classifierId: "10D41B-nlc-1",
                collection: collection
                );

            Console.WriteLine(result.Response);
        }
        public void CreateClassifier()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            NaturalLanguageClassifierService service = new NaturalLanguageClassifierService(authenticator);

            service.SetServiceUrl("{serviceUrl}");

            DetailedResponse <Classifier> result = null;

            using (FileStream trainingDataFile = File.OpenRead("./train.csv"), metadataFile = File.OpenRead("./metadata.json"))
            {
                using (MemoryStream trainingData = new MemoryStream(), metadata = new MemoryStream())
                {
                    trainingDataFile.CopyTo(trainingData);
                    metadataFile.CopyTo(metadata);
                    result = service.CreateClassifier(
                        trainingMetadata: metadata,
                        trainingData: trainingData
                        );
                }
            }

            Console.WriteLine(result.Response);

            classifierId = result.Result.ClassifierId;
        }
        public void DeleteClassifier()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            NaturalLanguageClassifierService service = new NaturalLanguageClassifierService(authenticator);

            service.SetServiceUrl("{serviceUrl}");

            var result = service.DeleteClassifier(
                classifierId: "10D41B-nlc-1"
                );

            Console.WriteLine(result.Response);
        }
        public void Classify()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            NaturalLanguageClassifierService service = new NaturalLanguageClassifierService(authenticator);

            service.SetServiceUrl("{serviceUrl}");

            var result = service.Classify(
                classifierId: "10D41B-nlc-1",
                text: "How hot will it be today?"
                );

            Console.WriteLine(result.Response);
        }
        public void ListClassifiers()
        {
            IamAuthenticator authenticator = new IamAuthenticator(
                apikey: "{apikey}");

            NaturalLanguageClassifierService service = new NaturalLanguageClassifierService(authenticator);

            service.SetServiceUrl("{serviceUrl}");

            var result = service.ListClassifiers();

            Console.WriteLine(result.Response);

            if (result.Result.Classifiers != null && result.Result.Classifiers.Count > 0)
            {
                classifierId = result.Result.Classifiers[0].ClassifierId;
            }
        }
        private IEnumerator CreateService()
        {
            if (string.IsNullOrEmpty(iamApikey))
            {
                throw new IBMException("Please add IAM ApiKey to the Iam Apikey field in the inspector.");
            }

            IamAuthenticator authenticator = new IamAuthenticator(apikey: iamApikey);

            while (!authenticator.CanAuthenticate())
            {
                yield return(null);
            }

            service = new NaturalLanguageClassifierService(authenticator);
            if (!string.IsNullOrEmpty(serviceUrl))
            {
                service.SetServiceUrl(serviceUrl);
            }

            Runnable.Run(ExampleListClassifiers());
        }