use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifierIT method cListClassifiers.
/**
* Test list classifiers.
*/
@Test
public void cListClassifiers() {
ListClassifiersOptions listOptions = new ListClassifiersOptions.Builder().build();
final ClassifierList classifiers = service.listClassifiers(listOptions).execute();
assertNotNull(classifiers);
// #324: Classifiers may be empty, because of other tests interfering.
// The build should not fail here, because this is out of our control.
Assume.assumeFalse(classifiers.getClassifiers().isEmpty());
}
use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions in project java-sdk by watson-developer-cloud.
the class NaturalLanguageClassifier method listClassifiers.
/**
* List classifiers.
*
* Returns an empty array if no classifiers are available.
*
* @param listClassifiersOptions the {@link ListClassifiersOptions} containing the options for the call
* @return a {@link ServiceCall} with a response type of {@link ClassifierList}
*/
public ServiceCall<ClassifierList> listClassifiers(ListClassifiersOptions listClassifiersOptions) {
String[] pathSegments = { "v1/classifiers" };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
if (listClassifiersOptions != null) {
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ClassifierList.class));
}
use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions 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;
}
}
}
use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions in project java-sdk by watson-developer-cloud.
the class VisualRecognitionIT method testListClassifiers.
/**
* Test list all the classifiers.
*/
@Ignore
@Test
public void testListClassifiers() {
ListClassifiersOptions options = new ListClassifiersOptions.Builder().verbose(true).build();
List<Classifier> classifiers = service.listClassifiers(options).execute().getClassifiers();
assertNotNull(classifiers);
assertTrue(!classifiers.isEmpty());
Classifier classifier = classifiers.get(0);
assertNotNull(classifier.getClassifierId());
assertNotNull(classifier.getName());
assertNotNull(classifier.getOwner());
assertNotNull(classifier.getStatus());
assertNotNull(classifier.getClasses());
assertNotNull(classifier.getCreated());
}
use of com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ListClassifiersOptions in project java-sdk by watson-developer-cloud.
the class VisualRecognitionTest method testGetClassifiers.
/**
* Test get classifiers.
*
* @throws InterruptedException the interrupted exception
* @throws IOException Signals that an I/O exception has occurred.
*/
@Test
public void testGetClassifiers() throws InterruptedException, IOException {
Classifier mockClassifier = loadFixture(FIXTURE_CLASSIFIER, Classifier.class);
List<Classifier> classifiers = new ArrayList<Classifier>();
classifiers.add(mockClassifier);
classifiers.add(mockClassifier);
classifiers.add(mockClassifier);
JsonObject mockResponse = new JsonObject();
mockResponse.add("classifiers", new Gson().toJsonTree(classifiers));
server.enqueue(new MockResponse().setBody(mockResponse.toString()));
ListClassifiersOptions options = new ListClassifiersOptions.Builder().verbose(true).build();
List<Classifier> serviceResponse = service.listClassifiers(options).execute().getClassifiers();
// first request
RecordedRequest request = server.takeRequest();
String path = PATH_CLASSIFIERS + "?" + VERSION_DATE + "=2016-05-20&verbose=true&api_key=" + API_KEY;
assertEquals(path, request.getPath());
assertEquals("GET", request.getMethod());
assertEquals(serviceResponse, classifiers);
}
Aggregations