private void createChunkLayer(Project aProject) throws IOException { AnnotationLayer chunkLayer = new AnnotationLayer(Chunk.class.getName(), "Chunk", SPAN_TYPE, aProject, true, AnchoringMode.TOKENS); chunkLayer.setAllowStacking(false); annotationSchemaService.createLayer(chunkLayer); AnnotationFeature chunkValueFeature = new AnnotationFeature(); chunkValueFeature.setDescription("Chunk tag"); chunkValueFeature.setName("chunkValue"); chunkValueFeature.setType(CAS.TYPE_NAME_STRING); chunkValueFeature.setProject(aProject); chunkValueFeature.setUiName("Tag"); chunkValueFeature.setLayer(chunkLayer); annotationSchemaService.createFeature(chunkValueFeature); }
@Override public void configure(Project aProject) throws IOException { AnnotationLayer chunkLayer = new AnnotationLayer(Chunk.class.getName(), "Chunk", SPAN_TYPE, aProject, true, AnchoringMode.TOKENS); chunkLayer.setAllowStacking(false); annotationSchemaService.createLayer(chunkLayer); AnnotationFeature chunkValueFeature = new AnnotationFeature(); chunkValueFeature.setDescription("Chunk tag"); chunkValueFeature.setName("chunkValue"); chunkValueFeature.setType(CAS.TYPE_NAME_STRING); chunkValueFeature.setProject(aProject); chunkValueFeature.setUiName("Tag"); chunkValueFeature.setLayer(chunkLayer); annotationSchemaService.createFeature(chunkValueFeature); } }
private void createLemmaLayer(Project aProject) throws IOException { AnnotationLayer tokenLayer = annotationSchemaService.getLayer(Token.class.getName(), aProject); AnnotationFeature tokenLemmaFeature = new AnnotationFeature(aProject, tokenLayer, "lemma", "lemma", Lemma.class.getName()); annotationSchemaService.createFeature(tokenLemmaFeature); AnnotationLayer lemmaLayer = new AnnotationLayer(Lemma.class.getName(), "Lemma", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); lemmaLayer.setAttachType(tokenLayer); lemmaLayer.setAttachFeature(tokenLemmaFeature); annotationSchemaService.createLayer(lemmaLayer); AnnotationFeature lemmaFeature = new AnnotationFeature(); lemmaFeature.setDescription("lemma Annotation"); lemmaFeature.setName("value"); lemmaFeature.setType(CAS.TYPE_NAME_STRING); lemmaFeature.setProject(aProject); lemmaFeature.setUiName("Lemma"); lemmaFeature.setLayer(lemmaLayer); annotationSchemaService.createFeature(lemmaFeature); }
@Override public void configure(Project aProject) throws IOException { AnnotationLayer chunkLayer = new AnnotationLayer(Chunk.class.getName(), "Chunk", SPAN_TYPE, aProject, true, AnchoringMode.TOKENS); chunkLayer.setAllowStacking(false); annotationSchemaService.createLayer(chunkLayer); AnnotationFeature chunkValueFeature = new AnnotationFeature(); chunkValueFeature.setDescription("Chunk tag"); chunkValueFeature.setName("chunkValue"); chunkValueFeature.setType(CAS.TYPE_NAME_STRING); chunkValueFeature.setProject(aProject); chunkValueFeature.setUiName("Tag"); chunkValueFeature.setLayer(chunkLayer); annotationSchemaService.createFeature(chunkValueFeature); } }
@Override public void configure(Project aProject) throws IOException { AnnotationLayer tokenLayer = annotationSchemaService.getLayer(Token.class.getName(), aProject); AnnotationFeature tokenLemmaFeature = new AnnotationFeature(aProject, tokenLayer, "lemma", "lemma", Lemma.class.getName()); annotationSchemaService.createFeature(tokenLemmaFeature); AnnotationLayer lemmaLayer = new AnnotationLayer(Lemma.class.getName(), "Lemma", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); lemmaLayer.setAttachType(tokenLayer); lemmaLayer.setAttachFeature(tokenLemmaFeature); annotationSchemaService.createLayer(lemmaLayer); AnnotationFeature lemmaFeature = new AnnotationFeature(); lemmaFeature.setDescription("lemma Annotation"); lemmaFeature.setName("value"); lemmaFeature.setType(CAS.TYPE_NAME_STRING); lemmaFeature.setProject(aProject); lemmaFeature.setUiName("Lemma"); lemmaFeature.setLayer(lemmaLayer); annotationSchemaService.createFeature(lemmaFeature); } }
private void createChunkLayer(Project aProject) throws IOException { AnnotationLayer chunkLayer = new AnnotationLayer(Chunk.class.getName(), "Chunk", SPAN_TYPE, aProject, true, AnchoringMode.TOKENS); chunkLayer.setAllowStacking(false); annotationSchemaService.createLayer(chunkLayer); AnnotationFeature chunkValueFeature = new AnnotationFeature(); chunkValueFeature.setDescription("Chunk tag"); chunkValueFeature.setName("chunkValue"); chunkValueFeature.setType(CAS.TYPE_NAME_STRING); chunkValueFeature.setProject(aProject); chunkValueFeature.setUiName("Tag"); chunkValueFeature.setLayer(chunkLayer); annotationSchemaService.createFeature(chunkValueFeature); }
private void createLemmaLayer(Project aProject) throws IOException { AnnotationLayer tokenLayer = annotationSchemaService.getLayer(Token.class.getName(), aProject); AnnotationFeature tokenLemmaFeature = new AnnotationFeature(aProject, tokenLayer, "lemma", "lemma", Lemma.class.getName()); annotationSchemaService.createFeature(tokenLemmaFeature); AnnotationLayer lemmaLayer = new AnnotationLayer(Lemma.class.getName(), "Lemma", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); lemmaLayer.setAttachType(tokenLayer); lemmaLayer.setAttachFeature(tokenLemmaFeature); annotationSchemaService.createLayer(lemmaLayer); AnnotationFeature lemmaFeature = new AnnotationFeature(); lemmaFeature.setDescription("lemma Annotation"); lemmaFeature.setName("value"); lemmaFeature.setType(CAS.TYPE_NAME_STRING); lemmaFeature.setProject(aProject); lemmaFeature.setUiName("Lemma"); lemmaFeature.setLayer(lemmaLayer); annotationSchemaService.createFeature(lemmaFeature); }
@Override public void configure(Project aProject) throws IOException { // The surface form must be locked to tokens for CoNLL-U writer to work properly AnnotationLayer surfaceFormLayer = new AnnotationLayer(SurfaceForm.class.getName(), "Surface form", SPAN_TYPE, aProject, true, AnchoringMode.TOKENS); surfaceFormLayer.setAllowStacking(false); annotationSchemaService.createLayer(surfaceFormLayer); AnnotationFeature surfaceFormValueFeature = new AnnotationFeature(); surfaceFormValueFeature.setDescription("Original surface text"); surfaceFormValueFeature.setName("value"); surfaceFormValueFeature.setType(CAS.TYPE_NAME_STRING); surfaceFormValueFeature.setProject(aProject); surfaceFormValueFeature.setUiName("Form"); surfaceFormValueFeature.setLayer(surfaceFormLayer); annotationSchemaService.createFeature(surfaceFormValueFeature); } }
@Override public void configure(Project aProject) throws IOException { AnnotationLayer tokenLayer = annotationSchemaService.getLayer(Token.class.getName(), aProject); AnnotationFeature tokenLemmaFeature = new AnnotationFeature(aProject, tokenLayer, "lemma", "lemma", Lemma.class.getName()); annotationSchemaService.createFeature(tokenLemmaFeature); AnnotationLayer lemmaLayer = new AnnotationLayer(Lemma.class.getName(), "Lemma", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); lemmaLayer.setAttachType(tokenLayer); lemmaLayer.setAttachFeature(tokenLemmaFeature); annotationSchemaService.createLayer(lemmaLayer); AnnotationFeature lemmaFeature = new AnnotationFeature(); lemmaFeature.setDescription("lemma Annotation"); lemmaFeature.setName("value"); lemmaFeature.setType(CAS.TYPE_NAME_STRING); lemmaFeature.setProject(aProject); lemmaFeature.setUiName("Lemma"); lemmaFeature.setLayer(lemmaLayer); annotationSchemaService.createFeature(lemmaFeature); } }
@Override public void configure(Project aProject) throws IOException { // The surface form must be locked to tokens for CoNLL-U writer to work properly AnnotationLayer surfaceFormLayer = new AnnotationLayer(SurfaceForm.class.getName(), "Surface form", SPAN_TYPE, aProject, true, AnchoringMode.TOKENS); surfaceFormLayer.setAllowStacking(false); annotationSchemaService.createLayer(surfaceFormLayer); AnnotationFeature surfaceFormValueFeature = new AnnotationFeature(); surfaceFormValueFeature.setDescription("Original surface text"); surfaceFormValueFeature.setName("value"); surfaceFormValueFeature.setType(CAS.TYPE_NAME_STRING); surfaceFormValueFeature.setProject(aProject); surfaceFormValueFeature.setUiName("Form"); surfaceFormValueFeature.setLayer(surfaceFormLayer); annotationSchemaService.createFeature(surfaceFormValueFeature); } }
@Override public void configure(Project aProject) throws IOException { AnnotationLayer tokenLayer = annotationSchemaService.getLayer(Token.class.getName(), aProject); AnnotationFeature tokenMorphFeature = new AnnotationFeature(aProject, tokenLayer, "morph", "morph", Lemma.class.getName()); annotationSchemaService.createFeature(tokenMorphFeature); AnnotationLayer morphLayer = new AnnotationLayer(MorphologicalFeatures.class.getName(), "Morphological features", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); morphLayer.setAttachType(tokenLayer); morphLayer.setAttachFeature(tokenMorphFeature); annotationSchemaService.createLayer(morphLayer); AnnotationFeature valueFeature = new AnnotationFeature(); valueFeature.setDescription("Morphological features"); valueFeature.setName("value"); valueFeature.setType(CAS.TYPE_NAME_STRING); valueFeature.setProject(aProject); valueFeature.setUiName("Features"); valueFeature.setLayer(morphLayer); valueFeature.setIncludeInHover(true); valueFeature.setVisible(false); annotationSchemaService.createFeature(valueFeature); } }
@Override public void configure(Project aProject) throws IOException { AnnotationLayer tokenLayer = annotationSchemaService.getLayer(Token.class.getName(), aProject); AnnotationFeature tokenMorphFeature = new AnnotationFeature(aProject, tokenLayer, "morph", "morph", Lemma.class.getName()); annotationSchemaService.createFeature(tokenMorphFeature); AnnotationLayer morphLayer = new AnnotationLayer(MorphologicalFeatures.class.getName(), "Morphological features", SPAN_TYPE, aProject, true, AnchoringMode.SINGLE_TOKEN); morphLayer.setAttachType(tokenLayer); morphLayer.setAttachFeature(tokenMorphFeature); annotationSchemaService.createLayer(morphLayer); AnnotationFeature valueFeature = new AnnotationFeature(); valueFeature.setDescription("Morphological features"); valueFeature.setName("value"); valueFeature.setType(CAS.TYPE_NAME_STRING); valueFeature.setProject(aProject); valueFeature.setUiName("Features"); valueFeature.setLayer(morphLayer); valueFeature.setIncludeInHover(true); valueFeature.setVisible(false); annotationSchemaService.createFeature(valueFeature); } }
return; feature.setName(name); annotationService.createFeature(feature); featureDetailForm.setVisible(false);
private AnnotationFeature createLinkedFeature(String featureName, String featureUiName, String description, String linkedTypeName, AnnotationLayer aAnnotationLayer, Project aProject) { AnnotationFeature linkedFeature = new AnnotationFeature(); linkedFeature.setName(featureName); linkedFeature.setUiName(featureUiName); linkedFeature.setDescription(description); linkedFeature.setType(NamedEntity.class.getName()); linkedFeature.setProject(aProject); linkedFeature.setTagset(null); linkedFeature.setMode(MultiValueMode.ARRAY); linkedFeature.setLinkMode(LinkMode.WITH_ROLE); linkedFeature.setLinkTypeName(linkedTypeName); linkedFeature.setLinkTypeRoleFeatureName("role"); linkedFeature.setLinkTypeTargetFeatureName("target"); linkedFeature.setLayer(aAnnotationLayer); return linkedFeature; } }
private AnnotationFeature createLinkedFeature(String featureName, String featureUiName, String description, String linkedTypeName, AnnotationLayer aAnnotationLayer, Project aProject) { AnnotationFeature linkedFeature = new AnnotationFeature(); linkedFeature.setName(featureName); linkedFeature.setUiName(featureUiName); linkedFeature.setDescription(description); linkedFeature.setType(NamedEntity.class.getName()); linkedFeature.setProject(aProject); linkedFeature.setTagset(null); linkedFeature.setMode(MultiValueMode.ARRAY); linkedFeature.setLinkMode(LinkMode.WITH_ROLE); linkedFeature.setLinkTypeName(linkedTypeName); linkedFeature.setLinkTypeRoleFeatureName("role"); linkedFeature.setLinkTypeTargetFeatureName("target"); linkedFeature.setLayer(aAnnotationLayer); return linkedFeature; } }
@Override public void initialize(AnnotationSchemaService aSchemaService) { AnnotationFeature relationFeature = new AnnotationFeature(); relationFeature.setType(CAS.TYPE_NAME_STRING); relationFeature.setName(COREFERENCE_RELATION_FEATURE); relationFeature.setLayer(getLayer()); relationFeature.setEnabled(true); relationFeature.setUiName("Reference Relation"); relationFeature.setProject(getLayer().getProject()); aSchemaService.createFeature(relationFeature); AnnotationFeature typeFeature = new AnnotationFeature(); typeFeature.setType(CAS.TYPE_NAME_STRING); typeFeature.setName(COREFERENCE_TYPE_FEATURE); typeFeature.setLayer(getLayer()); typeFeature.setEnabled(true); typeFeature.setUiName("Reference Type"); typeFeature.setProject(getLayer().getProject()); aSchemaService.createFeature(typeFeature); }
@Override public void initialize(AnnotationSchemaService aSchemaService) { AnnotationFeature relationFeature = new AnnotationFeature(); relationFeature.setType(CAS.TYPE_NAME_STRING); relationFeature.setName(COREFERENCE_RELATION_FEATURE); relationFeature.setLayer(getLayer()); relationFeature.setEnabled(true); relationFeature.setUiName("Reference Relation"); relationFeature.setProject(getLayer().getProject()); aSchemaService.createFeature(relationFeature); AnnotationFeature typeFeature = new AnnotationFeature(); typeFeature.setType(CAS.TYPE_NAME_STRING); typeFeature.setName(COREFERENCE_TYPE_FEATURE); typeFeature.setLayer(getLayer()); typeFeature.setEnabled(true); typeFeature.setUiName("Reference Type"); typeFeature.setProject(getLayer().getProject()); aSchemaService.createFeature(typeFeature); }
public static void setFeature(AnnotationService aAnnotationService, AnnotationFeature aFeature, de.tudarmstadt.ukp.clarin.webanno.model.export.AnnotationFeature aExFeature, Project aProject, User aUser) { aFeature.setDescription(aExFeature.getDescription()); aFeature.setEnabled(aExFeature.isEnabled()); aFeature.setVisible(aExFeature.isVisible()); aFeature.setUiName(aExFeature.getUiName()); aFeature.setProject(aProject); aFeature.setLayer(aFeature.getLayer()); aFeature.setType(aExFeature.getType()); aFeature.setName(aExFeature.getName()); aAnnotationService.createFeature(aFeature); }
private AnnotationFeature analyzeFeature(TypeSystem aTS, FeatureDescription aFD, Feature aFeat) { AnnotationFeature feat = new AnnotationFeature(); feat.setType(aFeat.getRange().getName()); feat.setName(aFeat.getShortName()); feat.setUiName(aFeat.getShortName()); feat.setDescription(trimToNull(aFD.getDescription())); feat.setEnabled(true); if (isSlotFeature(aTS, aFeat)) { feat.setType(aFeat.getRange().getComponentType().getFeatureByBaseName("target") .getRange().getName()); feat.setMode(MultiValueMode.ARRAY); feat.setLinkMode(LinkMode.WITH_ROLE); // Need to strip the "[]" marking the type as multi-valued off the type name feat.setLinkTypeName(removeEnd(aFeat.getRange().getName(), "[]")); // FIXME Instead of hard-coding the feature names here, try to auto-detect them by // looking for a String feature and a feature whose type is subsumed by Annotation feat.setLinkTypeRoleFeatureName("role"); feat.setLinkTypeTargetFeatureName("target"); } return feat; }
private AnnotationFeature analyzeFeature(TypeSystem aTS, FeatureDescription aFD, Feature aFeat) { AnnotationFeature feat = new AnnotationFeature(); feat.setType(aFeat.getRange().getName()); feat.setName(aFeat.getShortName()); feat.setUiName(aFeat.getShortName()); feat.setDescription(trimToNull(aFD.getDescription())); feat.setEnabled(true); if (isSlotFeature(aTS, aFeat)) { feat.setType(aFeat.getRange().getComponentType().getFeatureByBaseName("target") .getRange().getName()); feat.setMode(MultiValueMode.ARRAY); feat.setLinkMode(LinkMode.WITH_ROLE); // Need to strip the "[]" marking the type as multi-valued off the type name feat.setLinkTypeName(removeEnd(aFeat.getRange().getName(), "[]")); // FIXME Instead of hard-coding the feature names here, try to auto-detect them by // looking for a String feature and a feature whose type is subsumed by Annotation feat.setLinkTypeRoleFeatureName("role"); feat.setLinkTypeTargetFeatureName("target"); } return feat; }