Class Jaccard

  extended by
      extended by
All Implemented Interfaces:
StringDistance, StringDistanceLearner

public class Jaccard
extends AbstractStringDistance

Jaccard distance implementation. The Jaccard distance between two sets is the ratio of the size of their intersection to the size of their union.

Constructor Summary
Jaccard(Tokenizer tokenizer)
Method Summary
 java.lang.String explainScore(StringWrapper s, StringWrapper t)
          Explain how the distance was computed.
static void main(java.lang.String[] argv)
 StringWrapper prepare(java.lang.String s)
          Preprocess a string by finding tokens.
 double score(StringWrapper s, StringWrapper t)
          This method needs to be implemented by subclasses.
 java.lang.String toString()
Methods inherited from class
addExample, doMain, explainScore, getDistance, hasNextQuery, nextQuery, prepare, prepare, score, setDistanceInstancePool, setStringWrapperPool
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public Jaccard(Tokenizer tokenizer)


public Jaccard()
Method Detail


public double score(StringWrapper s,
                    StringWrapper t)
Description copied from class: AbstractStringDistance
This method needs to be implemented by subclasses.

Specified by:
score in interface StringDistance
Specified by:
score in class AbstractStringDistance


public StringWrapper prepare(java.lang.String s)
Preprocess a string by finding tokens.

Specified by:
prepare in interface StringDistance
prepare in class AbstractStringDistance


public java.lang.String explainScore(StringWrapper s,
                                     StringWrapper t)
Explain how the distance was computed. In the output, the tokens in S and T are listed, and the common tokens are marked with an asterisk.

Specified by:
explainScore in interface StringDistance
Specified by:
explainScore in class AbstractStringDistance


public java.lang.String toString()
toString in class java.lang.Object


public static void main(java.lang.String[] argv)