ir.classifiers
Class DirectoryExamplesConstructor

java.lang.Object
  extended by ir.classifiers.ExamplesConstructor
      extended by ir.classifiers.DirectoryExamplesConstructor

public class DirectoryExamplesConstructor
extends ExamplesConstructor

Creates a list of examples from a directory where file names contain the category name as a substring.


Field Summary
protected  java.lang.String[] categories
          Array of categories (classes) in the data
protected  java.lang.String dirName
          Name of the directory where the example files are stored.
protected  short docType
          Type of document (text or HTML)
protected  boolean stem
          Flag set to stem words to their root forms
 
Constructor Summary
DirectoryExamplesConstructor(java.lang.String dirName, java.lang.String[] categories)
          Construct an ExamplesConstructor for the given directory and category labels
DirectoryExamplesConstructor(java.lang.String dirName, java.lang.String[] categories, short docType, boolean stem)
          Construct an ExamplesConstructor for the given directory and category labels
 
Method Summary
 int findClassID(java.lang.String name)
          Finds the class ID from the name of the document file.
 java.util.List<Example> getExamples()
          Get the examples from the directory, process them into HashMapVector's and label them with the correct category label
static void main(java.lang.String[] args)
          Test loading a sample directory of examples
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirName

protected java.lang.String dirName
Name of the directory where the example files are stored.


docType

protected short docType
Type of document (text or HTML)


stem

protected boolean stem
Flag set to stem words to their root forms


categories

protected java.lang.String[] categories
Array of categories (classes) in the data

Constructor Detail

DirectoryExamplesConstructor

public DirectoryExamplesConstructor(java.lang.String dirName,
                                    java.lang.String[] categories,
                                    short docType,
                                    boolean stem)
Construct an ExamplesConstructor for the given directory and category labels


DirectoryExamplesConstructor

public DirectoryExamplesConstructor(java.lang.String dirName,
                                    java.lang.String[] categories)
Construct an ExamplesConstructor for the given directory and category labels

Method Detail

getExamples

public java.util.List<Example> getExamples()
Get the examples from the directory, process them into HashMapVector's and label them with the correct category label

Specified by:
getExamples in class ExamplesConstructor

findClassID

public int findClassID(java.lang.String name)
Finds the class ID from the name of the document file. Assumes file name contains the category name as a substring


main

public static void main(java.lang.String[] args)
Test loading a sample directory of examples