public class NCDComparator extends ComparisonBasedSkipExtendedComparator<StringValue>
Modifier and Type | Class and Description |
---|---|
static class |
NCDComparator.CompressorType
This class contains all possible CompressorTypes for this NCD
implementation.
|
Constructor and Description |
---|
NCDComparator() |
Modifier and Type | Method and Description |
---|---|
double |
calculateNCD(String x,
String y)
Returns the normalized compression distance between two input strings
according to the compressor currently set.
|
double |
compare(StringValue a,
StringValue b)
This has to return a distance between a and b with the following
restrictions:
The return value has to lie between 0 and 1.
|
double |
comparisonDerivative(int paramIdx,
StringValue a,
StringValue b)
This should implement the local derivative calculation in case of
comparisons.
|
boolean |
equals(Object obj) |
NCDComparator.CompressorType |
getCompressor() |
int |
getNumberOfComparisonParameters()
Implementing classes should return the number of (derivative-relevant)
parameters used for the compare-function.
|
ValueType |
getType() |
int |
hashCode() |
void |
setCompressor(NCDComparator.CompressorType compressor) |
SparseLocalDerivative |
sparseComparisonDerivative(StringValue a,
StringValue b)
This should implement the local derivative calculation in case of
comparisons.
|
calculateLocalDerivative, calculateSparseLocalDerivative, delete, getDeleteComparison, getInsertComparison, getSkipDeleteComparison, getSkipFactor, getSkipInsertComparison, insert, isDynamic, setDeleteComparison, setDynamic, setInsertComparison, setSkipDeleteComparison, setSkipFactor, setSkipInsertComparison, skipDelete, skipInsert
getDeletionCost, getInsertionCost, getNumberOfParameters, getResultClass, getSkipDeletionCost, getSkipInsertionCost, setDeletionCost, setInsertionCost, setSkipDeletionCost, setSkipInsertionCost, transformToResult
public void setCompressor(NCDComparator.CompressorType compressor)
public NCDComparator.CompressorType getCompressor()
public double compare(StringValue a, StringValue b)
a
- the left input.b
- the right input.public ValueType getType()
public int hashCode()
hashCode
in class ComparisonBasedSkipExtendedComparator<StringValue>
public boolean equals(Object obj)
equals
in class ComparisonBasedSkipExtendedComparator<StringValue>
public double calculateNCD(String x, String y)
x
- first input string.y
- second input string.public double comparisonDerivative(int paramIdx, StringValue a, StringValue b)
comparisonDerivative
in class SkipExtendedComparator<StringValue>
paramIdx
- the index of the parameter the alignment is currently
derived to. Note that the first four parameters (0-3) are reserved for
the parameters of this superclass.a
- the value on the left side of the comparison.b
- the value on the right side of the comparison.public SparseLocalDerivative sparseComparisonDerivative(StringValue a, StringValue b)
sparseComparisonDerivative
in class SkipExtendedComparator<StringValue>
a
- the value on the left side of the comparison.b
- the value on the right side of the comparison.public int getNumberOfComparisonParameters()
getNumberOfComparisonParameters
in class SkipExtendedComparator<StringValue>
Copyright (C) 2013, 2014 Benjamin Paaßen, Charlie Krüger, Georg Zentgraf, AG Theoretical Computer Science, Centre of Excellence Cognitive Interaction Technology (CITEC), University of Bielefeld, licensed under the AGPL v. 3: http://openresearch.cit-ec.de/projects/tcs