Class CachedDistanceFunction

java.lang.Object
org.dkpro.statistics.agreement.distance.CachedDistanceFunction
All Implemented Interfaces:
IDistanceFunction

public class CachedDistanceFunction
extends java.lang.Object
implements IDistanceFunction
Wrapper class for arbitrary distance functions that caches the distance scores between two categories in a hash table. This is useful, if the calculation of a distance value is computationally complex, for instance, for set-valued categories as assumed by the SetAnnotationDistanceFunction.
Author:
Christian M. Meyer
See Also:
IDistanceFunction
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.util.Hashtable<java.lang.String,​java.lang.Double> cache  
    protected IDistanceFunction wrappee  
  • Constructor Summary

    Constructors 
    Constructor Description
    CachedDistanceFunction​(IDistanceFunction wrappee)
    Instantiates the wrapper for the given distance function.
  • Method Summary

    Modifier and Type Method Description
    double measureDistance​(IAnnotationStudy study, java.lang.Object category1, java.lang.Object category2)
    Returns a distance value for the given pair of categories used within the given annotation study.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • measureDistance

      public double measureDistance​(IAnnotationStudy study, java.lang.Object category1, java.lang.Object category2)
      Description copied from interface: IDistanceFunction
      Returns a distance value for the given pair of categories used within the given annotation study. Normally, the measure should return a distance of 0 if, and only if, the two categories are equal and a positive number otherwise.
      Specified by:
      measureDistance in interface IDistanceFunction