/** * Returns the first prediction that matches recommendationId and recommenderId * in the given document. */ public Optional<AnnotationSuggestion> getPredictionByVID(SourceDocument aDocument, VID aVID) { return predictions.values().stream() .filter(f -> f.getDocumentName().equals(aDocument.getName())) .filter(f -> f.getId() == aVID.getSubId()) .filter(f -> f.getRecommenderId() == aVID.getId()) .findFirst(); }
return singletonMap(top.getRecommenderId(), asList(new Delta(top)));
AnnotationSuggestion top = get(0); if (top.isVisible()) { return singletonMap(top.getRecommenderId(), new Delta(top));
/** * * @param aLayerId * @param aPredictions - list of sentences containing recommendations */ public void putPredictions(long aLayerId, List<AnnotationSuggestion> aPredictions) { aPredictions.forEach(prediction -> { if (prediction.getLabel() != null) { predictions.put(new ExtendedId(user.getUsername(), project.getId(), prediction.getDocumentName(), aLayerId, prediction.getOffset(), prediction.getRecommenderId(), prediction.getId(), -1), prediction); } }); }
.containsKey(ao.getRecommenderId()) || labelMap.get(ao.getLabel()).get(ao.getRecommenderId()) .getConfidence() < ao.getConfidence()) { confidencePerClassifier.put(ao.getRecommenderId(), ao); labelMap.put(ao.getLabel(), confidencePerClassifier);
@Override public String getDetails(ActiveLearningSuggestionOfferedEvent aEvent) { try { Details details = new Details(); details.ann = new AnnotationDetails(); details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin()); details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd()); details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText()); details.ann.setType(aEvent.getLayer().getName()); details.annotationFeature = aEvent.getAnnotationFeature(); details.currentLabel = aEvent.getCurrentRecommendation().getLabel(); details.confidence = aEvent.getCurrentRecommendation().getConfidence(); details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId(); List<String> allLabelList = aEvent.getAllRecommendations().stream() .map(ao -> ao.getLabel()).collect(Collectors.toList()); details.allLabels = String.join(", ", allLabelList); return JSONUtil.toJsonString(details); } catch (IOException e) { log.error("Unable to log event [{}]", aEvent, e); return "<ERROR>"; } }
@Override public String getDetails(ActiveLearningRecommendationEvent aEvent) { try { ActiveLearningRecommendationDetails details = new ActiveLearningRecommendationDetails(); details.ann = new AnnotationDetails(); details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin()); details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd()); details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText()); details.ann.setType(aEvent.getLayer().getName()); details.annotationFeature = aEvent.getAnnotationFeature(); details.userAction = aEvent.getAction(); details.currentLabel = aEvent.getCurrentRecommendation().getLabel(); details.confidence = aEvent.getCurrentRecommendation().getConfidence(); details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId(); List<String> allLabelList = aEvent.getAllRecommendations().stream() .map(ao -> ao.getLabel()).collect(Collectors.toList()); details.allLabels = String.join(", ", allLabelList); return JSONUtil.toJsonString(details); } catch (IOException e) { log.error("Unable to log event [{}]", aEvent, e); return "<ERROR>"; } }
@Override public String getDetails(ActiveLearningSuggestionOfferedEvent aEvent) { try { Details details = new Details(); details.ann = new AnnotationDetails(); details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin()); details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd()); details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText()); details.ann.setType(aEvent.getLayer().getName()); details.annotationFeature = aEvent.getAnnotationFeature(); details.currentLabel = aEvent.getCurrentRecommendation().getLabel(); details.confidence = aEvent.getCurrentRecommendation().getConfidence(); details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId(); List<String> allLabelList = aEvent.getAllRecommendations().stream() .map(ao -> ao.getLabel()).collect(Collectors.toList()); details.allLabels = String.join(", ", allLabelList); return JSONUtil.toJsonString(details); } catch (IOException e) { log.error("Unable to log event [{}]", aEvent, e); return "<ERROR>"; } }
@Override public String getDetails(ActiveLearningRecommendationEvent aEvent) { try { ActiveLearningRecommendationDetails details = new ActiveLearningRecommendationDetails(); details.ann = new AnnotationDetails(); details.ann.setBegin(aEvent.getCurrentRecommendation().getBegin()); details.ann.setEnd(aEvent.getCurrentRecommendation().getEnd()); details.ann.setText(aEvent.getCurrentRecommendation().getCoveredText()); details.ann.setType(aEvent.getLayer().getName()); details.annotationFeature = aEvent.getAnnotationFeature(); details.userAction = aEvent.getAction(); details.currentLabel = aEvent.getCurrentRecommendation().getLabel(); details.confidence = aEvent.getCurrentRecommendation().getConfidence(); details.recommenderId = aEvent.getCurrentRecommendation().getRecommenderId(); List<String> allLabelList = aEvent.getAllRecommendations().stream() .map(ao -> ao.getLabel()).collect(Collectors.toList()); details.allLabels = String.join(", ", allLabelList); return JSONUtil.toJsonString(details); } catch (IOException e) { log.error("Unable to log event [{}]", aEvent, e); return "<ERROR>"; } }