ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenbeth...@apache.org
Subject svn commit: r1393218 - /incubator/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/ClearParserSemanticRoleLabelerAE.java
Date Tue, 02 Oct 2012 22:28:10 GMT
Author: stevenbethard
Date: Tue Oct  2 22:28:10 2012
New Revision: 1393218

URL: http://svn.apache.org/viewvc?rev=1393218&view=rev
Log:
Fixes semantic role labeler lemmatizer file parameter in the same way that dependency parser
was just fixed.

Modified:
    incubator/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/ClearParserSemanticRoleLabelerAE.java

Modified: incubator/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/ClearParserSemanticRoleLabelerAE.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/ClearParserSemanticRoleLabelerAE.java?rev=1393218&r1=1393217&r2=1393218&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/ClearParserSemanticRoleLabelerAE.java
(original)
+++ incubator/ctakes/trunk/ctakes-dependency-parser/src/main/java/org/apache/ctakes/dependency/parser/ae/ClearParserSemanticRoleLabelerAE.java
Tue Oct  2 22:28:10 2012
@@ -18,42 +18,41 @@
  */
 package org.apache.ctakes.dependency.parser.ae;
 
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.apache.uima.UimaContext;
-import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.jcas.cas.EmptyFSList;
-import org.apache.uima.jcas.cas.FSList;
-import org.apache.uima.jcas.cas.TOP;
-import org.apache.uima.resource.ResourceInitializationException;
-import org.uimafit.component.JCasAnnotator_ImplBase;
-import org.uimafit.descriptor.ConfigurationParameter;
-import org.uimafit.descriptor.TypeCapability;
-import org.uimafit.util.JCasUtil;
-
-import clear.dep.DepNode;
-import clear.dep.DepTree;
-import clear.dep.srl.SRLHead;
-import clear.morph.MorphEnAnalyzer;
-import clear.parse.AbstractSRLParser;
-import clear.reader.AbstractReader;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.ctakes.core.util.ListFactory;
-import org.apache.ctakes.typesystem.type.syntax.BaseToken;
-import org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode;
-import org.apache.ctakes.typesystem.type.textsem.Predicate;
-import org.apache.ctakes.typesystem.type.textsem.SemanticArgument;
-import org.apache.ctakes.typesystem.type.textsem.SemanticRoleRelation;
-import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.ctakes.typesystem.type.syntax.BaseToken;
+import org.apache.ctakes.typesystem.type.syntax.ConllDependencyNode;
+import org.apache.ctakes.typesystem.type.textsem.Predicate;
+import org.apache.ctakes.typesystem.type.textsem.SemanticArgument;
+import org.apache.ctakes.typesystem.type.textsem.SemanticRoleRelation;
+import org.apache.ctakes.typesystem.type.textspan.Sentence;
+import org.apache.log4j.Logger;
+import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.jcas.cas.EmptyFSList;
+import org.apache.uima.jcas.cas.FSList;
+import org.apache.uima.jcas.cas.TOP;
+import org.apache.uima.resource.ResourceInitializationException;
+import org.uimafit.component.JCasAnnotator_ImplBase;
+import org.uimafit.descriptor.ConfigurationParameter;
+import org.uimafit.descriptor.TypeCapability;
+import org.uimafit.util.JCasUtil;
+
+import clear.dep.DepNode;
+import clear.dep.DepTree;
+import clear.dep.srl.SRLHead;
+import clear.morph.MorphEnAnalyzer;
+import clear.parse.AbstractSRLParser;
+import clear.reader.AbstractReader;
 
 /**
  *This class provides a UIMA wrapper for the ClearParser Semantic Role Labeler, which is
@@ -95,7 +94,14 @@ public class ClearParserSemanticRoleLabe
 		  description = "This parameter provides the file name of the semantic role labeler model
required by the factory method provided by ClearParserUtil.")
   private String parserModelFileName;
 
-
+  public static final String PARAM_LEMMATIZER_DATA_FILE = "LemmatizerDataFile";
+
+  @ConfigurationParameter(
+      name = PARAM_LEMMATIZER_DATA_FILE,
+      description = "This parameter provides the data file required for the MorphEnAnalyzer.
If not "
+          + "specified, this analysis engine will use a default model from the resources
directory")
+  protected File lemmatizerDataFile;
+
   public static final String PARAM_USE_LEMMATIZER = "UseLemmatizer";
   @ConfigurationParameter(
 		  name = PARAM_USE_LEMMATIZER,
@@ -116,7 +122,9 @@ public class ClearParserSemanticRoleLabe
     	if (useLemmatizer) {
     		// Note: If lemmatizer data file is not specified, then use lemmas from the BaseToken
normalizedToken field.
     		// Initialize lemmatizer
-    		URL lemmatizerDataFileURL = this.getClass().getResource(ENG_LEMMATIZER_DATA_FILE);
+        URL lemmatizerDataFileURL = this.lemmatizerDataFile != null
+            ? this.lemmatizerDataFile.toURI().toURL()
+            : this.getClass().getResource(ENG_LEMMATIZER_DATA_FILE);
     		lemmatizer = new MorphEnAnalyzer(new URL(lemmatizerDataFileURL.toString()));
     	}
 



Mime
View raw message