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(); }
private void stepB() { _stepCount++; _nb = _ib.nextIndex(); _curb = _ib.next(); if (_log.isTraceEnabled()) { _log.trace(" -> B: " + _nb + "/" + _maxb + " " + _curb); } if (_curb.getBeginCharacter() < _cura.getEndCharacter()) { // Rewind A to the point where it was when we last stepped // up B. rewindA(); } else { _last_b_step_na = _na; } }
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 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()); } }
/** * 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 * * @param aDocumentName the given document name * @param aLayer the given layer * @param aBegin the offset character begin * @param aEnd the offset character end * @param aFeature the given annotation feature name * @return */ public List<AnnotationSuggestion> getPredictionsByTokenAndFeature(String aDocumentName, AnnotationLayer aLayer, int aBegin, int aEnd, String aFeature) { return predictions.entrySet().stream() .filter(f -> f.getKey().getDocumentName().equals(aDocumentName)) .filter(f -> f.getKey().getLayerId() == aLayer.getId()) .filter(f -> f.getKey().getOffset().getBeginCharacter() == aBegin) .filter(f -> f.getKey().getOffset().getEndCharacter() == aEnd) .filter(f -> f.getValue().getFeature().equals(aFeature)) .map(Map.Entry::getValue) .collect(Collectors.toList()); } }
while ((_na > _last_b_step_na) && (_cura.getEndCharacter() > _curb.getBeginCharacter())) { stepBackA(); steppedBack = true;
Offset offsetExpected = aoExpected.getOffset(); Offset offsetGenerated = aoGenerated.getOffset(); if (offsetExpected.getBeginCharacter() < offsetGenerated.getBeginCharacter()) { printAnnotationObjectComparison(sb, aoExpected, null, EXCEL_DELIMITER); if (itExpected.hasNext()) { else if (offsetExpected.getBeginCharacter() > offsetGenerated.getBeginCharacter()) { printAnnotationObjectComparison(sb, null, aoGenerated, EXCEL_DELIMITER); if (itGenerated.hasNext()) {
&& (nexta.getBeginCharacter() <= _curb.getEndCharacter()); final boolean cura_ends_before_or_with_curb = _cura.getEndCharacter() <= _curb .getEndCharacter();