com.wcohen.secondstring
Class SLIM

java.lang.Object
  |
  +--com.wcohen.secondstring.AbstractStringDistance
        |
        +--com.wcohen.secondstring.SLIM
All Implemented Interfaces:
StringDistance

public class SLIM
extends AbstractStringDistance

The same-letter index mixture distance.

Experimental, invented by William Cohen. Ahem. Ahem. Which is mine.

Represents a pair S=a1...aK, T=b1...bK as a set of index distances D = { i-j : ai=bj }, and models this set D as a mixture of two Gaussians, one with small variance (so i~=j) and one with large variance (so i!=j). The degree of overlap for two chars ai and bj such that ai=bj is the posterior probability of the small-variance Gaussian, given i-j. Distance is average overlap between the two strings.


Constructor Summary
SLIM()
           
 
Method Summary
 java.lang.String explainScore(StringWrapper s, StringWrapper t)
          This method needs to be implemented by subclasses.
static void main(java.lang.String[] argv)
           
 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.secondstring.AbstractStringDistance
accumulateStatistics, doMain, explainScore, score
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SLIM

public SLIM()
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

main

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