public abstract class AbstractClusterWriter extends Object implements ClusterWriter
| Modifier and Type | Field and Description |
|---|---|
protected Map<Integer,List<WeightedVectorWritable>> |
clusterIdToPoints |
protected DistanceMeasure |
measure |
protected Writer |
writer |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractClusterWriter(Writer writer,
Map<Integer,List<WeightedVectorWritable>> clusterIdToPoints,
DistanceMeasure measure) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected Map<Integer,List<WeightedVectorWritable>> |
getClusterIdToPoints() |
static String |
getTopFeatures(Vector vector,
String[] dictionary,
int numTerms) |
static String |
getTopTerms(Vector vector,
String[] dictionary,
int numTerms) |
protected Writer |
getWriter() |
long |
write(Iterable<ClusterWritable> iterable)
Write all values in the Iterable to the output
|
long |
write(Iterable<ClusterWritable> iterable,
long maxDocs)
Write the first
maxDocs to the output. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteprotected final Writer writer
protected final Map<Integer,List<WeightedVectorWritable>> clusterIdToPoints
protected final DistanceMeasure measure
protected AbstractClusterWriter(Writer writer, Map<Integer,List<WeightedVectorWritable>> clusterIdToPoints, DistanceMeasure measure)
writer - The underlying Writer to useclusterIdToPoints - The map between cluster ids Cluster.getId() and the
points in the clustermeasure - The DistanceMeasure used to calculate the distance.
Some writers may wish to use it for calculating weights for display. May be null.protected Writer getWriter()
protected Map<Integer,List<WeightedVectorWritable>> getClusterIdToPoints()
public static String getTopFeatures(Vector vector, String[] dictionary, int numTerms)
public long write(Iterable<ClusterWritable> iterable) throws IOException
ClusterWriterwrite in interface ClusterWriteriterable - The Iterable to loop overIOException - if there was a problem writingpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic long write(Iterable<ClusterWritable> iterable, long maxDocs) throws IOException
ClusterWritermaxDocs to the output.write in interface ClusterWriteriterable - The Iterable to loop overmaxDocs - the maximum number of docs to writeIOException - if there was a problem writingCopyright © 2008–2013 The Apache Software Foundation. All rights reserved.