compile 'com.ibm.watson.developer_cloud:java-sdk:3.3.0'
它添加到您的搖籃 看這裏爲examples
AlchemyLanguage service = new AlchemyLanguage();
service.setApiKey("<api_key>");
Map<String,Object> params;
params = new HashMap<String, Object>();
params.put(AlchemyLanguage.TEXT, "IBM Watson won the Jeopardy television show hosted by Alex Trebek");
CombinedResults combinedResults=service.getCombinedResults(params).execute();
List<SAORelation> relationObject=combinedResults.getRelations();
for (SAORelation relation: relationObject){
System.out.println(relation.getSentence());
}
看here對於什麼樣的鍊金術API能實現一些
'API key'演示?它來自'AlchemyApi key'還是'IBM-Alchemy Api' ke? – Awais
編譯你的代碼後,採取'API密鑰'。它提供了錯誤'I/CredentialUtils:JNDI字符串查找不可用。' – Awais
這不是一個錯誤此方法私有靜態字符串getKeyUsingJNDI(字符串服務名)應始終返回null在Android上由於不支持的javax函數它只是一個警告 – ketrox