Class Chunk

java.lang.Object
com.lexalytics.salience.Chunk

public class Chunk
extends java.lang.Object

A Chunk object represents a section of the text, generally a sentence fragment.

A list of Chunk objects is returned in Sentence results from calls to the Salience.getDocumentDetails() API method.

  • Constructor Summary

    Constructors 
    Constructor Description
    Chunk​(java.util.Vector<ChunkToken> vTokens, java.lang.String sLabel, int nSentence, float fSentiment)
    Creates a new chunk.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getLabel()
    A label describing the grammatical type of the chunk.
    int getSentenceNumber()
    A zero-based index of the sentence in the document that is the source of the chunk.
    float getSentiment()
    The sentiment score of the chunk.
    java.util.Vector<ChunkToken> getTokens()
    Retrieves a list of the tokens in the chunk.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Chunk

      public Chunk​(java.util.Vector<ChunkToken> vTokens, java.lang.String sLabel, int nSentence, float fSentiment)
      Creates a new chunk. This is not intended for client use. Chunks are created by Salience Engine when the Salience.getDocumentDetails() API method is called.
      Parameters:
      vTokens - A Vector of the chunk tokens.
      sLabel - A label describing the grammatical type of the chunk.
      nSentence - A zero-based index of the sentence in the document that is the source of the chunk.
      fSentiment - The sentiment score of the chunk.
  • Method Details

    • getTokens

      public java.util.Vector<ChunkToken> getTokens()
      Retrieves a list of the tokens in the chunk.
      Returns:
      A Vector of ChunkToken objects that comprise the chunk.
    • getLabel

      public java.lang.String getLabel()
      A label describing the grammatical type of the chunk.
      Returns:
      A String containing a label that provides the grammatical type of the chunk.
    • getSentiment

      public float getSentiment()
      The sentiment score of the chunk.
      Returns:
      A float indicating the sentiment score of the chunk.
    • getSentenceNumber

      public int getSentenceNumber()
      A zero-based index of the sentence in the document that is the source of the chunk.
      Returns:
      The sentence number in the document that is the source of the chunk.