ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1720835 - /ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSectionFeaturesExtractor.java
Date Fri, 18 Dec 2015 18:21:01 GMT
Author: tmill
Date: Fri Dec 18 18:21:01 2015
New Revision: 1720835

URL: http://svn.apache.org/viewvc?rev=1720835&view=rev
Log:
Fixed bug in section feature -- wasn't requiring paragraph to have only 1 sentence.

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

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSectionFeaturesExtractor.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSectionFeaturesExtractor.java?rev=1720835&r1=1720834&r2=1720835&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSectionFeaturesExtractor.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/features/cluster/MentionClusterSectionFeaturesExtractor.java
Fri Dec 18 18:21:01 2015
@@ -30,35 +30,34 @@ public class MentionClusterSectionFeatur
     Set<Integer> parsWithAnteHeader = new HashSet<>();
     
     boolean anteInHeader = false;
-    boolean anaInHeader = false;
     int anaPar = -1;
     
     // Find section headers -- paragraphs 
+    // FIXME - should be paragraphs that only cover one sentence
     List<Paragraph> pars = new ArrayList<>(JCasUtil.select(jcas, Paragraph.class));
     for(int i = 0; i < pars.size(); i++){
       Paragraph par = pars.get(i);
+      // find the paragraph with the anaphor
+      if(mention.getBegin() >= par.getBegin() && mention.getEnd() <= par.getEnd()){
+        anaPar = i;
+      }
+
       if(par.getBegin() > mention.getEnd()){
         break;
       }
       
+      List<Sentence> coveredSents = JCasUtil.selectCovered(Sentence.class, par);
+      if(coveredSents == null || coveredSents.size() == 0 || coveredSents.size() > 1)
continue;
+      
+      // if we get this far then we are in a paragraph comprised of a single sentence 
       for(Markable member : new ListIterable<Markable>(cluster.getMembers())){
         if(member.getBegin() >= par.getBegin() && member.getEnd() <= par.getEnd()){
           parsWithAnteHeader.add(i);
+          anteInHeader = true;
           break;
         }
       }
       
-      // find the paragraph with the anaphor
-      if(mention.getBegin() >= par.getBegin() && mention.getEnd() <= par.getEnd()){
-        anaPar = i;
-      }
-      List<Sentence> coveredSents = JCasUtil.selectCovered(jcas, Sentence.class, par);
-      if(coveredSents != null && coveredSents.size() == 1){
-        if(anaPar == i){
-          anaInHeader = true;
-          break;
-        }
-      }
     }
 
     feats.add(new Feature("AnteInHeader", parsWithAnteHeader.size() > 0));



Mime
View raw message