public class MetaObjectCophirKeywords extends MetaObjectArrayWeightedSum implements StringFieldDataProvider
weighted
sum of the distances
of the respective visual descriptors.Modifier and Type | Class and Description |
---|---|
static class |
MetaObjectCophirKeywords.CophirWeightedCosineDistanceFunction
Class for distance functions that compute distances on keyword vectors
of two
MetaObjectCophirKeywords }s using weighted Cosine distance. |
static class |
MetaObjectCophirKeywords.MetaObjectCophirKeywordsDistCosine
Object that holds only keywords and measures the distance as the
weighted Cosine distance with weights based on tf-idf algorithm.
|
static class |
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings
Extension of the MetaObjectCophirKeywords that preserves also the keyword
strings in both binary and Java serialization.
|
LocalAbstractObject.DataEqualObject, LocalAbstractObject.TextStreamFactory<T extends LocalAbstractObject>, LocalAbstractObject.TrivialDistanceFunction
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
keywordStrings
Array of keyword strings that are represented by the KeyWordsType identifiers
|
objects
counterDistanceComputations, counterLowerBoundDistanceComputations, counterPrecomputedDistanceSavings, counterUpperBoundDistanceComputations, MAX_DISTANCE, MIN_DISTANCE, suppData, trivialDistanceFunction, UNKNOWN_DISTANCE
Modifier | Constructor and Description |
---|---|
protected |
MetaObjectCophirKeywords(BinaryInput input,
BinarySerializator serializator)
Creates a new instance of MetaObjectCophirKeywords loaded from binary input.
|
|
MetaObjectCophirKeywords(java.io.BufferedReader stream)
Creates a new instance of MetaObjectCophirKeywords from a stream.
|
|
MetaObjectCophirKeywords(java.io.BufferedReader stream,
int wordLines,
int keywordStringLines)
Creates a new instance of MetaObjectCophirKeywords from a stream.
|
|
MetaObjectCophirKeywords(MetaObject metaObject)
Creates a new instance of MetaObjectCophirKeywords from another
MetaObject . |
|
MetaObjectCophirKeywords(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects)
Creates a new instance of MetaObjectCophirKeywords with the given encapsulated objects.
|
|
MetaObjectCophirKeywords(java.lang.String locatorURI,
java.util.Map<java.lang.String,? extends LocalAbstractObject> objects,
java.lang.String[] keywordStrings)
Creates a new instance of MetaObjectCophirKeywords with the given encapsulated objects.
|
|
MetaObjectCophirKeywords(java.lang.String locatorURI,
ObjectGPSCoordinate location,
ObjectColorLayout colorLayout,
ObjectShortVectorL1 colorStructure,
ObjectVectorEdgecomp edgeHistogram,
ObjectHomogeneousTexture homogeneousTexture,
ObjectIntVectorL1 scalableColor,
ObjectIntMultiVectorCosine keywords,
java.lang.String[] keywordStrings)
Creates a new instance of MetaObjectCophirKeywords with the given encapsulated objects.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String[] |
getDescriptorNames()
Returns the list of the names of the possible encapsulated objects.
|
ObjectIntMultiVectorCosine |
getKeywordsObject()
Returns the encapsulated "KeyWordsType" object.
|
float |
getMaxDistance()
Returns a maximal possible distance for this class.
|
protected java.lang.String |
getObjectName(int index)
Returns the name of the fixed object with the given
index . |
java.lang.String |
getStringData()
Returns the textual data provided by this object.
|
java.lang.String |
getStringData(java.lang.String fieldName)
Returns the textual data for field
fieldName provided by this object. |
java.util.Collection<java.lang.String> |
getStringDataFields()
Returns the names of the textual data fields of this object.
|
protected float |
getWeight(int index)
Returns the weight used for the
index th encapsulated object distance in the overall distance sum. |
static float[] |
getWeights()
Returns the weights used for the respective encapsulated objects to compute overall distance.
|
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings |
wrapWithKwStringSerialization()
Returns this object encapsulated in
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings . |
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings |
wrapWithTitleOnlySerialization()
Returns this object only with title encapsulated in
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings . |
protected void |
writeData(java.io.OutputStream stream)
Store this object's data to a text stream.
|
getDistanceImpl
binarySerialize, createClassArray, getBinarySize, getObject, getObject, getObjectCount, getObjectMap, getObjectNames, getObjects, readObjects
clearSurplusData, containsObject, createMetaDistancesHolder, createSearchMetaObject, dataEquals, dataHashCode, fillMetaDistances, fillMetaDistances, getDistanceImpl, getObjectFromMap, getSize, implementationGetDistance, readObject, readObject, readObjects, readObjects, readObjectsHeader, toString, writeObjects, writeObjectsHeader
clone, clone, cloneRandomlyModify, create, create, excludeUsingPrecompDist, getDistance, getDistance, getDistance, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceFilter, getDistanceLowerBound, getDistanceLowerBoundImpl, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceStorePrecomputed, getDistanceUpperBound, getDistanceUpperBoundImpl, getFieldsForNames, getNormDistance, getPrecomputedDistance, getPrecomputedDistance, getRandomChar, getRandomNormal, chainDestroy, chainFilter, includeUsingPrecompDist, isDistanceCompatible, parseObjectComment, peekNextChar, readAttributesFromStream, readObjectComments, readObjectCommentsWithoutData, unchainFilter, write, write, writeAttributesToStream, writeObjectComment
clone, getLocatorURI, getNoDataObject, getObjectKey, getObjectKey, getObjectLocatorURI, setObjectKey
protected transient java.lang.String[] keywordStrings
public MetaObjectCophirKeywords(java.lang.String locatorURI, ObjectGPSCoordinate location, ObjectColorLayout colorLayout, ObjectShortVectorL1 colorStructure, ObjectVectorEdgecomp edgeHistogram, ObjectHomogeneousTexture homogeneousTexture, ObjectIntVectorL1 scalableColor, ObjectIntMultiVectorCosine keywords, java.lang.String[] keywordStrings)
locatorURI
- the locator URI for the new objectlocation
- the GPS location objectcolorLayout
- the color layout MPEG7 visual descriptorcolorStructure
- the color structure MPEG7 visual descriptoredgeHistogram
- the edge histogram MPEG7 visual descriptorhomogeneousTexture
- the homogeneous texture MPEG7 visual descriptorscalableColor
- the scalable color MPEG7 visual descriptorkeywords
- the keyword identifiers in multi-vector (representing title, description, and tags)keywordStrings
- the keyword strings that are represented by the keyword identifiers multi-vectorpublic MetaObjectCophirKeywords(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends LocalAbstractObject> objects, java.lang.String[] keywordStrings)
locatorURI
- the locator URI for the new objectobjects
- the encapsulated objects to add (keys should match the descriptorNames
)keywordStrings
- the keyword strings that are represented by the keyword identifiers multi-vectorpublic MetaObjectCophirKeywords(java.lang.String locatorURI, java.util.Map<java.lang.String,? extends LocalAbstractObject> objects)
locatorURI
- the locator URI for the new objectobjects
- the encapsulated objects to add (keys should match the descriptorNames
)public MetaObjectCophirKeywords(MetaObject metaObject)
MetaObject
.metaObject
- the meta object the encapsulated objects of which to add (keys should match the descriptorNames
)public MetaObjectCophirKeywords(java.io.BufferedReader stream, int wordLines, int keywordStringLines) throws java.io.IOException, java.lang.NumberFormatException
stream
- text stream to read the data fromwordLines
- number of lines the keyword identifiers are stored on (zero, one, or multiple)keywordStringLines
- number of lines the keyword strings are stored on (zero, one, or multiple)java.io.IOException
- when an error appears during reading from given stream;
EOFException
is thrown when end-of-file of the given stream is reachedjava.lang.NumberFormatException
- when the line with the descriptor is not validpublic MetaObjectCophirKeywords(java.io.BufferedReader stream) throws java.io.IOException
stream
- text stream to read the data fromjava.io.IOException
- when an error appears during reading from given stream;
EOFException
is thrown when end-of-file of the given stream is reachedjava.lang.NumberFormatException
- when the line with the descriptor is not validprotected MetaObjectCophirKeywords(BinaryInput input, BinarySerializator serializator) throws java.io.IOException
input
- the input to read the MetaObject fromserializator
- the serializator used to write objectsjava.io.IOException
- if there was an I/O error reading from the bufferpublic static java.lang.String[] getDescriptorNames()
protected java.lang.String getObjectName(int index)
MetaObjectArray
index
.
By default, this implementation returns "ObjectX" where X is the given
index
. However, this method should be overridden to give
the real name of the object if appropriate (e.g. from a static array of names).getObjectName
in class MetaObjectArray
index
- the fixed index of the object the name of which to getindex
th objectpublic ObjectIntMultiVectorCosine getKeywordsObject()
public static float[] getWeights()
protected float getWeight(int index)
MetaObjectArrayWeightedSum
index
th encapsulated object distance in the overall distance sum.getWeight
in class MetaObjectArrayWeightedSum
index
- the fixed index of the object the weight of which to getindex
th encapsulated objectpublic float getMaxDistance()
LocalAbstractObject
LocalAbstractObject.MAX_DISTANCE
.getMaxDistance
in class MetaObjectArrayWeightedSum
protected void writeData(java.io.OutputStream stream) throws java.io.IOException
LocalAbstractObject
writeData
in class MetaObjectArray
stream
- the stream to store this object tojava.io.IOException
- if there was an error while writing to streampublic java.lang.String getStringData()
StringDataProvider
getStringData
in interface StringDataProvider
public java.util.Collection<java.lang.String> getStringDataFields()
StringFieldDataProvider
getStringDataFields
in interface StringFieldDataProvider
public java.lang.String getStringData(java.lang.String fieldName) throws java.lang.IllegalArgumentException
StringFieldDataProvider
fieldName
provided by this object.getStringData
in interface StringFieldDataProvider
fieldName
- the name of the field the data of which to returnfieldName
java.lang.IllegalArgumentException
- if the given field name is unknown for this data providerpublic MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings wrapWithKwStringSerialization()
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings
.MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings
public MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings wrapWithTitleOnlySerialization()
MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings
.MetaObjectCophirKeywords.MetaObjectCophirKeywordsWithTKStrings