private JCas getCas(Project aProject, User user, SourceDocument aDocument, Mode aMode) throws UIMAException, IOException, ClassNotFoundException { if (aMode.equals(Mode.ANNOTATION) || aMode.equals(Mode.AUTOMATION) || aMode.equals(Mode.CORRECTION) || aMode.equals(Mode.CORRECTION_MERGE)) { return repository.readJCas(aDocument, aProject, user); } else { return repository.getCurationDocumentContent(getModelObject().getDocument()); } }
@Override public String getColor(FeatureStructure aFS, String aLabel) { int address = BratAjaxCasUtil.getAddr(aFS); AnnotationSelection annotationSelection = annotationSelectionByAddress.get(address); AnnotationState newState = null; if (mode.equals(Mode.AUTOMATION) || mode.equals(Mode.CORRECTION)) { newState = getCorrectionState(annotationSelection, aAnnotationOptions, numUsers, address); } else { newState = getCurationState(numUsers, annotationSelection); } return newState.getColorCode(); } };
private JCas getJCas(AnnotatorState aState, AnnotationDocument aDocument) throws IOException { if (aState.getMode().equals(Mode.AUTOMATION) || aState.getMode().equals(Mode.CORRECTION)) { return correctionDocumentService.readCorrectionCas(aState.getDocument()); } else { return documentService.readAnnotationCas(aDocument); } }
private JCas getJCas(BratAnnotatorModel aModel, AnnotationDocument aDocument) throws IOException { try { if (aModel.getMode().equals(Mode.AUTOMATION) || aModel.getMode().equals(Mode.CORRECTION)) { return repository.getCorrectionDocumentContent(aModel .getDocument()); } else { return repository.getAnnotationDocumentContent(aDocument); } } catch (UIMAException e) { throw new IOException(e); } catch (ClassNotFoundException e) { throw new IOException(e); } }
private List<AnnotationLayer> getLayersToRender() { AnnotatorState state = getModelObject(); List<AnnotationLayer> layersToRender = new ArrayList<>(); for (AnnotationLayer layer : state.getAnnotationLayers()) { boolean isSegmentationLayer = layer.getName().equals(Token.class.getName()) || layer.getName().equals(Sentence.class.getName()); boolean isUnsupportedLayer = layer.getType().equals(CHAIN_TYPE) && (state.getMode().equals(Mode.AUTOMATION) || state.getMode().equals(Mode.CORRECTION) || state.getMode().equals(Mode.CURATION)); if (layer.isEnabled() && !isSegmentationLayer && !isUnsupportedLayer) { layersToRender.add(layer); } } return layersToRender; }
private List<AnnotationLayer> getLayersToRender() { AnnotatorState state = getModelObject(); List<AnnotationLayer> layersToRender = new ArrayList<>(); for (AnnotationLayer layer : state.getAnnotationLayers()) { boolean isSegmentationLayer = layer.getName().equals(Token.class.getName()) || layer.getName().equals(Sentence.class.getName()); boolean isUnsupportedLayer = layer.getType().equals(CHAIN_TYPE) && (state.getMode().equals(Mode.AUTOMATION) || state.getMode().equals(Mode.CORRECTION) || state.getMode().equals(Mode.CURATION)); if (layer.isEnabled() && !isSegmentationLayer && !isUnsupportedLayer) { layersToRender.add(layer); } } return layersToRender; }
private List<AnnotationLayer> getLayersToRender() { AnnotatorState state = getModelObject(); List<AnnotationLayer> layersToRender = new ArrayList<>(); for (AnnotationLayer layer : state.getAnnotationLayers()) { boolean isSegmentationLayer = layer.getName().equals(Token.class.getName()) || layer.getName().equals(Sentence.class.getName()); boolean isUnsupportedLayer = layer.getType().equals(CHAIN_TYPE) && (state.getMode().equals(Mode.AUTOMATION) || state.getMode().equals(Mode.CORRECTION) || state.getMode().equals(Mode.CURATION)); if (layer.isEnabled() && !isSegmentationLayer && !isUnsupportedLayer) { layersToRender.add(layer); } } return layersToRender; } }
private JCas getJCas(AnnotatorState aState, AnnotationDocument aDocument) throws IOException { if (aState.getMode().equals(Mode.AUTOMATION) || aState.getMode().equals(Mode.CORRECTION)) { return correctionDocumentService.readCorrectionCas(aState.getDocument()); } else { return documentService.readAnnotationCas(aDocument); } }
private List<AnnotationLayer> getLayersToRender() { AnnotatorState state = getModelObject(); List<AnnotationLayer> layersToRender = new ArrayList<>(); for (AnnotationLayer layer : state.getAnnotationLayers()) { boolean isSegmentationLayer = layer.getName().equals(Token.class.getName()) || layer.getName().equals(Sentence.class.getName()); boolean isUnsupportedLayer = layer.getType().equals(CHAIN_TYPE) && (state.getMode().equals(Mode.AUTOMATION) || state.getMode().equals(Mode.CORRECTION) || state.getMode().equals(Mode.CURATION)); if (layer.isEnabled() && !isSegmentationLayer && !isUnsupportedLayer) { layersToRender.add(layer); } } return layersToRender; } }
private JCas getCas(BratAnnotatorModel aBratAnnotatorModel) throws UIMAException, IOException, ClassNotFoundException { if (aBratAnnotatorModel.getMode().equals(Mode.ANNOTATION) || aBratAnnotatorModel.getMode().equals(Mode.AUTOMATION) || aBratAnnotatorModel.getMode().equals(Mode.CORRECTION) || aBratAnnotatorModel.getMode().equals(Mode.CORRECTION_MERGE)) { return repository.readJCas(aBratAnnotatorModel.getDocument(), aBratAnnotatorModel.getProject(), aBratAnnotatorModel.getUser()); } else { return repository.getCurationDocumentContent(bratAnnotatorModel.getDocument()); } }
private JCas getCas(BratAnnotatorModel aBratAnnotatorModel) throws UIMAException, IOException, ClassNotFoundException { if (aBratAnnotatorModel.getMode().equals(Mode.ANNOTATION) || aBratAnnotatorModel.getMode().equals(Mode.AUTOMATION) || aBratAnnotatorModel.getMode().equals(Mode.CORRECTION) || aBratAnnotatorModel.getMode().equals(Mode.CORRECTION_MERGE)) { return repository.readJCas(aBratAnnotatorModel.getDocument(), aBratAnnotatorModel.getProject(), aBratAnnotatorModel.getUser()); } else { return repository.getCurationDocumentContent(bratAnnotatorModel.getDocument()); } }
@Override public boolean isVisible() { return projectModel.getObject().getId() != 0 && projectModel.getObject().getMode().equals(Mode.AUTOMATION) && visible; } });
private void writeEditorCas(AnnotatorState aState, JCas aJCas) throws IOException { if (aState.getMode().equals(Mode.ANNOTATION) || aState.getMode().equals(Mode.AUTOMATION) || aState.getMode().equals(Mode.CORRECTION)) { documentService.writeAnnotationCas(aJCas, aState.getDocument(), aState.getUser(), true); updateDocumentTimestampAfterWrite(aState, documentService.getAnnotationCasTimestamp( aState.getDocument(), aState.getUser().getUsername())); } else if (aState.getMode().equals(Mode.CURATION)) { curationDocumentService.writeCurationCas(aJCas, aState.getDocument(), true); updateDocumentTimestampAfterWrite(aState, curationDocumentService .getCurationCasTimestamp(aState.getDocument())); } }
private void writeEditorCas(AnnotatorState aState, JCas aJCas) throws IOException { if (aState.getMode().equals(Mode.ANNOTATION) || aState.getMode().equals(Mode.AUTOMATION) || aState.getMode().equals(Mode.CORRECTION)) { documentService.writeAnnotationCas(aJCas, aState.getDocument(), aState.getUser(), true); updateDocumentTimestampAfterWrite(aState, documentService.getAnnotationCasTimestamp( aState.getDocument(), aState.getUser().getUsername())); } else if (aState.getMode().equals(Mode.CURATION)) { curationDocumentService.writeCurationCas(aJCas, aState.getDocument(), true); updateDocumentTimestampAfterWrite(aState, curationDocumentService .getCurationCasTimestamp(aState.getDocument())); } }
private void updateTrainingResultForm(Project aProject) { trainingResultForm.remove(); trainingResultForm = new TrainingResultForm("trainingResultForm"); add(trainingResultForm); trainingResultForm.setVisible(aProject.getMode().equals(Mode.AUTOMATION)); }
public BratCurationVisualizer(String id, IModel<CurationUserSegmentForAnnotationDocument> aModel) { super(id, aModel); String username; if(getModelObject().getBratAnnotatorModel().getMode().equals(Mode.AUTOMATION) ||getModelObject().getBratAnnotatorModel().getMode().equals(Mode.CORRECTION)){ username = "Suggestion"; } else { username = getModelObject().getUsername(); } Label label = new Label("username", username); add(label); controller = new AbstractDefaultAjaxBehavior() { private static final long serialVersionUID = 1133593826878553307L; @Override protected void respond(AjaxRequestTarget aTarget) { //aTarget.prependJavaScript("Wicket.$('"+vis.getMarkupId()+"').temp = ['test'];"); onSelectAnnotationForMerge(aTarget); } }; add(controller); }
private void actionCancel(AjaxRequestTarget aTarget) { projectSelectionForm.detach(); documentSelectionForm.detach(); if (Mode.CURATION.equals(state.getMode())) { state.setDocument(null, null); // on cancel, go welcomePage } onCancel(aTarget); modalWindow.close(aTarget); }
boolean isAnnotationFinished() { AnnotatorState state = getModelObject(); if (state.getMode().equals(Mode.CURATION)) { return state.getDocument().getState().equals(SourceDocumentState.CURATION_FINISHED); } else { return documentService.isAnnotationFinished(state.getDocument(), state.getUser()); } }
private void mergeSpan(IRequestParameters aRequest, UserAnnotationSegment aCurationUserSegment, JCas aJcas) throws AnnotationException, UIMAException, ClassNotFoundException, IOException { AnnotationDocument clickedAnnotationDocument; AnnotatorState state = aCurationUserSegment.getAnnotatorState(); if (state.getMode().equals(Mode.AUTOMATION) || state.getMode().equals(Mode.CORRECTION)) { // createSpan / getJCas do not require an annotation document in this mode clickedAnnotationDocument = null; } else { SourceDocument sourceDocument = aCurationUserSegment.getAnnotatorState().getDocument(); clickedAnnotationDocument = documentService.getAnnotationDocument(sourceDocument, aCurationUserSegment.getUsername()); } int address = aRequest.getParameterValue(PARAM_ID).toInt(); String spanType = removePrefix(aRequest.getParameterValue(PARAM_TYPE).toString()); createSpan(spanType, state, aJcas, clickedAnnotationDocument, address); }
private void mergeSpan(IRequestParameters aRequest, UserAnnotationSegment aCurationUserSegment, JCas aJcas) throws AnnotationException, UIMAException, ClassNotFoundException, IOException { AnnotationDocument clickedAnnotationDocument; AnnotatorState state = aCurationUserSegment.getAnnotatorState(); if (state.getMode().equals(Mode.AUTOMATION) || state.getMode().equals(Mode.CORRECTION)) { // createSpan / getJCas do not require an annotation document in this mode clickedAnnotationDocument = null; } else { SourceDocument sourceDocument = aCurationUserSegment.getAnnotatorState().getDocument(); clickedAnnotationDocument = documentService.getAnnotationDocument(sourceDocument, aCurationUserSegment.getUsername()); } int address = aRequest.getParameterValue(PARAM_ID).toInt(); String spanType = removePrefix(aRequest.getParameterValue(PARAM_TYPE).toString()); createSpan(spanType, state, aJcas, clickedAnnotationDocument, address); }