ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tm...@apache.org
Subject svn commit: r1696986 - /ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/MentionClusterCoreferenceAnnotator.java
Date Fri, 21 Aug 2015 13:44:58 GMT
Author: tmill
Date: Fri Aug 21 13:44:58 2015
New Revision: 1696986

URL: http://svn.apache.org/r1696986
Log:
Use headwords for matching pairs.

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

Modified: ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/MentionClusterCoreferenceAnnotator.java
URL: http://svn.apache.org/viewvc/ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/MentionClusterCoreferenceAnnotator.java?rev=1696986&r1=1696985&r2=1696986&view=diff
==============================================================================
--- ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/MentionClusterCoreferenceAnnotator.java
(original)
+++ ctakes/sandbox/ctakes-coref-cleartk/src/main/java/org/apache/ctakes/coreference/ae/MentionClusterCoreferenceAnnotator.java
Fri Aug 21 13:44:58 2015
@@ -137,9 +137,9 @@ public class MentionClusterCoreferenceAn
       pairs.addAll(getSentenceDistancePairs(jcas, mention, sentDist));
       pairs.addAll(getSectionHeaderPairs(jcas, mention, sentDist));
       pairs.addAll(getClusterPairs(jcas, mention, Integer.MAX_VALUE));
-      pairs.addAll(getExactStringMatchPairs(jcas, mention, sentDist));
+//      pairs.addAll(getExactStringMatchPairs(jcas, mention, sentDist));
+      pairs.addAll(getHeadwordMatchPairs(jcas, mention, sentDist));
     }
-//    pairs.addAll(getHeadwordMatchPairs(jcas, mention, sentDist));
     
     return pairs;
   }
@@ -302,11 +302,11 @@ public class MentionClusterCoreferenceAn
         Annotation mostRecent = ClusterUtils.getMostRecent((NonEmptyFSList)cluster.getMembers(),
mention);
         if(mostRecent == null) continue;
         for(Markable m : JCasUtil.select(cluster.getMembers(), Markable.class)){
-          if(m == mostRecent) break;
           if(headSet.contains(mostRecent)){
             pairs.add(new CollectionTextRelationIdentifiedAnnotationPair(cluster, mention));
             break;
           }
+          if(m == mostRecent) break;
         }
       }      
     }
@@ -327,9 +327,6 @@ public class MentionClusterCoreferenceAn
     if (this.isTraining()) {
       for (CollectionTextRelation cluster : JCasUtil.select(jCas, CollectionTextRelation.class))
{
         for(IdentifiedAnnotation mention : JCasUtil.select(cluster.getMembers(), Markable.class)){
-          if(mention.getCoveredText().equalsIgnoreCase("this")){
-            System.err.println("Found a mention of 'this' as a pronoun");
-          }
           CollectionTextRelationIdentifiedAnnotationRelation relation = 
               new CollectionTextRelationIdentifiedAnnotationRelation(jCas);
           relation.setCluster(cluster);
@@ -363,7 +360,7 @@ public class MentionClusterCoreferenceAn
           for (RelationFeaturesExtractor<CollectionTextRelation,IdentifiedAnnotation>
extractor : this.featureExtractors) {
             List<Feature> feats = extractor.extract(jCas, cluster, mention);
             if (feats != null){
-              Logger.getRootLogger().info(String.format("For cluster with %d mentions, %d
%s features", JCasUtil.select(cluster.getMembers(), Markable.class).size(), feats.size(),
extractor.getClass().getSimpleName()));
+//              Logger.getRootLogger().info(String.format("For cluster with %d mentions,
%d %s features", JCasUtil.select(cluster.getMembers(), Markable.class).size(), feats.size(),
extractor.getClass().getSimpleName()));
               features.addAll(feats);
             }
           }
@@ -429,6 +426,7 @@ public class MentionClusterCoreferenceAn
         }
         
         markableStrings.add(mention.getCoveredText().toLowerCase());
+        
         ConllDependencyNode headNode = DependencyUtility.getNominalHeadNode(jCas, mention);
         if(headNode != null){
           String head = headNode.getCoveredText().toLowerCase();



Mime
View raw message