I am using IBM watsons SDK for Nodejs watson-developer-cloud/natural-language-understanding/v1.js
and I am analyzing lines of text like 'I love Fridays and I hate Mondays' with this I have to define the targets which are Friday
and Monday
I wish to analyze any given line of text without setting the targets everytime
using the following code
var nlu = new NaturalLanguageUnderstandingV1({
username: "",
password: "",
version: "2017-02-27",
url:
"https://gateway.watsonplatform.net/natural-language-understanding/api/"
});
nlu.analyze(
{
text: "Iphone rocks , the android phone sucks",
features: {
sentiment: {
targets: ["iphone", "android"]
}
}
}
I can use another API to find out the entities and then call this function but is there any other way?
You can use the "entities.sentiment" sub-feature of entities documented here.