org.apache.mahout.utils.vectors
Class VectorHelper

java.lang.Object
  extended by org.apache.mahout.utils.vectors.VectorHelper

public class VectorHelper
extends java.lang.Object


Method Summary
static java.lang.String[] loadTermDictionary(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, java.lang.String filePattern)
          Read a dictionary in SequenceFile generated by DictionaryVectorizer
static java.lang.String[] loadTermDictionary(java.io.File dictFile)
          Read in a dictionary file.
static java.lang.String[] loadTermDictionary(java.io.InputStream is)
          Read in a dictionary file.
static java.lang.String vectorToString(Vector vector, java.lang.String[] dictionary)
          Create a String from a vector that fills in the values with the appropriate value from a dictionary where each the ith entry is the term for the ith vector cell..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

vectorToString

public static java.lang.String vectorToString(Vector vector,
                                              java.lang.String[] dictionary)
Create a String from a vector that fills in the values with the appropriate value from a dictionary where each the ith entry is the term for the ith vector cell..

Parameters:
vector -
dictionary - The dictionary. See
Returns:
The String

loadTermDictionary

public static java.lang.String[] loadTermDictionary(java.io.File dictFile)
                                             throws java.io.IOException
Read in a dictionary file. Format is:
 term DocFreq Index
 

Parameters:
dictFile -
Returns:
Throws:
java.io.IOException

loadTermDictionary

public static java.lang.String[] loadTermDictionary(org.apache.hadoop.conf.Configuration conf,
                                                    org.apache.hadoop.fs.FileSystem fs,
                                                    java.lang.String filePattern)
                                             throws java.io.IOException
Read a dictionary in SequenceFile generated by DictionaryVectorizer

Parameters:
conf -
fs -
filePattern - /dictionary.file-*
Returns:
Throws:
java.io.IOException

loadTermDictionary

public static java.lang.String[] loadTermDictionary(java.io.InputStream is)
                                             throws java.io.IOException
Read in a dictionary file. Format is: First line is the number of entries
 term DocFreq Index
 

Throws:
java.io.IOException


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.