ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chen...@apache.org
Subject svn commit: r1637238 - in /ctakes/trunk: ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/ ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/ ctakes-temporal/src/main/java/org/apache/ctakes/te...
Date Thu, 06 Nov 2014 22:00:39 GMT
Author: chenpei
Date: Thu Nov  6 22:00:38 2014
New Revision: 1637238

URL: http://svn.apache.org/r1637238
Log:
CTAKES-329 - Initial check in of temporal event-event and event-time relation discovery models.

Added:
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/Event_Event_UMLS_doubleFilter_useSystemEvents.txt
  (with props)
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/READEME.txt
  (with props)
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/model.jar
  (with props)
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_no_UMLS_filter.txt
  (with props)
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_with_UMLS_filter.txt
  (with props)
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/READEME.txt
  (with props)
    ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/model.jar
  (with props)
    ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotatorTest.java
  (with props)
    ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotatorTest.java
  (with props)
Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
    ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotatorTest.java

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/Event_Event_UMLS_doubleFilter_useSystemEvents.txt
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/Event_Event_UMLS_doubleFilter_useSystemEvents.txt?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/Event_Event_UMLS_doubleFilter_useSystemEvents.txt
(added)
+++ ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/Event_Event_UMLS_doubleFilter_useSystemEvents.txt
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,35 @@
+a)No closure on gold::Closure on System::Recall Mode						
+P	R	F1	#gold	#system	#correct	
+0.768	0.324	0.455	584	246	189	OVERALL
+1	0	0	39	0	0	BEFORE
+1	0	0	15	0	0	BEGINS-ON
+0.807	0.482	0.604	390	233	188	CONTAINS
+1	0	0	1	0	0	ENDS-ON
+0.077	0.007	0.013	139	13	1	OVERLAP
+						
+b) No closure on System::Closure on Gold::Precision Mode						
+P	R	F1	#gold	#system	#correct	
+0.801	0.247	0.378	765	236	189	OVERALL
+1	0	0	48	0	0	BEFORE
+1	0	0	16	0	0	BEGINS-ON
+0.811	0.482	0.605	392	233	189	CONTAINS
+1	0	0	16	0	0	ENDS-ON
+0	0	0	293	3	0	OVERLAP
+						
+c) Final Score:						
+P	R	F				
+0.801	0.324	0.461376	OVERALL			
+1	0	0	BEFORE			
+1	0	0	BEGINS-ON			
+0.811	0.482	0.604643465	CONTAINS			
+1	0	0	ENDS-ON			
+0	0.007	0	OVERLAP			
+d) Closure on train::No closure onTest::PlainMode						
+P	R	F1	#gold	#system	#correct	
+0.797	0.322	0.459	584	236	188	OVERALL
+1	0	0	39	0	0	BEFORE
+1	0	0	15	0	0	BEGINS-ON
+0.807	0.482	0.604	390	233	188	CONTAINS
+1	0	0	1	0	0	ENDS-ON
+						
+						

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/Event_Event_UMLS_doubleFilter_useSystemEvents.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/READEME.txt
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/READEME.txt?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/READEME.txt
(added)
+++ ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/READEME.txt
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,10 @@
+Models are trained on THYME patient sets: 28-127
+Training data: Mode 8, residue 0-3
+Testing data: Mode 8, residue 4 and 5
+
+UMLS entities, whose spans overlap with gold Events, were extracted to boost training data
+UMLS entities were not extracted for testing data. For testing data, only gold events were
used for evaluation.
+
+Both arguments of event-event relations are required to be valid medical terms (i.e. be one
of the UMLS semantic types).
+We show test results for event-time relations, in which events were not required to be valid
medical terms.
+Results for event-time relations, in which event arguments are requried to be valid medical
terms, were also shown here. Final event-time model is UMLS-filtered. 
\ No newline at end of file

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/READEME.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/model.jar
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/model.jar?rev=1637238&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventevent/model.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_no_UMLS_filter.txt
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_no_UMLS_filter.txt?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_no_UMLS_filter.txt
(added)
+++ ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_no_UMLS_filter.txt
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,36 @@
+a)No closure on gold::Closure on System::Recall Mode						
+P	R	F1	#gold	#system	#correct	
+0.459	0.64	0.535	1229	1715	787	OVERALL
+0.048	0.081	0.061	37	62	3	BEFORE
+0.207	0.143	0.169	42	29	6	BEGINS-ON
+0.576	0.777	0.662	977	1317	759	CONTAINS
+0.214	0.214	0.214	28	28	6	ENDS-ON
+0.047	0.09	0.061	145	279	13	OVERLAP
+						
+b) No closure on System::Closure on Gold::Precision Mode						
+P	R	F1	#gold	#system	#correct	
+0.617	0.399	0.485	2379	1540	950	OVERALL
+0.052	0.039	0.044	77	58	3	BEFORE
+0.353	0.086	0.138	70	17	6	BEGINS-ON
+0.672	0.727	0.698	1216	1316	884	CONTAINS
+0.5	0.092	0.156	65	12	6	ENDS-ON
+0.372	0.054	0.094	951	137	51	OVERLAP
+						
+c) Final Score:						
+P	R	F				
+0.617	0.64	0.628289578	OVERALL			
+0.052	0.081	0.063338346	BEFORE			
+0.353	0.143	0.203544355	BEGINS-ON			
+0.672	0.777	0.720695652	CONTAINS			
+0.5	0.214	0.299719888	ENDS-ON			
+0.372	0.09	0.144935065	OVERLAP			
+						
+d) Closure on train::No closure onTest::PlainMode						
+P	R	F1	#gold	#system#correct		
+0.508	0.637	0.566	1229	1540	783	OVERALL
+0.052	0.081	0.063	37	58	3	BEFORE
+0.353	0.143	0.203	42	17	6	BEGINS-ON
+0.577	0.777	0.662	977	1316	759	CONTAINS
+0.5	0.214	0.3	28	12	6	ENDS-ON
+0.066	0.062	0.064	145	137	9	OVERLAP
+						

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_no_UMLS_filter.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_with_UMLS_filter.txt
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_with_UMLS_filter.txt?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_with_UMLS_filter.txt
(added)
+++ ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_with_UMLS_filter.txt
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,36 @@
+a)No closure on gold::Closure on System::Recall Mode						
+P	R	F1	#gold	#system	#correct	
+0.358	0.628	0.456	549	964	345	OVERALL
+0	0	0	14	7	0	BEFORE
+0.5	0.045	0.083	22	2	1	BEGINS-ON
+0.661	0.746	0.701	437	493	326	CONTAINS
+0	0	0	7	2	0	ENDS-ON
+0.039	0.261	0.068	69	460	18	OVERLAP
+						
+b) No closure on System::Closure on Gold::Precision Mode						
+P	R	F1	#gold	#system	#correct	
+0.594	0.256	0.357	1702	732	435	OVERALL
+0	0	0	51	7	0	BEFORE
+0.5	0.02	0.038	50	2	1	BEGINS-ON
+0.716	0.506	0.593	698	493	353	CONTAINS
+1	0	0	43	0	0	ENDS-ON
+0.352	0.094	0.149	860	230	81	OVERLAP
+						
+c) Final Score:						
+P	R	F				
+0.594	0.628	0.610527005	OVERALL			
+0	0	#DIV/0!	BEFORE			
+0.5	0.045	0.082568807	BEGINS-ON			
+0.716	0.746	0.730692202	CONTAINS			
+1	0	0	ENDS-ON			
+0.352	0.261	0.299745514	OVERLAP			
+						
+d) Closure on train::No closure onTest::PlainMode						
+P	R	F1	#gold	#system#correct		
+0.462	0.616	0.528	549	732	338	OVERALL
+0	0	0	14	7	0	BEFORE
+0.5	0.045	0.083	22	2	1	BEGINS-ON
+0.661	0.746	0.701	437	493	326	CONTAINS
+1	0	0	7	0	0	ENDS-ON
+0.048	0.159	0.074	69	230	11	OVERLAP
+						

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/Event_Time_with_UMLS_filter.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/READEME.txt
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/READEME.txt?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/READEME.txt
(added)
+++ ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/READEME.txt
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,10 @@
+Models are trained on THYME patient sets: 28-127
+Training data: Mode 8, residue 0-3
+Testing data: Mode 8, residue 4 and 5
+
+UMLS entities, whose spans overlap with gold Events, were extracted to boost training data
+UMLS entities were not extracted for testing data. For testing data, only gold events were
used for evaluation.
+
+Both arguments of event-event relations are required to be valid medical terms (i.e. be one
of the UMLS semantic types).
+We show test results for event-time relations, in which events were not required to be valid
medical terms.
+Results for event-time relations, in which event arguments are requried to be valid medical
terms, were also shown here. Final event-time model is UMLS-filtered. 
\ No newline at end of file

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/READEME.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/model.jar
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/model.jar?rev=1637238&view=auto
==============================================================================
Binary file - no diff available.

