Author: rwesten
Date: Mon Oct 29 13:31:32 2012
New Revision: 1403283

URL: http://svn.apache.org/viewvc?rev=1403283&view=rev
Log:
STANBOL-740: Minor changes to the configuration and ensuring extensibility by 
making some properties/methods protected

Modified:
    
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java
    
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntityLinkerConfig.java

Modified: 
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java?rev=1403283&r1=1403282&r2=1403283&view=diff
==============================================================================
--- 
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java
 (original)
+++ 
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java
 Mon Oct 29 13:31:32 2012
@@ -204,7 +204,7 @@ public class KeywordLinkingEngine 
      * This parameter allows to configure the maximum distance surounding the 
current
      * "processable" Token other "processable" tokens can be included in 
searches.
      */
-    public static final String MAX_SEARCH_TOKEN_DISTANCE = 
"org.apache.stanbol.enhancer.engines.keywordextraction.masSearchTokenDistance";
+    public static final String MAX_SEARCH_TOKEN_DISTANCE = 
"org.apache.stanbol.enhancer.engines.keywordextraction.maxSearchTokenDistance";
     
     /**
      * {@link NlpAnnotations#POS_ANNOTATION POS annotations} with a lower
@@ -289,7 +289,10 @@ public class KeywordLinkingEngine 
      */
     private static final int DEFAULT_ENTITY_SEARCHER_LIMIT = 10;
 
-    private EntitySearcher entitySearcher;
+    /**
+     * The entitySearcher used for linking
+     */
+    protected EntitySearcher entitySearcher;
     private EntityLinkerConfig linkerConfig;
     
     private TextProcessingConfig defaultTextProcessingConfig;
@@ -300,7 +303,7 @@ public class KeywordLinkingEngine 
     // "LabelTokenizerManager labelTokenizer" and not "LabelTokenizer 
labelTokenizer"
     
@org.apache.felix.scr.annotations.Reference(referenceInterface=LabelTokenizerManager.class,
             bind="bindLabelTokenizer",unbind="unbindLabelTokenizer")
-    private LabelTokenizer labelTokenizer;
+    protected LabelTokenizer labelTokenizer;
 
     protected void bindLabelTokenizer(LabelTokenizerManager ltm){
         labelTokenizer = ltm;
@@ -930,14 +933,14 @@ public class KeywordLinkingEngine 
             try {
                 maxSearchDistance = Integer.valueOf(value.toString());
             } catch(NumberFormatException e){
-                throw new ConfigurationException(MAX_SEARCH_TOKENS, "Values 
MUST be valid Integer values > 0",e);
+                throw new ConfigurationException(MAX_SEARCH_TOKEN_DISTANCE, 
"Values MUST be valid Integer values > 0",e);
             }
         } else {
             maxSearchDistance = null;
         }
         if(maxSearchDistance != null){
             if(maxSearchDistance < 1){
-                throw new ConfigurationException(MAX_SEARCH_TOKENS, "Values 
MUST be valid Integer values > 0");
+                throw new ConfigurationException(MAX_SEARCH_TOKEN_DISTANCE, 
"Values MUST be valid Integer values > 0");
             }
             linkerConfig.setMaxSearchDistance(maxSearchDistance);
         }

Modified: 
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntityLinkerConfig.java
URL: 
http://svn.apache.org/viewvc/stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntityLinkerConfig.java?rev=1403283&r1=1403282&r2=1403283&view=diff
==============================================================================
--- 
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntityLinkerConfig.java
 (original)
+++ 
stanbol/branches/stanbol-nlp-processing/enhancer/engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/linking/EntityLinkerConfig.java
 Mon Oct 29 13:31:32 2012
@@ -429,7 +429,13 @@ public class EntityLinkerConfig {
      * @param maxSearchTokens the maxSearchTokens to set
      */
     public final void setMaxSearchTokens(int maxSearchTokens) {
-        this.maxSearchTokens = maxSearchTokens;
+        if(maxSearchTokens == 0){
+            this.maxSearchTokens = DEFAULT_MAX_SEARCH_TOKENS;
+        } else if (maxSearchTokens < 0){
+            throw new IllegalArgumentException("The maxSearchToken value MUST 
BE >= 0 (0 for setting the default)");
+        } else {
+            this.maxSearchTokens = maxSearchTokens;
+        }
     }
     /**
      * Getter for the case sensitive matching state


Reply via email to