csli.util.classify.stanford
Class ExternalClassifier

java.lang.Object
  extended by edu.stanford.nlp.classify.Classifier
      extended by csli.util.classify.stanford.ExternalClassifier
Direct Known Subclasses:
C4_5Classifier, SvmLightClassifier

public abstract class ExternalClassifier
extends edu.stanford.nlp.classify.Classifier

An extension for the standard Stanford Classifier class for use with external stand-alone classifiers. Includes result cacheing, feature normalization, and mapping from feature objects to numerical indices (for external classifier packages which like that sort of thing)

Author:
mpurver

Constructor Summary
ExternalClassifier(String classifyCommand, String fileStem)
           
ExternalClassifier(String classifyCommand, String fileStem, HashMap<String,Integer> featureMap, List<Pair<Double,Double>> normFactors)
           
 
Method Summary
 Object classOf(edu.stanford.nlp.dbm.Datum example)
           
<D extends edu.stanford.nlp.dbm.Datum>
List<Object>
classOf(List<D> examples)
           
 String getClassifyCommand()
           
 HashMap<edu.stanford.nlp.dbm.Datum,Object> getClassResults()
           
 HashMap<String,Integer> getFeatureMap()
           
 String getFileStem()
           
 List<Pair<Double,Double>> getNormFactors()
           
 HashMap<edu.stanford.nlp.dbm.Datum,edu.stanford.nlp.util.Counter<?>> getScoreResults()
           
 boolean isResultCacheing()
           
 edu.stanford.nlp.util.Counter<?> scoresOf(edu.stanford.nlp.dbm.Datum example)
           
<D extends edu.stanford.nlp.dbm.Datum>
List<edu.stanford.nlp.util.Counter<?>>
scoresOf(List<D> examples)
           
 void setClassifyCommand(String classifyCommand)
           
 void setFileStem(String fileStem)
           
 void setResultCacheing(boolean resultCacheing)
           
 
Methods inherited from class edu.stanford.nlp.classify.Classifier
classOf, scoresOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalClassifier

public ExternalClassifier(String classifyCommand,
                          String fileStem)

ExternalClassifier

public ExternalClassifier(String classifyCommand,
                          String fileStem,
                          HashMap<String,Integer> featureMap,
                          List<Pair<Double,Double>> normFactors)
Method Detail

getClassifyCommand

public String getClassifyCommand()
Returns:
the classifyCommand

setClassifyCommand

public void setClassifyCommand(String classifyCommand)
Parameters:
classifyCommand - the classifyCommand to set

getFileStem

public String getFileStem()
Returns:
the fileStem

setFileStem

public void setFileStem(String fileStem)
Parameters:
fileStem - the fileStem to set

isResultCacheing

public boolean isResultCacheing()
Returns:
true if this classifier caches its scoresOf results

setResultCacheing

public void setResultCacheing(boolean resultCacheing)
Parameters:
resultCacheing - true if this classifier should cache its scoresOf results, false otherwise

getFeatureMap

public HashMap<String,Integer> getFeatureMap()

getNormFactors

public List<Pair<Double,Double>> getNormFactors()
Returns:
the normFactors

getClassResults

public HashMap<edu.stanford.nlp.dbm.Datum,Object> getClassResults()
Returns:
the cached class results

getScoreResults

public HashMap<edu.stanford.nlp.dbm.Datum,edu.stanford.nlp.util.Counter<?>> getScoreResults()
Returns:
the cached score results

classOf

public Object classOf(edu.stanford.nlp.dbm.Datum example)
Specified by:
classOf in class edu.stanford.nlp.classify.Classifier

classOf

public <D extends edu.stanford.nlp.dbm.Datum> List<Object> classOf(List<D> examples)
Overrides:
classOf in class edu.stanford.nlp.classify.Classifier

scoresOf

public edu.stanford.nlp.util.Counter<?> scoresOf(edu.stanford.nlp.dbm.Datum example)
Specified by:
scoresOf in class edu.stanford.nlp.classify.Classifier

scoresOf

public <D extends edu.stanford.nlp.dbm.Datum> List<edu.stanford.nlp.util.Counter<?>> scoresOf(List<D> examples)
Overrides:
scoresOf in class edu.stanford.nlp.classify.Classifier