ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1595005 - in /ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae: EventEventRelationAnnotator.java EventTimeRelationAnnotator.java
Date Thu, 15 May 2014 18:20:20 GMT
Author: clin
Date: Thu May 15 18:20:19 2014
New Revision: 1595005

URL: http://svn.apache.org/r1595005
Log:
added several features for event-event relation annotator.
added tlink writer for both event-time and event-event annotators.

Modified:
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
    ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventTimeRelationAnnotator.java

Modified: ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java?rev=1595005&r1=1595004&r2=1595005&view=diff
==============================================================================
--- ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
(original)
+++ ctakes/trunk/ctakes-temporal/src/main/java/org/apache/ctakes/temporal/ae/EventEventRelationAnnotator.java
Thu May 15 18:20:19 2014
@@ -10,10 +10,15 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.relationextractor.ae.features.PartOfSpeechFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
 import org.apache.ctakes.relationextractor.ae.features.TokenFeaturesExtractor;
+import org.apache.ctakes.temporal.ae.feature.CheckSpecialWordRelationExtractor;
 import org.apache.ctakes.temporal.ae.feature.DependencyPathFeaturesExtractor;
 import org.apache.ctakes.temporal.ae.feature.EventArgumentPropertyExtractor;
+import org.apache.ctakes.temporal.ae.feature.NearbyVerbTenseRelationExtractor;
+import org.apache.ctakes.temporal.ae.feature.SectionHeaderRelationExtractor;
 import org.apache.ctakes.temporal.ae.feature.UmlsFeatureExtractor;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
+import org.apache.ctakes.typesystem.type.relation.RelationArgument;
+import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
@@ -66,6 +71,9 @@ public class EventEventRelationAnnotator
 	    						  new TokenFeaturesExtractor()
 	    						, new PartOfSpeechFeaturesExtractor()
 //	    						, new EventArgumentPropertyExtractor()
+	    						, new SectionHeaderRelationExtractor()
+	    						, new NearbyVerbTenseRelationExtractor()
+	    						, new CheckSpecialWordRelationExtractor()
 	    						, new UmlsFeatureExtractor()
 	    						, new DependencyPathFeaturesExtractor()
 	    						);
@@ -92,6 +100,24 @@ public class EventEventRelationAnnotator
 	}
 	
 	@Override
+	protected void createRelation(JCas jCas, IdentifiedAnnotation arg1,
+			IdentifiedAnnotation arg2, String predictedCategory) {
+		RelationArgument relArg1 = new RelationArgument(jCas);
+		relArg1.setArgument(arg1);
+		relArg1.setRole("Arg1");
+		relArg1.addToIndexes();
+		RelationArgument relArg2 = new RelationArgument(jCas);
+		relArg2.setArgument(arg2);
+		relArg2.setRole("Arg2");
+		relArg2.addToIndexes();
+		TemporalTextRelation relation = new TemporalTextRelation(jCas);
+		relation.setArg1(relArg1);
+		relation.setArg2(relArg2);
+		relation.setCategory(predictedCategory);
+		relation.addToIndexes();
+	}
+	
+	@Override
 	protected String getRelationCategory(
 			Map<List<Annotation>, BinaryTextRelation> relationLookup,
 			IdentifiedAnnotation arg1,

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=1595005&r1=1595004&r2=1595005&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 May 15 18:20:19 2014
@@ -20,6 +20,8 @@ import org.apache.ctakes.temporal.ae.fea
 import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPETExtractor;
 //import org.apache.ctakes.temporal.ae.feature.treekernel.TemporalPathExtractor;
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
+import org.apache.ctakes.typesystem.type.relation.RelationArgument;
+import org.apache.ctakes.typesystem.type.relation.TemporalTextRelation;
 import org.apache.ctakes.typesystem.type.textsem.EventMention;
 import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textsem.TimeMention;
@@ -73,16 +75,16 @@ public class EventTimeRelationAnnotator 
 				new TokenFeaturesExtractor()
 				, new PartOfSpeechFeaturesExtractor()
 				//    						, new TemporalAttributeFeatureExtractor()
-//				, new EventTimeFlatTreeFeatureExtractor()
+				//				, new EventTimeFlatTreeFeatureExtractor()
 				, new TemporalPETExtractor()
-//				, new TemporalPathExtractor()
-//				, new EventVerbRelationTreeExtractor()
+				//				, new TemporalPathExtractor()
+				//				, new EventVerbRelationTreeExtractor()
 				, new SectionHeaderRelationExtractor()
 				, new NearbyVerbTenseRelationExtractor()
 				, new CheckSpecialWordRelationExtractor()
 				, new NearestFlagFeatureExtractor()
 				, new DependencyPathFeaturesExtractor()
-//				, new DependencyFeatureExtractor()
+				//				, new DependencyFeatureExtractor()
 				);
 	}
 
@@ -104,31 +106,49 @@ public class EventTimeRelationAnnotator 
 				}
 			}
 		}
-		
+
 		//only use gold pairs:
-//		for (BinaryTextRelation relation : JCasUtil.select(jCas, BinaryTextRelation.class)) {
-//			Annotation arg1 = relation.getArg1().getArgument();
-//			Annotation arg2 = relation.getArg2().getArgument();
-//			EventMention event = null;
-//			TimeMention time = null;
-//			if(arg1 instanceof EventMention){
-//				 event = (EventMention) arg1;
-//			}else if(arg1 instanceof TimeMention){
-//				time = (TimeMention) arg1;
-//			}
-//			if(arg2 instanceof EventMention){
-//				 event = (EventMention) arg2;
-//			}else if(arg2 instanceof TimeMention){
-//				time = (TimeMention) arg2;
-//			}
-//			if(event != null && time != null){
-//				pairs.add(new IdentifiedAnnotationPair(event, time));
-//			}
-//		}
-		
+		//		for (BinaryTextRelation relation : JCasUtil.select(jCas, BinaryTextRelation.class))
{
+		//			Annotation arg1 = relation.getArg1().getArgument();
+		//			Annotation arg2 = relation.getArg2().getArgument();
+		//			EventMention event = null;
+		//			TimeMention time = null;
+		//			if(arg1 instanceof EventMention){
+		//				 event = (EventMention) arg1;
+		//			}else if(arg1 instanceof TimeMention){
+		//				time = (TimeMention) arg1;
+		//			}
+		//			if(arg2 instanceof EventMention){
+		//				 event = (EventMention) arg2;
+		//			}else if(arg2 instanceof TimeMention){
+		//				time = (TimeMention) arg2;
+		//			}
+		//			if(event != null && time != null){
+		//				pairs.add(new IdentifiedAnnotationPair(event, time));
+		//			}
+		//		}
+
 		return pairs;
 	}
 
+	@Override
+	protected void createRelation(JCas jCas, IdentifiedAnnotation arg1,
+			IdentifiedAnnotation arg2, String predictedCategory) {
+		RelationArgument relArg1 = new RelationArgument(jCas);
+		relArg1.setArgument(arg1);
+		relArg1.setRole("Arg1");
+		relArg1.addToIndexes();
+		RelationArgument relArg2 = new RelationArgument(jCas);
+		relArg2.setArgument(arg2);
+		relArg2.setRole("Arg2");
+		relArg2.addToIndexes();
+		TemporalTextRelation relation = new TemporalTextRelation(jCas);
+		relation.setArg1(relArg1);
+		relation.setArg2(relArg2);
+		relation.setCategory(predictedCategory);
+		relation.addToIndexes();
+	}
+
 
 	@Override
 	protected String getRelationCategory(



Mime
View raw message