Revision: 14175
          http://gate.svn.sourceforge.net/gate/?rev=14175&view=rev
Author:   philgooch
Date:     2011-07-25 17:15:56 +0000 (Mon, 25 Jul 2011)

Log Message:
-----------
For HighestMappingLowestCUI and HighestMappingMostSources processing modes, 
compare the head word/phrase of each mapping event, rather than the first 
mapping event.

Modified Paths:
--------------
    gate/trunk/plugins/Tagger_MetaMap/src/gate/metamap/MetaMapPR.java

Modified: gate/trunk/plugins/Tagger_MetaMap/src/gate/metamap/MetaMapPR.java
===================================================================
--- gate/trunk/plugins/Tagger_MetaMap/src/gate/metamap/MetaMapPR.java   
2011-07-25 14:46:01 UTC (rev 14174)
+++ gate/trunk/plugins/Tagger_MetaMap/src/gate/metamap/MetaMapPR.java   
2011-07-25 17:15:56 UTC (rev 14175)
@@ -472,12 +472,27 @@
                 try {
                     List<Ev> m1Evs = m1.getEvList();
                     List<Ev> m2Evs = m2.getEvList();
+                    Ev m1HeadEvent = m1Evs.get(0);
+                    Ev m2HeadEvent = m2Evs.get(0);
+                    // Iterate over both event lists to get and compare the 
head term
+                    for (Ev ev : m1Evs) {
+                        if (ev.isHead()) {
+                            m1HeadEvent = ev;
+                            break;
+                        }
+                    }
+                    for (Ev ev : m2Evs) {
+                        if (ev.isHead()) {
+                            m2HeadEvent = ev;
+                            break;
+                        }
+                    }
                     if ( 
outputMode.equals(OutputMode.HighestMappingMostSources) ) {
                         // return highest number of sources
-                        result = m2Evs.get(0).getSources().size() - 
m1Evs.get(0).getSources().size();
+                        result = m2HeadEvent.getSources().size() - 
m1HeadEvent.getSources().size();
                     } else if ( 
outputMode.equals(OutputMode.HighestMappingLowestCUI) ) {
                         // return lowest CUI
-                        result = 
m1Evs.get(0).getConceptId().compareTo(m2Evs.get(0).getConceptId());
+                        result = 
m1HeadEvent.getConceptId().compareTo(m2HeadEvent.getConceptId());
                     }
                 } catch (Exception e) {
                     // we'll ignore this and return the default (i.e. sorted 
by score)


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
GATE-cvs mailing list
GATE-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to