Class Predictions
- java.lang.Object
-
- de.tudarmstadt.ukp.inception.recommendation.api.model.Predictions
-
- All Implemented Interfaces:
java.io.Serializable
public class Predictions extends java.lang.Object implements java.io.Serializable
Stores references to the recommendationService, the currently used JCas and the annotatorState. This class is widely used in the recommendation module. If the prediction task has run it stores the predicted annotations for an annotation layer in the predictions map.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Predictions(de.tudarmstadt.ukp.clarin.webanno.model.Project aProject, de.tudarmstadt.ukp.clarin.webanno.security.model.User aUser)
Predictions(de.tudarmstadt.ukp.clarin.webanno.model.Project aProject, de.tudarmstadt.ukp.clarin.webanno.security.model.User aUser, java.util.Map<ExtendedId,AnnotationSuggestion> aPredictions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearPredictions()
java.util.Optional<AnnotationSuggestion>
getPrediction(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument aDocument, int aBegin, int aEnd, java.lang.String aLabel)
Returns the prediction used to generate the VIDjava.util.Optional<AnnotationSuggestion>
getPredictionByVID(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument aDocument, de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.VID aVID)
Returns the first prediction that matches recommendationId and recommenderId in the given document.java.util.Map<ExtendedId,AnnotationSuggestion>
getPredictions()
SuggestionDocumentGroup
getPredictions(java.lang.String aDocumentName, de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer aLayer, int aWindowBegin, int aWindowEnd)
TODO #176 use the document Id once it it available in the CAS Get the predictions of a given window, where the outer list is a list of tokens and the inner list is a list of predictions for a tokenjava.util.List<AnnotationSuggestion>
getPredictionsByTokenAndFeature(java.lang.String aDocumentName, de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer aLayer, int aBegin, int aEnd, java.lang.String aFeature)
TODO #176 use the document Id once it it available in the CAS Returns a list of predictions for a given token that matches the given layer and the annotation feature in the given documentjava.util.Map<java.lang.String,SuggestionDocumentGroup>
getPredictionsForWholeProject(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer aLayer, de.tudarmstadt.ukp.clarin.webanno.api.DocumentService aDocumentService)
Get the predictions of a given window for each document, where the outer list is a list of tokens and the inner list is a list of predictions for a token.de.tudarmstadt.ukp.clarin.webanno.model.Project
getProject()
boolean
hasPredictions()
void
putPredictions(long aLayerId, java.util.List<AnnotationSuggestion> aPredictions)
void
removePredictions(java.lang.Long recommenderId)
-
-
-
Constructor Detail
-
Predictions
public Predictions(de.tudarmstadt.ukp.clarin.webanno.model.Project aProject, de.tudarmstadt.ukp.clarin.webanno.security.model.User aUser, java.util.Map<ExtendedId,AnnotationSuggestion> aPredictions)
-
Predictions
public Predictions(de.tudarmstadt.ukp.clarin.webanno.model.Project aProject, de.tudarmstadt.ukp.clarin.webanno.security.model.User aUser)
-
-
Method Detail
-
getPredictionsForWholeProject
public java.util.Map<java.lang.String,SuggestionDocumentGroup> getPredictionsForWholeProject(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer aLayer, de.tudarmstadt.ukp.clarin.webanno.api.DocumentService aDocumentService)
Get the predictions of a given window for each document, where the outer list is a list of tokens and the inner list is a list of predictions for a token. The method filters all tokens which already have an annotation and don't need further recommendation.
-
getPredictions
public SuggestionDocumentGroup getPredictions(java.lang.String aDocumentName, de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer aLayer, int aWindowBegin, int aWindowEnd)
TODO #176 use the document Id once it it available in the CAS Get the predictions of a given window, where the outer list is a list of tokens and the inner list is a list of predictions for a token
-
getPredictionByVID
public java.util.Optional<AnnotationSuggestion> getPredictionByVID(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument aDocument, de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.VID aVID)
Returns the first prediction that matches recommendationId and recommenderId in the given document.
-
getPrediction
public java.util.Optional<AnnotationSuggestion> getPrediction(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument aDocument, int aBegin, int aEnd, java.lang.String aLabel)
Returns the prediction used to generate the VID
-
putPredictions
public void putPredictions(long aLayerId, java.util.List<AnnotationSuggestion> aPredictions)
- Parameters:
aLayerId
-aPredictions
- - list of sentences containing recommendations
-
getProject
public de.tudarmstadt.ukp.clarin.webanno.model.Project getProject()
-
hasPredictions
public boolean hasPredictions()
-
getPredictions
public java.util.Map<ExtendedId,AnnotationSuggestion> getPredictions()
-
clearPredictions
public void clearPredictions()
-
removePredictions
public void removePredictions(java.lang.Long recommenderId)
-
getPredictionsByTokenAndFeature
public java.util.List<AnnotationSuggestion> getPredictionsByTokenAndFeature(java.lang.String aDocumentName, de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer aLayer, int aBegin, int aEnd, java.lang.String aFeature)
TODO #176 use the document Id once it it available in the CAS Returns a list of predictions for a given token that matches the given layer and the annotation feature in the given document- Parameters:
aDocumentName
- the given document nameaLayer
- the given layeraBegin
- the offset character beginaEnd
- the offset character endaFeature
- the given annotation feature name- Returns:
-
-