Skip to content

Commit

Permalink
Merge branch 'github/master' into github/feature/30-pre-disambiguate-…
Browse files Browse the repository at this point in the history
…concepts

* github/master:
  #25 - Add "identifier" feature to the built-in named entity layer
  #25 - Add "identifier" feature to the built-in named entity layer

% Conflicts:
%	inception-ui-kb/pom.xml
  • Loading branch information
reckart committed Apr 10, 2018
2 parents 5651d89 + 992853e commit 9fcfc70
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
@ComponentScan(excludeFilters = {
@Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
@Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class),
@Filter(type = FilterType.ASSIGNABLE_TYPE, classes = AutomationService.class)})
@Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { AutomationService.class })})
@EntityScan(basePackages = {
// Include WebAnno entity packages separately so we can skip the automation entities!
"de.tudarmstadt.ukp.clarin.webanno.model",
Expand Down
9 changes: 9 additions & 0 deletions inception-ui-kb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<groupId>de.tudarmstadt.ukp.clarin.webanno</groupId>
<artifactId>webanno-api</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.clarin.webanno</groupId>
<artifactId>webanno-api-dao</artifactId>
</dependency>
<dependency>
<groupId>de.tudarmstadt.ukp.clarin.webanno</groupId>
<artifactId>webanno-support</artifactId>
Expand All @@ -68,6 +72,11 @@
<groupId>de.tudarmstadt.ukp.inception.app</groupId>
<artifactId>inception-concept-linking</artifactId>
</dependency>

<dependency>
<groupId>de.tudarmstadt.ukp.dkpro.core</groupId>
<artifactId>de.tudarmstadt.ukp.dkpro.core.api.ner-asl</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2018
* Ubiquitous Knowledge Processing (UKP) Lab
* Technische Universität Darmstadt
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.ui.kb.initializers;

import static java.util.Arrays.asList;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import de.tudarmstadt.ukp.clarin.webanno.api.AnnotationSchemaService;
import de.tudarmstadt.ukp.clarin.webanno.api.dao.initializers.LayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.api.dao.initializers.NamedEntityLayerInitializer;
import de.tudarmstadt.ukp.clarin.webanno.api.dao.initializers.ProjectInitializer;
import de.tudarmstadt.ukp.clarin.webanno.api.dao.initializers.TokenLayerInitializer;
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.ui.kb.feature.ConceptFeatureSupport;

/**
* Adds the {@code identifier} feature provided since DKPro Core 1.9.0 as a concept feature.
*/
@Component
public class NamedEntityIdentifierFeatureInitializer
implements LayerInitializer
{
private final AnnotationSchemaService annotationSchemaService;

@Autowired
public NamedEntityIdentifierFeatureInitializer(AnnotationSchemaService aAnnotationSchemaService)
{
annotationSchemaService = aAnnotationSchemaService;
}

@Override
public List<Class<? extends ProjectInitializer>> getDependencies()
{
// Because locks to token boundaries
return asList(TokenLayerInitializer.class, NamedEntityLayerInitializer.class);
}

@Override
public void configure(Project aProject) throws IOException
{
AnnotationLayer neLayer = annotationSchemaService.getLayer(NamedEntity.class.getName(),
aProject);

annotationSchemaService.createFeature(new AnnotationFeature(aProject, neLayer, "identifier",
"identifier", ConceptFeatureSupport.TYPE_ANY_CONCEPT, "Linked entity", null));
}
}

0 comments on commit 9fcfc70

Please sign in to comment.