public final class VectorHelper extends Object
Modifier and Type | Method and Description |
---|---|
static String |
buildJson(Iterable<Pair<String,Double>> iterable) |
static String |
buildJson(Iterable<Pair<String,Double>> iterable,
StringBuilder bldr) |
static List<Pair<Integer,Double>> |
firstEntries(Vector vector,
int maxEntries) |
static String[] |
loadTermDictionary(org.apache.hadoop.conf.Configuration conf,
String filePattern)
Read a dictionary in
SequenceFile generated by
DictionaryVectorizer |
static String[] |
loadTermDictionary(File dictFile)
Read in a dictionary file.
|
static List<Pair<Integer,Double>> |
topEntries(Vector vector,
int maxEntries) |
static List<Pair<String,Double>> |
toWeightedTerms(Collection<Pair<Integer,Double>> entries,
String[] dictionary) |
static String |
vectorToCSVString(Vector vector,
boolean namesAsComments) |
static void |
vectorToCSVString(Vector vector,
boolean namesAsComments,
Appendable bldr) |
static String |
vectorToJson(Vector vector,
String[] dictionary,
int maxEntries,
boolean sort) |
public static String vectorToCSVString(Vector vector, boolean namesAsComments) throws IOException
IOException
public static String buildJson(Iterable<Pair<String,Double>> iterable, StringBuilder bldr)
public static List<Pair<String,Double>> toWeightedTerms(Collection<Pair<Integer,Double>> entries, String[] dictionary)
public static String vectorToJson(Vector vector, String[] dictionary, int maxEntries, boolean sort)
public static void vectorToCSVString(Vector vector, boolean namesAsComments, Appendable bldr) throws IOException
IOException
public static String[] loadTermDictionary(File dictFile) throws IOException
term DocFreq Index
IOException
public static String[] loadTermDictionary(org.apache.hadoop.conf.Configuration conf, String filePattern)
SequenceFile
generated by
DictionaryVectorizer
filePattern
- Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.