ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vjapa...@apache.org
Subject svn commit: r1567501 - in /ctakes/branches/ytex/ctakes-ytex-uima: desc/analysis_engine/ src/main/java/org/apache/ctakes/ytex/tools/ src/test/java/org/apache/ctakes/ytex/tools/
Date Wed, 12 Feb 2014 02:16:56 GMT
Author: vjapache
Date: Wed Feb 12 02:16:56 2014
New Revision: 1567501

URL: http://svn.apache.org/r1567501
Log:
fix YTEXPipeline
fix lvg support for SetupAuiFirstWord

Added:
    ctakes/branches/ytex/ctakes-ytex-uima/src/test/java/org/apache/ctakes/ytex/tools/
    ctakes/branches/ytex/ctakes-ytex-uima/src/test/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWordTest.java
Modified:
    ctakes/branches/ytex/ctakes-ytex-uima/desc/analysis_engine/YTEXPipeline.xml
    ctakes/branches/ytex/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java

Modified: ctakes/branches/ytex/ctakes-ytex-uima/desc/analysis_engine/YTEXPipeline.xml
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex-uima/desc/analysis_engine/YTEXPipeline.xml?rev=1567501&r1=1567500&r2=1567501&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex-uima/desc/analysis_engine/YTEXPipeline.xml (original)
+++ ctakes/branches/ytex/ctakes-ytex-uima/desc/analysis_engine/YTEXPipeline.xml Wed Feb 12
02:16:56 2014
@@ -4,10 +4,10 @@
 	<primitive>false</primitive>
 	<delegateAnalysisEngineSpecifiers>
 		<delegateAnalysisEngine key="AggregatePlaintextUMLSProcessor">
-	      <import location="./AggregatePlaintextUMLSProcessor.xml"/>
+			<import location="./AggregatePlaintextUMLSProcessor.xml" />
 		</delegateAnalysisEngine>
 		<delegateAnalysisEngine key="DBConsumer">
-	      <import location="./DBConsumer.xml"/>
+			<import location="./DBConsumer.xml" />
 		</delegateAnalysisEngine>
 	</delegateAnalysisEngineSpecifiers>
 	<analysisEngineMetaData>
@@ -24,6 +24,15 @@
 		<vendor />
 		<configurationParameters searchStrategy="language_fallback">
 			<configurationParameter>
+				<name>xmiOutputDirectory</name>
+				<type>String</type>
+				<multiValued>false</multiValued>
+				<mandatory>false</mandatory>
+				<overrides>
+					<parameter>DBConsumer/xmiOutputDirectory</parameter>
+				</overrides>
+			</configurationParameter>
+			<configurationParameter>
 				<name>analysisBatch</name>
 				<type>String</type>
 				<multiValued>false</multiValued>
@@ -78,7 +87,7 @@
 			<nameValuePair>
 				<name>xmiOutputDirectory</name>
 				<value>
-					<string />
+					<string></string>
 				</value>
 			</nameValuePair>
 			<nameValuePair>
@@ -109,14 +118,18 @@
 				<name>typesToIgnore</name>
 				<value>
 					<array>
-						<string>org.apache.ctakes.typesystem.type.syntax.ContractionToken</string>
-						<string>org.apache.ctakes.typesystem.type.syntax.NewlineToken</string>
+						<string>org.apache.ctakes.typesystem.type.syntax.ContractionToken
+						</string>
+						<string>org.apache.ctakes.typesystem.type.syntax.NewlineToken
+						</string>
 						<string>org.apache.ctakes.typesystem.type.syntax.PunctuationToken
 						</string>
-						<string>org.apache.ctakes.typesystem.type.syntax.SymbolToken</string>
+						<string>org.apache.ctakes.typesystem.type.syntax.SymbolToken
+						</string>
 						<string>org.apache.ctakes.typesystem.type.textsem.RomanNumeralAnnotation
 						</string>
