ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1718959 - /ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/data/CoreferenceAttributeAnalyzer.java
Date Wed, 09 Dec 2015 20:29:15 GMT
Author: tmill
Date: Wed Dec  9 20:29:15 2015
New Revision: 1718959

URL: http://svn.apache.org/viewvc?rev=1718959&view=rev
Log:
Added some output to instrumentation.

Modified:
    ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/data/CoreferenceAttributeAnalyzer.java

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/data/CoreferenceAttributeAnalyzer.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/data/CoreferenceAttributeAnalyzer.java?rev=1718959&r1=1718958&r2=1718959&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/data/CoreferenceAttributeAnalyzer.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/data/CoreferenceAttributeAnalyzer.java
Wed Dec  9 20:29:15 2015
@@ -70,11 +70,16 @@ public class CoreferenceAttributeAnalyze
     aggregateBuilder.add(AnalysisEngineFactory.createEngineDescription(CopyCoreferenceRelations.class,
CopyCoreferenceRelations.PARAM_GOLD_VIEW, GOLD_VIEW_NAME));
     aggregateBuilder.add(MarkableSalienceAnnotator.createAnnotatorDescription("/org/apache/ctakes/temporal/ae/salience/model.jar"));
 
-    int numNegChainMatches = 0;
+    int numNegChainMatches = 0; // number of times that the chain is coherent
+    int numNegMinority = 0;     // number of times that a coherent chain uses the minority
class (negated, uncertain, generic, not patient, history)
     int numUncChainMatches = 0;
+    int numUncMinority = 0;
     int numGenChainMatches = 0;
+    int numGenMinority = 0;
     int numSubjChainMatches = 0;
+    int numSubjMinority = 0;
     int numHistChainMatches = 0;
+    int numHistMinority = 0;
     int numChains = 0;
     
     for(JCas jcas : new JCasIterable(reader, aggregateBuilder.createAggregateDescription())){
@@ -105,7 +110,7 @@ public class CoreferenceAttributeAnalyze
           if(ent.getGeneric() == CONST.NE_GENERIC_TRUE){
             numGen++;
           }
-          if(ent.getSubject() == CONST.ATTR_SUBJECT_PATIENT){
+          if(CONST.ATTR_SUBJECT_PATIENT.equals(ent.getSubject())){
             numSubj++;
           }
           if(ent.getHistoryOf() == CONST.NE_HISTORY_OF_PRESENT){
@@ -117,26 +122,41 @@ public class CoreferenceAttributeAnalyze
           numChains++;
           if(numNeg == 0 || numNeg == numMarkables){
             numNegChainMatches++;
+            if(numNeg == numMarkables){
+              numNegMinority++;
+            }
           }else{
             logMismatch("Negation", head);
           }
           if(numUnc == 0 || numUnc == numMarkables){
             numUncChainMatches++;
+            if(numUnc == numMarkables){
+              numUncMinority++;
+            }
           }else{
             logMismatch("Uncertainty", head);
           }
           if(numGen == 0 || numGen == numMarkables){
             numGenChainMatches++;
+            if(numGen == numMarkables){
+              numGenMinority++;
+            }
           }else{
             logMismatch("Generic", head);           
           }
           if(numSubj == 0 || numSubj == numMarkables){
             numSubjChainMatches++;
+            if(numSubj == 0){
+              numSubjMinority++;
+            }
           }else{
             logMismatch("Subject", head);
           }
           if(numHist == 0 || numHist == numMarkables){
             numHistChainMatches++;
+            if(numHist == numMarkables){
+              numHistMinority++;
+            }
           }else{
             logMismatch("History", head);
           }
@@ -146,16 +166,16 @@ public class CoreferenceAttributeAnalyze
     }
     
     // print out some statistics:
-    printOutcome("Negation", numChains, numNegChainMatches);
-    printOutcome("Uncertainty", numChains, numUncChainMatches);
-    printOutcome("Generic", numChains, numGenChainMatches);
-    printOutcome("Subject", numChains, numSubjChainMatches);
-    printOutcome("History", numChains, numHistChainMatches);
+    printOutcome("Negation", numChains, numNegMinority, numNegChainMatches);
+    printOutcome("Uncertainty", numChains, numUncMinority, numUncChainMatches);
+    printOutcome("Generic", numChains, numGenMinority, numGenChainMatches);
+    printOutcome("Subject", numChains, numSubjMinority, numSubjChainMatches);
+    printOutcome("History", numChains, numHistMinority, numHistChainMatches);
   }
 
-  private static void printOutcome(String attName, int numChains, int numMatches){
-    System.out.println(String.format("%s: There are %d chains in the corpus with some UMLS
named entity element and %d of them %s status agrees",
-        attName, numChains, numMatches, attName));    
+  private static void printOutcome(String attName, int numChains, int numMinority, int numMatches){
+    System.out.println(String.format("%s: There are %d chains in the corpus with some UMLS
named entity element and %d of them %s status agrees, and of those %d are the minority class
of that attribute.",
+        attName, numChains, numMatches, attName, numMinority));    
   }
   
   private static void logMismatch(String attName, Markable head){



Mime
View raw message