com.meapsoft
Class FeatFile

java.lang.Object
  extended bycom.meapsoft.MEAPFile
      extended bycom.meapsoft.FeatFile
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
EDLFile

public class FeatFile
extends MEAPFile
implements java.lang.Cloneable

Representation of a MEAPsoft segment/feature file.

See Also:
Serialized Form

Field Summary
 java.util.Vector chunks
           
protected static java.util.regex.Pattern commentPattern
           
protected static java.util.regex.Pattern featDescPattern
           
 java.util.Vector featureDescriptions
           
protected static java.util.regex.Pattern linePattern
           
 
Fields inherited from class com.meapsoft.MEAPFile
filename, haveReadFile, haveWrittenFile
 
Constructor Summary
protected FeatFile()
           
  FeatFile(java.lang.String fn)
           
 
Method Summary
 void applyFeatureWeights()
          Apply weights (as listed in the "# Features: x.x*FeatureExtractor(ndim)" line ) to the features contained in this file.
 void clearChunks()
          Remove any chunks in this file
 void clearFeatures()
          Remove the features of all chunks in this file
 java.lang.Object clone()
          Clone this FeatFile
 int[] getFeatureLengths()
          Return the number of elements in each feature i.e.
 double[][] getFeatures()
          Get a matrix (2D double array) of all of the features in all of the chunks contained in this file.
 double[][] getFeatures(int[] featdim)
          Get a matrix (2D double array) of all of the features in all of the chunks contained in this file.
 boolean isCompatibleWith(FeatFile f)
          Check if another FeatFile is compatible with this one.
 void normalizeFeatures()
          Normalize the features contained in this file such that the feature dimensions corresponding to the outputs of each FeatureExtractor are normalized independently to lie between 0 and 1.
 void readFile()
          Read in a feature file
protected  void write(java.io.Writer w)
          Write the contents of this FeatFile
 
Methods inherited from class com.meapsoft.MEAPFile
toString, writeFile, writeFile, writeFile
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

featureDescriptions

public java.util.Vector featureDescriptions

chunks

public java.util.Vector chunks

commentPattern

protected static final java.util.regex.Pattern commentPattern

linePattern

protected static final java.util.regex.Pattern linePattern

featDescPattern

protected static final java.util.regex.Pattern featDescPattern
Constructor Detail

FeatFile

public FeatFile(java.lang.String fn)

FeatFile

protected FeatFile()
Method Detail

getFeatures

public double[][] getFeatures()
Get a matrix (2D double array) of all of the features in all of the chunks contained in this file. Each row corresponds to a single feature vector. Index it as you would in Matlab ([row][column] = [chunk][featdim]).


getFeatures

public double[][] getFeatures(int[] featdim)
Get a matrix (2D double array) of all of the features in all of the chunks contained in this file. Each row corresponds to a single feature vector. Index it as you would in Matlab ([row][column] = [chunk][featdim]).


getFeatureLengths

public int[] getFeatureLengths()
Return the number of elements in each feature i.e. for AvgMelSpec (0-39) and AvgChroma (40-51) we return [40, 12]


normalizeFeatures

public void normalizeFeatures()
Normalize the features contained in this file such that the feature dimensions corresponding to the outputs of each FeatureExtractor are normalized independently to lie between 0 and 1. I.e. if this featfile contains outputs of both AvgMelSpec (dim 0-39) and AvgChroma (dim 40-51), dimensions 0-39 will be normalized independently of dimensions 40-51 and vice versa.


applyFeatureWeights

public void applyFeatureWeights()
Apply weights (as listed in the "# Features: x.x*FeatureExtractor(ndim)" line ) to the features contained in this file.


readFile

public void readFile()
              throws java.io.IOException,
                     ParserException
Read in a feature file

Specified by:
readFile in class MEAPFile
Throws:
java.io.IOException
ParserException

clearChunks

public void clearChunks()
Remove any chunks in this file


clearFeatures

public void clearFeatures()
Remove the features of all chunks in this file


write

protected void write(java.io.Writer w)
              throws java.io.IOException
Write the contents of this FeatFile

Specified by:
write in class MEAPFile
Throws:
java.io.IOException

clone

public java.lang.Object clone()
Clone this FeatFile


isCompatibleWith

public boolean isCompatibleWith(FeatFile f)
Check if another FeatFile is compatible with this one. Two feature files are said to be incompatible if they contain different features.