Propchange: ctakes/trunk/ctakes-temporal-res/src/main/resources/org/apache/ctakes/temporal/ae/eventtime/model.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java?rev=1637238&r1=1637237&r2=1637238&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java
Thu Nov  6 22:00:38 2014
@@ -92,7 +92,7 @@ public class EventTimeRelationAnnotator 
 				(float) probabilityOfKeepingANegativeExample);
 	}
 
-	public static AnalysisEngineDescription createEngineDescription(String modelPath)
+	public static AnalysisEngineDescription createAnnotatorDescription(String modelPath)
 			throws ResourceInitializationException {
 		return AnalysisEngineFactory.createEngineDescription(
 				EventTimeRelationAnnotator.class,
@@ -107,7 +107,7 @@ public class EventTimeRelationAnnotator 
 	 * This will allow resources to be read within from a jar as well as File.  
 	 */	 
 	@Deprecated
-	public static AnalysisEngineDescription createEngineDescription(File modelDirectory)
+	public static AnalysisEngineDescription createAnnotatorDescription(File modelDirectory)
 			throws ResourceInitializationException {
 		return AnalysisEngineFactory.createEngineDescription(
 				EventTimeRelationAnnotator.class,

Modified: ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotatorTest.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotatorTest.java?rev=1637238&r1=1637237&r2=1637238&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotatorTest.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/DocTimeRelAnnotatorTest.java
Thu Nov  6 22:00:38 2014
@@ -114,7 +114,7 @@ public class DocTimeRelAnnotatorTest {
 		// assertTrue(temp.contains("6 months ago"));
 	}
 
-	public static class AddEvent extends JCasAnnotator_ImplBase {
+	public static class AddEvent extends org.apache.uima.fit.component.JCasAnnotator_ImplBase
{
 		@Override
 		public void process(JCas jCas) throws AnalysisEngineProcessException {
 			for (EventMention emention : Lists.newArrayList(JCasUtil.select(

Added: ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotatorTest.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotatorTest.java?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotatorTest.java
(added)
+++ ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotatorTest.java
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.temporal.ae;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory;
+import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory.CopyNPChunksToLookupWindowAnnotations;
+import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory.RemoveEnclosedLookupWindows;
+import org.apache.ctakes.dependency.parser.ae.ClearNLPDependencyParserAE;
+import org.apache.ctakes.dictionary.lookup.ae.UmlsDictionaryLookupAnnotator;
+import org.apache.ctakes.typesystem.type.refsem.Event;
+import org.apache.ctakes.typesystem.type.refsem.EventProperties;
+import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
+import org.apache.ctakes.typesystem.type.textsem.EventMention;
+import org.apache.log4j.Logger;
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
+import org.apache.uima.fit.factory.AggregateBuilder;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.factory.JCasFactory;
+import org.apache.uima.fit.pipeline.SimplePipeline;
+import org.apache.uima.fit.util.JCasUtil;
+import org.apache.uima.jcas.JCas;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class EventEventRelationAnnotatorTest {
+
+	// LOG4J logger based on class name
+	private Logger LOGGER = Logger.getLogger(getClass().getName());
+
+	@Test
+	public void testPipeline() throws UIMAException, IOException {
+
+		String note = "The patient is a 55-year-old man referred by Dr. Good for recently diagnosed
colorectal cancer.  "
+				+ "The patient was well till 6 months ago, when he started having a little blood with
stool.";
+		JCas jcas = JCasFactory.createJCas();
+		jcas.setDocumentText(note);
+
+		// Get the default pipeline with umls dictionary lookup
+		AggregateBuilder builder = new AggregateBuilder();
+		builder.add(ClinicalPipelineFactory.getTokenProcessingPipeline());
+		builder.add(AnalysisEngineFactory
+				.createEngineDescription(CopyNPChunksToLookupWindowAnnotations.class));
+		builder.add(AnalysisEngineFactory
+				.createEngineDescription(RemoveEnclosedLookupWindows.class));
+		// Commented out the Dictionary lookup for the test
+		// Uncomment and set -Dctakes.umlsuser and -Dctakes.umlspw env params if
+		// needed
+		//builder.add(UmlsDictionaryLookupAnnotator.createAnnotatorDescription());
+		builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription());
+
+		// Add BackwardsTimeAnnotator
+		builder.add(BackwardsTimeAnnotator
+				.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/timeannotator/model.jar"));
+		// Add EventAnnotator
+		builder.add(EventAnnotator
+				.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/eventannotator/model.jar"));
+		//link event to eventMention
+		builder.add(AnalysisEngineFactory.createEngineDescription(AddEvent.class));
+		// Add Event to Event Relation Annotator
+		builder.add(EventEventRelationAnnotator
+				.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/eventevent/model.jar"));
+
+		SimplePipeline.runPipeline(jcas, builder.createAggregateDescription());
+
+		Collection<TemporalTextRelation> relations = JCasUtil.select(jcas,
+				TemporalTextRelation.class);
+
+		for (TemporalTextRelation relation : relations) {
+			LOGGER.info("Relation: " + relation.getArg1() + " " + relation.getArg2() + " Category:
" + relation.getCategory());
+			}
+		// assertEquals(2, temp.size());
+		// assertTrue(temp.contains("recently"));
+		// assertTrue(temp.contains("6 months ago"));
+	}
+
+	public static class AddEvent extends org.apache.uima.fit.component.JCasAnnotator_ImplBase
{
+		@Override
+		public void process(JCas jCas) throws AnalysisEngineProcessException {
+			for (EventMention emention : Lists.newArrayList(JCasUtil.select(
+					jCas,
+					EventMention.class))) {
+				EventProperties eventProperties = new org.apache.ctakes.typesystem.type.refsem.EventProperties(jCas);
+
+				// create the event object
+				Event event = new Event(jCas);
+
+				// add the links between event, mention and properties
+				event.setProperties(eventProperties);
+				emention.setEvent(event);
+
+				// add the annotations to the indexes
+				eventProperties.addToIndexes();
+				event.addToIndexes();
+			}
+		}
+	}
+
+}

Propchange: ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotatorTest.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotatorTest.java?rev=1637238&view=auto
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotatorTest.java
(added)
+++ ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotatorTest.java
Thu Nov  6 22:00:38 2014
@@ -0,0 +1,121 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.ctakes.temporal.ae;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory;
+import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory.CopyNPChunksToLookupWindowAnnotations;
+import org.apache.ctakes.clinicalpipeline.ClinicalPipelineFactory.RemoveEnclosedLookupWindows;
+import org.apache.ctakes.dependency.parser.ae.ClearNLPDependencyParserAE;
+import org.apache.ctakes.dictionary.lookup.ae.UmlsDictionaryLookupAnnotator;
+import org.apache.ctakes.typesystem.type.refsem.Event;
+import org.apache.ctakes.typesystem.type.refsem.EventProperties;
+import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
+import org.apache.ctakes.typesystem.type.textsem.EventMention;
+import org.apache.log4j.Logger;
+import org.apache.uima.UIMAException;
+import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
+import org.apache.uima.fit.component.JCasAnnotator_ImplBase;
+import org.apache.uima.fit.factory.AggregateBuilder;
+import org.apache.uima.fit.factory.AnalysisEngineFactory;
+import org.apache.uima.fit.factory.JCasFactory;
+import org.apache.uima.fit.pipeline.SimplePipeline;
+import org.apache.uima.fit.util.JCasUtil;
+import org.apache.uima.jcas.JCas;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+public class EventTimeRelationAnnotatorTest {
+
+	// LOG4J logger based on class name
+	private Logger LOGGER = Logger.getLogger(getClass().getName());
+
+	@Test
+	public void testPipeline() throws UIMAException, IOException {
+
+		String note = "The patient is a 55-year-old man referred by Dr. Good for recently diagnosed
colorectal cancer.  "
+				+ "The patient was well till 6 months ago, when he started having a little blood with
stool.";
+		JCas jcas = JCasFactory.createJCas();
+		jcas.setDocumentText(note);
+
+		// Get the default pipeline with umls dictionary lookup
+		AggregateBuilder builder = new AggregateBuilder();
+		builder.add(ClinicalPipelineFactory.getTokenProcessingPipeline());
+		builder.add(AnalysisEngineFactory
+				.createEngineDescription(CopyNPChunksToLookupWindowAnnotations.class));
+		builder.add(AnalysisEngineFactory
+				.createEngineDescription(RemoveEnclosedLookupWindows.class));
+		// Commented out the Dictionary lookup for the test
+		// Uncomment and set -Dctakes.umlsuser and -Dctakes.umlspw env params if
+		// needed
+		//builder.add(UmlsDictionaryLookupAnnotator.createAnnotatorDescription());
+		builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription());
+
+		// Add BackwardsTimeAnnotator
+		builder.add(BackwardsTimeAnnotator
+				.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/timeannotator/model.jar"));
+		// Add EventAnnotator
+		builder.add(EventAnnotator
+				.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/eventannotator/model.jar"));
+		//link event to eventMention
+		builder.add(AnalysisEngineFactory.createEngineDescription(AddEvent.class));
+		// Add Event to Event Relation Annotator
+		builder.add(EventTimeRelationAnnotator
+				.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/eventtime/model.jar"));
+
+		SimplePipeline.runPipeline(jcas, builder.createAggregateDescription());
+
+		Collection<TemporalTextRelation> relations = JCasUtil.select(jcas,
+				TemporalTextRelation.class);
+
+		for (TemporalTextRelation relation : relations) {
+			LOGGER.info("Relation: " + relation.getArg1() + " " + relation.getArg2() + " Category:
" + relation.getCategory());
+		}
+		// assertEquals(2, temp.size());
+		// assertTrue(temp.contains("recently"));
+		// assertTrue(temp.contains("6 months ago"));
+	}
+
+	public static class AddEvent extends org.apache.uima.fit.component.JCasAnnotator_ImplBase
{
+		@Override
+		public void process(JCas jCas) throws AnalysisEngineProcessException {
+			for (EventMention emention : Lists.newArrayList(JCasUtil.select(
+					jCas,
+					EventMention.class))) {
+				EventProperties eventProperties = new org.apache.ctakes.typesystem.type.refsem.EventProperties(jCas);
+
+				// create the event object
+				Event event = new Event(jCas);
+
+				// add the links between event, mention and properties
+				event.setProperties(eventProperties);
+				emention.setEvent(event);
+
+				// add the annotations to the indexes
+				eventProperties.addToIndexes();
+				event.addToIndexes();
+			}
+		}
+	}
+
+}

Propchange: ctakes/trunk/ctakes-temporal/src/test/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotatorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message