ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1641650 - in /ctakes/branches/ctakes-3.2.1: ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ae/ ctakes-dictionary-lookup-fast-re...
Date Tue, 25 Nov 2014 16:42:34 GMT
Author: chenpei
Date: Tue Nov 25 16:42:33 2014
New Revision: 1641650

URL: http://svn.apache.org/r1641650
Log:
CTAKES-335 - url typo in ctakessql.xml CTAKES-336 (FROM TRUNK)

Modified:
    ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/MaxentParserWrapper.java
    ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ae/ConstituencyParser.java
    ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast-res/src/main/resources/org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml
    ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedLookupAnnotator.xml
    ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedOvLookupAnnotator.xml
    ctakes/branches/ctakes-3.2.1/ctakes-drug-ner/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml
    ctakes/branches/ctakes-3.2.1/ctakes-side-effect/desc/analysis_engine/DictionaryLookupAnnotator_sideEffectUMLS.xml

Modified: ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/MaxentParserWrapper.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/MaxentParserWrapper.java?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/MaxentParserWrapper.java
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/MaxentParserWrapper.java
Tue Nov 25 16:42:33 2014
@@ -18,48 +18,35 @@
  */
 package org.apache.ctakes.constituency.parser;
 
-import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
-import opennlp.tools.cmdline.parser.ParserTool;
 import opennlp.tools.parser.AbstractBottomUpParser;
 import opennlp.tools.parser.Parse;
 import opennlp.tools.parser.ParserModel;
 import opennlp.tools.parser.chunking.Parser;
-import opennlp.tools.util.Span;
 
 import org.apache.ctakes.constituency.parser.util.TreeUtils;
 import org.apache.ctakes.core.util.DocumentIDAnnotationUtil;
-import org.apache.ctakes.typesystem.type.syntax.TerminalTreebankNode;
 import org.apache.ctakes.typesystem.type.syntax.TopTreebankNode;
-import org.apache.ctakes.typesystem.type.syntax.TreebankNode;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.log4j.Logger;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
 import org.apache.uima.cas.FSIterator;
 import org.apache.uima.jcas.JCas;
 import org.apache.uima.jcas.cas.FSArray;
