use of com.ibm.watson.visual_recognition.v3.model.Classifier in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifierIT method eDelete.
/**
* Test delete classifier. Do not delete the pre created classifier. We need it for classify
*/
@Test
public void eDelete() {
List<Classifier> classifiers = service.listClassifiers().execute().getClassifiers();
for (Classifier classifier : classifiers) {
if (!classifier.getClassifierId().equals(preCreatedClassifierId)) {
DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder().classifierId(classifier.getClassifierId()).build();
service.deleteClassifier(deleteOptions).execute();
}
}
}
use of com.ibm.watson.visual_recognition.v3.model.Classifier in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifierIT method bGetClassifier.
/**
* Test get classifier.
*/
@Test
public void bGetClassifier() {
final Classifier classifier;
try {
GetClassifierOptions getOptions = new GetClassifierOptions.Builder().classifierId(classifierId).build();
classifier = service.getClassifier(getOptions).execute();
} catch (NotFoundException e) {
// The build should not fail here, because this is out of our control.
throw new AssumptionViolatedException(e.getMessage(), e);
}
assertNotNull(classifier);
assertEquals(classifierId, classifier.getClassifierId());
assertEquals(Classifier.Status.TRAINING, classifier.getStatus());
}
use of com.ibm.watson.visual_recognition.v3.model.Classifier in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifierTest method testGetClassifier.
/**
* Test get classifier.
*
* @throws InterruptedException the interrupted exception
*/
@Test
public void testGetClassifier() throws InterruptedException {
server.enqueue(jsonResponse(classifier));
GetClassifierOptions getOptions = new GetClassifierOptions.Builder().classifierId(classifierId).build();
final Classifier response = service.getClassifier(getOptions).execute();
final RecordedRequest request = server.takeRequest();
assertEquals(CLASSIFIERS_PATH + "/" + classifierId, request.getPath());
assertEquals(classifier, response);
}
use of com.ibm.watson.visual_recognition.v3.model.Classifier in project java-sdk by watson-developer-cloud.
the class VisualRecognitionIT method testDeleteAllClassifiers.
/**
* Delete all the visual classifiers.
*/
@Test
@Ignore
public void testDeleteAllClassifiers() {
List<Classifier> classifiers = service.listClassifiers(null).execute().getClassifiers();
for (Classifier classifier : classifiers) {
if (!classifier.getClassifierId().equals(classifierId)) {
DeleteClassifierOptions deleteOptions = new DeleteClassifierOptions.Builder(classifier.getClassifierId()).build();
service.deleteClassifier(deleteOptions).execute();
}
}
}
use of com.ibm.watson.visual_recognition.v3.model.Classifier in project java-sdk by watson-developer-cloud.
the class VisualRecognitionIT method testGetCoreMlModel.
/**
* Test getting the Core ML file for a classifier.
*/
@Ignore
@Test
public void testGetCoreMlModel() {
ListClassifiersOptions options = new ListClassifiersOptions.Builder().verbose(true).build();
List<Classifier> classifiers = service.listClassifiers(options).execute().getClassifiers();
for (Classifier classifier : classifiers) {
if (classifier.isCoreMlEnabled()) {
GetCoreMlModelOptions getCoreMlModelOptions = new GetCoreMlModelOptions.Builder().classifierId(classifier.getClassifierId()).build();
InputStream coreMlFile = service.getCoreMlModel(getCoreMlModelOptions).execute();
assertNotNull(coreMlFile);
break;
}
}
}
Aggregations