ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1696985 - in /ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster: MentionClusterDistSemExtractor.java MentionClusterSalienceFeaturesExtractor.java
Date Fri, 21 Aug 2015 13:43:43 GMT
Author: tmill
Date: Fri Aug 21 13:43:43 2015
New Revision: 1696985

URL: http://svn.apache.org/r1696985
Log:
Fixed a couple feature extractors that were going past where they should be able to see during
training.

Modified:
    ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterDistSemExtractor.java
    ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSalienceFeaturesExtractor.java

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterDistSemExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterDistSemExtractor.java?rev=1696985&r1=1696984&r2=1696985&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterDistSemExtractor.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterDistSemExtractor.java
Fri Aug 21 13:43:43 2015
@@ -45,6 +45,11 @@ public class MentionClusterDistSemExtrac
     String mentionHead = mentionNode != null ? mentionNode.getCoveredText().toLowerCase()
: null;
     if(mentionHead != null){
       for(Markable member : new ListIterable<Markable>(cluster.getMembers())){
+        if(mention.getBegin() < member.getEnd()){
+          // during training this might happen -- see a member of a cluster that
+          // is actually subsequent to the candidate mention
+          break;
+        }
         ConllDependencyNode memberNode = DependencyUtility.getNominalHeadNode(jCas, member);
         String memberHead = memberNode != null ? memberNode.getCoveredText().toLowerCase()
: null;
         if(mentionHead.equals(memberHead)){

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSalienceFeaturesExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSalienceFeaturesExtractor.java?rev=1696985&r1=1696984&r2=1696985&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSalienceFeaturesExtractor.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSalienceFeaturesExtractor.java
Fri Aug 21 13:43:43 2015
@@ -23,13 +23,34 @@ public class MentionClusterSalienceFeatu
     feats.add(new Feature("MC_MENTION_SALIENCE", mention.getConfidence()));
 
     double maxSalience = 0.0;
+    double totalSalience = 0.0;
+    double productSalience = 1.0;
+    
+    int numElements = 0;
     for(Markable member : new ListIterable<Markable>(cluster.getMembers())){
+      if(mention.getBegin() < member.getEnd()){
+        // during training this might happen -- see a member of a cluster that
+        // is actually subsequent to the candidate mention
+        break;
+      }
+      totalSalience += member.getConfidence();
+      numElements++;
+      productSalience *= member.getConfidence();
+      
       if(member.getConfidence() > maxSalience){
         maxSalience = member.getConfidence();
       }
     }
-    feats.add(new Feature("MC_MAX_SALIENCE", maxSalience));
     
+    feats.add(new Feature("MC_MAX_SALIENCE", maxSalience));
+//    if(numElements > 0){
+//      feats.add(new Feature("MC_AVE_SALIENCE", totalSalience / numElements));      
+//    }
+//    if(numElements > 1){
+//      feats.add(new Feature("MC_GEOMAVE_SALIENCE", Math.pow(productSalience, 1.0 / numElements)));
+//    }else{
+//      feats.add(new Feature("MC_GEOMAVE_SALIENCE", productSalience));
+//    }
     return feats;
   }
 



Mime
View raw message