Commits

Slavko Zitnik committed 4513156

BioNLP works with challenge submitted results

  • Participants
  • Parent commits 16a8f71

Comments (0)

Files changed (1)

File src/main/java/si/zitnik/research/iobie/core/relationship/test/BioNLP2013Relationship.scala

       filename = filename)
   }
 
+  def printlnForR(map: SortedMap[Int, Int]) {
+    println(map)
+    println("keys <- " + map.map(_._1).mkString("c(",",",")"))
+    println("values <- " + map.map(_._2).mkString("c(",",",")"))
+  }
+
   def doSomeAnalytics(trainExamples: Examples, testExamples: Examples) {
     //Check EVENT attribute types:
     /*val subjs = trainExamples.flatMap(_.getAllRelationships().filter(_.get(Label.ATTRIBUTE_TYPE).equals("EVENT"))).map(_.get(Label.SUBJECT_TYPE)).toSet
     processSieves(trainExamples, testExamples)
   }
 
+
   def processSieves(trainExamples: Examples, testExamples: Examples) {
-    //visualiza distances //COMMENT TO RUN FOR REAL!!!!
-    /*trainExamples.foreach(e => {
+    //visualize distances //COMMENT TO RUN FOR REAL!!!!
+    /*
+    trainExamples.foreach(e => {
       //add also events as mentions
       val mentions = new ArrayBuffer[Constituent]()
       mentions.addAll(e.getAllMentions())
     })
 
     //0. print some statistics
-    /*println(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(trainExamples))
-    println(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(
+    //OPTIONAL: add events as mentions
+    /*
+    trainExamples.foreach(e => {
+      val mentions = new ArrayBuffer[Constituent]()
+      mentions.addAll(e.getAllMentions())
+      mentions.addAll(eventsToMentions(e))
+      e.setMentions(mentions)
+    })
+
+
+    printlnForR(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(trainExamples))
+    printlnForR(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(
       trainExamples,
       valueTypeToProcess = Some(Array("RELATIONSHIP"))
     ))
-    println(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(
+    printlnForR(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(
       trainExamples,
       valueTypeToProcess = Some(Array("EVENT"))
     ))
-    println(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(
+    printlnForR(SortedMap[Int, Int]() ++ RelationshipAnalysis.getRelationshipAttributeMentionsDistanceDistribution(
       trainExamples,
       valueTypeToProcess = Some(Array("NEGATION"))
     ))
     println(relationShipsHavingRelationshipAsAnAttribute.size)
     println(trainExamples.flatMap(_.getAllRelationships().filter(r => {
       r.get(Label.ATTRIBUTE_TYPE).equals("NEGATION")
-    })).size) */
+    })).size)
+    */
+
 
     //1. detect new mentions
     detectNewMentions(trainExamples, testExamples)