weka.deduping.metrics
Class StringMetric

java.lang.Object
  extended byweka.deduping.metrics.StringMetric
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
AffineMetric, AffineProbMetric, JaccardMetric, KernelVSMetric, VectorSpaceMetric

public abstract class StringMetric
extends java.lang.Object
implements java.lang.Cloneable

An abstract class that returns a measure of similarity between strings


Constructor Summary
StringMetric()
           
 
Method Summary
abstract  java.lang.Object clone()
          Create a copy of this metric
abstract  double distance(java.lang.String s1, java.lang.String s2)
          Compute a measure of distance between two strings
static StringMetric forName(java.lang.String metricName, java.lang.String[] options)
          Creates a new instance of a metric given it's class name and (optional) arguments to pass to it's setOptions method.
abstract  boolean isDistanceBased()
          The computation of a metric can be either based on distance, or on similarity
abstract  double similarity(java.lang.String s1, java.lang.String s2)
          Compute a measure of similarity between two strings
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMetric

public StringMetric()
Method Detail

distance

public abstract double distance(java.lang.String s1,
                                java.lang.String s2)
                         throws java.lang.Exception
Compute a measure of distance between two strings

Parameters:
s1 - first string
s2 - second string
Throws:
java.lang.Exception

similarity

public abstract double similarity(java.lang.String s1,
                                  java.lang.String s2)
                           throws java.lang.Exception
Compute a measure of similarity between two strings

Parameters:
s1 - first string
s2 - second string
Throws:
java.lang.Exception

isDistanceBased

public abstract boolean isDistanceBased()
The computation of a metric can be either based on distance, or on similarity


clone

public abstract java.lang.Object clone()
Create a copy of this metric


forName

public static StringMetric forName(java.lang.String metricName,
                                   java.lang.String[] options)
                            throws java.lang.Exception
Creates a new instance of a metric given it's class name and (optional) arguments to pass to it's setOptions method. If the classifier implements OptionHandler and the options parameter is non-null, the classifier will have it's options set.

Parameters:
metricName - the fully qualified class name of the metric
options - an array of options suitable for passing to setOptions. May be null.
Returns:
the newly created metric ready for use.
Throws:
java.lang.Exception - if the metric name is invalid, or the options supplied are not acceptable to the metric