0

1) Please explain what is the functionality of TextGetTargetedSentiment.

2) Please provide Java code snippet calling TextGetTargetedSentiment.

EDIT

API info is at http://www.alchemyapi.com/api/sentiment/textc.html#targetedsentiment

As answered by Zach below, code snippet given by AlchemyAPI is

        AlchemyAPI_TargetedSentimentParams sentimentParams = new AlchemyAPI_TargetedSentimentParams();
        sentimentParams.setShowSourceText(true);
        doc = alchemyObj.TextGetTargetedSentiment("This car is terrible.", "car", sentimentParams);
        System.out.print(getStringFromDocument(doc));

Result is

    :
 <totalTransactions>1</totalTransactions>
<language>english</language>
<text>This car is terrible.</text>
<docSentiment>
    <score>-0.776261</score>
    <type>negative</type>
</docSentiment>

If we change a statement to

"This car is superb." Then result is

:
<totalTransactions>1</totalTransactions>
<language>english</language>
<text>This car is superb.</text>
<docSentiment>
    <score>0.695491</score>
    <type>positive</type>
</docSentiment>

All files

4

1 回答 1

0

TextGetTargetedSentiment 查找文本中特定关键字的情绪。这可以与文档级别的情绪(端点 TextGetTextSentiment)形成对比,后者查看整个文本以确定情绪。

AlchemyAPI Java SDK可以帮助您通过有针对性的情绪调用快速启动和运行。

于 2015-06-11T14:13:10.813 回答