private void setCurationSegmentBeginEnd(JCas aEditorCas) throws UIMAException, ClassNotFoundException, IOException { AnnotatorState state = getModelObject(); curationSegment.setBegin(state.getWindowBeginOffset()); curationSegment.setEnd(state.getWindowEndOffset()); }
private void setCurationSegmentBeginEnd(JCas aEditorCas) throws UIMAException, ClassNotFoundException, IOException { AnnotatorState state = getModelObject(); curationSegment.setBegin(state.getWindowBeginOffset()); curationSegment.setEnd(state.getWindowEndOffset()); }
private void setCurationSegmentBeginEnd(JCas aEditorCas) throws UIMAException, ClassNotFoundException, IOException { AnnotatorState state = getModelObject(); curationSegment.setBegin(state.getWindowBeginOffset()); curationSegment.setEnd(state.getWindowEndOffset()); }
private void render(GetDocumentResponse response, JCas aJCas) { AnnotatorState aState = getModelObject(); VDocument vdoc = render(aJCas, aState.getWindowBeginOffset(), aState.getWindowEndOffset()); BratRenderer.render(response, aState, vdoc, aJCas, annotationService); }
private void render(GetDocumentResponse response, JCas aJCas) { AnnotatorState aState = getModelObject(); VDocument vdoc = render(aJCas, aState.getWindowBeginOffset(), aState.getWindowEndOffset()); BratRenderer.render(response, aState, vdoc, aJCas, annotationService); }
private String render(JCas aJcas, AnnotatorState aBratAnnotatorModel, ColoringStrategy aCurationColoringStrategy) throws IOException { List<AnnotationLayer> layersToRender = new ArrayList<>(); for (AnnotationLayer layer : aBratAnnotatorModel.getAnnotationLayers()) { boolean isSegmentationLayer = layer.getName().equals(Token.class.getName()) || layer.getName().equals(Sentence.class.getName()); boolean isUnsupportedLayer = layer.getType().equals(CHAIN_TYPE); if (layer.isEnabled() && !isSegmentationLayer && !isUnsupportedLayer) { layersToRender.add(layer); } } VDocument vdoc = new VDocument(); preRenderer.render(vdoc, aBratAnnotatorModel.getWindowBeginOffset(), aBratAnnotatorModel.getWindowEndOffset(), aJcas, layersToRender); GetDocumentResponse response = new GetDocumentResponse(); BratRenderer.render(response, aBratAnnotatorModel, vdoc, aJcas, annotationService, aCurationColoringStrategy); return JSONUtil.toInterpretableJsonString(response); }
private String render(JCas aJcas, AnnotatorState aBratAnnotatorModel, ColoringStrategy aCurationColoringStrategy) throws IOException { List<AnnotationLayer> layersToRender = new ArrayList<>(); for (AnnotationLayer layer : aBratAnnotatorModel.getAnnotationLayers()) { boolean isSegmentationLayer = layer.getName().equals(Token.class.getName()) || layer.getName().equals(Sentence.class.getName()); boolean isUnsupportedLayer = layer.getType().equals(CHAIN_TYPE); if (layer.isEnabled() && !isSegmentationLayer && !isUnsupportedLayer) { layersToRender.add(layer); } } VDocument vdoc = new VDocument(); preRenderer.render(vdoc, aBratAnnotatorModel.getWindowBeginOffset(), aBratAnnotatorModel.getWindowEndOffset(), aJcas, layersToRender); GetDocumentResponse response = new GetDocumentResponse(); BratRenderer.render(response, aBratAnnotatorModel, vdoc, aJcas, annotationService, aCurationColoringStrategy); return JSONUtil.toInterpretableJsonString(response); }
AnnotatorState state = getModelObject(); if (state.getWindowBeginOffset() <= highlightSpan.getBegin() && highlightSpan.getEnd() <= state.getWindowEndOffset()) { aVDoc.add(new VTextMarker(this, VMarker.FOCUS, highlightSpan.getBegin() - state.getWindowBeginOffset(),
AnnotatorState state = getModelObject(); if (state.getWindowBeginOffset() <= highlightSpan.getBegin() && highlightSpan.getEnd() <= state.getWindowEndOffset()) { aVDoc.add(new VTextMarker(this, VMarker.FOCUS, highlightSpan.getBegin() - state.getWindowBeginOffset(),
private void reactToAnnotationsBeingCreatedOrDeleted(IPartialPageRequestHandler aTarget, AnnotationLayer aLayer) { try { AnnotatorState state = getModelObject(); ActiveLearningUserState alState = alStateModel.getObject(); // // Make sure we know about the current suggestions and their visibility state // refreshSuggestions(); // Update visibility in case the annotation where the feature was set overlaps with // any suggestions that need to be hidden now. PredictionTask.calculateVisibility(learningRecordService, annotationService, getAnnotationPage().getEditorCas(), state.getUser().getUsername(), aLayer, alState.getSuggestions(), state.getWindowBeginOffset(), state.getWindowEndOffset()); // Update the suggestion in the AL sidebar, but do not jump or touch the right // sidebar such that the user can happily continue to edit the annotation moveToNextRecommendation(aTarget, true); } catch (IOException e) { LOG.info("Error reading CAS: {}", e.getMessage()); error("Error reading CAS " + e.getMessage()); aTarget.addChildren(getPage(), IFeedback.class); } }
private void reactToAnnotationsBeingCreatedOrDeleted(IPartialPageRequestHandler aTarget, AnnotationLayer aLayer) { try { AnnotatorState state = getModelObject(); ActiveLearningUserState alState = alStateModel.getObject(); // // Make sure we know about the current suggestions and their visibility state // refreshSuggestions(); // Update visibility in case the annotation where the feature was set overlaps with // any suggestions that need to be hidden now. PredictionTask.calculateVisibility(learningRecordService, annotationService, getAnnotationPage().getEditorCas(), state.getUser().getUsername(), aLayer, alState.getSuggestions(), state.getWindowBeginOffset(), state.getWindowEndOffset()); // Update the suggestion in the AL sidebar, but do not jump or touch the right // sidebar such that the user can happily continue to edit the annotation moveToNextRecommendation(aTarget, true); } catch (IOException e) { LOG.info("Error reading CAS: {}", e.getMessage()); error("Error reading CAS " + e.getMessage()); aTarget.addChildren(getPage(), IFeedback.class); } }
private void createNewRelationAnnotation(RelationAdapter aAdapter, JCas aJCas) throws AnnotationException { LOG.trace("createNewRelationAnnotation()"); AnnotatorState state = getModelObject(); Selection selection = state.getSelection(); AnnotationFS originFs = selectByAddr(aJCas, selection.getOrigin()); AnnotationFS targetFs = selectByAddr(aJCas, selection.getTarget()); // Creating a relation AnnotationFS arc = aAdapter.add(state.getDocument(), state.getUser().getUsername(), originFs, targetFs, aJCas, state.getWindowBeginOffset(), state.getWindowEndOffset()); selection.selectArc(new VID(arc), originFs, targetFs); }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { if (selectedResult != null) { AnnotatorState state = aEvent.getState(); if (state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset()) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { if (selectedResult != null) { AnnotatorState state = aEvent.getState(); if (state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset()) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
/** * Show the next document if it exists, starting in a certain begin offset */ public void actionShowSelectedDocument(AjaxRequestTarget aTarget, SourceDocument aDocument, int aBegin, int aEnd) throws IOException { boolean switched = actionShowSelectedDocument(aTarget, aDocument); AnnotatorState state = getModelObject(); // If the document was not switched and the requested offset is already visible on screen, // then there is no need to change the screen contents if (switched || !(state.getWindowBeginOffset() <= aBegin && aEnd <= state.getWindowEndOffset())) { JCas jCas = getEditorCas(); int sentenceNumber = WebAnnoCasUtil.getSentenceNumber(jCas, aBegin); Sentence sentence = WebAnnoCasUtil.getSentence(jCas, aBegin); getGotoPageTextField().setModelObject(sentenceNumber); state.setFirstVisibleUnit(sentence); state.setFocusUnitIndex(sentenceNumber); } actionRefreshDocument(aTarget); }
int windowEnd = aState.getWindowEndOffset();
preRenderer.render(vdoc, aState.getWindowBeginOffset(), aState.getWindowEndOffset(), jcas, getLayersToRender());
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { AnnotatorState state = aEvent.getState(); if (selectedResult != null) { if ( // Check if match is in current document selectedResult.getDocumentId() == state.getDocument().getId() && // Check if match is in currently visible part of the document state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset() ) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
preRenderer.render(vdoc, aState.getWindowBeginOffset(), aState.getWindowEndOffset(), jcas, getLayersToRender());
preRenderer.render(vdoc, state.getWindowBeginOffset(), state.getWindowEndOffset(), jCas, schemaService.listAnnotationLayer(project));