Search in sources :

Example 36 with AnnotatorState

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.

the class CurationPage method updatePanel.

private void updatePanel(CurationContainer aCurationContainer, AjaxRequestTarget aTarget) {
    AnnotatorState state = getModelObject();
    gotoPageTextField.setModelObject(state.getFirstVisibleUnitIndex());
    curationPanel.setDefaultModelObject(curationContainer);
    aTarget.add(gotoPageTextField);
    aTarget.add(curationPanel);
}
Also used : AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState)

Example 37 with AnnotatorState

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.

the class CurationPage method actionFinishDocument.

private void actionFinishDocument(AjaxRequestTarget aTarget) {
    finishDocumentDialog.setConfirmAction((aCallbackTarget) -> {
        ensureRequiredFeatureValuesSet(aCallbackTarget, getEditorCas());
        AnnotatorState state = getModelObject();
        SourceDocument sourceDocument = state.getDocument();
        if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) {
            documentService.transitionSourceDocumentState(sourceDocument, CURATION_FINISHED_TO_CURATION_IN_PROGRESS);
        } else {
            documentService.transitionSourceDocumentState(sourceDocument, CURATION_IN_PROGRESS_TO_CURATION_FINISHED);
        }
        aCallbackTarget.add(finishDocumentIcon);
        aCallbackTarget.add(finishDocumentLink);
        aCallbackTarget.add(curationPanel.editor);
        aCallbackTarget.add(remergeDocumentLink);
    });
    finishDocumentDialog.show(aTarget);
}
Also used : AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState) SourceDocument(de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument)

Example 38 with AnnotatorState

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.

the class CopyAnnotationTest method simpleCopyToEmptyTest.

@Test
public void simpleCopyToEmptyTest() throws Exception {
    AnnotatorState state = new AnnotatorStateImpl(Mode.CURATION);
    state.setUser(new User());
    JCas jcas = JCasFactory.createJCas();
    Type type = jcas.getTypeSystem().getType(POS.class.getTypeName());
    AnnotationFS clickedFs = createPOSAnno(jcas, type, "NN", 0, 0);
    JCas mergeCAs = JCasFactory.createJCas();
    createTokenAnno(mergeCAs, 0, 0);
    MergeCas.addSpanAnnotation(state, annotationSchemaService, posLayer, mergeCAs, clickedFs, false);
    assertEquals(1, CasUtil.selectCovered(mergeCAs.getCas(), type, 0, 0).size());
}
Also used : AnnotationFS(org.apache.uima.cas.text.AnnotationFS) Type(org.apache.uima.cas.Type) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) POS(de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS) AnnotatorStateImpl(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorStateImpl) AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState) JCas(org.apache.uima.jcas.JCas) Test(org.junit.Test)

Example 39 with AnnotatorState

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.

the class CopyAnnotationTest method simpleCopyToDiffExistingAnnoWithStackingTest.

@Test
public void simpleCopyToDiffExistingAnnoWithStackingTest() throws Exception {
    AnnotatorState state = new AnnotatorStateImpl(Mode.CURATION);
    state.setUser(new User());
    posLayer.setAllowStacking(true);
    JCas jcas = JCasFactory.createJCas();
    Type type = jcas.getTypeSystem().getType(POS.class.getTypeName());
    AnnotationFS clickedFs = createPOSAnno(jcas, type, "NN", 0, 0);
    JCas mergeCAs = JCasFactory.createJCas();
    createTokenAnno(mergeCAs, 0, 0);
    AnnotationFS existingFs = mergeCAs.getCas().createAnnotation(type, 0, 0);
    Feature posValue = type.getFeatureByBaseName("PosValue");
    existingFs.setStringValue(posValue, "NE");
    mergeCAs.addFsToIndexes(existingFs);
    MergeCas.addSpanAnnotation(state, annotationSchemaService, posLayer, mergeCAs, clickedFs, true);
    assertEquals(2, CasUtil.selectCovered(mergeCAs.getCas(), type, 0, 0).size());
}
Also used : AnnotationFS(org.apache.uima.cas.text.AnnotationFS) Type(org.apache.uima.cas.Type) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) POS(de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS) AnnotatorStateImpl(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorStateImpl) AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState) JCas(org.apache.uima.jcas.JCas) Feature(org.apache.uima.cas.Feature) AnnotationFeature(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature) Test(org.junit.Test)

Example 40 with AnnotatorState

use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.

the class CopyAnnotationTest method copySpanWithSlotWithStackingTest.

@Test
public void copySpanWithSlotWithStackingTest() throws Exception {
    AnnotatorState state = new AnnotatorStateImpl(Mode.CURATION);
    state.setUser(new User());
    slotLayer.setAllowStacking(true);
    JCas jcasA = JCasFactory.createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem("f1"));
    Type type = jcasA.getTypeSystem().getType(DiffUtils.HOST_TYPE);
    Feature feature = type.getFeatureByBaseName("f1");
    AnnotationFS clickedFs = DiffUtils.makeLinkHostMultiSPanFeatureFS(jcasA, 0, 0, feature, "A", DiffUtils.makeLinkFS(jcasA, "slot1", 0, 0));
    JCas mergeCAs = JCasFactory.createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem("f1"));
    DiffUtils.makeLinkHostMultiSPanFeatureFS(mergeCAs, 0, 0, feature, "C", DiffUtils.makeLinkFS(mergeCAs, "slot1", 0, 0));
    MergeCas.addSpanAnnotation(state, annotationSchemaService, slotLayer, mergeCAs, clickedFs, true);
    assertEquals(2, CasUtil.selectCovered(mergeCAs.getCas(), type, 0, 0).size());
}
Also used : AnnotationFS(org.apache.uima.cas.text.AnnotationFS) Type(org.apache.uima.cas.Type) User(de.tudarmstadt.ukp.clarin.webanno.security.model.User) AnnotatorStateImpl(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorStateImpl) AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState) JCas(org.apache.uima.jcas.JCas) Feature(org.apache.uima.cas.Feature) AnnotationFeature(de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature) Test(org.junit.Test)

Aggregations

AnnotatorState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState)84 JCas (org.apache.uima.jcas.JCas)37 IOException (java.io.IOException)26 AnnotationException (de.tudarmstadt.ukp.clarin.webanno.api.annotation.exception.AnnotationException)23 AnnotationFS (org.apache.uima.cas.text.AnnotationFS)22 UIMAException (org.apache.uima.UIMAException)20 AnnotationLayer (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer)16 Sentence (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence)16 ArrayList (java.util.ArrayList)16 AnnotationFeature (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)14 List (java.util.List)13 AnnotationDocument (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationDocument)12 TypeAdapter (de.tudarmstadt.ukp.clarin.webanno.api.annotation.adapter.TypeAdapter)9 SourceDocument (de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument)9 SuggestionBuilder (de.tudarmstadt.ukp.clarin.webanno.ui.curation.component.model.SuggestionBuilder)9 Map (java.util.Map)9 NoResultException (javax.persistence.NoResultException)9 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)9 FeatureState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.FeatureState)8 Selection (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.Selection)8