Author: rwesten
Date: Sat Nov 24 09:41:57 2012
New Revision: 1413156
URL: http://svn.apache.org/viewvc?rev=1413156&view=rev
Log:
STANBOL-812: moved the keywordlinking engine to entityhublinking and than
extracted all generic component and moved them over to entitylinking
Added:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/
- copied from r1412418,
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntitySearcherUtils.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubLinkingEngine.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubSearcher.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/ReferencedSiteSearcher.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/TrackingEntitySearcher.java
Removed:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntityLinkerConfig.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntitySearcher.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/LabelTokenizer.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/LabelTokenizerManager.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/TextProcessingConfig.java
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/impl/
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/
Modified:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/pom.xml
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/resources/OSGI-INF/metatype/metatype.properties
Modified:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/pom.xml
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/pom.xml?rev=1413156&r1=1412418&r2=1413156&view=diff
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/pom.xml
(original)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/pom.xml
Sat Nov 24 09:41:57 2012
@@ -28,28 +28,27 @@
</parent>
<groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.enhancer.engine.keywordextraction</artifactId>
+ <artifactId>org.apache.stanbol.enhancer.engines.entityhublinking</artifactId>
<version>0.10.0-SNAPSHOT</version>
<packaging>bundle</packaging>
- <name>Apache Stanbol Enhancer Enhancement Engine : Keyword Extraction</name>
+ <name>Apache Stanbol Enhancer Enhancement Engine : Entityhub Linking</name>
<description>
- Implementation of utilities and an engine to extract keywords defined in
- a controlloed vocabulary from a parsed text.
- This also provides default implementation to use OpenNLP to parse the
- text and the Entityhub to search for Entities.
+ Named Entity Linking for the Stanbol Entityhub. This Engine provides an
+ Entityhub based implementation/configuration of the EntityLinkingEngine. It
+ supports linking against the Entityhub, ReferencedSites and ManagedSites.
</description>
- <inceptionYear>2011</inceptionYear>
+ <inceptionYear>2012</inceptionYear>
<scm>
<connection>
-
scm:svn:http://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/engines/keywordextraction/
+
scm:svn:http://svn.apache.org/repos/asf/stanbol/trunk/enhancer/engines/entityhublinking/
</connection>
<developerConnection>
-
scm:svn:https://svn.apache.org/repos/asf/incubator/stanbol/trunk/enhancer/engines/keywordextraction/
+
scm:svn:https://svn.apache.org/repos/asf/stanbol/trunk/enhancer/engines/entityhublinking/
</developerConnection>
- <url>http://incubator.apache.org/stanbol/</url>
+ <url>http://stanbol.apache.org/</url>
</scm>
<build>
@@ -60,13 +59,13 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>
-
org.apache.stanbol.enhancer.engines.keywordextraction.linking;version=${project.version},
-
org.apache.stanbol.enhancer.engines.keywordextraction.linking.impl;version=${project.version},
-
org.apache.stanbol.enhancer.engines.keywordextraction.engine;version=${project.version},
- </Export-Package>
+ <Import-Package>
+ org.apache.stanbol.enhancer.servicesapi; provide:=true,
+
org.apache.stanbol.enhancer.engines.entitylinking;version=${project.version};
provide:=true,
+ *
+ </Import-Package>
<Private-Package>
-
org.apache.stanbol.enhancer.engines.keywordextraction.impl;version=${project.version}
+
org.apache.stanbol.enhancer.engines.entityhublinking;version=${project.version}
</Private-Package>
</instructions>
</configuration>
@@ -81,102 +80,25 @@
<dependencies>
<dependency>
<groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.enhancer.servicesapi</artifactId>
+
<artifactId>org.apache.stanbol.enhancer.engines.entitylinking</artifactId>
<version>0.10.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.enhancer.nlp</artifactId>
- <version>0.10.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.commons.stanboltools.offline</artifactId>
- <version>0.9.0-incubating</version>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.servicesapi</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
<artifactId>org.apache.stanbol.entityhub.model.clerezza</artifactId>
- <version>0.9.0-incubating</version>
+ <version>0.11.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.commons.opennlp</artifactId>
- <version>0.9.0-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>rdf.core</artifactId>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
- <!-- Testing -->
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.enhancer.core</artifactId>
- <version>0.10.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
-
<artifactId>org.apache.stanbol.commons.stanboltools.datafileprovider</artifactId>
- <version>0.9.0-incubating</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.entityhub.core</artifactId>
- <version>0.11.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.data.opennlp.lang.en</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency> <!-- used for debug level logging during tests -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
-
</dependencies>
</project>
Added:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntitySearcherUtils.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntitySearcherUtils.java?rev=1413156&view=auto
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntitySearcherUtils.java
(added)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntitySearcherUtils.java
Sat Nov 24 09:41:57 2012
@@ -0,0 +1,67 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF 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. 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 org.apache.stanbol.enhancer.engines.entityhublinking;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher;
+import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
+import org.apache.stanbol.entityhub.servicesapi.query.FieldQueryFactory;
+import org.apache.stanbol.entityhub.servicesapi.query.TextConstraint;
+
+public class EntitySearcherUtils {
+
+ /**
+ * Validated the parsed parameter as parsed to
+ * {@link EntitySearcher#lookup(String, Set, List, String...)}
+ * and creates a fieldQuery for the parsed parameter
+ * @param field
+ * @param includeFields
+ * @param search
+ * @param languages
+ * @return
+ */
+ public final static FieldQuery createFieldQuery(FieldQueryFactory factory,
+ String field,
+ Set<String> includeFields,
+ List<String> search,
+ String... languages) {
+ if(field == null || field.isEmpty()){
+ throw new IllegalArgumentException("The parsed search field MUST
NOT be NULL nor empty");
+ }
+ if(search == null || search.isEmpty()){
+ throw new IllegalArgumentException("The parsed list of search
strings MUST NOT be NULL nor empty");
+ }
+ //build the query and than return the result
+ FieldQuery query = factory.createFieldQuery();
+ if(includeFields == null){
+ query.addSelectedField(field);
+ } else {
+ if(!includeFields.contains(field)){
+ query.addSelectedField(field);
+ }
+ for(String select : includeFields){
+ query.addSelectedField(select);
+ }
+ }
+ query.setLimit(20);//TODO make configurable
+ query.setConstraint(field, new TextConstraint(search, languages));
+ return query;
+ }
+
+}
Added:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubLinkingEngine.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubLinkingEngine.java?rev=1413156&view=auto
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubLinkingEngine.java
(added)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubLinkingEngine.java
Sat Nov 24 09:41:57 2012
@@ -0,0 +1,268 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF 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. 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 org.apache.stanbol.enhancer.engines.entityhublinking;
+
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.CASE_SENSITIVE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_CASE_SENSITIVE_MATCHING_STATE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_DEREFERENCE_ENTITIES_STATE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_MATCHING_LANGUAGE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_MIN_SEARCH_TOKEN_LENGTH;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_MIN_TOKEN_SCORE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_NAME_FIELD;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_REDIRECT_FIELD;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_SUGGESTIONS;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEFAULT_TYPE_FIELD;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.DEREFERENCE_ENTITIES;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.MIN_SEARCH_TOKEN_LENGTH;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.MIN_TOKEN_SCORE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.NAME_FIELD;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.REDIRECT_FIELD;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.REDIRECT_MODE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.SUGGESTIONS;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.TYPE_FIELD;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig.TYPE_MAPPINGS;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig.DEFAULT_PROCESS_ONLY_PROPER_NOUNS_STATE;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig.PROCESSED_LANGUAGES;
+import static
org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig.PROCESS_ONLY_PROPER_NOUNS_STATE;
+import static
org.apache.stanbol.enhancer.servicesapi.EnhancementEngine.PROPERTY_NAME;
+import static org.osgi.framework.Constants.SERVICE_RANKING;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.clerezza.rdf.core.LiteralFactory;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.PropertyOption;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.stanbol.enhancer.engines.entitylinking.LabelTokenizer;
+import
org.apache.stanbol.enhancer.engines.entitylinking.config.EntityLinkerConfig;
+import
org.apache.stanbol.enhancer.engines.entitylinking.config.TextProcessingConfig;
+import
org.apache.stanbol.enhancer.engines.entitylinking.engine.EntityLinkingEngine;
+import org.apache.stanbol.enhancer.servicesapi.EnhancementEngine;
+import org.apache.stanbol.enhancer.servicesapi.ServiceProperties;
+import org.apache.stanbol.entityhub.servicesapi.Entityhub;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+/**
+ * The EntityhubLinkingEngine in NOT an {@link EnhancementEngine} but only an
+ * OSGI {@link Component} that allows to configure instances of the
+ * {@link EntityLinkingEngine} using an {@link ReferencedSiteSearcher} or
+ * {@link EntityhubSearcher} to link entities.
+ * @author Rupert Westenthaler
+ *
+ */
+@Component(
+ configurationFactory = true,
+ policy = ConfigurationPolicy.REQUIRE, // the baseUri is required!
+ specVersion = "1.1",
+ metatype = true,
+ immediate = true,
+ inherit = true)
[email protected](value={
+ @Property(name=PROPERTY_NAME),
+ @Property(name=EntityhubLinkingEngine.SITE_ID),
+ @Property(name=NAME_FIELD,value=DEFAULT_NAME_FIELD),
+
@Property(name=CASE_SENSITIVE,boolValue=DEFAULT_CASE_SENSITIVE_MATCHING_STATE),
+ @Property(name=TYPE_FIELD,value=DEFAULT_TYPE_FIELD),
+ @Property(name=REDIRECT_FIELD,value=DEFAULT_REDIRECT_FIELD),
+ @Property(name=REDIRECT_MODE,options={
+ @PropertyOption(
+ value='%'+REDIRECT_MODE+".option.ignore",
+ name="IGNORE"),
+ @PropertyOption(
+ value='%'+REDIRECT_MODE+".option.addValues",
+ name="ADD_VALUES"),
+ @PropertyOption(
+ value='%'+REDIRECT_MODE+".option.follow",
+ name="FOLLOW")
+ },value="IGNORE"),
+ @Property(name=MIN_SEARCH_TOKEN_LENGTH,
intValue=DEFAULT_MIN_SEARCH_TOKEN_LENGTH),
+ @Property(name=MIN_TOKEN_SCORE,floatValue=DEFAULT_MIN_TOKEN_SCORE),
+ @Property(name=SUGGESTIONS, intValue=DEFAULT_SUGGESTIONS),
+ @Property(name=PROCESS_ONLY_PROPER_NOUNS_STATE,
boolValue=DEFAULT_PROCESS_ONLY_PROPER_NOUNS_STATE),
+ @Property(name=PROCESSED_LANGUAGES,
+ cardinality=Integer.MAX_VALUE,
+ value={"*;lmmtip;uc=LINK;prop=0.75;pprob=0.75", // link multiple
matchable tokens in chunks; link upper case words
+ "de;uc=MATCH", //in German all Nouns are upper case
+ "es;lc=Noun", //the OpenNLP POS tagger for Spanish does not
support ProperNouns
+ "nl;lc=Noun"}), //same for Dutch
+ @Property(name=DEFAULT_MATCHING_LANGUAGE,value=""),
+ @Property(name=TYPE_MAPPINGS,cardinality=Integer.MAX_VALUE),
+ @Property(name=DEREFERENCE_ENTITIES,
boolValue=DEFAULT_DEREFERENCE_ENTITIES_STATE),
+ @Property(name=SERVICE_RANKING,intValue=0)
+})
+public class EntityhubLinkingEngine implements ServiceTrackerCustomizer {
+
+ private final Logger log =
LoggerFactory.getLogger(EntityhubLinkingEngine.class);
+
+ /**
+ * The id of the Entityhub Site (Referenced or Managed Site) used for
matching. <p>
+ * To match against the Entityhub use "entityhub" as value.
+ */
+ public static final String SITE_ID =
"enhancer.engines.linking.entityhub.siteId";
+
+ /**
+ * The engine initialised based on the configuration of this component
+ */
+ protected EntityLinkingEngine entityLinkingEngine;
+ protected Dictionary<String,Object> engineMetadata;
+ /**
+ * The service registration for the {@link #entityLinkingEngine}
+ */
+ protected ServiceRegistration engineRegistration;
+ /**
+ * The EntitySearcher used for the {@link #entityLinkingEngine}
+ */
+ private TrackingEntitySearcher<?> entitySearcher;
+ int trackedServiceCount = 0;
+
+ /**
+ * the MainLabelTokenizer
+ */
+ @Reference
+ protected LabelTokenizer labelTokenizer;
+
+
+ /**
+ * The name of the reference site ('local' or 'entityhub') if the
+ * Entityhub is used for enhancing
+ */
+ protected String siteName;
+
+ private BundleContext bundleContext;
+
+ /**
+ * Default constructor as used by OSGI. This expects that
+ * {@link #activate(ComponentContext)} is called before usage
+ */
+ public EntityhubLinkingEngine() {
+ }
+
+ @Activate
+ @SuppressWarnings("unchecked")
+ protected void activate(ComponentContext ctx) throws
ConfigurationException {
+ Dictionary<String,Object> properties = ctx.getProperties();
+ bundleContext = ctx.getBundleContext();
+ EntityLinkerConfig linkerConfig =
EntityLinkerConfig.createInstance(properties);
+ TextProcessingConfig textProcessingConfig =
TextProcessingConfig.createInstance(properties);
+ Object value = properties.get(SITE_ID);
+ //init the EntitySource
+ if (value == null) {
+ throw new ConfigurationException(SITE_ID,
+ "The ID of the Referenced Site is a required Parameter and
MUST NOT be NULL!");
+ }
+ siteName = value.toString();
+ if (siteName.isEmpty()) {
+ throw new ConfigurationException(SITE_ID,
+ "The ID of the Referenced Site is a required Parameter and
MUST NOT be an empty String!");
+ }
+ //get the metadata later set to the enhancement engine
+ String engineName;
+ engineMetadata = new Hashtable<String,Object>();
+ value = properties.get(PROPERTY_NAME);
+ if(value == null || value.toString().isEmpty()){
+ throw new ConfigurationException(PROPERTY_NAME, "The
EnhancementEngine name MUST BE configured!");
+ } else {
+ engineName = value.toString();
+ }
+ engineMetadata.put(PROPERTY_NAME, value);
+ value = properties.get(Constants.SERVICE_RANKING);
+ engineMetadata.put(Constants.SERVICE_RANKING, value == null ?
Integer.valueOf(0) : value);
+
+ //init the tracking entity searcher
+ trackedServiceCount = 0;
+ if(Entityhub.ENTITYHUB_IDS.contains(siteName.toLowerCase())){
+ entitySearcher = new EntityhubSearcher(bundleContext, 10, this);
+ } else {
+ entitySearcher = new
ReferencedSiteSearcher(bundleContext,siteName,10,this);
+ }
+ //create the engine
+ entityLinkingEngine = new EntityLinkingEngine(engineName,
+ entitySearcher, //the searcher might not be available
+ textProcessingConfig, linkerConfig,
+ labelTokenizer);
+ //start tracking
+ entitySearcher.open();
+ }
+ /**
+ * Deactivates this components.
+ */
+ @Deactivate
+ protected void deactivate(ComponentContext context) {
+ //TODO:
+ //* unregister service
+ ServiceRegistration reg = engineRegistration;
+ if(reg != null){
+ reg.unregister();
+ engineRegistration = null;
+ }
+ //* reset engine
+ entityLinkingEngine = null;
+ engineMetadata = null;
+ //close the tracking EntitySearcher
+ entitySearcher.close();
+ entitySearcher = null;
+ }
+ @Override
+ public Object addingService(ServiceReference reference) {
+ BundleContext bc = this.bundleContext;
+ if(bc != null){
+ Object service = bc.getService(reference);
+ if(service != null){
+ if(trackedServiceCount == 0){
+ //register the service
+ engineRegistration = bc.registerService(
+ new String[]{EnhancementEngine.class.getName(),
+ ServiceProperties.class.getName()},
+ entityLinkingEngine,
+ engineMetadata);
+
+ }
+ trackedServiceCount++;
+ }
+ return service;
+ } else {
+ return null;
+ }
+ }
+ @Override
+ public void modifiedService(ServiceReference reference, Object service) {
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service) {
+ BundleContext bc = this.bundleContext;
+ if(bc != null){
+ trackedServiceCount--;
+ if(trackedServiceCount == 0 && engineRegistration != null){
+ engineRegistration.unregister();
+ }
+ bc.ungetService(reference);
+ }
+ }
+}
Added:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubSearcher.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubSearcher.java?rev=1413156&view=auto
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubSearcher.java
(added)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/EntityhubSearcher.java
Sat Nov 24 09:41:57 2012
@@ -0,0 +1,117 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF 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. 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 org.apache.stanbol.enhancer.engines.entityhublinking;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher;
+import org.apache.stanbol.entityhub.servicesapi.Entityhub;
+import org.apache.stanbol.entityhub.servicesapi.EntityhubException;
+import org.apache.stanbol.entityhub.servicesapi.model.Entity;
+import org.apache.stanbol.entityhub.servicesapi.model.Representation;
+import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
+import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
+import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+public final class EntityhubSearcher extends TrackingEntitySearcher<Entityhub>
implements EntitySearcher {
+
+ private final Integer limit;
+ private Map<UriRef,Collection<Resource>> originInfo;
+
+ public EntityhubSearcher(BundleContext context, Integer limit) {
+ this(context,limit,null);
+ }
+ public EntityhubSearcher(BundleContext context, Integer
limit,ServiceTrackerCustomizer customizer) {
+ super(context,Entityhub.class,null,customizer);
+ this.limit = limit != null && limit > 0 ? limit : null;
+ this.originInfo = Collections.singletonMap(
+ new UriRef(RdfResourceEnum.site.getUri()),
+ (Collection<Resource>)Collections.singleton(
+ (Resource)new PlainLiteralImpl("entityhub")));
+ }
+
+ @Override
+ public Representation get(String id,Set<String> includeFields) {
+ if(id == null || id.isEmpty()){
+ return null;
+ }
+ Entityhub entityhub = getSearchService();
+ if(entityhub == null){
+ throw new IllegalStateException("The Entityhub is currently not
active");
+ }
+ Entity entity;
+ try {
+ entity = entityhub.getEntity(id);
+ } catch (EntityhubException e) {
+ throw new IllegalStateException("Exception while getting "+id+
+ " from the Entityhub",e);
+ }
+ return entity == null ? null : entity.getRepresentation();
+ }
+ @Override
+ public Collection<? extends Representation> lookup(String field,
+ Set<String> includeFields,
+ List<String> search,
+ String[] languages,
+ Integer limit) throws
IllegalStateException {
+ Entityhub entityhub = getSearchService();
+ if(entityhub == null){
+ throw new IllegalStateException("The Entityhub is currently not
active");
+ }
+ FieldQuery query =
EntitySearcherUtils.createFieldQuery(entityhub.getQueryFactory(),
+ field, includeFields, search, languages);
+ if(limit != null && limit > 0){
+ query.setLimit(limit);
+ } else if(this.limit != null){
+ query.setLimit(this.limit);
+ }
+ QueryResultList<Representation> results;
+ try {
+ results = entityhub.find(query);
+ } catch (EntityhubException e) {
+ throw new IllegalStateException("Exception while searchign for "+
+ search+'@'+Arrays.toString(languages)+"in the Entityhub", e);
+ }
+ return results.results();
+ }
+
+ @Override
+ public boolean supportsOfflineMode() {
+ return true; //the entityhub is always offline
+ }
+
+ @Override
+ public Integer getLimit() {
+ return limit;
+ }
+
+ @Override
+ public Map<UriRef,Collection<Resource>> getOriginInformation() {
+ return originInfo;
+ }
+}
Added:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/ReferencedSiteSearcher.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/ReferencedSiteSearcher.java?rev=1413156&view=auto
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/ReferencedSiteSearcher.java
(added)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/ReferencedSiteSearcher.java
Sat Nov 24 09:41:57 2012
@@ -0,0 +1,127 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF 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. 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 org.apache.stanbol.enhancer.engines.entityhublinking;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
+import org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher;
+import org.apache.stanbol.entityhub.servicesapi.model.Entity;
+import org.apache.stanbol.entityhub.servicesapi.model.Representation;
+import org.apache.stanbol.entityhub.servicesapi.model.rdf.RdfResourceEnum;
+import org.apache.stanbol.entityhub.servicesapi.query.FieldQuery;
+import org.apache.stanbol.entityhub.servicesapi.query.QueryResultList;
+import org.apache.stanbol.entityhub.servicesapi.site.Site;
+import org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration;
+import org.apache.stanbol.entityhub.servicesapi.site.SiteException;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+public final class ReferencedSiteSearcher extends TrackingEntitySearcher<Site>
implements EntitySearcher {
+
+
+ private final String siteId;
+ private final Integer limit;
+ private Map<UriRef,Collection<Resource>> originInfo;
+ public ReferencedSiteSearcher(BundleContext context,String siteId, Integer
limit){
+ this(context,siteId,limit,null);
+ }
+ public ReferencedSiteSearcher(BundleContext context,String siteId, Integer
limit, ServiceTrackerCustomizer customizer) {
+ super(context, Site.class,
+ Collections.singletonMap(SiteConfiguration.ID,siteId),
+ customizer);
+ this.siteId = siteId;
+ this.limit = limit != null && limit > 0 ? limit : null;
+ this.originInfo = Collections.singletonMap(
+ new UriRef(RdfResourceEnum.site.getUri()),
+ (Collection<Resource>)Collections.singleton(
+ (Resource)new PlainLiteralImpl(siteId)));
+ }
+
+ @Override
+ public Representation get(String id,Set<String> includeFields) {
+ if(id == null || id.isEmpty()){
+ return null;
+ }
+ Entity entity;
+ Site site = getSearchService();
+ if(site == null){
+ throw new IllegalStateException("ReferencedSite "+siteId+" is
currently not available");
+ }
+ try {
+ entity = site.getEntity(id);
+ } catch (SiteException e) {
+ throw new IllegalStateException("Exception while getting "+id+
+ " from the ReferencedSite "+site.getId(),e);
+ }
+ return entity == null ? null : entity.getRepresentation();
+ }
+
+ @Override
+ public Collection<? extends Representation> lookup(String field,
+ Set<String> includeFields,
+ List<String> search,
+ String[] languages,
+ Integer limit) throws
IllegalStateException {
+ //build the query and than return the result
+ Site site = getSearchService();
+ if(site == null){
+ throw new IllegalStateException("ReferencedSite "+siteId+" is
currently not available");
+ }
+ FieldQuery query =
EntitySearcherUtils.createFieldQuery(site.getQueryFactory(),
+ field, includeFields, search, languages);
+ if(limit != null && limit > 0){
+ query.setLimit(limit);
+ } else if(this.limit != null){
+ query.setLimit(this.limit);
+ }
+ QueryResultList<Representation> results;
+ try {
+ results = site.find(query);
+ } catch (SiteException e) {
+ throw new IllegalStateException("Exception while searchign for "+
+ search+'@'+Arrays.toString(languages)+"in the ReferencedSite "+
+ site.getId(), e);
+ }
+ return results.results();
+ }
+
+ @Override
+ public boolean supportsOfflineMode() {
+ Site site = getSearchService();
+ //Do not throw an exception here if the site is not available. Just
return false
+ return site == null ? false : site.supportsLocalMode();
+ }
+
+ @Override
+ public Integer getLimit() {
+ return limit;
+ }
+
+ @Override
+ public Map<UriRef,Collection<Resource>> getOriginInformation() {
+ return originInfo;
+ }
+}
Added:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/TrackingEntitySearcher.java
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/TrackingEntitySearcher.java?rev=1413156&view=auto
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/TrackingEntitySearcher.java
(added)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/java/org/apache/stanbol/enhancer/engines/entityhublinking/TrackingEntitySearcher.java
Sat Nov 24 09:41:57 2012
@@ -0,0 +1,110 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF 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. 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 org.apache.stanbol.enhancer.engines.entityhublinking;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.stanbol.enhancer.engines.entitylinking.EntitySearcher;
+import org.apache.stanbol.entityhub.servicesapi.site.SiteConfiguration;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+/**
+ * Abstract super class for EntitySearchers that need to track the OSGI service
+ * used to lookup Entities. Used by the {@link EntityhubSearcher} and the
+ * {@link ReferencedSiteSearcher} implementation
+ * @author Rupert Westenthaler
+ *
+ */
+public abstract class TrackingEntitySearcher<T> implements EntitySearcher {
+
+ private ServiceTracker searchServiceTracker;
+ protected BundleContext bundleContext;
+ /**
+ * Creates a new instance for the parsed parameter
+ * @param context the BundleContexed used to create the {@link
ServiceTracker}
+ * listening for the SearchService
+ * @param serviceClass
+ * @param filterEntries
+ */
+ protected TrackingEntitySearcher(BundleContext context, Class<T>
serviceClass,Map<String,String> filterEntries, ServiceTrackerCustomizer
customizer){
+ this.bundleContext = context;
+ if(filterEntries == null || filterEntries.isEmpty()){
+ searchServiceTracker = new ServiceTracker(context,
serviceClass.getName(), customizer);
+ } else {
+ StringBuffer filterString = new StringBuffer();
+
filterString.append(String.format("(&(objectclass=%s)",serviceClass.getName()));
+ for(Entry<String,String> filterEntry : filterEntries.entrySet()){
+ if(filterEntry.getKey() != null &&
!filterEntry.getKey().isEmpty() &&
+ filterEntry.getValue() != null &&
!filterEntry.getValue().isEmpty()){
+ filterString.append(String.format("(%s=%s)",
+ filterEntry.getKey(),filterEntry.getValue()));
+ } else {
+ throw new IllegalArgumentException("Illegal filterEntry
"+filterEntry+". Both key and value MUST NOT be NULL nor emtpty!");
+ }
+ }
+ filterString.append(')');
+ Filter filter;
+ try {
+ filter = context.createFilter(filterString.toString());
+ } catch (InvalidSyntaxException e) {
+ throw new IllegalArgumentException(String.format(
+ "Unable to build Filter for '%s' (class=%s,filter=%s)",
+ filterString,serviceClass,filterEntries),e);
+ }
+ searchServiceTracker = new ServiceTracker(context, filter,
customizer);
+ }
+ }
+ /**
+ * Starts the tracking by calling {@link ServiceTracker#open()}
+ */
+ public void open(){
+ searchServiceTracker.open();
+ }
+ /**
+ * Getter for the Service used to search for Entities. If the service is
+ * currently not available, than this method will return <code>null</code>
+ * @return The service of <code>null</code> if not available
+ */
+ @SuppressWarnings("unchecked") //type is ensured by OSGI
+ protected T getSearchService(){
+ if(searchServiceTracker == null){
+ throw new IllegalStateException("This TrackingEntitySearcher is
already closed!");
+ } else {
+ return (T) searchServiceTracker.getService();
+ }
+ }
+
+ /**
+ * Closes the {@link ServiceTracker} used to track the service.
+ */
+ public void close(){
+ searchServiceTracker.close();
+ searchServiceTracker = null;
+ bundleContext = null;
+ }
+ @Override
+ protected void finalize() throws Throwable {
+ close();
+ super.finalize();
+ }
+}
Modified:
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/resources/OSGI-INF/metatype/metatype.properties
URL:
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1413156&r1=1412418&r2=1413156&view=diff
==============================================================================
---
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/resources/OSGI-INF/metatype/metatype.properties
(original)
+++
stanbol/branches/stanbol-nlp-processing/enhancer/engines/entityhublinking/src/main/resources/OSGI-INF/metatype/metatype.properties
Sat Nov 24 09:41:57 2012
@@ -25,109 +25,100 @@ one with the higher ranking will be used
#===============================================================================
#Properties and Options used to configure
#===============================================================================
-org.apache.stanbol.enhancer.engines.keywordextraction.engine.KeywordLinkingEngine.name=Apache
\
-Stanbol Enhancer Engine: Keyword Linking
-org.apache.stanbol.enhancer.engines.keywordextraction.engine.KeywordLinkingEngine.description=An
engine \
-that extracts keywords present within a Controlled Vocabulary mentioned within
parsed ContentItem
+org.apache.stanbol.enhancer.engines.entityhublinking.EntityhubLinkingEngine.name=Apache
\
+Stanbol Enhancer Engine: Entityhub Linking
+org.apache.stanbol.enhancer.engines.entityhublinking.EntityhubLinkingEngine.description=An
engine \
+that links NLP processed text with Entities of the Entityhub Sites.
-org.apache.stanbol.enhancer.engines.keywordextraction.referencedSiteId.name=Referenced
Site
-org.apache.stanbol.enhancer.engines.keywordextraction.referencedSiteId.description=The
ID of the \
+enhancer.engines.entityhublinking.siteId.name=Referenced Site
+enhancer.engines.entityhublinking.siteId.description=The ID of the \
Entityhub Referenced Site holding the Controlled Vocabulary (e.g. a taxonomy
or just a set of \
named entities)
-org.apache.stanbol.enhancer.engines.keywordextraction.simpleTokenizer.name=Use
Simple Tokenizer
-org.apache.stanbol.enhancer.engines.keywordextraction.simpleTokenizer.description=This
allows to \
-deactivate the use of Language specific Tokenizers. For most European
languages the Simple Tokenizer \
-is sufficient.
-
-org.apache.stanbol.enhancer.engines.keywordextraction.minSearchTokenLength.name=Min
Token Length
-org.apache.stanbol.enhancer.engines.keywordextraction.minSearchTokenLength.description=The
minimum \
+enhancer.engines.linking.minSearchTokenLength.name=Min Token Length
+enhancer.engines.linking.minSearchTokenLength.description=The minimum \
length of Tokens used to lookup Entities within the Controlled Vocabulary.
This parameter is ignored \
in case a POS (Part of Speech) tagger is available for the language of the
parsed content.
-#org.apache.stanbol.enhancer.engines.keywordextraction.enableChunker.name=Use
Chunker
-#org.apache.stanbol.enhancer.engines.keywordextraction.enableChunker.description=This
allows to enable/disable the use of a Chunker. Even if enabled it will only be
used if one is present for the language of the content.
-
-org.apache.stanbol.enhancer.engines.keywordextraction.nameField.name=Label
Field
-org.apache.stanbol.enhancer.engines.keywordextraction.nameField.description=The
field used to match \
+enhancer.engines.linking.labelField.name=Label Field
+enhancer.engines.linking.labelField.description=The field used to match \
Entities with a mentions within the parsed text.
-org.apache.stanbol.enhancer.engines.keywordextraction.typeField.name=Type Field
-org.apache.stanbol.enhancer.engines.keywordextraction.typeField.description=The
field used to \
+enhancer.engines.linking.typeField.name=Type Field
+enhancer.engines.linking.typeField.description=The field used to \
retrieve the types of matched Entities. Values of that field are expected to
be URIs
-org.apache.stanbol.enhancer.engines.keywordextraction.caseSensitive.name=Case
Sensitivity
-org.apache.stanbol.enhancer.engines.keywordextraction.caseSensitive.description=Allows
to enable/disable \
+enhancer.engines.linking.caseSensitive.name=Case Sensitivity
+enhancer.engines.linking.caseSensitive.description=Allows to enable/disable \
case sensitive matching
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectField.name=Redirect
Field
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectField.description=Entities
may \
+enhancer.engines.linking.redirectField.name=Redirect Field
+enhancer.engines.linking.redirectField.description=Entities may \
define redirects to other Entities (e.g.
"USA"(http://dbpedia.org/resource/USA) -> \
"United States"(http://dbpedia.org/resource/United_States). Values of this
field are \
expected to link to other entities part of the controlled vocabulary
-org.apache.stanbol.enhancer.engines.keywordextraction.maxSuggestions.name=Suggestions
-org.apache.stanbol.enhancer.engines.keywordextraction.maxSuggestions.description=The
maximal \
+enhancer.engines.linking.suggestions.name=Suggestions
+enhancer.engines.linking.suggestions.description=The maximal \
number of suggestions returned for a single mention.
-org.apache.stanbol.enhancer.engines.keywordextraction.minFoundTokens.name=Number
of Required Tokens
-org.apache.stanbol.enhancer.engines.keywordextraction.minFoundTokens.description=For
lookups with \
+enhancer.engines.linking.minFoundTokens.name=Number of Required Tokens
+enhancer.engines.linking.minFoundTokens.description=For lookups with \
several words (e.g. Dr Patrick Marshall) this is the minimum number of Tokens
the label of an \
entity must match to be suggested. This is only used of the label does not
exactly match a part \
of the text.
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectMode.name=Redirect
Mode
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectMode.description=Defines
how to \
+enhancer.engines.linking.redirectMode.name=Redirect Mode
+enhancer.engines.linking.redirectMode.description=Defines how to \
process redirects of Entities mentioned in the parsed content.. Three modes to
deal with such \
links are supported: Ignore redirects; Add values from redirected Entities to
extracted; Follow \
Redirects and suggest the redirected Entity instead of the extracted.
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectMode.option.follow=Follow
Redirects
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectMode.option.addValues=Keep
extracted \
+enhancer.engines.linking.redirectMode.option.follow=Follow Redirects
+enhancer.engines.linking.redirectMode.option.addValues=Keep extracted \
Entity, but add information of the redirected
-org.apache.stanbol.enhancer.engines.keywordextraction.redirectMode.option.ignore=Ignore
Redirects
+enhancer.engines.linking.redirectMode.option.ignore=Ignore Redirects
-org.apache.stanbol.enhancer.engines.keywordextraction.properNounsState.name=Link
ProperNouns only
-org.apache.stanbol.enhancer.engines.keywordextraction.properNounsState.description=If
activated \
+enhancer.engines.linking.properNounsState.name=Link ProperNouns only
+enhancer.engines.linking.properNounsState.description=If activated \
only ProperNouns will be matched against the Vocabulary. If deactivated any
Noun will be matched. \
NOTE that this parameter requires a tag of the POS TagSet to be mapped against
'olia:PorperNoun'. \
Otherwise mapping will not work as expected.
-org.apache.stanbol.enhancer.engines.keywordextraction.processedLanguages.name=Processed
Languages
-org.apache.stanbol.enhancer.engines.keywordextraction.processedLanguages.description=Languages
to \
+enhancer.engines.linking.processedLanguages.name=Processed Languages
+enhancer.engines.linking.processedLanguages.description=Languages to \
process and optionally language specific configurations. Syntax
"{lang};{param-name}={param-value};\
{param-name}={param-value};...". Supported {param-name}s: "lc" - processed
Lexical Categories (see \
LexicalCategory enumeration for possible values); "pos" - processed Pos types
(see Pos enumeration \
for possible values); "tag" - processed string pos tags; "prob" - minumum
probability of pos annotations.
-org.apache.stanbol.enhancer.engines.keywordextraction.defaultMatchingLanguage.name=Default
Matching Language
-org.apache.stanbol.enhancer.engines.keywordextraction.defaultMatchingLanguage.description=The
language \
+enhancer.engines.linking.defaultMatchingLanguage.name=Default Matching Language
+enhancer.engines.linking.defaultMatchingLanguage.description=The language \
used in addition to the language detected for the analysed text to search for
Entities. Typically this \
configuration is an empty string to search for labels without any language
defined, but for some data \
sets (such as DBpedia.org) that add languages to any labels it might improve
resuls to change this \
configuration (e.g. to 'en' in the case of DBpedia.org).
-org.apache.stanbol.enhancer.engines.keywordextraction.dereference.name=Dereference
Entities
-org.apache.stanbol.enhancer.engines.keywordextraction.dereference.description=If
enabled additional \
+enhancer.engines.linking.dereference.name=Dereference Entities
+enhancer.engines.linking.dereference.description=If enabled additional \
data for suggested Entities are included.
-org.apache.stanbol.enhancer.engines.keywordextraction.typeMappings.name=Type
Mappings
-org.apache.stanbol.enhancer.engines.keywordextraction.typeMappings.description=This
allows to add \
+enhancer.engines.linking.typeMappings.name=Type Mappings
+enhancer.engines.linking.typeMappings.description=This allows to add \
additional entity-type > text-annotation-type mappings. Such mappings are used
to determine the \
'dc:type' value of the 'fise:TextAnnotation' created for extracted entities.
Usage: \
variant (a) '{uri}' short for {uri} > {uri} or (b)
'{source1};{source2};..;{sourceN} > {target}'. \
Note that a {source} may be only mapped to a single {target}. Multiple
{source} types \
can be mapped to the same {target}.
-org.apache.stanbol.enhancer.engines.keywordextraction.keywordTokenizer.name=Keyword
Tokenizer
-org.apache.stanbol.enhancer.engines.keywordextraction.keywordTokenizer.description=This
allows \
+enhancer.engines.linking.keywordTokenizer.name=Keyword Tokenizer
+enhancer.engines.linking.keywordTokenizer.description=This allows \
to use a special Tokenizer for matching keywords and alpha numeric IDs.
Typical language \
specific Tokenizers tned to split such IDs in several tokens and therefore
might prevent \
a correct matching.
-org.apache.stanbol.enhancer.engines.keywordextraction.minTokenMatchFactor.name=Minimum
Token Match Factor
-org.apache.stanbol.enhancer.engines.keywordextraction.minTokenMatchFactor.description=If
a Token \
-of the text is compared with a Token in the Label of an Entity the similarity
of those is \
-expressed in the range [0..1]. This factor specifies the minimum similarity of
two Tokens \
-so that they are considered to match. Lower values will allow more Tokens to
match (e.g \
-inflected forms of words) but may also result in false positives. Regardless
of the \
-configured value the similarity will influence the confidence of suggestions.
+enhancer.engines.linking.minTokenScore.name=Minimum Token Score
+enhancer.engines.linking.minTokenScore.description=The minimum score a single
Token \
+of the text must match a Token of the Label so that it is considered to match.
[0..1].\
+The score is calculated by comparing the matching characters from the
beginning of the two \
+tokens compared to the overal size of the token. So it allows derivations at
the end of the \
+of the tokens (e.g because of inflected forms of words).