com.wcohen.ss
Class WinklerRescorer

java.lang.Object
  extended by com.wcohen.ss.AbstractStringDistance
      extended by com.wcohen.ss.WinklerRescorer
All Implemented Interfaces:
StringDistance, StringDistanceLearner
Direct Known Subclasses:
JaroWinkler

public class WinklerRescorer
extends AbstractStringDistance

Winkler's reweighting scheme for distance metrics. In the literature, this was applied to the Jaro metric ('An Application of the Fellegi-Sunter Model of Record Linkage to the 1990 U.S. Decennial Census' by William E. Winkler and Yves Thibaudeau.)


Constructor Summary
WinklerRescorer(StringDistance innerDistance)
          Rescore the innerDistance's scores, to account for the subjectively greater importance of the first few characters.
 
Method Summary
 java.lang.String explainScore(StringWrapper s, StringWrapper t)
          This method needs to be implemented by subclasses.
 StringWrapper prepare(java.lang.String s)
          Default way to preprocess a string for distance computation.
 double score(StringWrapper s, StringWrapper t)
          This method needs to be implemented by subclasses.
 java.lang.String toString()
           
 
Methods inherited from class com.wcohen.ss.AbstractStringDistance
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

WinklerRescorer

public WinklerRescorer(StringDistance innerDistance)
Rescore the innerDistance's scores, to account for the subjectively greater importance of the first few characters.

Note: the innerDistance must produce scores between 0 and 1.

Method Detail

toString

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

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)
Description copied from class: AbstractStringDistance
This method needs to be implemented by subclasses.

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

prepare

public StringWrapper prepare(java.lang.String s)
Description copied from class: AbstractStringDistance
Default way to preprocess a string for distance computation. If this is an expensive operations, then override this method to return a StringWrapper implementation that caches appropriate information about s.

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