Class SentimentPhrase

java.lang.Object
com.lexalytics.salience.Phrase
com.lexalytics.salience.SentimentPhrase

public class SentimentPhrase
extends Phrase
A Phrase that contains sentiment.
See Also:
Phrase
  • Constructor Details

    • SentimentPhrase

      public SentimentPhrase​(java.lang.String sText, int nType, int nSentence, int nWord, int nLength, int nByteOffset, int nByteLength, int nCharOffset, int nCharLength, float fSentimentScore, java.lang.String sSource, int nModified, java.util.Vector<Phrase> oSupportingPhrases, int nSection, int nRow, int nColumn)
      Standard constructor for Phrase objects.
      Used internally to marshal results from underlying C API.
      Parameters:
      sText - The text of the phrase
      nType - Type of phrase this is
      nSentence - The zero-based index of the sentence in which the phrase occurs
      nWord - The zero-based index of the first word of the phrase
      nLength - The length (in tokens) of the phrase
      nByteOffset - The byte offset of the phrase
      nByteLength - The length of the phrase in bytes
      nCharOffset - The character offset of the phrase
      nCharLength - The character length of the phrase
      fSentimentScore - The sentiment score determined for the phrase
      sSource - The source HSD (if applicable) for the sentiment phrase
      nModified - Indicates if the phrase has been modified (sentiment is multiplied via negation and/or intensification)
      oSupportingPhrases - A Vector containing supporting phrases (such as a negator)
      nSection -
      nRow -
      nColumn -
  • Method Details

    • getSentimentScore

      public float getSentimentScore()
      Returns the sentiment score for the phrase
      Returns:
      The sentiment score associated with this phrase.
    • getSource

      public java.lang.String getSource()
      Returns the source of the sentiment phrase. If this is blank, the sentiment score for the phrase came from the underlying LSF, otherwise this member contains the path to the HSD file containing the phrase.
      Returns:
      The source of the sentiment phrase score.
    • getModified

      public int getModified()
      A bitmask indicating the modifications used, such as intensifiers or negators. The phrase "friendly" is expected to always be positive, but can have its sentiment inverted by the presence of a negator; "not friendly".
      Returns:
      True/false indication of negated sentiment.
    • getSupportingPhrases

      public java.util.Vector<Phrase> getSupportingPhrases()
      Any phrase that supports the sentiment phrase. In most cases, this will be the negating phrase if isNegated() returns true.
      Returns:
      True/false indication of negated sentiment.
    • getType

      public int getType()
      Returns the type of phrase this is.
      Returns:
      number representing the phrase type