use of org.vitrivr.cineast.core.data.query.containers.ParameterisedLocationQueryTermContainer in project cineast by vitrivr.
the class SpatialDistance method getSimilar.
/**
* Returns similar <i>objects</i> to the feature data contained in the given segment container.
*/
@Override
public List<ScoreElement> getSimilar(SegmentContainer sc, ReadableQueryConfig qc) {
final QueryConfig mqc = QueryConfig.clone(qc);
if (sc instanceof ParameterisedLocationQueryTermContainer) {
if (((ParameterisedLocationQueryTermContainer) sc).getParameter().isPresent()) {
final String param = ((ParameterisedLocationQueryTermContainer) sc).getParameter().get();
mqc.setCorrespondenceFunctionIfEmpty(CorrespondenceFunction.hyperbolic(parseAndEvaluateHalfSimilarityDistance(param)));
}
}
return this.extractFeature(sc).map(ReadableFloatVector::toArray).map(array -> this.getSimilar(array, new ReadableQueryConfig(mqc))).orElse(Collections.emptyList());
}
Aggregations