ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlig...@apache.org
Subject svn commit: r1706614 - /ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DeepPheAnaforaXMLReader.java
Date Sat, 03 Oct 2015 18:02:47 GMT
Author: dligach
Date: Sat Oct  3 18:02:47 2015
New Revision: 1706614

URL: http://svn.apache.org/viewvc?rev=1706614&view=rev
Log:
how handling the fact that a disease disorder (or metastasis) can be linked to multiple anatomical
sites

Modified:
    ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DeepPheAnaforaXMLReader.java

Modified: ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DeepPheAnaforaXMLReader.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DeepPheAnaforaXMLReader.java?rev=1706614&r1=1706613&r2=1706614&view=diff
==============================================================================
--- ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DeepPheAnaforaXMLReader.java
(original)
+++ ctakes/trunk/ctakes-relation-extractor/src/main/java/org/apache/ctakes/relationextractor/ae/DeepPheAnaforaXMLReader.java
Sat Oct  3 18:02:47 2015
@@ -96,7 +96,7 @@ public class DeepPheAnaforaXMLReader ext
     for (Element annotationsElem : dataElem.getChildren("annotations")) {
 
       Map<String, IdentifiedAnnotation> idToAnnotation = Maps.newHashMap();
-      Map<String, String> diseaseDisorderToBodyLocation = Maps.newHashMap();
+      Map<String, List<String>> diseaseDisorderToAnatomicalSites = Maps.newHashMap();
       
       for (Element entityElem : annotationsElem.getChildren("entity")) {
         
@@ -127,8 +127,12 @@ public class DeepPheAnaforaXMLReader ext
           DiseaseDisorderMention diseaseDisorderMention = new DiseaseDisorderMention(jCas,
begin, end);
           diseaseDisorderMention.addToIndexes();
           idToAnnotation.put(id, diseaseDisorderMention);
-          String bodyLocationId = removeSingleChildText(propertiesElem, "body_location",
id);
-          diseaseDisorderToBodyLocation.put(id, bodyLocationId);
+          List<String> anatomicalSiteIds = Lists.newArrayList();
+          for(Element child : propertiesElem.getChildren("body_location")) {
+            String bodyLocationId = child.getText();
+            anatomicalSiteIds.add(bodyLocationId);
+          }
+          diseaseDisorderToAnatomicalSites.put(id, anatomicalSiteIds);
         } else if(type.equals("Anatomical_site")) {
           AnatomicalSiteMention anatomicalSiteMention = new AnatomicalSiteMention(jCas, begin,
end);
           anatomicalSiteMention.addToIndexes();
@@ -138,11 +142,12 @@ public class DeepPheAnaforaXMLReader ext
         }
       }
       
-      for(String diseaseDisorderId : diseaseDisorderToBodyLocation.keySet()) {
+      for(String diseaseDisorderId : diseaseDisorderToAnatomicalSites.keySet()) {
         IdentifiedAnnotation diseaseDisorderMention = idToAnnotation.get(diseaseDisorderId);
-        String anatomicalSiteId = diseaseDisorderToBodyLocation.get(diseaseDisorderId);
-        IdentifiedAnnotation anatomicalSiteMention = idToAnnotation.get(anatomicalSiteId);
-        createLocationOfRelation(jCas, diseaseDisorderMention, anatomicalSiteMention);
+        for(String anatomicalSiteId : diseaseDisorderToAnatomicalSites.get(diseaseDisorderId))
{
+          IdentifiedAnnotation anatomicalSiteMention = idToAnnotation.get(anatomicalSiteId);
+          createLocationOfRelation(jCas, diseaseDisorderMention, anatomicalSiteMention);
+        }
       }
     }
   }



Mime
View raw message