Mercurial > hg > anteater
view src/de/mpiwg/anteater/results/AResultManager.java @ 0:036535fcd179
anteater
author | jdamerow |
---|---|
date | Fri, 14 Sep 2012 10:30:43 +0200 |
parents | |
children |
line wrap: on
line source
package de.mpiwg.anteater.results; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import de.mpiwg.anteater.AnteaterConfiguration; import de.mpiwg.anteater.text.TextInformation; public abstract class AResultManager<E extends IResult<?,?>> { private AnteaterConfiguration configuration; public AResultManager(AnteaterConfiguration configuration) { this.configuration = configuration; } protected abstract List<AnnotationTag> getSpecificSummaryTags(List<E> results, int textIndex); protected abstract List<AnnotationTag> getSpecificSuppleInfTags(List<E> applicants, int textIndex); public List<AnnotationTag> getSummaryTags(List<E> results, int textIndex) { return getSpecificSummaryTags(results, textIndex); } public List<AnnotationTag> getSuppleInfTags(List<E> results, int textIndex) { return getSpecificSuppleInfTags(results, textIndex); } public Map<TextInformation, List<E>> sortResultsByText(List<E> results) { configuration.getLogger().logMessage(getClass().getSimpleName(), "Sorting results by texts."); Map<TextInformation, List<E>> resultsPerText = new HashMap<TextInformation, List<E>>(); for (E r : results) { List<E> appResults = resultsPerText.get(r.getTextInfo()); if (appResults == null) { appResults = new ArrayList<E>(); resultsPerText.put(r.getTextInfo(), appResults); } appResults.add(r); } return resultsPerText; } public List<E> getPredictedResults(List<E> results) { List<E> predictedResults = new ArrayList<E>(); if (results == null) return predictedResults; for (E r : results) { if (r.getPrediction() >= 1.0) predictedResults.add(r); } return predictedResults; } }