public abstract class AbstractClusterWriter extends Object implements ClusterWriter
Modifier and Type | Field and Description |
---|---|
protected Map<Integer,List<WeightedPropertyVectorWritable>> |
clusterIdToPoints |
protected DistanceMeasure |
measure |
protected Writer |
writer |
Modifier | Constructor and Description |
---|---|
protected |
AbstractClusterWriter(Writer writer,
Map<Integer,List<WeightedPropertyVectorWritable>> clusterIdToPoints,
DistanceMeasure measure) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected Map<Integer,List<WeightedPropertyVectorWritable>> |
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, wait
write
protected final Writer writer
protected final Map<Integer,List<WeightedPropertyVectorWritable>> clusterIdToPoints
protected final DistanceMeasure measure
protected AbstractClusterWriter(Writer writer, Map<Integer,List<WeightedPropertyVectorWritable>> 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<WeightedPropertyVectorWritable>> getClusterIdToPoints()
public static String getTopFeatures(Vector vector, String[] dictionary, int numTerms)
public long write(Iterable<ClusterWritable> iterable) throws IOException
ClusterWriter
write
in interface ClusterWriter
iterable
- The Iterable
to loop overIOException
- if there was a problem writingpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public long write(Iterable<ClusterWritable> iterable, long maxDocs) throws IOException
ClusterWriter
maxDocs
to the output.write
in interface ClusterWriter
iterable
- The Iterable
to loop overmaxDocs
- the maximum number of docs to writeIOException
- if there was a problem writingCopyright © 2008–2017 The Apache Software Foundation. All rights reserved.