-import org.apache.uima.jcas.cas.StringArray;
 
 public class MaxentParserWrapper implements ParserWrapper {
 
 	Parser parser = null;
 	private String parseStr = "";
 	Logger logger = Logger.getLogger(this.getClass().getName());
-	private boolean usePos;
-	
-	public MaxentParserWrapper(String dataDir) {
-		this(dataDir, false);
-	}
-	
-	public MaxentParserWrapper(String dataDir, boolean usePos){
+
+
+	public MaxentParserWrapper(InputStream is){
 		try {
-			File d = new File(dataDir);
-			this.usePos = usePos;
-			if (!d.isDirectory()) {
-				FileInputStream fis = new FileInputStream(d);
-				ParserModel model = new ParserModel(fis);
+			if (is!=null) {
+				ParserModel model = new ParserModel(is);
 				parser = new Parser(model, AbstractBottomUpParser.defaultBeamSize, AbstractBottomUpParser.defaultAdvancePercentage);
 			}
 		} catch (IOException e) {

Modified: ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ae/ConstituencyParser.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ae/ConstituencyParser.java?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ae/ConstituencyParser.java
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-constituency-parser/src/main/java/org/apache/ctakes/constituency/parser/ae/ConstituencyParser.java
Tue Nov 25 16:42:33 2014
@@ -25,16 +25,17 @@ import org.apache.ctakes.constituency.pa
 import org.apache.ctakes.core.resource.FileLocator;
 import org.apache.log4j.Logger;
 import org.apache.uima.UimaContext;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
-import org.apache.uima.jcas.JCas;
-import org.apache.uima.resource.ResourceInitializationException;
 import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
 import org.apache.uima.fit.descriptor.ConfigurationParameter;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.jcas.JCas;
+import org.apache.uima.resource.ResourceInitializationException;
 
 
 public class ConstituencyParser extends JCasAnnotator_ImplBase {
 	public static final String PARAM_MODEL_FILENAME = "MODEL_FILENAME";
-	public static final String PARAM_USE_POS = "USE_POS";
 	
 	@ConfigurationParameter(
 			name = PARAM_MODEL_FILENAME,
@@ -43,12 +44,6 @@ public class ConstituencyParser extends 
 			defaultValue = "org/apache/ctakes/constituency/parser/models/sharpacq-3.1.bin"
 	) private String modelFilename;
 	
-	@ConfigurationParameter(
-			name = PARAM_USE_POS,
-			description = "Whether to use the POS tags generated by cTAKES pos tagger or generate
our own",
-			mandatory = false,
-			defaultValue = "false"
-	) private boolean usePos;
 	
 	private ParserWrapper parser = null;
 	private Logger logger = Logger.getLogger(this.getClass());
@@ -59,7 +54,7 @@ public class ConstituencyParser extends 
 		super.initialize(aContext);
 		try {
 			logger.info("Initializing parser...");		
-			parser = new MaxentParserWrapper(FileLocator.locateFile(modelFilename).getAbsolutePath(),
usePos);
+			parser = new MaxentParserWrapper(FileLocator.getAsStream(modelFilename));
 		} catch (FileNotFoundException e) {
 			e.printStackTrace();
 			logger.error("Error reading parser model file/directory: " + e.getMessage());
@@ -72,4 +67,17 @@ public class ConstituencyParser extends 
 	public void process(JCas jcas) throws AnalysisEngineProcessException {
 		parser.createAnnotations(jcas);
 	}
+	
+	  public static AnalysisEngineDescription createAnnotatorDescription(
+		      String modelPath) throws ResourceInitializationException {
+		    return AnalysisEngineFactory.createEngineDescription(
+		    		ConstituencyParser.class,
+		    		ConstituencyParser.PARAM_MODEL_FILENAME,
+		        modelPath);
+		  }
+	  public static AnalysisEngineDescription createAnnotatorDescription() 
+			  throws ResourceInitializationException {
+		    return AnalysisEngineFactory.createEngineDescription(
+		    		ConstituencyParser.class);
+		  }	  
 }

Modified: ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast-res/src/main/resources/org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast-res/src/main/resources/org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast-res/src/main/resources/org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast-res/src/main/resources/org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml
Tue Nov 25 16:42:33 2014
@@ -38,7 +38,7 @@
             <property key="jdbcUser" value="sa"/>
             <property key="jdbcPass" value=""/>
             <property key="rareWordTable" value="cui_terms"/>
-            <property key="umlsUrl" value="https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser"/>
+            <property key="umlsUrl" value="https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser"/>
             <property key="umlsVendor" value="NLM-6515182895"/>
             <property key="umlsUser" value="CHANGEME"/>
             <property key="umlsPass" value="CHANGEME"/>
@@ -65,7 +65,7 @@
             <!--<property key="rxNormTable" value="rxnorm"/>-->
             <!--<property key="icd9Table" value="icd9cm"/>-->
             <!--<property key="icd10Table" value="icd10pcs"/>-->
-            <property key="umlsUrl" value="https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser"/>
+            <property key="umlsUrl" value="https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser"/>
             <property key="umlsVendor" value="NLM-6515182895"/>
             <property key="umlsUser" value="CHANGEME"/>
             <property key="umlsPass" value="CHANGEME"/>

Modified: ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedLookupAnnotator.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedLookupAnnotator.xml?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedLookupAnnotator.xml
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedLookupAnnotator.xml
Tue Nov 25 16:42:33 2014
@@ -113,7 +113,7 @@
          <!--<nameValuePair>-->
             <!--<name>ctakes.umlsaddr</name>-->
             <!--<value>-->
-               <!--<string>https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser</string>-->
+               <!--<string>https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser</string>-->
             <!--</value>-->
          <!--</nameValuePair>-->
          <!--<nameValuePair>-->

Modified: ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedOvLookupAnnotator.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedOvLookupAnnotator.xml?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedOvLookupAnnotator.xml
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-dictionary-lookup-fast/desc/analysis_engine/SnomedOvLookupAnnotator.xml
Tue Nov 25 16:42:33 2014
@@ -139,7 +139,7 @@
          <nameValuePair>
             <name>ctakes.umlsaddr</name>
             <value>
-               <string>https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser</string>
+               <string>https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser</string>
             </value>
          </nameValuePair>
          <nameValuePair>

Modified: ctakes/branches/ctakes-3.2.1/ctakes-drug-ner/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-drug-ner/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-drug-ner/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-drug-ner/desc/analysis_engine/DictionaryLookupAnnotatorUMLS.xml
Tue Nov 25 16:42:33 2014
@@ -80,7 +80,7 @@
       <nameValuePair>
         <name>ctakes.umlsaddr</name>
         <value>
-          <string>https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser</string>
+          <string>https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser</string>
         </value>
       </nameValuePair>    
       <nameValuePair>

Modified: ctakes/branches/ctakes-3.2.1/ctakes-side-effect/desc/analysis_engine/DictionaryLookupAnnotator_sideEffectUMLS.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ctakes-3.2.1/ctakes-side-effect/desc/analysis_engine/DictionaryLookupAnnotator_sideEffectUMLS.xml?rev=1641650&r1=1641649&r2=1641650&view=diff
==============================================================================
--- ctakes/branches/ctakes-3.2.1/ctakes-side-effect/desc/analysis_engine/DictionaryLookupAnnotator_sideEffectUMLS.xml
(original)
+++ ctakes/branches/ctakes-3.2.1/ctakes-side-effect/desc/analysis_engine/DictionaryLookupAnnotator_sideEffectUMLS.xml
Tue Nov 25 16:42:33 2014
@@ -80,7 +80,7 @@
       <nameValuePair>
         <name>ctakes.umlsaddr</name>
         <value>
-          <string>https://uts-ws.nlm.nih.gov/restful/isValidctakes.umlsuser</string>
+          <string>https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser</string>
         </value>
       </nameValuePair>    
       <nameValuePair>



Mime
View raw message