com.wcohen.ss
Class Level2

java.lang.Object
  extended by com.wcohen.ss.AbstractStringDistance
      extended by com.wcohen.ss.AbstractTokenizedStringDistance
          extended by com.wcohen.ss.Level2
All Implemented Interfaces:
StringDistance, StringDistanceLearner
Direct Known Subclasses:
Level2Jaro, Level2JaroWinkler, Level2Levenstein, Level2MongeElkan

public class Level2
extends AbstractTokenizedStringDistance

Generic version of Monge & Elkan's "level 2" recursive field matching. Given strings A, B that are broken into substrings A = A1...Ak and B=B1...Bm, the recursive string matching algorithm scores

score(A,B) = 1/k [ sum_i max_j score(Ai,Bj) ] For level 1, substrings Ai, Bj are delimited by commas; for level 2, they are tokens.


Constructor Summary
Level2(Tokenizer tokenizer, StringDistance tokenDistance)
           
 
Method Summary
 java.lang.String explainScore(StringWrapper s, StringWrapper t)
          Explain how the distance was computed.
static void main(java.lang.String[] argv)
           
 double score(StringWrapper s, StringWrapper t)
          This method needs to be implemented by subclasses.
 java.lang.String toString()
           
 void train(StringWrapperIterator i)
          Training is a null operation.
 
Methods inherited from class com.wcohen.ss.AbstractTokenizedStringDistance
asBagOfTokens, prepare, setStringWrapperPool
 
Methods inherited from class com.wcohen.ss.AbstractStringDistance
addExample, doMain, explainScore, getDistance, hasNextQuery, nextQuery, prepare, prepare, score, setDistanceInstancePool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Level2

public Level2(Tokenizer tokenizer,
              StringDistance tokenDistance)
Method Detail

score

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

explainScore

public java.lang.String explainScore(StringWrapper s,
                                     StringWrapper t)
Explain how the distance was computed.

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

train

public void train(StringWrapperIterator i)
Training is a null operation. Properly speaking of course, it should train the inner distance function.

Specified by:
train in class AbstractTokenizedStringDistance

toString

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

main

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