Class QGramSimilarityMeasure

  • All Implemented Interfaces:
    IMeasure, IStringMeasure

    public class QGramSimilarityMeasure
    extends StringMeasure
    Author:
    Axel-C. Ngonga Ngomo (ngonga@informatik.uni-leipzig.de)
    • Constructor Detail

      • QGramSimilarityMeasure

        public QGramSimilarityMeasure​(int q)
      • QGramSimilarityMeasure

        public QGramSimilarityMeasure()
    • Method Detail

      • getSimilarity

        public double getSimilarity​(String x,
                                    String y)
      • getPrefixLength

        public int getPrefixLength​(int tokensNumber,
                                   double threshold)
        Description copied from interface: IStringMeasure
        Length of prefix to consider when mapping the input string with other strings.
        Parameters:
        tokensNumber - Size of input string in
        threshold - Similarity threshold
        Returns:
        Prefix length
      • getMidLength

        public int getMidLength​(int tokensNumber,
                                double threshold)
        Description copied from interface: IStringMeasure
        Theshold for the length of the tokens to be indexed
        Parameters:
        tokensNumber - Number of tokens of current input
        threshold - Similarity threshold
        Returns:
        Length of tokens to be indexed
      • getSizeFilteringThreshold

        public double getSizeFilteringThreshold​(int tokensNumber,
                                                double threshold)
      • getAlpha

        public int getAlpha​(int xTokensNumber,
                            int yTokensNumber,
                            double threshold)
        Description copied from interface: IStringMeasure
        Threshold for the positional filtering
        Parameters:
        xTokensNumber - Size of the first input string
        yTokensNumber - Size of the first input string
        threshold - Similarity threshold
        Returns:
        Threshold for positional filtering
      • getSimilarity

        public double getSimilarity​(int overlap,
                                    int lengthA,
                                    int lengthB)
        Description copied from interface: IStringMeasure
        Returns the similarity of two strings given their length and the overlap. Useful when these values are known so that no computation of known values have to be carried out anew
        Parameters:
        overlap - Overlap of strings A and B
        lengthA - Length of A
        lengthB - Length of B
        Returns:
        Similarity of A and B
      • computableViaOverlap

        public boolean computableViaOverlap()
        Description copied from interface: IStringMeasure
        Returns true if this similarity function can be computed just via the getSimilarity(overlag, lengthA, lengthB)
        Returns:
        True if it's possible, else false;
      • getSimilarity

        public double getSimilarity​(Object object1,
                                    Object object2)
        Description copied from interface: IMeasure
        Returns the similarity between two objects.
        Parameters:
        object1 - , the source object
        object2 - , the target object
        Returns:
        The similarity of the objects
      • getType

        public String getType()
        Description copied from interface: IMeasure
        Returns type of a measure.
        Returns:
        The runtime of the measure
      • getSimilarity

        public double getSimilarity​(Instance instance1,
                                    Instance instance2,
                                    String property1,
                                    String property2)
        Description copied from interface: IMeasure
        Returns the similarity between two instances, given their corresponding properties.
        Parameters:
        instance1 - , the source instance
        instance2 - , the target instance
        property1 - , the source property
        property2 - , the target property
        Returns:
        The similarity of the instances
      • getName

        public String getName()
        Description copied from interface: IMeasure
        Returns name of a measure.
        Returns:
        Measure name as a string
      • getRuntimeApproximation

        public double getRuntimeApproximation​(double mappingSize)
        Description copied from interface: IMeasure
        Returns the runtime approximation of a measure.
        Parameters:
        mappingSize - , the mapping size returned by the measure
        Returns:
        The runtime of the measure