You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by dl...@apache.org on 2013/01/10 21:05:02 UTC

svn commit: r1431594 - /incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/Baseline1EntityMentionPairRelationExtractorAnnotator.java

Author: dligach
Date: Thu Jan 10 20:05:02 2013
New Revision: 1431594

URL: http://svn.apache.org/viewvc?rev=1431594&view=rev
Log:
bug fixes

Modified:
    incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/Baseline1EntityMentionPairRelationExtractorAnnotator.java

Modified: incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/Baseline1EntityMentionPairRelationExtractorAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/Baseline1EntityMentionPairRelationExtractorAnnotator.java?rev=1431594&r1=1431593&r2=1431594&view=diff
==============================================================================
--- incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/Baseline1EntityMentionPairRelationExtractorAnnotator.java (original)
+++ incubator/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/Baseline1EntityMentionPairRelationExtractorAnnotator.java Thu Jan 10 20:05:02 2013
@@ -37,6 +37,8 @@ import org.uimafit.util.JCasUtil;
 /**
  * Annotate location_of relation between two entities in sentences containing
  * exactly two entities (where the entities are of the correct types).
+ * This implementation assumes classifyBothDirections is set to true (i.e.
+ * each pair of entities is considered twice).
  */
 public class Baseline1EntityMentionPairRelationExtractorAnnotator extends RelationExtractorAnnotator {
 	
@@ -77,18 +79,26 @@ public class Baseline1EntityMentionPairR
 			}
 		}
 
-		// return the pairs if there is only a single pair of entities
-		// and the argument types are legitimate for location_of
-		if(pairs.size() == 1) {
-		  if(validateArgumentTypes(pairs.get(0))) {
-		    System.out.println(sentence.getCoveredText());
-		    System.out.println("arg1: " + pairs.get(0).getArg1().getCoveredText());
-		    System.out.println("arg2: " + pairs.get(0).getArg2().getCoveredText());
-		    System.out.println();
-		    return pairs;
+		// look for sentence with two entities
+		// because each pair of entities is cosidered twice, pairs.size() should be 2.
+		if(pairs.size() == 2) {
+		  // there are two entities in this sentence
+		  // are they of suitable types for location_of?
+		  for(IdentifiedAnnotationPair pair : pairs) {
+		    if(validateArgumentTypes(pair)) {
+	        System.out.println(sentence.getCoveredText());
+	        System.out.println("arg1: " + pair.getArg1().getCoveredText());
+	        System.out.println("arg2: " + pair.getArg2().getCoveredText());
+	        System.out.println();
+	        
+		      List<IdentifiedAnnotationPair> result = new ArrayList<IdentifiedAnnotationPair>();
+		      result.add(pair);
+		      return result;
+		    }
 		  }
 		}
-
+		
+		
 		// for all other cases, return no entity pairs
 		return new ArrayList<IdentifiedAnnotationPair>();
 	}