Salience.GetDocumentSentiment

<< Salience.GetSummary | Back to Salience 6 .Net Index | Salience.GetDocumentThemes >>

Summary

Returns an object containing results of sentiment analysis on the document. This includes phrase-based sentiment analysis as well as the results of model-based sentiment analysis.
The id parameter is an optional parameter to specify which configuration to return results for. Content can be processed by multiple configurations in one pass by prior calls to Salience.AddSalienceConfiguration. Omitting this parameter or passing an empty string returns results based on the default configuration.
This method is a a wrapper around the underlying C API method lxaGetSentiment.

Syntax

public SalienceSentiment GetDocumentSentiment(bool bUseChains, String id="")

Parameters

bUseChains Determines if chains are used to calculate sentiment
id Optional: The identifier for a specific configuration for results.

Returns

If successful, a SalienceSentiment object is returned. Otherwise, an exception is thrown with information about the failure.

Example

    Salience Engine = null;
    string licensePath = "C:/Program Files/Lexalytics/License.v5";
    string dataPath = "C:/Program Files/Lexalytics/data";

    try
    {
        Engine = new Salience(licensePath, dataPath);
    }
    catch (SalienceException e)
    {
        System.Console.WriteLine("Error Loading SalienceEngine: " + e.Message);
        return;
    }

    int nRet = Engine.PrepareText("Lexalytics is headquartered in Amherst, MA");
    if (nRet==0)
    {
        SalienceSentiment mySentiment = Engine.GetDocumentSentiment(true, String.Empty);
        ....
    }

<< Salience.GetSummary | Back to Salience 6 .Net Index | Salience.GetDocumentThemes >>