You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by st...@apache.org on 2013/01/10 00:51:41 UTC
svn commit: r1431154 - in /incubator/ctakes/trunk/ctakes-temporal: pom.xml
src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
Author: stevenbethard
Date: Wed Jan 9 23:51:41 2013
New Revision: 1431154
URL: http://svn.apache.org/viewvc?rev=1431154&view=rev
Log:
Adds UMLS entity chunk features back to the EventAnnotator evalution
Modified:
incubator/ctakes/trunk/ctakes-temporal/pom.xml
incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
Modified: incubator/ctakes/trunk/ctakes-temporal/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/pom.xml?rev=1431154&r1=1431153&r2=1431154&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/pom.xml (original)
+++ incubator/ctakes/trunk/ctakes-temporal/pom.xml Wed Jan 9 23:51:41 2013
@@ -95,5 +95,67 @@
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-dependency-parser</artifactId>
</dependency>
+ <dependency>
+ <groupId>net.sourceforge.ctakesresources</groupId>
+ <artifactId>ctakes-resources-umls2011ab</artifactId>
+ <version>3.1.0</version>
+ </dependency>
</dependencies>
+ <!-- The below is all necessary to unpack the UMLS resources since they
+ can't be used from the classpath -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>net.sourceforge.ctakesresources</groupId>
+ <artifactId>ctakes-resources-umls2011ab</artifactId>
+ <version>3.1.0</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.directory}/unpacked</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[2.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
\ No newline at end of file
Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java?rev=1431154&r1=1431153&r2=1431154&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java (original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/EvaluationOfEventSpans.java Wed Jan 9 23:51:41 2013
@@ -93,12 +93,10 @@ public class EvaluationOfEventSpans exte
super(baseDirectory, rawTextDirectory, knowtatorXMLDirectory, EnumSet.of(
AnnotatorType.PART_OF_SPEECH_TAGS,
AnnotatorType.CHUNKS,
+ AnnotatorType.UMLS_NAMED_ENTITIES,
AnnotatorType.DEPENDENCIES,
AnnotatorType.SEMANTIC_ROLES));
- //AnnotatorType.UMLS_NAMED_ENTITIES,
//AnnotatorType.LEXICAL_VARIANTS,
- //AnnotatorType.DEPENDENCIES,
- //AnnotatorType.SEMANTIC_ROLES));
this.probabilityOfKeepingANegativeExample = probabilityOfKeepingANegativeExample;
this.featureSelectionThreshold = featureSelectionThreshold;
this.smoteNeighborNumber = numOfSmoteNeighbors;
Modified: incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java?rev=1431154&r1=1431153&r2=1431154&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java (original)
+++ incubator/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/eval/Evaluation_ImplBase.java Wed Jan 9 23:51:41 2013
@@ -19,7 +19,6 @@
package org.apache.ctakes.temporal.eval;
import java.io.File;
-import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
@@ -232,28 +231,16 @@ public abstract class Evaluation_ImplBas
"DeleteAction",
new String[] { "selector=B" }));
// add UMLS on top of lookup windows
- String umlsUser = System.getProperty("umls.user");
- String umlsPassword = System.getProperty("umls.password");
- if (umlsUser == null || umlsPassword == null) {
- throw new IllegalArgumentException(
- "The properties umls.user and umls.password must be set to use the "
- + "UmlsDictionaryLookupAnnotator. You can set them by provding java with the "
- + "arguments -Dumls.user=... and -Dumls.password=...");
- }
aggregateBuilder.add(AnalysisEngineFactory.createPrimitiveDescription(
UmlsDictionaryLookupAnnotator.class,
- "UMLSAddr",
+ "ctakes.umlsaddr",
"https://uts-ws.nlm.nih.gov/restful/isValidUMLSUser",
- "UMLSVendor",
+ "ctakes.umlsvendor",
"NLM-6515182895",
- "UMLSUser",
- umlsUser,
- "UMLSPW",
- umlsPassword,
"LookupDescriptor",
ExternalResourceFactory.createExternalResourceDescription(
FileResourceImpl.class,
- getResourceAsFile(UmlsDictionaryLookupAnnotator.class, "../LookupDesc_Db.xml")),
+ new File("target/unpacked/org/apache/ctakes/dictionary/lookup/LookupDesc_Db.xml").getAbsoluteFile()),
"DbConnection",
ExternalResourceFactory.createExternalResourceDescription(
JdbcConnectionResourceImpl.class,
@@ -261,7 +248,9 @@ public abstract class Evaluation_ImplBas
JdbcConnectionResourceImpl.PARAM_DRIVER_CLASS,
"org.hsqldb.jdbcDriver",
JdbcConnectionResourceImpl.PARAM_URL,
- "jdbc:hsqldb:res:/org/apache/ctakes/dictionary/lookup/umls2011ab/umls"),
+ // Should be the following but it's WAY too slow
+ //"jdbc:hsqldb:res:/org/apache/ctakes/dictionary/lookup/umls2011ab/umls"),
+ "jdbc:hsqldb:file:target/unpacked/org/apache/ctakes/dictionary/lookup/umls2011ab/umls"),
"RxnormIndexReader",
ExternalResourceFactory.createExternalResourceDescription(
LuceneIndexReaderResourceImpl.class,
@@ -269,7 +258,7 @@ public abstract class Evaluation_ImplBas
"UseMemoryIndex",
true,
"IndexDirectory",
- getResourceAsFile(UmlsDictionaryLookupAnnotator.class, "../rxnorm_index")),
+ new File("target/unpacked/org/apache/ctakes/dictionary/lookup/rxnorm_index").getAbsoluteFile()),
"OrangeBookIndexReader",
ExternalResourceFactory.createExternalResourceDescription(
LuceneIndexReaderResourceImpl.class,
@@ -277,7 +266,7 @@ public abstract class Evaluation_ImplBas
"UseMemoryIndex",
true,
"IndexDirectory",
- getResourceAsFile(UmlsDictionaryLookupAnnotator.class, "../OrangeBook"))));
+ new File("target/unpacked/org/apache/ctakes/dictionary/lookup/OrangeBook").getAbsoluteFile())));
}
// add lvg annotator
@@ -340,7 +329,7 @@ public abstract class Evaluation_ImplBas
"LvgCmdApi",
ExternalResourceFactory.createExternalResourceDescription(
LvgCmdApiResourceImpl.class,
- getResourceAsFile(LvgAnnotator.class, "../data/config/lvg.properties")));
+ "org/apache/ctakes/lvg/data/config/lvg.properties"));
aggregateBuilder.add(lvgAnnotator);
}
@@ -356,14 +345,6 @@ public abstract class Evaluation_ImplBas
return aggregateBuilder.createAggregateDescription();
}
- /**
- * This is hack to deal with classes that don't handle resources correctly
- */
- private static File getResourceAsFile(Class<?> cls, String path) throws URISyntaxException {
- // this will fail if the resource is not a real File, but the UMLS code assumes that
- return new File(cls.getResource(path).toURI());
- }
-
public static class CopyNPChunksToLookupWindowAnnotations extends JCasAnnotator_ImplBase {
@Override