0

I'm trying to invoke the deleteClassifier() method in the Natural Language Classifier service in IBM Watson platform, the operation completes but does not delete the classifier. Here's my code and the output:

Code:

NaturalLanguageClassifier service = new NaturalLanguageClassifier();
service.setUsernameAndPassword("xxxxxxx", "yyyyyyy");

System.out.println("Before deleting: ");
Classifier classifier;
classifier = service.getClassifier("90e7acx197-nlc-38920").execute();
System.out.println(classifier);

service.deleteClassifier("90e7acx197-nlc-38920");

System.out.println("After deleting: ");
classifier = service.getClassifier("90e7acx197-nlc-38920").execute();
System.out.println(classifier);

Output:

Before deleting:

Apr 18, 2017 7:16:08 PM okhttp3.internal.platform.Platform log
INFO: --> GET https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/90e7acx197-nlc-38920 http/1.1
Apr 18, 2017 7:16:08 PM okhttp3.internal.platform.Platform log
INFO: <-- 200 OK https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/90e7acx197-nlc-38920 (167ms, unknown-length body)

{
  "classifier_id": "90e7acx197-nlc-38920",
  "language": "en",
  "name": "TutorialClassifier",
  "status": "Available",
  "created": "2017-04-18T01:26:14.630",
  "status_description": "The classifier instance is now available and is ready to take classifier requests.",
  "url": "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/90e7acx197-nlc-38920"
}

After deleting:

Apr 18, 2017 7:16:08 PM okhttp3.internal.platform.Platform log
INFO: --> GET https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/90e7acx197-nlc-38920 http/1.1
Apr 18, 2017 7:16:09 PM okhttp3.internal.platform.Platform log
INFO: <-- 200 OK https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/90e7acx197-nlc-38920 (142ms, unknown-length body)

{
  "classifier_id": "90e7acx197-nlc-38920",
  "language": "en",
  "name": "TutorialClassifier",
  "status": "Available",
  "created": "2017-04-18T01:26:14.630",
  "status_description": "The classifier instance is now available and is ready to take classifier requests.",
  "url": "https://gateway.watsonplatform.net/natural-language-classifier/api/v1/classifiers/90e7acx197-nlc-38920"
}

Picked up _JAVA_OPTIONS: -Xmx512M -Xms512M

Am I doing something wrong here?

German Attanasio
  • 22,217
  • 7
  • 47
  • 63
Lalit
  • 1,944
  • 12
  • 20

1 Answers1

0

The deleteClassifier needs to be invoked using .execute()

Add .execute() to

service.deleteClassifier("90e7acx197-nlc-38920");

The method below will delete your classifier

service.deleteClassifier("90e7acx197-nlc-38920").execute();
German Attanasio
  • 22,217
  • 7
  • 47
  • 63
  • Thanks a heap. This works. After reading your response, I went back to the documentation and realised that I missed the ".execute()" part or may be I somehow landed at the old documentation then. Anyways, thanks again for your help. – Lalit May 03 '17 at 22:34