Search in sources :

Example 1 with RetrievalResultCSVExporter

use of org.vitrivr.cineast.standalone.listener.RetrievalResultCSVExporter in project cineast by vitrivr.

the class RetrieveCommand method run.

public void run() {
    final ContinuousRetrievalLogic retrieval = new ContinuousRetrievalLogic(Config.sharedConfig().getDatabase());
    if (export) {
        retrieval.addRetrievalResultListener(new RetrievalResultCSVExporter(Config.sharedConfig().getDatabase()));
    }
    QueryConfig qc = QueryConfig.newQueryConfigFromOther(new ConstrainedQueryConfig("cli-query", new ArrayList<>()));
    if (relevantSegments != null && !relevantSegments.isEmpty()) {
        String[] segments = relevantSegments.split(",");
        for (String segment : segments) {
            qc.addRelevantSegmentIds(segment);
        }
    }
    qc.setMaxResults(Config.sharedConfig().getRetriever().getMaxResults());
    qc.setResultsPerModule(Config.sharedConfig().getRetriever().getMaxResultsPerModule());
    final List<SegmentScoreElement> results = retrieval.retrieve(this.segmentId, this.category, qc);
    System.out.println("results:");
    results.forEach(System.out::println);
    System.out.println();
}
Also used : ConstrainedQueryConfig(org.vitrivr.cineast.standalone.config.ConstrainedQueryConfig) QueryConfig(org.vitrivr.cineast.core.config.QueryConfig) ConstrainedQueryConfig(org.vitrivr.cineast.standalone.config.ConstrainedQueryConfig) SegmentScoreElement(org.vitrivr.cineast.core.data.score.SegmentScoreElement) ContinuousRetrievalLogic(org.vitrivr.cineast.standalone.util.ContinuousRetrievalLogic) ArrayList(java.util.ArrayList) RetrievalResultCSVExporter(org.vitrivr.cineast.standalone.listener.RetrievalResultCSVExporter)

Aggregations

ArrayList (java.util.ArrayList)1 QueryConfig (org.vitrivr.cineast.core.config.QueryConfig)1 SegmentScoreElement (org.vitrivr.cineast.core.data.score.SegmentScoreElement)1 ConstrainedQueryConfig (org.vitrivr.cineast.standalone.config.ConstrainedQueryConfig)1 RetrievalResultCSVExporter (org.vitrivr.cineast.standalone.listener.RetrievalResultCSVExporter)1 ContinuousRetrievalLogic (org.vitrivr.cineast.standalone.util.ContinuousRetrievalLogic)1