/** * 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 */ public SuggestionDocumentGroup getPredictions(String aDocumentName, AnnotationLayer aLayer, int aWindowBegin, int aWindowEnd) { return new SuggestionDocumentGroup(getFlattenedPredictions(aDocumentName, aLayer, aWindowBegin, aWindowEnd)); }
@Override public String toString() { return getId(); } }
public GroupKey(AnnotationSuggestion aSuggestion) { super(); begin = aSuggestion.getBegin(); end = aSuggestion.getEnd(); feature = aSuggestion.getFeature(); layerId = aSuggestion.getLayerId(); }
private List<AnnotationSuggestion> getMatchingSuggestion(List<SuggestionGroup> aSuggestions, AnnotationSuggestion aSuggestion) { return getMatchingSuggestion(aSuggestions, aSuggestion.getDocumentName(), aSuggestion.getLayerId(), aSuggestion.getFeature(), aSuggestion.getBegin(), aSuggestion.getEnd(), aSuggestion.getLabel()); }
private void setHighlight(AnnotationSuggestion aSuggestion) { if (protectHighlight) { LOG.trace("Active learning sidebar not updating protected highlights"); protectHighlight = false; return; } LOG.trace("Active learning sidebar set highlight suggestion: {}", aSuggestion); highlightVID = aSuggestion.getVID(); highlightSpan = new Offset(aSuggestion.getBegin(), aSuggestion.getEnd()); highlightDocumentName = aSuggestion.getDocumentName(); }
private static void printAnnotationObject(StringBuilder sb, AnnotationObject ao, String delimiter) { if (ao == null) { return; } Offset offset = ao.getOffset(); sb.append(offset.getBeginCharacter()).append("..").append(offset.getEndCharacter()); sb.append(delimiter); sb.append(offset.getBeginToken()).append("..").append(offset.getEndToken()); sb.append(delimiter); sb.append(ao.getLabel()); sb.append(delimiter); sb.append(ao.getCoveredText()); }
private void setHighlight(LearningRecord aRecord) { LOG.trace("Active learning sidebar set highlight history record: {}", aRecord); highlightVID = null; highlightSpan = new Offset(aRecord.getOffsetCharacterBegin(), aRecord.getOffsetCharacterEnd()); highlightDocumentName = aRecord.getSourceDocument().getName(); // This is a bit of hack. Consider the following case: // - use removes an ACCEPT history item // - user clicks then on another history item // - ... but during the subsequent rendering the "moveToNextSuggestion" method sets or // clears the highlight. protectHighlight = true; }
@Override public String getPredictedFeature() { return recommender.getFeature().getName(); }
@Override public String getPredictedType() { return recommender.getLayer().getName(); }
public ExtendedId(String userName, long projectId, String documentName, long layerId, Offset offset, long recommenderId, int annotationId, int sentenceId) { super(); this.userName = userName; this.projectId = projectId; this.documentName = documentName; this.layerId = layerId; this.annotationId = annotationId; this.sentenceId = sentenceId; this.recommenderId = recommenderId; this.begin = offset.getBeginCharacter(); this.end = offset.getEndCharacter(); }
public boolean overlaps(final Offset i) { // Cases: // // start end // | | // 1 ####### | // 2 | ####### // 3 #################################### // 4 | ####### | // | | return (((i.getStart() <= getStart()) && (getStart() < i.getEnd())) || // Case 1-3 ((i.getStart() < getEnd()) && (getEnd() <= i.getEnd())) || // Case 1-3 ((getStart() <= i.getStart()) && (i.getEnd() <= getEnd()))); // Case 4 } @Override
private void writeLearningRecordInDatabaseAndEventLog( AnnotationSuggestion aCurrentRecommendation, LearningRecordType aUserAction) { writeLearningRecordInDatabaseAndEventLog(aCurrentRecommendation, aUserAction, aCurrentRecommendation.getLabel()); }
@Override public String toString() { return getId(); } }
public static SuggestionGroupCollector collector() { return new SuggestionGroupCollector(); }
public Optional<AnnotationSuggestion> getSuggestion() { return currentDifference != null ? Optional.of(currentDifference.getFirst()) : Optional.empty(); }
private void setHighlight(AnnotationSuggestion aSuggestion) { if (protectHighlight) { LOG.trace("Active learning sidebar not updating protected highlights"); protectHighlight = false; return; } LOG.trace("Active learning sidebar set highlight suggestion: {}", aSuggestion); highlightVID = aSuggestion.getVID(); highlightSpan = new Offset(aSuggestion.getBegin(), aSuggestion.getEnd()); highlightDocumentName = aSuggestion.getDocumentName(); }
private static void printAnnotationObjectInverted(StringBuilder sb, AnnotationObject ao, String delimiter) { if (ao == null) { return; } Offset offset = ao.getOffset(); sb.append(ao.getCoveredText()); sb.append(delimiter); sb.append(ao.getLabel()); sb.append(delimiter); sb.append(offset.getBeginToken()).append("..").append(offset.getEndToken()); sb.append(delimiter); sb.append(offset.getBeginCharacter()).append("..").append(offset.getEndCharacter()); } }
public String getName() { return getId(); }
public String getName() { return getId(); }