Class Topic

java.lang.Object
com.lexalytics.salience.Topic

public class Topic
extends java.lang.Object

A topic is a label associated with a document. This label can be associated either through queries or concepts.

In order to extract topics via query, a query topic file must be specified by setting the Options.QueryTopicOptions.setQueryTopicList(java.lang.String) option, and then making calls to Salience.getDocumentTopics(). The query syntax is provided on the Lexalytics developer wiki and an example query topic file is provided in the data directory.

Extracting topics via concepts is possible via the Concept Matrix™. Similar to query-defined topics, a concept topic file must be specified. The path to the concept topic file is set through the Options.ConceptOptions.setConceptTopicList(java.lang.String) option, and calls to Salience.getConceptTopics() are made to extract concept-defined topics. The syntax for concept topics is provided on the Lexalytics developer wiki and an example concept topic file is provided in the data directory.

  • Constructor Summary

    Constructors 
    Constructor Description
    Topic​(java.lang.String sTopic, int nHits, float fScore, float fSentiment, int nType, java.lang.String sAdditional, boolean bCollectionTopic, java.util.Vector<Topic> vChildren, java.util.Vector<Entity> vEntities, java.util.Vector<Phrase> vMentions, java.util.Vector<SentimentPhrase> vSentimentPhrases)
    Creates a new topic.
  • Method Summary

    Modifier and Type Method Description
    java.util.Vector<Topic> getChildren()
    A vector containing child topics, if the results were generated from a topic hierarchy, like with GetDocumentCategories.
    java.util.Vector<Entity> getEntities()
    A vector containing entities for the topic.
    int getHitCount()
    The number of hits for the topic.
    java.util.Vector<Phrase> getMentions()
    A vector containing hits for the topic.
    float getScore()
    A score value for the topic.
    float getSentiment()
    Added in Salience 5.1: The sentiment score associated with the topic.
    java.util.Vector<SentimentPhrase> getSentimentPhrases()
    A list of sentiment bearing phrases related to the topic.
    java.lang.String getSummary()
    A summary of content related to the topic.
    java.lang.String getTopic()
    Returns the label for the topic.
    int getType()
    Added in Salience 5.2: An int value indicating whether the topic is a concept topic or a query topic.

    Methods inherited from class java.lang.Object

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

    • Topic

      public Topic​(java.lang.String sTopic, int nHits, float fScore, float fSentiment, int nType, java.lang.String sAdditional, boolean bCollectionTopic, java.util.Vector<Topic> vChildren, java.util.Vector<Entity> vEntities, java.util.Vector<Phrase> vMentions, java.util.Vector<SentimentPhrase> vSentimentPhrases)
      Creates a new topic. This is not intended for client use. Topics are created by Salience Engine when a topic-related function is called.
      Parameters:
      sTopic - The topic label.
      nHits - The number of term hits for the topic.
      fScore - A score value associated with the topic for the content.
      fSentiment - Sentiment score for the topic.
      nType - An int value determining whether the topic is a concept or a query topic.
      sAdditional - A String of additional information for the topic.
      bCollectionTopic - A flag used to distinguish collection-level topics from document-level topics.
      vChildren - A vector of child topics for topic hierarchies
      vEntities - A vector of entities for the topic.
      vMentions - A vector of phrases that hit the topic query
  • Method Details

    • getTopic

      public java.lang.String getTopic()
      Returns the label for the topic. This is defined in the query topic file or concept topic file.
      Returns:
      A String containing the topic label.
    • getScore

      public float getScore()
      A score value for the topic. What this score value indicates depends on the type of result:
      • Query-defined topics for documents: 0 (not used)
      • Query-defined topics for collections: 0 (not used)
      • Concept topics for documents: Strength of the concept topic match to document content
      • Concept topics for collections: 0 (not used)
      Returns:
      The score associated with the topic.
    • getSentiment

      public float getSentiment()
      Added in Salience 5.1: The sentiment score associated with the topic.
      Returns:
      sentiment score associated with the topic
    • getType

      public int getType()
      Added in Salience 5.2: An int value indicating whether the topic is a concept topic or a query topic.
      • 0: Query Topic
      • 1: Concept Topic
      Returns:
      The type of topic this is.
    • getSummary

      public java.lang.String getSummary()
      A summary of content related to the topic.
      Returns:
      A String object containing a summary of the document text that pertains to the topic.
    • getHitCount

      public int getHitCount()
      The number of hits for the topic. The value depends on the type of result:
      • Query-defined topics for documents: Number of query terms that hit within the document
      • Query-defined topics for collections: The number of documents within the collection that contain hits for the topic
      • Concept topics for documents: 0 (not used)
      • Concept topics for collections: The number of documents within the collection that match the concept
      Returns:
      Number of term hits in the content for the topic query.
    • getChildren

      public java.util.Vector<Topic> getChildren()
      A vector containing child topics, if the results were generated from a topic hierarchy, like with GetDocumentCategories.
      Returns:
      a vector of child topics comprising this topic hit.
    • getEntities

      public java.util.Vector<Entity> getEntities()
      A vector containing entities for the topic.
      Returns:
      a vector of entities for this topic.
    • getMentions

      public java.util.Vector<Phrase> getMentions()
      A vector containing hits for the topic.
      Returns:
      a vector of hits for this topic.
    • getSentimentPhrases

      public java.util.Vector<SentimentPhrase> getSentimentPhrases()
      A list of sentiment bearing phrases related to the topic.
      Returns:
      A Vector of SentimentPhrase objects giving the topic its sentiment