ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1574228 - in /ctakes/sandbox/ctakes-dictionary-lookup2: example/desc/analysis_engine/ctakes-dictionary-lookup2/ src/main/java/org/apache/ctakes/dictionary/lookup2/ae/
Date Tue, 04 Mar 2014 22:31:40 GMT
Author: seanfinan
Date: Tue Mar  4 22:31:40 2014
New Revision: 1574228

URL: http://svn.apache.org/r1574228
Log:
A few renames of resources, keys, etc.  No Jira

Modified:
    ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml
    ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml
    ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java
    ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java
    ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/OverlapJCasTermAnnotator.java

Modified: ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml?rev=1574228&r1=1574227&r2=1574228&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml
(original)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorBSV.xml
Tue Mar  4 22:31:40 2014
@@ -46,6 +46,13 @@
             <multiValued>false</multiValued>
             <mandatory>false</mandatory>
          </configurationParameter>
+         <configurationParameter>
+            <name>minimumSpan</name>
+            <description>Minimum required span length of tokens to use for lookup.
 Default is 3</description>
+            <type>Integer</type>
+            <multiValued>false</multiValued>
+            <mandatory>false</mandatory>
+         </configurationParameter>
       </configurationParameters>
 
       <configurationParameterSettings>
@@ -64,6 +71,12 @@
                <string>VB,VBD,VBG,VBN,VBP,VBZ,CC,CD,DT,EX,IN,LS,MD,PDT,POS,PP,PP$,PRP,PRP$,RP,TO,WDT,WP,WPS,WRB</string>
             </value>
          </nameValuePair>
+         <nameValuePair>
+            <name>minimumSpan</name>
+            <value>
+               <integer>3</integer>
+            </value>
+         </nameValuePair>
       </configurationParameterSettings>
 
       <typeSystemDescription>
@@ -92,18 +105,18 @@
    </analysisEngineMetaData>
 
    <externalResourceDependencies>
-      <!-- LookupDescriptor is a relatively poorly-named xml that contains parms for dictionary
files, dbs, etc. -->
+      <!-- DictionaryDescriptor is a relatively poorly-named xml that contains parms for
dictionary files, dbs, etc. -->
       <!-- why aren't such things just defined here?  The obvious answer is -->
       <externalResourceDependency>
-         <key>RareWordTermsDescriptor</key>
+         <key>DictionaryDescriptor</key>
          <description/>
          <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
          <optional>false</optional>
       </externalResourceDependency>
-      <!-- BsvDictionaryFile is the key that we are giving the actual bsv file that contains
the dictionary -->
+      <!-- CustomBsvDictionary is the key that we are giving the actual bsv file that
contains the dictionary -->
       <!-- This is not a filename, just a key to connect what is here with what is in
the lookupDescriptor -->
       <externalResourceDependency>
-         <key>BsvDictionaryFile</key>
+         <key>CustomBsvDictionary</key>
          <description/>
          <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
          <optional>false</optional>
@@ -113,8 +126,8 @@
    <resourceManagerConfiguration>
       <externalResources>
          <externalResource>
-            <!-- Kind of backwards.  The Binding is below, for LookupDescriptor = LookupDescriptorFile
-->
-            <name>RareWordTermsDescriptorFile</name>
+            <!-- Kind of backwards.  The Binding is below, for DictionaryDescriptor =
DictionaryDescriptorFile -->
+            <name>DictionaryDescriptorFile</name>
             <description/>
             <fileResourceSpecifier>
                <fileUrl>file:org/apache/ctakes/dictionary/lookup2/example/bsv/RareWord_BSV.xml</fileUrl>
@@ -122,10 +135,10 @@
             <implementationName>org.apache.ctakes.core.resource.FileResourceImpl</implementationName>
          </externalResource>
          <externalResource>
