com.wcohen.ss
Class AbstractTokenizedStringDistance

java.lang.Object
  extended by com.wcohen.ss.AbstractStringDistance
      extended by com.wcohen.ss.AbstractTokenizedStringDistance
All Implemented Interfaces:
StringDistance, StringDistanceLearner
Direct Known Subclasses:
AbstractStatisticalTokenDistance, JensenShannonDistance, Level2

public abstract class AbstractTokenizedStringDistance
extends AbstractStringDistance

Abstract distance metric for tokenized strings.


Field Summary
protected  Tokenizer tokenizer
           
 
Constructor Summary
AbstractTokenizedStringDistance()
           
AbstractTokenizedStringDistance(Tokenizer tokenizer)
           
 
Method Summary
protected  com.wcohen.ss.BagOfTokens asBagOfTokens(StringWrapper w)
           
 StringWrapperIterator prepare(StringWrapperIterator i)
          Implements StringDistanceLearner api by providing a way to prep a StringWrapperIterator for training.
 void setStringWrapperPool(StringWrapperIterator i)
          Implements the StringDistanceLearner api, by providing a way to accumulate statistics for a set of related strings.
abstract  void train(StringWrapperIterator i)
           
 
Methods inherited from class com.wcohen.ss.AbstractStringDistance
addExample, doMain, explainScore, explainScore, getDistance, hasNextQuery, nextQuery, prepare, prepare, score, score, setDistanceInstancePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tokenizer

protected Tokenizer tokenizer
Constructor Detail

AbstractTokenizedStringDistance

public AbstractTokenizedStringDistance(Tokenizer tokenizer)

AbstractTokenizedStringDistance

public AbstractTokenizedStringDistance()
Method Detail

setStringWrapperPool

public final void setStringWrapperPool(StringWrapperIterator i)
Description copied from class: AbstractStringDistance
Implements the StringDistanceLearner api, by providing a way to accumulate statistics for a set of related strings. This is for distance metrics like TFIDF that use statistics on unlabeled strings to adjust a distance metric. The Default is to do nothing; override this method if it's necessary to accumulate statistics.

Specified by:
setStringWrapperPool in interface StringDistanceLearner
Overrides:
setStringWrapperPool in class AbstractStringDistance

train

public abstract void train(StringWrapperIterator i)

prepare

public final StringWrapperIterator prepare(StringWrapperIterator i)
Description copied from class: AbstractStringDistance
Implements StringDistanceLearner api by providing a way to prep a StringWrapperIterator for training. By default this makes no changes to the iterator.

Specified by:
prepare in interface StringDistanceLearner
Overrides:
prepare in class AbstractStringDistance

asBagOfTokens

protected final com.wcohen.ss.BagOfTokens asBagOfTokens(StringWrapper w)