jInfer

cz.cuni.mff.ksi.jinfer.twostep.clustering.withattributesiname
Class AttributeClusterer

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.twostep.clustering.withattributesiname.AttributeClusterer
All Implemented Interfaces:
Clusterer<Attribute>

public class AttributeClusterer
extends Object
implements Clusterer<Attribute>

Helper class for Iname. Clusters attributes for one element, by name (case insensitive).


Constructor Summary
AttributeClusterer()
          Default constructor.
 
Method Summary
 void add(Attribute item)
          Add x to some clusterer, enqueue for processing.
 void addAll(Collection<Attribute> items)
          Add the whole collection to queue for clustering
 void cluster()
          Do the main job, cluster enqueued items into clusters.
 List<Cluster<Attribute>> getClusters()
          Without doing clustering again, return result of last cluster() call.
 Attribute getRepresentantForItem(Attribute item)
          Return representative of the item's cluster
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeClusterer

public AttributeClusterer()
Default constructor.

Method Detail

add

public void add(Attribute item)
Description copied from interface: Clusterer
Add x to some clusterer, enqueue for processing. Don't implement clustering here, has to be in cluster() method to enable thread interruption.

Specified by:
add in interface Clusterer<Attribute>
Parameters:
item - to add

addAll

public void addAll(Collection<Attribute> items)
Description copied from interface: Clusterer
Add the whole collection to queue for clustering

Specified by:
addAll in interface Clusterer<Attribute>
Parameters:
items - elements to add

cluster

public void cluster()
             throws InterruptedException
Description copied from interface: Clusterer
Do the main job, cluster enqueued items into clusters. But don't throw away old items. If there are already some items in clusters, user suppose they didn't disappeared.

Example: add(x), add(y), add(xx), add(yx), enqueued items: x, y, xx, yx. Calling cluster() creates clusters for example based on starting letter. Creates two clusters: (x, xx) | (y, yx)

Now let user use add(xd), add(zz). Calling cluster() again have to result in (x, xx, xd) | (y, yx) | (zz)

Of course, if cluster criterion is not so stable as first letter, items x, xx, y, yx can change their clusters and so. Point is, that they don't disappear. Once an item is added clusterer has to hold it for future cluster() calls. cluster method has to check for interruption of thread by using: if (Thread.interrupted()) { throw new InterruptedException(); } in some main loop.

Specified by:
cluster in interface Clusterer<Attribute>
Throws:
InterruptedException

getRepresentantForItem

public Attribute getRepresentantForItem(Attribute item)
Description copied from interface: Clusterer
Return representative of the item's cluster

Specified by:
getRepresentantForItem in interface Clusterer<Attribute>
Returns:

getClusters

public List<Cluster<Attribute>> getClusters()
Description copied from interface: Clusterer
Without doing clustering again, return result of last cluster() call.

Specified by:
getClusters in interface Clusterer<Attribute>
Returns:
all clusters obtained by last call of cluster

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011