org.jactr.core.utils.similarity
Class AutoSimilarityHandler

java.lang.Object
  extended by org.jactr.core.utils.similarity.AutoSimilarityHandler
All Implemented Interfaces:
SimilarityHandler

public class AutoSimilarityHandler
extends java.lang.Object
implements SimilarityHandler

AutoSimilarityHandler that computes the similarity between any two chunks based on average of the similarities between their slot values. This is similar, if not identical to Raluca's proposal. 0. if they are the same, return maxsim 1. if the sim between two chunks is already defined, return it 2. if they are of the same chunk type, or derivable chunk types - compare the slot values based on the smaller of the two chunks 3. if they are not related chunk types - return maxDiff 4. if they are both numbers - return the diff scaled by maxDiff/maxSim 5. if they are strings.. well, screw them

Author:
harrison

Constructor Summary
AutoSimilarityHandler()
          Constructor for the AutoSimilarityHandler object
AutoSimilarityHandler(int depth)
          Constructor for the AutoSimilarityHandler object
 
Method Summary
 double computeSimilarity(java.lang.Object one, java.lang.Object two, double maxDiff, double maxSim)
          Description of the Method
 boolean handles(java.lang.Object one, java.lang.Object two)
          Description of the Method
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AutoSimilarityHandler

public AutoSimilarityHandler()
Constructor for the AutoSimilarityHandler object


AutoSimilarityHandler

public AutoSimilarityHandler(int depth)
Constructor for the AutoSimilarityHandler object

Parameters:
depth - Description of the Parameter
Method Detail

handles

public boolean handles(java.lang.Object one,
                       java.lang.Object two)
Description of the Method

Specified by:
handles in interface SimilarityHandler
Parameters:
one - Description of the Parameter
two - Description of the Parameter
Returns:
Description of the Return Value

computeSimilarity

public double computeSimilarity(java.lang.Object one,
                                java.lang.Object two,
                                double maxDiff,
                                double maxSim)
Description of the Method

Specified by:
computeSimilarity in interface SimilarityHandler
Parameters:
one - Description of the Parameter
two - Description of the Parameter
maxDiff - Description of the Parameter
maxSim - Description of the Parameter
Returns:
Description of the Return Value