Commits

Slavko Zitnik committed 8f9133d

Run3 for CHEMDNER results

Comments (0)

Files changed (2)

             <version>3.6.10</version>
         </dependency>
 
+        <dependency>
+            <groupId>tw.edu.ntu.csie</groupId>
+            <artifactId>libsvm</artifactId>
+            <version>3.17</version>
+        </dependency>
+
+
     </dependencies>
 
 

src/main/java/si/zitnik/research/iobie/core/ner/test/Chemdner2013Evaluation.scala

           idx1 = constituents1.size
         }
         //check to merge
-        if (intersects(constituents1(idx1), constituents2(idx2))) { //merge
+        if (constituents1(idx1).example.get(0).get(Label.START_IDX).asInstanceOf[Int] == constituents2(idx2).example.get(0).get(Label.START_IDX).asInstanceOf[Int] && intersects(constituents1(idx1), constituents2(idx2))) { //merge
           //if it comes here, they are already within the same sentence
           val startIdx = math.min(constituents1(idx1).startIdx, constituents2(idx2).startIdx)
-          val endIdx = math.max(constituents1(idx1).endIdx, constituents2(idx2).endIdx)
+          val endIdx = math.min(math.min(math.max(constituents1(idx1).endIdx, constituents2(idx2).endIdx), constituents2(idx2).example.size()), constituents1(idx1).example.size())
           mergedResults.put(docId, (new Constituent(constituents1(idx1).example, startIdx, endIdx),
             constituents1(idx1).get(Label.MARGINAL_PROB).asInstanceOf[Double], constituents1(idx1).example.get(ExampleLabel.EXAMPLE_PROB).asInstanceOf[Double],
             constituents2(idx2).get(Label.MARGINAL_PROB).asInstanceOf[Double], constituents2(idx2).example.get(ExampleLabel.EXAMPLE_PROB).asInstanceOf[Double],