Back to Top


Relation Sentiment

Directional Sentiment Analysis Support

AlchemyAPI provides the ability to extract directional sentiment (positive / negative statements) for subjects and objects in identified Subject-Action-Object relations, in addition to performing document-level, user-targeted sentiment, entity-level, and keyword-level sentiment analysis.

What is Sentiment Analysis?

Sentiment analysis is the process of identifying positive or negative statements, feelings, and opinions within text.

How Do I Use It?

Directional sentiment output is disabled by default. Enabling this feature for an API call results in counting of one additional transaction against your daily API limit. To enable directional sentiment analysis, you may use the following HTTP parameter with your API calls:


NOTE: Sentiment analysis is currently available for English-language content only. Support for outputting sentiment data in other languages is currently in development.

What Does AlchemyAPI Directional Sentiment Look Like?

When directional sentiment analysis is enabled, sentiment data is computed for every detected relation subject and object within the analyzed text. AlchemyAPI also computes sentiment "directed at" the relation Object via the Subject-Action.

The following is an example XML-formatted response (for "Ugly bob attacked beautiful Susan"):

    <text>Ugly Bob</text>
    <text>beautiful Susan</text>

In the above example, "Bob" is given negative 'subject' sentiment ("Ugly Bob"), "Susan" is given positive 'object' sentiment ("beautiful Susan"), and "Susan" is given negative directional sentiment as applied from the Subject-Action (Bob -> attacked -> Susan).

NOTE: Directional sentiment analysis is supported within all AlchemyAPI response formats, including XML, JSON, and RDF.

Is This Sentiment Analysis "Entity-Aware"?

Yes! AlchemyAPI can avoid analyzing named entity text when computing sentiment analysis results, improving classification accuracy. This functionality is enabled by default. To disable it, you may use the following HTTP parameter with your API calls:


NOTE: This functionality excludes the "text" of identified named entities from sentiment analysis. For example, "Bob went to New York," would be classified as neutral, because "New" refers to an entity ("New York") and does not signify "being new." A system that is not entity-aware may incorrectly mark this sentence as positive, because it does not understand that "New" is referring to a city.