> 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",