public class FeatureExtractor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.String,java.lang.String> |
attributes |
(package private) java.util.Set<java.lang.String> |
DC_FIELDS |
private static java.lang.String[] |
FIELD_VALUES |
(package private) static FeatureVector |
fv |
private java.lang.String |
outputFileName |
(package private) java.io.BufferedWriter |
writer |
Constructor and Description |
---|
FeatureExtractor(java.lang.String outputFileName)
Creates a new feature vector and the output file.
|
Modifier and Type | Method and Description |
---|---|
private void |
createOutputFile() |
void |
processFile(java.io.File f)
Process an individual input file
|
void |
processFiles(java.lang.String directory)
Process all the file in a given directory
|
private void |
processLine(java.lang.String line,
int lineNumber,
java.lang.String fileName)
Processes an individual line and extracts class and data
|
private void |
writeAttributes()
Writes attributes to output file.
|
private void |
writeData(java.lang.String fieldName,
java.util.List<java.lang.String> features)
Writes data to arff file in the form "x, y, z, class"
i.e.
|
private static final java.util.Map<java.lang.String,java.lang.String> attributes
private static final java.lang.String[] FIELD_VALUES
static FeatureVector fv
java.io.BufferedWriter writer
java.util.Set<java.lang.String> DC_FIELDS
private java.lang.String outputFileName
public FeatureExtractor(java.lang.String outputFileName)
outputFileName
- the name of the outpur file.private void createOutputFile()
private void writeAttributes() throws java.io.IOException
java.io.IOException
public void processFiles(java.lang.String directory) throws java.io.IOException
directory
- the directory to transversejava.io.IOException
public void processFile(java.io.File f)
f
- the file to processprivate void processLine(java.lang.String line, int lineNumber, java.lang.String fileName) throws java.io.IOException
line
- the line to processlineNumber
- the location of the line in the file.fileName
- the name of the file being processed *java.io.IOException
private void writeData(java.lang.String fieldName, java.util.List<java.lang.String> features) throws java.io.IOException
fieldName
- features
- java.io.IOException