2

I am trying to extract keywords from a URL using the AlchemyLanguage API. I have a custom Watson Knowledge Studio model.

The code below doesn't take into account my custom model:

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); 
  } 
});
German Attanasio
  • 22,217
  • 7
  • 47
  • 63

1 Answers1

0

Knowledge Studio let you create and train custom models that can be used only in the typed_relation endpoint.

You just need to update the method name and the way you send the 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));
});

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

German Attanasio
  • 22,217
  • 7
  • 47
  • 63