-            <!-- Kind of backwards.  The Binding is below, for BsvDictionaryFile = BsvDictionaryFileResource
-->
+            <!-- Kind of backwards.  The Binding is below, for CustomBsvDictionary = BsvDictionaryResource
-->
             <!-- The binding key DictionaryFile will be used in the LookupDescriptor to
point back to this
-                 BsvDictionaryFileResource.  Dead or Alive anyone? (80's)-->
-            <name>BsvDictionaryFileResource</name>
+                 BsvDictionaryResource.  Dead or Alive anyone? (80's)-->
+            <name>BsvDictionaryResource</name>
             <description/>
             <fileResourceSpecifier>
                <fileUrl>file:org/apache/ctakes/dictionary/lookup2/example/bsv/CustomBsvDictionary.bsv</fileUrl>
@@ -135,13 +148,13 @@
       </externalResources>
       <externalResourceBindings>
          <externalResourceBinding>
-            <key>LookupDescriptor</key>
-            <resourceName>LookupDescriptorFile</resourceName>
+            <key>DictionaryDescriptor</key>
+            <resourceName>DictionaryDescriptorFile</resourceName>
          </externalResourceBinding>
          <externalResourceBinding>
-            <!-- binding key BsvDictionaryFile points up to the externalResource named
BsvDictionaryFileResource -->
-            <key>BsvDictionaryFile</key>
-            <resourceName>BsvDictionaryFileResource</resourceName>
+            <!-- binding key CustomBsvDictionary points up to the externalResource named
BsvDictionaryResource -->
+            <key>CustomBsvDictionary</key>
+            <resourceName>BsvDictionaryResource</resourceName>
          </externalResourceBinding>
       </externalResourceBindings>
    </resourceManagerConfiguration>

Modified: ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml?rev=1574228&r1=1574227&r2=1574228&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml
(original)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/example/desc/analysis_engine/ctakes-dictionary-lookup2/CustomLookupAnnotatorJDBC.xml
Tue Mar  4 22:31:40 2014
@@ -91,10 +91,10 @@
    </analysisEngineMetaData>
 
    <externalResourceDependencies>
-      <!-- RareWordTermsDescriptor is a relatively poorly-named xml that contains parms
for dictionary files, dbs, etc. -->
+      <!-- DictionaryDescriptor is a relatively poorly-named xml that contains parms for
dictionary files, dbs, etc. -->
       <!-- why aren't such things just defined here?  The obvious answer is -->
       <externalResourceDependency>
-         <key>RareWordTermsDescriptor</key>
+         <key>DictionaryDescriptor</key>
          <description/>
          <interfaceName>org.apache.ctakes.core.resource.FileResource</interfaceName>
          <optional>false</optional>
@@ -111,7 +111,7 @@
       <externalResources>
          <externalResource>
             <!-- Kind of backwards.  The Binding is below, for RareWordTermsDescriptor
= RareWordTermsDescriptorFile -->
-            <name>RareWordTermsDescriptorFile</name>
+            <name>DictionaryDescriptorFile</name>
             <description/>
             <fileResourceSpecifier>
                <fileUrl>file:org/apache/ctakes/dictionary/lookup2/example/hsql/RareWord_JDBC.xml</fileUrl>
@@ -186,8 +186,8 @@
       </externalResources>
       <externalResourceBindings>
          <externalResourceBinding>
-            <key>RareWordTermsDescriptor</key>
-            <resourceName>RareWordTermsDescriptorFile</resourceName>
+            <key>DictionaryDescriptor</key>
+            <resourceName>DictionaryDescriptorFile</resourceName>
          </externalResourceBinding>
 
          <externalResourceBinding>

Modified: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java?rev=1574228&r1=1574227&r2=1574228&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java
(original)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/AbstractJCasTermAnnotator.java
Tue Mar  4 22:31:40 2014
@@ -112,12 +112,12 @@ abstract public class AbstractJCasTermAn
          }
 
          // optional minimum span, default is 3
-         final String minimumSpan = (String)uimaContext.getConfigParameterValue( MIN_SPAN_PRP_KEY
);
+         final Object minimumSpan = uimaContext.getConfigParameterValue( MIN_SPAN_PRP_KEY
);
          if ( minimumSpan != null ) {
             _minimumLookupSpan = parseInt( minimumSpan, MIN_SPAN_PRP_KEY, _minimumLookupSpan
);
          }
          _logger.info( "Using minimum lookup token span: " + _minimumLookupSpan );
-         final FileResource fileResource = (FileResource) uimaContext.getResourceObject(
LOOKUP_DESCRIPTOR_KEY );
+         final FileResource fileResource = (FileResource) uimaContext.getResourceObject(
DICTIONARY_DESCRIPTOR_KEY );
          final File descriptorFile = fileResource.getFile();
          _dictionarySpec = DictionaryDescriptorParser.parseDescriptor( descriptorFile, uimaContext
);
       } catch ( ResourceAccessException raE ) {
@@ -260,14 +260,17 @@ abstract public class AbstractJCasTermAn
 
 
 
-
-
-
-   protected int parseInt( final String text, final String name, final int defaultValue )
{
-      try {
-         return Integer.parseInt( text );
-      } catch ( NumberFormatException nfE ) {
-         _logger.warn( "Could not parse " + name + " " + text + " as an integer" );
+   protected int parseInt( final Object value, final String name, final int defaultValue
) {
+      if ( value instanceof Integer ) {
+         return (Integer)value;
+      } else if ( value instanceof String ) {
+         try {
+            return Integer.parseInt( (String)value );
+         } catch ( NumberFormatException nfE ) {
+            _logger.warn( "Could not parse " + name + " " + value + " as an integer" );
+         }
+      } else {
+         _logger.warn( "Could not parse " + name + " " + value + " as an integer" );
       }
       return defaultValue;
    }

Modified: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java?rev=1574228&r1=1574227&r2=1574228&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java
(original)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/JCasTermAnnotator.java
Tue Mar  4 22:31:40 2014
@@ -33,7 +33,7 @@ import java.util.Collection;
  */
 public interface JCasTermAnnotator extends AnalysisComponent {
 
-   static public final String LOOKUP_DESCRIPTOR_KEY = "RareWordTermsDescriptor";
+   static public final String DICTIONARY_DESCRIPTOR_KEY = "DictionaryDescriptor";
 
    /**
     * @return Dictionaries that are used by this WindowProcessor

Modified: ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/OverlapJCasTermAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/OverlapJCasTermAnnotator.java?rev=1574228&r1=1574227&r2=1574228&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/OverlapJCasTermAnnotator.java
(original)
+++ ctakes/sandbox/ctakes-dictionary-lookup2/src/main/java/org/apache/ctakes/dictionary/lookup2/ae/OverlapJCasTermAnnotator.java
Tue Mar  4 22:31:40 2014
@@ -60,11 +60,11 @@ final public class OverlapJCasTermAnnota
    @Override
    public void initialize( final UimaContext uimaContext ) throws ResourceInitializationException
{
       super.initialize( uimaContext );
-      final String consecutiveSkipText = (String)uimaContext.getConfigParameterValue( CONS_SKIP_PRP_KEY
);
+      final Object consecutiveSkipText = uimaContext.getConfigParameterValue( CONS_SKIP_PRP_KEY
);
       if ( consecutiveSkipText != null ) {
          _consecutiveSkipMax = parseInt( consecutiveSkipText, CONS_SKIP_PRP_KEY, _consecutiveSkipMax
);
       }
-      final String totalSkipText = (String)uimaContext.getConfigParameterValue( TOTAL_SKIP_PRP_KEY
);
+      final Object totalSkipText = uimaContext.getConfigParameterValue( TOTAL_SKIP_PRP_KEY
);
       if ( totalSkipText != null ) {
          _totalSkipMax = parseInt( totalSkipText, TOTAL_SKIP_PRP_KEY, _consecutiveSkipMax
);
       }



Mime
View raw message