IBM Watson + JAVA

0 respostas
Matrirxp
/*
 * 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);
        
    }
    
}

Não estou conseguindo usar o NaturalLanguageClassifier.
Quando tento executar o programa ele volta o erro abaixo:

inserir a descrição da imagem aqui

Tentei usar o VCAP_SERVICES.json como mostra nesse site

Mas não tive resultados.

Quando tento acessar o link usando o usuário e senha que eu coloquei, ele fala que o usuário e senha estão errados.
inserir a descrição da imagem aqui

Alguém pode me ajudar!

Criado 8 de março de 2019
Respostas 0
Participantes 1