From be328e8b800b8dfb2bc53594faff9e732d88e2d4 Mon Sep 17 00:00:00 2001
From: Richard Eckart de Castilho
Date: Mon, 26 Feb 2024 20:00:10 +0100
Subject: [PATCH 1/2] #4562 - Project template for named entity annotation
- Added new entity annotation template
- Still need to add original thumbnail image for this
---
.../pom.xml | 4 +
.../EntityAnnotationProjectInitializer.java | 113 ++++++++++++++++++
.../EntityLinkingProjectInitializer.java | 9 +-
...dentifierStringRecommenderInitializer.java | 11 +-
...uenceClassifierRecommenderInitializer.java | 95 +++++++++++++++
...medEntityStringRecommenderInitializer.java | 95 +++++++++++++++
...gProjectInitializersAutoConfiguration.java | 31 +++++
.../wikidatalinking/wicket-package.properties | 1 +
.../NamedEntityLayerInitializer.java | 9 +-
9 files changed, 350 insertions(+), 18 deletions(-)
create mode 100644 inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java
create mode 100644 inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntitySequenceClassifierRecommenderInitializer.java
create mode 100644 inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityStringRecommenderInitializer.java
diff --git a/inception/inception-project-initializers-wikidatalinking/pom.xml b/inception/inception-project-initializers-wikidatalinking/pom.xml
index 5295034ae2b..0de82b02346 100644
--- a/inception/inception-project-initializers-wikidatalinking/pom.xml
+++ b/inception/inception-project-initializers-wikidatalinking/pom.xml
@@ -53,6 +53,10 @@
de.tudarmstadt.ukp.inception.appinception-imls-stringmatch
+
+ de.tudarmstadt.ukp.inception.app
+ inception-imls-opennlp
+ de.tudarmstadt.ukp.inception.appinception-kb
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java
new file mode 100644
index 00000000000..293b659db1d
--- /dev/null
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Technische Universität Darmstadt under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The Technische Universität Darmstadt
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking;
+
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.wicket.request.resource.PackageResourceReference;
+import org.apache.wicket.request.resource.ResourceReference;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.annotation.Order;
+
+import de.tudarmstadt.ukp.clarin.webanno.model.Project;
+import de.tudarmstadt.ukp.clarin.webanno.project.initializers.NamedEntityLayerInitializer;
+import de.tudarmstadt.ukp.clarin.webanno.project.initializers.QuickProjectInitializer;
+import de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity;
+import de.tudarmstadt.ukp.inception.project.api.ProjectInitializer;
+import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.config.WikiDataLinkingProjectInitializersAutoConfiguration;
+import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
+import de.tudarmstadt.ukp.inception.support.wicket.resource.Strings;
+
+/**
+ *
+ * This class is exposed as a Spring Component via
+ * {@link WikiDataLinkingProjectInitializersAutoConfiguration#entityAnnotationProjectInitializer}.
+ *
+ */
+@Order(5000)
+public class EntityAnnotationProjectInitializer
+ implements QuickProjectInitializer
+{
+ private static final PackageResourceReference THUMBNAIL = new PackageResourceReference(
+ MethodHandles.lookup().lookupClass(), "EntityLinkingProjectInitializer.svg");
+
+ private final AnnotationSchemaService annotationService;
+ private final ApplicationContext context;
+
+ public EntityAnnotationProjectInitializer(ApplicationContext aContext,
+ AnnotationSchemaService aAnnotationService)
+ {
+ context = aContext;
+ annotationService = aAnnotationService;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Entity annotation";
+ }
+
+ @Override
+ public Optional getDescription()
+ {
+ return Optional.of(Strings.getString("entity-annotation-project.description"));
+ }
+
+ @Override
+ public Optional getThumbnail()
+ {
+ return Optional.of(THUMBNAIL);
+ }
+
+ @Override
+ public boolean alreadyApplied(Project aProject)
+ {
+ return false;
+ }
+
+ @Override
+ public List> getDependencies()
+ {
+ var dependencies = new ArrayList>();
+ dependencies.add(NamedEntityLayerInitializer.class);
+
+ if (context.getBeanNamesForType(NamedEntityStringRecommenderInitializer.class).length > 0) {
+ dependencies.add(NamedEntityStringRecommenderInitializer.class);
+ }
+
+ if (context.getBeanNamesForType(
+ NamedEntitySequenceClassifierRecommenderInitializer.class).length > 0) {
+ dependencies.add(NamedEntitySequenceClassifierRecommenderInitializer.class);
+ }
+
+ return dependencies;
+ }
+
+ @Override
+ public void configure(Project aProject) throws IOException
+ {
+ var layer = annotationService.findLayer(aProject, NamedEntity.class.getName());
+ var valueFeature = annotationService.getFeature(NamedEntity._FeatName_value, layer);
+ valueFeature.setEnabled(false);
+ annotationService.createFeature(valueFeature);
+ }
+}
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java
index ed11ca995a2..3fd72586f29 100644
--- a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityLinkingProjectInitializer.java
@@ -28,8 +28,6 @@
import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.Order;
-import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
-import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.NamedEntityLayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.QuickProjectInitializer;
@@ -90,7 +88,7 @@ public boolean alreadyApplied(Project aProject)
@Override
public List> getDependencies()
{
- List> dependencies = new ArrayList<>();
+ var dependencies = new ArrayList>();
dependencies.add(NamedEntityLayerInitializer.class);
dependencies.add(NamedEntityIdentifierFeatureInitializer.class);
dependencies.add(WikiDataKnowledgeBaseInitializer.class);
@@ -106,9 +104,8 @@ public List> getDependencies()
@Override
public void configure(Project aProject) throws IOException
{
- AnnotationLayer layer = annotationService.findLayer(aProject, NamedEntity.class.getName());
- AnnotationFeature valueFeature = annotationService.getFeature(NamedEntity._FeatName_value,
- layer);
+ var layer = annotationService.findLayer(aProject, NamedEntity.class.getName());
+ var valueFeature = annotationService.getFeature(NamedEntity._FeatName_value, layer);
valueFeature.setEnabled(false);
annotationService.createFeature(valueFeature);
}
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityIdentifierStringRecommenderInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityIdentifierStringRecommenderInitializer.java
index c9eb9317185..c3fbbdcf4b8 100644
--- a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityIdentifierStringRecommenderInitializer.java
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityIdentifierStringRecommenderInitializer.java
@@ -22,8 +22,6 @@
import java.io.IOException;
import java.util.List;
-import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
-import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity;
import de.tudarmstadt.ukp.inception.project.api.ProjectInitializer;
@@ -83,12 +81,11 @@ public List> getDependencies()
@Override
public void configure(Project aProject) throws IOException
{
- AnnotationLayer spanLayer = annotationService.findLayer(aProject,
- NamedEntity.class.getName());
- AnnotationFeature labelFeature = annotationService
- .getFeature(NamedEntity._FeatName_identifier, spanLayer);
+ var spanLayer = annotationService.findLayer(aProject, NamedEntity.class.getName());
+ var labelFeature = annotationService.getFeature(NamedEntity._FeatName_identifier,
+ spanLayer);
- Recommender recommender = new Recommender(getName(), spanLayer);
+ var recommender = new Recommender(getName(), spanLayer);
recommender.setFeature(labelFeature);
recommender.setMaxRecommendations(3);
recommender.setThreshold(0.0d);
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntitySequenceClassifierRecommenderInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntitySequenceClassifierRecommenderInitializer.java
new file mode 100644
index 00000000000..c202903e0ab
--- /dev/null
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntitySequenceClassifierRecommenderInitializer.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Technische Universität Darmstadt under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The Technische Universität Darmstadt
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking;
+
+import static java.util.Arrays.asList;
+
+import java.io.IOException;
+import java.util.List;
+
+import de.tudarmstadt.ukp.clarin.webanno.model.Project;
+import de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity;
+import de.tudarmstadt.ukp.inception.project.api.ProjectInitializer;
+import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.config.WikiDataLinkingProjectInitializersAutoConfiguration;
+import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
+import de.tudarmstadt.ukp.inception.recommendation.api.model.Recommender;
+import de.tudarmstadt.ukp.inception.recommendation.imls.opennlp.ner.OpenNlpNerRecommenderFactory;
+import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
+import de.tudarmstadt.ukp.inception.ui.kb.initializers.NamedEntityIdentifierFeatureInitializer;
+
+/**
+ *
+ * This class is exposed as a Spring Component via
+ * {@link WikiDataLinkingProjectInitializersAutoConfiguration#namedEntitySequenceClassifierRecommenderInitializer}.
+ *
+ */
+public class NamedEntitySequenceClassifierRecommenderInitializer
+ implements ProjectInitializer
+{
+ private final AnnotationSchemaService annotationService;
+ private final RecommendationService recommendationService;
+ private final OpenNlpNerRecommenderFactory recommenderFactory;
+
+ public NamedEntitySequenceClassifierRecommenderInitializer(
+ RecommendationService aRecommenderService, AnnotationSchemaService aAnnotationService,
+ OpenNlpNerRecommenderFactory aRecommenderFactory)
+ {
+ recommendationService = aRecommenderService;
+ annotationService = aAnnotationService;
+ recommenderFactory = aRecommenderFactory;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Named entity sequence classifier recommender";
+ }
+
+ @Override
+ public boolean applyByDefault()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean alreadyApplied(Project aProject)
+ {
+ return recommendationService.existsRecommender(aProject, getName());
+ }
+
+ @Override
+ public List> getDependencies()
+ {
+ return asList(NamedEntityIdentifierFeatureInitializer.class);
+ }
+
+ @Override
+ public void configure(Project aProject) throws IOException
+ {
+ var spanLayer = annotationService.findLayer(aProject, NamedEntity.class.getName());
+ var labelFeature = annotationService.getFeature(NamedEntity._FeatName_value, spanLayer);
+
+ var recommender = new Recommender(getName(), spanLayer);
+ recommender.setFeature(labelFeature);
+ recommender.setMaxRecommendations(3);
+ recommender.setThreshold(0.0d);
+ recommender.setTool(recommenderFactory.getId());
+
+ recommendationService.createOrUpdateRecommender(recommender);
+ }
+}
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityStringRecommenderInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityStringRecommenderInitializer.java
new file mode 100644
index 00000000000..9c042b68027
--- /dev/null
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/NamedEntityStringRecommenderInitializer.java
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Technische Universität Darmstadt under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The Technische Universität Darmstadt
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking;
+
+import static java.util.Arrays.asList;
+
+import java.io.IOException;
+import java.util.List;
+
+import de.tudarmstadt.ukp.clarin.webanno.model.Project;
+import de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity;
+import de.tudarmstadt.ukp.inception.project.api.ProjectInitializer;
+import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.config.WikiDataLinkingProjectInitializersAutoConfiguration;
+import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
+import de.tudarmstadt.ukp.inception.recommendation.api.model.Recommender;
+import de.tudarmstadt.ukp.inception.recommendation.imls.stringmatch.span.StringMatchingRecommenderFactory;
+import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
+import de.tudarmstadt.ukp.inception.ui.kb.initializers.NamedEntityIdentifierFeatureInitializer;
+
+/**
+ *
+ * This class is exposed as a Spring Component via
+ * {@link WikiDataLinkingProjectInitializersAutoConfiguration#namedEntityStringRecommenderInitializer}.
+ *
+ */
+public class NamedEntityStringRecommenderInitializer
+ implements ProjectInitializer
+{
+ private final AnnotationSchemaService annotationService;
+ private final RecommendationService recommendationService;
+ private final StringMatchingRecommenderFactory recommenderFactory;
+
+ public NamedEntityStringRecommenderInitializer(RecommendationService aRecommenderService,
+ AnnotationSchemaService aAnnotationService,
+ StringMatchingRecommenderFactory aRecommenderFactory)
+ {
+ recommendationService = aRecommenderService;
+ annotationService = aAnnotationService;
+ recommenderFactory = aRecommenderFactory;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Named entity string-matching recommender";
+ }
+
+ @Override
+ public boolean applyByDefault()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean alreadyApplied(Project aProject)
+ {
+ return recommendationService.existsRecommender(aProject, getName());
+ }
+
+ @Override
+ public List> getDependencies()
+ {
+ return asList(NamedEntityIdentifierFeatureInitializer.class);
+ }
+
+ @Override
+ public void configure(Project aProject) throws IOException
+ {
+ var spanLayer = annotationService.findLayer(aProject, NamedEntity.class.getName());
+ var labelFeature = annotationService.getFeature(NamedEntity._FeatName_value, spanLayer);
+
+ var recommender = new Recommender(getName(), spanLayer);
+ recommender.setFeature(labelFeature);
+ recommender.setMaxRecommendations(3);
+ recommender.setThreshold(0.0d);
+ recommender.setTool(recommenderFactory.getId());
+
+ recommendationService.createOrUpdateRecommender(recommender);
+ }
+}
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/config/WikiDataLinkingProjectInitializersAutoConfiguration.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/config/WikiDataLinkingProjectInitializersAutoConfiguration.java
index 6f0387fda1a..0e28888cbda 100644
--- a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/config/WikiDataLinkingProjectInitializersAutoConfiguration.java
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/config/WikiDataLinkingProjectInitializersAutoConfiguration.java
@@ -26,11 +26,15 @@
import de.tudarmstadt.ukp.inception.kb.KnowledgeBaseService;
import de.tudarmstadt.ukp.inception.kb.config.KnowledgeBaseProperties;
import de.tudarmstadt.ukp.inception.kb.config.KnowledgeBaseServiceAutoConfiguration;
+import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.EntityAnnotationProjectInitializer;
import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.EntityLinkingProjectInitializer;
import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.NamedEntityIdentifierStringRecommenderInitializer;
+import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.NamedEntitySequenceClassifierRecommenderInitializer;
+import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.NamedEntityStringRecommenderInitializer;
import de.tudarmstadt.ukp.inception.project.initializers.wikidatalinking.WikiDataKnowledgeBaseInitializer;
import de.tudarmstadt.ukp.inception.recommendation.api.RecommendationService;
import de.tudarmstadt.ukp.inception.recommendation.config.RecommenderServiceAutoConfiguration;
+import de.tudarmstadt.ukp.inception.recommendation.imls.opennlp.ner.OpenNlpNerRecommenderFactory;
import de.tudarmstadt.ukp.inception.recommendation.imls.stringmatch.config.StringMatchingRecommenderAutoConfiguration;
import de.tudarmstadt.ukp.inception.recommendation.imls.stringmatch.span.StringMatchingRecommenderFactory;
import de.tudarmstadt.ukp.inception.schema.api.AnnotationSchemaService;
@@ -67,4 +71,31 @@ public EntityLinkingProjectInitializer entityLinkingProjectInitializer(
{
return new EntityLinkingProjectInitializer(aContext, aAnnotationService);
}
+
+ @Bean
+ public EntityAnnotationProjectInitializer entityAnnotationProjectInitializer(
+ ApplicationContext aContext, AnnotationSchemaService aAnnotationService)
+ {
+ return new EntityAnnotationProjectInitializer(aContext, aAnnotationService);
+ }
+
+ @ConditionalOnBean(RecommendationService.class)
+ @Bean
+ public NamedEntityStringRecommenderInitializer namedEntityStringRecommenderInitializer(
+ RecommendationService aRecommenderService, AnnotationSchemaService aAnnotationService,
+ StringMatchingRecommenderFactory aRecommenderFactory)
+ {
+ return new NamedEntityStringRecommenderInitializer(aRecommenderService, aAnnotationService,
+ aRecommenderFactory);
+ }
+
+ @ConditionalOnBean(RecommendationService.class)
+ @Bean
+ public NamedEntitySequenceClassifierRecommenderInitializer namedEntitySequenceClassifierRecommenderInitializer(
+ RecommendationService aRecommenderService, AnnotationSchemaService aAnnotationService,
+ OpenNlpNerRecommenderFactory aRecommenderFactory)
+ {
+ return new NamedEntitySequenceClassifierRecommenderInitializer(aRecommenderService,
+ aAnnotationService, aRecommenderFactory);
+ }
}
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/wicket-package.properties b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/wicket-package.properties
index 68a66a82171..12490e75aa5 100644
--- a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/wicket-package.properties
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/wicket-package.properties
@@ -14,3 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
entity-linking-project.description=Link entity mentions to WikiData.
+entity-annotation-project.description=Identify and classify named entities.
diff --git a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/NamedEntityLayerInitializer.java b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/NamedEntityLayerInitializer.java
index a9f7464db3a..7a773002f2c 100644
--- a/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/NamedEntityLayerInitializer.java
+++ b/inception/inception-project-initializers/src/main/java/de/tudarmstadt/ukp/clarin/webanno/project/initializers/NamedEntityLayerInitializer.java
@@ -35,7 +35,6 @@
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.model.OverlapMode;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
-import de.tudarmstadt.ukp.clarin.webanno.model.TagSet;
import de.tudarmstadt.ukp.clarin.webanno.project.initializers.config.ProjectInitializersAutoConfiguration;
import de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity;
import de.tudarmstadt.ukp.inception.project.api.ProjectInitializer;
@@ -99,11 +98,11 @@ public boolean alreadyApplied(Project aProject)
@Override
public void configure(Project aProject) throws IOException
{
- TagSet nerTagSet = annotationSchemaService
- .getTagSet(NamedEntityTagSetInitializer.TAG_SET_NAME, aProject);
+ var nerTagSet = annotationSchemaService.getTagSet(NamedEntityTagSetInitializer.TAG_SET_NAME,
+ aProject);
- AnnotationLayer neLayer = new AnnotationLayer(NamedEntity.class.getName(), "Named entity",
- SPAN_TYPE, aProject, true, AnchoringMode.TOKENS, OverlapMode.NO_OVERLAP);
+ var neLayer = new AnnotationLayer(NamedEntity.class.getName(), "Named entity", SPAN_TYPE,
+ aProject, true, AnchoringMode.TOKENS, OverlapMode.NO_OVERLAP);
annotationSchemaService.createOrUpdateLayer(neLayer);
annotationSchemaService.createFeature(new AnnotationFeature(aProject, neLayer, "value",
From 0dbaf39dc7512bf41fa0cecfd8c4f80993ae0a51 Mon Sep 17 00:00:00 2001
From: Richard Eckart de Castilho
Date: Thu, 29 Feb 2024 21:52:24 +0100
Subject: [PATCH 2/2] #4562 - Project template for named entity annotation
- Added thumbnail
---
.../EntityAnnotationProjectInitializer.java | 4 +-
.../EntityAnnotationProjectInitializer.svg | 1118 +++++++++++++++++
2 files changed, 1120 insertions(+), 2 deletions(-)
create mode 100644 inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.svg
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java
index 293b659db1d..3ea7c0004f4 100644
--- a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.java
@@ -43,12 +43,12 @@
* {@link WikiDataLinkingProjectInitializersAutoConfiguration#entityAnnotationProjectInitializer}.
*
*/
-@Order(5000)
+@Order(4900)
public class EntityAnnotationProjectInitializer
implements QuickProjectInitializer
{
private static final PackageResourceReference THUMBNAIL = new PackageResourceReference(
- MethodHandles.lookup().lookupClass(), "EntityLinkingProjectInitializer.svg");
+ MethodHandles.lookup().lookupClass(), "EntityAnnotationProjectInitializer.svg");
private final AnnotationSchemaService annotationService;
private final ApplicationContext context;
diff --git a/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.svg b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.svg
new file mode 100644
index 00000000000..bab7e22df4e
--- /dev/null
+++ b/inception/inception-project-initializers-wikidatalinking/src/main/java/de/tudarmstadt/ukp/inception/project/initializers/wikidatalinking/EntityAnnotationProjectInitializer.svg
@@ -0,0 +1,1118 @@
+
+
+
+
+
+