org.carrot2.core.clustering
Class RawClusterBase

java.lang.Object
  extended by org.carrot2.util.PropertyProviderBase
      extended by org.carrot2.core.clustering.RawClusterBase
All Implemented Interfaces:
RawCluster, PropertyProvider
Direct Known Subclasses:
RawClusterInterfaceAdapter

public class RawClusterBase
extends PropertyProviderBase
implements RawCluster

A complete base implementation of the RawClusterinterface.

Version:
$Revision: 2122 $
Author:
Stanislaw Osinski

Field Summary
 
Fields inherited from interface org.carrot2.core.clustering.RawCluster
PROPERTY_JUNK_CLUSTER, PROPERTY_SCORE
 
Constructor Summary
RawClusterBase()
          Creates a new cluster with no labels, no documents, no subclusters and no properties;
 
Method Summary
 void addDocument(RawDocument rawDocument)
          Adds a document to this cluster.
 void addDocuments(Collection documents)
          Adds a collection of documents to this cluster in the order returned by the collection's iterator.
 void addLabel(String label)
          Adds a label to this cluster.
 void addSubcluster(RawCluster rawCluster)
          Adds a subcluster to this cluster.
 void addSubclusters(Collection subclusters)
          Adds a collection of subclusters to this cluster.
 List getClusterDescription()
          Returns phrases denoting this cluster's description.
 List getDocuments()
           
 String getFullInfo()
          Returns a multiline String representing this cluster's content, including the contents of this cluster's documents.
 Map getProperties()
          Returns all properties of this cluster.
 double getScore()
          A convenience method returning this cluster's score or -1 if the score has not been set.
 List getSubclusters()
           
 void setScore(double score)
          A convenience method setting score for this cluster.
 
Methods inherited from class org.carrot2.util.PropertyProviderBase
clonePropertiesFrom, getDoubleProperty, getIntProperty, getProperty, getPropertyHelper, setDoubleProperty, setIntProperty, setProperties, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.carrot2.core.clustering.RawCluster
getProperty, setProperty
 

Constructor Detail

RawClusterBase

public RawClusterBase()
Creates a new cluster with no labels, no documents, no subclusters and no properties;

Method Detail

getProperties

public Map getProperties()
Returns all properties of this cluster.

Overrides:
getProperties in class PropertyProviderBase
Returns:
all properties of this cluster.

getScore

public double getScore()
A convenience method returning this cluster's score or -1 if the score has not been set.

Returns:
this cluster's score or -1 if the score has not been set.

setScore

public void setScore(double score)
A convenience method setting score for this cluster.

Parameters:
score - score to be set

addDocument

public void addDocument(RawDocument rawDocument)
Adds a document to this cluster.

Parameters:
rawDocument - the document to be added.

addDocuments

public void addDocuments(Collection documents)
Adds a collection of documents to this cluster in the order returned by the collection's iterator.

Parameters:
documents -

addLabel

public void addLabel(String label)
Adds a label to this cluster.

Parameters:
label - the label to be added.

addSubcluster

public void addSubcluster(RawCluster rawCluster)
Adds a subcluster to this cluster.

Parameters:
rawCluster - the subcluster to be added.

addSubclusters

public void addSubclusters(Collection subclusters)
Adds a collection of subclusters to this cluster.

Parameters:
subclusters - to be added

getFullInfo

public String getFullInfo()
Returns a multiline String representing this cluster's content, including the contents of this cluster's documents.

Returns:
this cluster's content

getClusterDescription

public List getClusterDescription()
Description copied from interface: RawCluster
Returns phrases denoting this cluster's description. The order of phrases reflects their relevance to being a good cluster description - if there is a limit of phrases an application can display, phrases from the end of the list should be omitted.

Specified by:
getClusterDescription in interface RawCluster
Returns:
A list of String objects representing phrases. The list can be empty, but is never null.

getSubclusters

public List getSubclusters()
Specified by:
getSubclusters in interface RawCluster
Returns:
Returns a list of sub-clusters, each of type RawCluster.

getDocuments

public List getDocuments()
Specified by:
getDocuments in interface RawCluster
Returns:
Returns a list of documents in this cluster, each of type RawDocument.


Copyright (c) Dawid Weiss, Stanislaw Osinski