-						<string>org.apache.ctakes.typesystem.type.textsem.DateAnnotation</string>
+						<string>org.apache.ctakes.typesystem.type.textsem.DateAnnotation
+						</string>
 						<string>org.apache.ctakes.typesystem.type.textsem.FractionAnnotation
 						</string>
 						<string>org.apache.ctakes.typesystem.type.textsem.MeasurementAnnotation
@@ -125,7 +138,8 @@
 						</string>
 						<string>org.apache.ctakes.typesystem.type.textsem.RangeAnnotation
 						</string>
-						<string>org.apache.ctakes.typesystem.type.textsem.TimeAnnotation</string>
+						<string>org.apache.ctakes.typesystem.type.textsem.TimeAnnotation
+						</string>
 						<string>org.apache.ctakes.typesystem.type.syntax.NP</string>
 						<string>org.apache.ctakes.typesystem.type.syntax.VP</string>
 					</array>

Modified: ctakes/branches/ytex/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java?rev=1567501&r1=1567500&r2=1567501&view=diff
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java
(original)
+++ ctakes/branches/ytex/ctakes-ytex-uima/src/main/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWord.java
Wed Feb 12 02:16:56 2014
@@ -1,6 +1,8 @@
 package org.apache.ctakes.ytex.tools;
 
+import java.io.BufferedInputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -81,7 +83,7 @@ public class SetupAuiFirstWord {
 		// b = uninflect a term
 		try {
 			URL uri = this.getClass().getClassLoader()
-					.getResource("lvgresources/lvg/data/config/lvg.properties");
+					.getResource("org/apache/ctakes/lvg/data/config/lvg.properties");
 			if (log.isInfoEnabled())
 				log.info("loading lvg.properties from:" + uri.getPath());
 			File f = new File(uri.getPath());
@@ -109,19 +111,20 @@ public class SetupAuiFirstWord {
 		this.exclusionSet = new HashSet<String>();
 		InputStream isLvgAnno = null;
 		try {
-			URL lvgURL = this.getClass().getClassLoader()
-					.getResource("lvgdesc/analysis_engine/LvgAnnotator.xml");
-			if (lvgURL == null) {
-				log.warn("lvgdesc/analysis_engine/LvgAnnotator.xml not available, using empty exclusion
set");
+			isLvgAnno = this
+					.getClass()
+					.getClassLoader()
+					.getResourceAsStream(
+							"ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml");
+			if(isLvgAnno == null) {
+				log.warn("classpath:ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml not available, attempting
to load from file system");
+				File f = new File("../ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml");
+				if(f.exists())
+					isLvgAnno = new BufferedInputStream(new FileInputStream(f));
+			} 
+			if (isLvgAnno == null) {
+				log.warn("ctakes-lvg/desc/analysis_engine/LvgAnnotator.xml not available, using empty
exclusion set");
 			} else {
-				if (log.isInfoEnabled())
-					log.info("loading LvgAnnotator.xml from:"
-							+ lvgURL.getPath());
-				isLvgAnno = this
-						.getClass()
-						.getClassLoader()
-						.getResourceAsStream(
-								"lvgdesc/analysis_engine/LvgAnnotator.xml");
 				DocumentBuilderFactory dbFactory = DocumentBuilderFactory
 						.newInstance();
 				DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();

Added: ctakes/branches/ytex/ctakes-ytex-uima/src/test/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWordTest.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex-uima/src/test/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWordTest.java?rev=1567501&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex-uima/src/test/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWordTest.java
(added)
+++ ctakes/branches/ytex/ctakes-ytex-uima/src/test/java/org/apache/ctakes/ytex/tools/SetupAuiFirstWordTest.java
Wed Feb 12 02:16:56 2014
@@ -0,0 +1,15 @@
+package org.apache.ctakes.ytex.tools;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SetupAuiFirstWordTest {
+
+	@Test
+	public void test() throws Exception {
+		SetupAuiFirstWord fw = new SetupAuiFirstWord();
+		System.out.println(fw.tokenizeStr("1tok", "heart"));
+		Assert.assertTrue(fw.tokenizeStr("2tok", "heart attack").getFword().equals("heart"));
+	}
+
+}



Mime
View raw message