de.hpi.fgis.dude.similarityfunction.contentbased.impl.simmetrics
Class SimmetricsFunction<T extends SimmetricsFunction<T,M>,M extends uk.ac.shef.wit.simmetrics.similaritymetrics.InterfaceStringMetric>

java.lang.Object
  extended by de.hpi.fgis.dude.similarityfunction.AbstractSimilarityFunction
      extended by de.hpi.fgis.dude.similarityfunction.contentbased.ContentBasedSimilarityFunction<T>
          extended by de.hpi.fgis.dude.similarityfunction.contentbased.impl.simmetrics.SimmetricsFunction<T,M>
Type Parameters:
T - The type that is returned by any fluent interface method.
M - The internally used metric.
All Implemented Interfaces:
SimilarityFunction, StringSimilarity, AutoJsonable
Direct Known Subclasses:
BlockDistanceFunction, CosineSimilarityFunction, DiceCoefficientFunction, EuclideanDistanceFunction, JaccardSimilarityFunction, JaroDistanceFunction, JaroWinklerFunction, LevenshteinDistanceFunction, MatchingCoefficientFunction, MongeElkanFunction, NeedlemanWunschFunction, OverlapCoefficientFunction, SmithWatermanFunction, SmithWatermanGotohFunction

public abstract class SimmetricsFunction<T extends SimmetricsFunction<T,M>,M extends uk.ac.shef.wit.simmetrics.similaritymetrics.InterfaceStringMetric>
extends ContentBasedSimilarityFunction<T>
implements StringSimilarity

SimmetricsFunction is a skeleton class providing the common functionality of all Simmetric similarity functions.

Author:
Arvid Heise, Matthias Pohl

Nested Class Summary
 
Nested classes/interfaces inherited from interface de.hpi.fgis.dude.similarityfunction.SimilarityFunction
SimilarityFunction.SimilarityValidationState
 
Constructor Summary
protected SimmetricsFunction()
          Internal constructor for Jsonable deserialization.
protected SimmetricsFunction(M metric, int attrIndex, String... defaultAttr)
          Initializes the SimmetricsFunction with the passed metric and the default values.
protected SimmetricsFunction(M metric, String... defaultAttr)
          Initializes the SimmetricsFunction with the passed metric and the default values.
 
Method Summary
protected  double compareAtomicValues(JsonAtomic value1, JsonAtomic value2)
          Calculates the similarity of the two passed JsonAtomics.
 double getSimilarity(String str1, String str2)
          Returns the similarity of the passed Strings, where 0.0 means that Strings are completely different, and 1.0 indicates that the passed Strings are the same.
 
Methods inherited from class de.hpi.fgis.dude.similarityfunction.contentbased.ContentBasedSimilarityFunction
addAttribute, calculateSimilarity, calculateSimilarity, equals, getAttribute, hashCode, ignoreCapitalization, ignoringCapitalizationEnabled, setCompareArrayArrayStrategy, setCompareArrayAtomicStrategy, setCompareArrayRecordStrategy, setCompareRecordAtomicStrategy, setCompareRecordRecordStrategy
 
Methods inherited from class de.hpi.fgis.dude.similarityfunction.AbstractSimilarityFunction
getLastValidationState, getSimilarity, setValidationState
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimmetricsFunction

protected SimmetricsFunction()
Internal constructor for Jsonable deserialization.


SimmetricsFunction

protected SimmetricsFunction(M metric,
                             String... defaultAttr)
Initializes the SimmetricsFunction with the passed metric and the default values.

Parameters:
metric - The internally used metric function.
defaultAttr - The default attributes.

SimmetricsFunction

protected SimmetricsFunction(M metric,
                             int attrIndex,
                             String... defaultAttr)
Initializes the SimmetricsFunction with the passed metric and the default values.

Parameters:
metric - The internally used metric function.
attrIndex - The index of the default attribute. This parameter might be used to select other values than the first one of an array.
defaultAttr - The default attributes.
Method Detail

compareAtomicValues

protected double compareAtomicValues(JsonAtomic value1,
                                     JsonAtomic value2)
Description copied from class: ContentBasedSimilarityFunction
Calculates the similarity of the two passed JsonAtomics.

Specified by:
compareAtomicValues in class ContentBasedSimilarityFunction<T extends SimmetricsFunction<T,M>>
Parameters:
value1 - The first atomic value.
value2 - The second atomic value.
Returns:
The similarity of the two passed values.

getSimilarity

public double getSimilarity(String str1,
                            String str2)
Description copied from interface: StringSimilarity
Returns the similarity of the passed Strings, where 0.0 means that Strings are completely different, and 1.0 indicates that the passed Strings are the same.

Specified by:
getSimilarity in interface StringSimilarity
Parameters:
str1 - The first String.
str2 - The second String.
Returns:
Returns the similarity of the passed Strings or 0.0, if null was passed for at least one String.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.