int vSpanBegin = aVSpan.getRanges().stream().mapToInt(VRange::getBegin).min().getAsInt(); int vSpanEnd = aVSpan.getRanges().stream().mapToInt(VRange::getEnd).max().getAsInt(); return new Span(aVSpan.getVid().toString(), firstLine.getPage(), aColor, annotatedText, firstLine.getPosition(), lastLine.getPosition()); } catch (MultipleMatchesFoundException e) { aVSpan.getVid(), annotatedText); break; return new Span(aVSpan.getVid().toString(), -1, null, annotatedText, -1, -1);
public void add(VSpan aSpan) { if (arcs.containsKey(aSpan.getVid()) || spans.containsKey(aSpan.getVid())) { throw new IllegalStateException("Annotation [" + aSpan.getVid() + "] already exists."); } spans.put(aSpan.getVid(), aSpan); annotationLayers.put(aSpan.getLayer().getId(), aSpan.getLayer()); spansByLayer.put(aSpan.getLayer().getId(), aSpan); }
List<Offsets> offsets = toOffsets(vspan.getRanges()); String bratLabelText = TypeUtil.getUiLabelText(typeAdapter, vspan.getFeatures()); String bratHoverText = TypeUtil.getUiHoverText(typeAdapter, vspan.getHoverFeatures()); String color; if (vspan.getColorHint() == null) { color = getColor(vspan, coloringStrategy, bratLabelText); } else { color = vspan.getColorHint(); aResponse.addEntity(new Entity(vspan.getVid(), vspan.getType(), offsets, bratLabelText, color, bratHoverText));
vspan.getFeatures()); anno.setId(vspan.getVid().toString()); anno.setText(bratLabelText); anno.setRanges(toRanges(vspan.getRanges())); annotations.add(anno);
String labelText = TypeUtil.getUiLabelText(typeAdapter, vspan.getFeatures()); String color; if (vspan.getColorHint() == null) { color = getColor(vspan, coloringStrategy, labelText); } else { color = vspan.getColorHint(); pdfAnnoModel.addSpan(span); } else { pdfAnnoModel.addUnmatchedSpan(vspan.getVid().getId());
String labelText = TypeUtil.getUiLabelText(typeAdapter, vspan.getFeatures()); String color; if (vspan.getColorHint() == null) { color = getColor(vspan, coloringStrategy, labelText); } else { color = vspan.getColorHint();
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VSpan> annoToSpanIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } // Since we split spans into multiple ranges at sentence boundaries, we can simply check // if there are multiple ranges for a given span. This is cheaper than checking for // every annotation whether the begin/end offset is in the same sentence. for (Entry<AnnotationFS, VSpan> e : annoToSpanIdx.entrySet()) { if (e.getValue().getRanges().size() > 1) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } }
featureAnnotation.put(ao.getFeature(), annotation); VSpan v = new VSpan(layer, vid, bratTypeName, new VRange(ao.getBegin() - windowBegin, ao.getEnd() - windowBegin), featureAnnotation, Collections.emptyMap(), color);
List<Offsets> offsets = toOffsets(vspan.getRanges()); String bratLabelText = TypeUtil.getUiLabelText(typeAdapter, vspan.getFeatures()); String bratHoverText = TypeUtil.getUiHoverText(typeAdapter, vspan.getHoverFeatures()); String color; if (vspan.getColorHint() == null) { color = getColor(vspan, coloringStrategy, bratLabelText); } else { color = vspan.getColorHint(); aResponse.addEntity(new Entity(vspan.getVid(), vspan.getType(), offsets, bratLabelText, color, bratHoverText));
vspan.getFeatures()); anno.setId(vspan.getVid().toString()); anno.setText(bratLabelText); anno.setRanges(toRanges(vspan.getRanges())); annotations.add(anno);
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VSpan> annoToSpanIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } // Since we split spans into multiple ranges at sentence boundaries, we can simply check // if there are multiple ranges for a given span. This is cheaper than checking for // every annotation whether the begin/end offset is in the same sentence. for (Entry<AnnotationFS, VSpan> e : annoToSpanIdx.entrySet()) { if (e.getValue().getRanges().size() > 1) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } }
linkFs.getEnd() - windowBeginOffset); VSpan span = new VSpan(typeAdapter.getLayer(), linkFs, bratTypeName, offsets, colorIndex, singletonMap("label", bratLabelText), singletonMap("label", bratHoverText));
int vSpanBegin = aVSpan.getRanges().stream().mapToInt(VRange::getBegin).min().getAsInt(); int vSpanEnd = aVSpan.getRanges().stream().mapToInt(VRange::getEnd).max().getAsInt(); return new Span(aVSpan.getVid().getId(), firstLine.getPage(), aColor, annotatedText, firstLine.getPosition(), lastLine.getPosition()); } catch (MultipleMatchesFoundException e) { + aVSpan.getVid().toString()); break;
public void add(VSpan aSpan) { if (arcs.containsKey(aSpan.getVid()) || spans.containsKey(aSpan.getVid())) { throw new IllegalStateException("Annotation [" + aSpan.getVid() + "] already exists."); } spans.put(aSpan.getVid(), aSpan); annotationLayers.put(aSpan.getLayer().getId(), aSpan.getLayer()); spansByLayer.put(aSpan.getLayer().getId(), aSpan); }
linkFs.getEnd() - windowBeginOffset); VSpan span = new VSpan(typeAdapter.getLayer(), linkFs, bratTypeName, offsets, colorIndex, singletonMap("label", bratLabelText), singletonMap("label", bratHoverText));
aWindowBegin, aWindowEnd, fs); VSpan span = new VSpan(typeAdapter.getLayer(), fs, bratTypeName, ranges, features, hoverFeatures);
aWindowBegin, aWindowEnd, fs); VSpan span = new VSpan(typeAdapter.getLayer(), fs, bratTypeName, ranges, features, hoverFeatures);