Jacson

de.spieleck.app.ngramj.lm
Class CategorizerImpl

java.lang.Object
  extended by de.spieleck.app.ngramj.lm.CategorizerImpl
All Implemented Interfaces:
Categorizer, LMConstants

public class CategorizerImpl
extends java.lang.Object
implements Categorizer, LMConstants

One class to classify a profile against a set of profiles. Note this has a main() method for testing and tuning purposes.


Field Summary
static java.io.FilenameFilter LMFilter
           
protected  java.util.List profiles
           
 
Fields inherited from interface de.spieleck.app.ngramj.lm.LMConstants
SKIPABLE, USEDNGRAMS
 
Constructor Summary
CategorizerImpl()
          Construct an uninitialized Categorizer.
CategorizerImpl(java.lang.String dirName)
          Construct an Categorizer from a whole Directory of resources.
CategorizerImpl(java.lang.String[] fileNames)
          Construct an Categorizer from a List of resource file names.
 
Method Summary
 void addProfile(IterableProfile prof)
          add an Categorization alternative to the profiles.
 double deltaRank(IterableProfile prof1, Profile prof2)
          Calculate "the distance" between two profiles
protected  void init(java.io.File fi, java.lang.String[] names)
          Fetch the set of file resources.
static void main(java.lang.String[] args)
          Sample application, like the text_cat main mode.
 Profile match(Profile prof)
          Match a given profile against the Categorizer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

profiles

protected java.util.List profiles

LMFilter

public static java.io.FilenameFilter LMFilter
Constructor Detail

CategorizerImpl

public CategorizerImpl()
                throws java.io.IOException
Construct an uninitialized Categorizer.

Throws:
java.io.IOException

CategorizerImpl

public CategorizerImpl(java.lang.String dirName)
                throws NGramException,
                       java.io.FileNotFoundException
Construct an Categorizer from a whole Directory of resources.

Throws:
NGramException
java.io.FileNotFoundException

CategorizerImpl

public CategorizerImpl(java.lang.String[] fileNames)
                throws NGramException,
                       java.io.FileNotFoundException
Construct an Categorizer from a List of resource file names.

Throws:
NGramException
java.io.FileNotFoundException
Method Detail

init

protected void init(java.io.File fi,
                    java.lang.String[] names)
             throws NGramException,
                    java.io.FileNotFoundException
Fetch the set of file resources.

Throws:
NGramException
java.io.FileNotFoundException

addProfile

public void addProfile(IterableProfile prof)
add an Categorization alternative to the profiles.

Specified by:
addProfile in interface Categorizer

match

public Profile match(Profile prof)
Match a given profile against the Categorizer

Specified by:
match in interface Categorizer

deltaRank

public double deltaRank(IterableProfile prof1,
                        Profile prof2)
Calculate "the distance" between two profiles


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Sample application, like the text_cat main mode.

Throws:
java.lang.Exception

spieleck.de