ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1465737 - /ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/data/GoldAnnotationStatsCalculator.java
Date Mon, 08 Apr 2013 19:34:33 GMT
Author: dligach
Date: Mon Apr  8 19:34:33 2013
New Revision: 1465737

URL: http://svn.apache.org/r1465737
Log:
calculating number of candidate entity pairs for location_of and degree_of separately.

Modified:
    ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/data/GoldAnnotationStatsCalculator.java

Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/data/GoldAnnotationStatsCalculator.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/data/GoldAnnotationStatsCalculator.java?rev=1465737&r1=1465736&r2=1465737&view=diff
==============================================================================
--- ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/data/GoldAnnotationStatsCalculator.java
(original)
+++ ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/data/GoldAnnotationStatsCalculator.java
Mon Apr  8 19:34:33 2013
@@ -18,7 +18,6 @@
  */
 package org.apache.ctakes.relationextractor.data;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
@@ -28,7 +27,6 @@ import org.apache.ctakes.relationextract
 import org.apache.ctakes.typesystem.type.relation.BinaryTextRelation;
 import org.apache.ctakes.typesystem.type.syntax.BaseToken;
 import org.apache.ctakes.typesystem.type.textsem.EntityMention;
-import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
 import org.apache.ctakes.typesystem.type.textspan.Sentence;
 import org.apache.uima.UimaContext;
 import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
@@ -43,7 +41,10 @@ import com.google.common.collect.Multise
 
 /**
  * Count various stats such as token and relation counts 
- * based on the gold standard data.
+ * based on the gold standard data. 
+ * 
+ * Make sure relationType constant is set to the appropriate relation ("location_of" vs.
"degree_of")
+ * to make sure the relation-specific statisitics are calculated correctly. 
  *  
  * @author dmitriy dligach
  *
@@ -51,6 +52,8 @@ import com.google.common.collect.Multise
 public class GoldAnnotationStatsCalculator extends JCasAnnotator_ImplBase {
 
 	public static final String goldViewName = "GoldView";
+	public static final String relationType = "degree_of"; 
+	
 	public int tokenCount;
 	public int sentenceCount;
 	public int entityMentionCount;
@@ -106,7 +109,7 @@ public class GoldAnnotationStatsCalculat
     countSentences(jCas);
     countEntities(goldView);
     countEntityMentionPairs(jCas, goldView); 
-    countEntityMentionPairTypes(jCas, goldView, "location_of");
+    countEntityMentionPairTypes(jCas, goldView);
     countRelationTypes(goldView); 
   }
 	
@@ -124,13 +127,20 @@ public class GoldAnnotationStatsCalculat
   private void countEntityMentionPairs(JCas jCas, JCas goldView) {
     
     for(Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
-      EntityMentionPairRelationExtractorAnnotator emPairAnnot = new EntityMentionPairRelationExtractorAnnotator();
-      List<IdentifiedAnnotationPair> pairs = emPairAnnot.getCandidateRelationArgumentPairs(goldView,
sentence);
-      entityMentionPairCount += pairs.size();
+      if(relationType.equals("location_of")) {
+        EntityMentionPairRelationExtractorAnnotator emPairAnnot = new EntityMentionPairRelationExtractorAnnotator();
+        List<IdentifiedAnnotationPair> pairs = emPairAnnot.getCandidateRelationArgumentPairs(goldView,
sentence);
+        entityMentionPairCount += pairs.size();
+      } 
+      if(relationType.equals("degree_of")) {
+        DegreeOfRelationExtractorAnnotator degreeOfAnnot = new DegreeOfRelationExtractorAnnotator();
+        List<IdentifiedAnnotationPair> pairs = degreeOfAnnot.getCandidateRelationArgumentPairs(goldView,
sentence);
+        entityMentionPairCount += pairs.size();
+      }
     }
   }
 
-  private void countEntityMentionPairTypes(JCas jCas, JCas goldView, String relationType)
{
+  private void countEntityMentionPairTypes(JCas jCas, JCas goldView) {
     
     for(Sentence sentence : JCasUtil.select(jCas, Sentence.class)) {
          



Mime
View raw message