2016-09-22 78 views
2

我想使用AlchemyLanguage API从URL中提取关键字。我有一个自定义的Watson Knowledge Studio模型。炼金术语言+ WKS模型+ NodeJs

下面的代码并没有考虑到我的自定义模式:

var alchemyL = watson.alchemy_language({ 
    api_key: 'mykey', 
    model_id: '6311a194-0b12-4795-8edc-66ac0174868f' 
}); 

var params = { 
    maxRetrieve: 1000, 
    url: 'http://nsf701.mybluemix.net/', 
} 

alchemyL.keywords(params, function (err, resp) { 
    if(err) { 
    console.log('error:', err); 
    } else { 
    console.log(resp); 
    } 
}); 

回答

0

知识工作室,让您创建和只能在typed_relation端点使用火车定制机型。

你只需要更新的方法名称和你的方式发送model_id

var watson = require('watson-developer-cloud'); 
var alchemyL = watson.alchemy_language({ 
    api_key: 'API_KEY' 
}) 

var parameters = { 
    url: 'http://nsf701.mybluemix.net/', 
    model: '6311a194-0b12-4795-8edc-66ac0174868f' 
}; 

alchemyL.typedRelations(parameters, function (err, response) { 
    if (err) 
    console.log('error:', err); 
    else 
    console.log(JSON.stringify(response, null, 2)); 
}); 

http://www.ibm.com/watson/developercloud/alchemy-language/api/v1/?node#typed_relations