public class ObjectStringEditDist extends ObjectString
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
text
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
|
ObjectStringEditDist()
Creates a new instance of ObjectStringEditDist with randomly generated string content.
|
protected |
ObjectStringEditDist(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of ObjectString loaded from binary input buffer.
|
|
ObjectStringEditDist(java.io.BufferedReader stream)
Creates a new instance of ObjectString from text stream.
|
|
ObjectStringEditDist(int minLength,
int maxLength)
Creates a new instance of ObjectStringEditDist with randomly generated string content.
|
|
ObjectStringEditDist(java.lang.String text)
Creates a new instance of ObjectStringEditDist.
|
|
ObjectStringEditDist(java.lang.String text,
java.lang.String locatorURI)
Creates a new instance of ObjectStringEditDist.
|
Modifier and Type | Method and Description |
---|---|
protected float |
getDistanceImpl(LocalAbstractObject obj,
float distThreshold)
The actual implementation of the metric function (see
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject) for full explanation). |
protected float |
getDistanceLowerBoundImpl(LocalAbstractObject obj,
int accuracy)
Implementation that actually computes the lower bound on the metric distance.
|
protected float |
getDistanceUpperBoundImpl(LocalAbstractObject obj,
int accuracy)
Implementation that actually computes the upper bound on the metric distance.
|
protected int |
getChangeWeight(char chr1,
char chr2)
Returns the weight of changing
char1 into char2 during
the edit distance computation. |
protected int |
getInsertDeleteWeight()
Returns the weight of deleting or inserting a character during
the edit distance computation.
|
binarySerialize, cloneRandomlyModify, dataEquals, dataHashCode, generateRandom, getBinarySize, getObjectKey, getSize, getStringData, getStringLength, toString, writeData
clearSurplusData, clone, clone, create, create, createMetaDistancesHolder, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getFieldsForNames, getMaxDistance, getNormDistance, getPrecomputedDistance, getPrecomputedDistance, getRandomChar, getRandomNormal, chainDestroy, chainFilter, includeUsingPrecompDist, isDistanceCompatible, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectLocatorURI, setObjectKey
public ObjectStringEditDist(java.lang.String text)
text
- the string content of the new objectpublic ObjectStringEditDist(java.lang.String text, java.lang.String locatorURI)
text
- the string content of the new objectlocatorURI
- the locator URI for the new objectpublic ObjectStringEditDist()
public ObjectStringEditDist(int minLength, int maxLength)
minLength
characters
and at most maxLength
characters.minLength
- minimal length of the randomly generated string contentmaxLength
- maximal length of the randomly generated string contentpublic ObjectStringEditDist(java.io.BufferedReader stream) throws java.io.EOFException, java.io.IOException
stream
- the stream from which to read lines of textjava.io.EOFException
- if the end-of-file of the given stream is reachedjava.io.IOException
- if there was an I/O error during reading from the streamprotected ObjectStringEditDist(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the buffer to read the ObjectString fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferprotected int getChangeWeight(char chr1, char chr2)
char1
into char2
during
the edit distance computation. The returned value must be greater than or
equal to zero and must be symmetric, that is getChangeWeight(x,y) == getChangeWeight(y,x)
.chr1
- the source characterchr2
- the target characterchar1
into char2
protected int getInsertDeleteWeight()
protected float getDistanceImpl(LocalAbstractObject obj, float distThreshold)
ObjectString
LocalAbstractObject.getDistance(messif.objects.LocalAbstractObject)
for full explanation).
The implementation should not increment distanceComputations statistics.
Implements a trivial distance, so that the ObjectString can be used directly.getDistanceImpl
in class ObjectString
obj
- the object to compute distance todistThreshold
- the threshold value on the distanceprotected float getDistanceLowerBoundImpl(LocalAbstractObject obj, int accuracy)
LocalAbstractObject
getDistanceLowerBoundImpl
in class LocalAbstractObject
obj
- the object to compute lower-bound distance toaccuracy
- the level of precision to use for lower-boundobj
protected float getDistanceUpperBoundImpl(LocalAbstractObject obj, int accuracy)
LocalAbstractObject
getDistanceUpperBoundImpl
in class LocalAbstractObject
obj
- the object to compute upper-bound distance toaccuracy
- the level of precision to use for upper-boundobj