2
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dino_post_java;
import com.ibm.watson.developer_cloud.natural_language_classifier.v1.NaturalLanguageClassifier;
import com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.Classification;
import com.ibm.watson.developer_cloud.natural_language_classifier.v1.model.ClassifyOptions;
import java.util.ArrayList;
import org.json.JSONObject;
/**
*
* @author Matheus Markies
*/
public class Text_Robot extends Thread{
public static ArrayList<String> KeyWords = new ArrayList<String>();
public void run(){
//JSONObject vcap =new JSONObject(System.getenv("VCAP_SERVICES"));
NaturalLanguageClassifier service = new NaturalLanguageClassifier();
service.setUsernameAndPassword("<username>", "<password>");
ClassifyOptions classifyOptions = new ClassifyOptions.Builder()
.classifierId("<classifierId>")
.text("Is it sunny?")
.build();
Classification classification = service.classify(classifyOptions).execute();
System.out.println(classification);
}
}
I’m not getting the Naturallanguageclassifier. When I try to run the program it turns the error below:
I tried to use VCAP_SERVICES.json as shown in this website
But I didn’t get any results.
When I try to access the link using the user and password I put, it says that the user and password are wrong.
Can someone help me!