如何使用 IBM watson 情感分析来分析任何文本
how to analyze any text with IBM watson sentiment analysis
我正在使用 IBM watsons SDK for Nodejs watson-developer-cloud/natural-language-understanding/v1.js
,我正在分析像 'I love Fridays and I hate Mondays' 这样的文本行,我必须定义目标 Friday
和 Monday
我希望分析任何给定的文本行而不每次都设置目标
使用以下代码
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"]
}
}
}
我可以使用另一个 API 找出实体,然后调用此函数
但是还有别的办法吗?
您可以使用 here 记录的实体的 "entities.sentiment" 子功能。
我正在使用 IBM watsons SDK for Nodejs watson-developer-cloud/natural-language-understanding/v1.js
,我正在分析像 'I love Fridays and I hate Mondays' 这样的文本行,我必须定义目标 Friday
和 Monday
我希望分析任何给定的文本行而不每次都设置目标
使用以下代码
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"]
}
}
}
我可以使用另一个 API 找出实体,然后调用此函数 但是还有别的办法吗?
您可以使用 here 记录的实体的 "entities.sentiment" 子功能。