From dda21ef7babe6fec67bdda24920eee898e7f18d3 Mon Sep 17 00:00:00 2001 From: EgoLaparra Date: Fri, 4 Jan 2019 10:31:01 -0700 Subject: [PATCH] for scala 2.11 --- pom.xml | 6 +++--- src/main/scala/org/clulab/timenorm/TimeNormScorer.scala | 4 ++-- .../scala/org/clulab/timenorm/neural/WordToNumber.scala | 2 +- src/test/scala/org/clulab/timenorm/TimeNormScorerTest.scala | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 78541b5b..c794b7bc 100644 --- a/pom.xml +++ b/pom.xml @@ -41,8 +41,8 @@ 1.8 1.8 UTF-8 - 2.12.2 - 2.12 + 2.11.11 + 2.11 @@ -88,7 +88,7 @@ com.typesafe.play - play-json_2.12 + play-json_2.11 2.6.9 diff --git a/src/main/scala/org/clulab/timenorm/TimeNormScorer.scala b/src/main/scala/org/clulab/timenorm/TimeNormScorer.scala index 136ee07a..949cfc3d 100644 --- a/src/main/scala/org/clulab/timenorm/TimeNormScorer.scala +++ b/src/main/scala/org/clulab/timenorm/TimeNormScorer.scala @@ -21,8 +21,8 @@ object TimeNormScorer { } object Timex { def allFrom(reader: AnaforaReader)(implicit data: Data): Seq[Timex] = { - data.topEntities.filter(e => !skip.contains(e.`type`)).flatMap(e => - Try(Timex(e.id, e.fullSpan, reader.temporal(e))).fold(ex => {ex.printStackTrace(); Seq.empty}, ts => Seq(ts))) + data.topEntities.filter(e => !skip.contains(e.`type`)).map(e => + Try(Timex(e.id, e.fullSpan, reader.temporal(e))).get) } def allIntervalsFrom(reader: AnaforaReader)(implicit data: Data): Seq[Timex] = { allFrom(reader)(data).filter(t => Try(intervals(t.time).size > 0 && intervals(t.time).forall(i => i.isDefined)).getOrElse(false)) diff --git a/src/main/scala/org/clulab/timenorm/neural/WordToNumber.scala b/src/main/scala/org/clulab/timenorm/neural/WordToNumber.scala index 7b363f4c..c30bdb5e 100644 --- a/src/main/scala/org/clulab/timenorm/neural/WordToNumber.scala +++ b/src/main/scala/org/clulab/timenorm/neural/WordToNumber.scala @@ -39,7 +39,7 @@ object WordToNumber { "billion" -> 1000000000L, "trillion" -> 1000000000000L, "quadrillion" -> 1000000000000000L, - "quintillion" -> 1000000000000000000L, + "quintillion" -> 1000000000000000000L // "sextillion" -> 1000000000000000000000L, // "septillion" -> 1000000000000000000000000L, // "octillion" -> 1000000000000000000000000000L, diff --git a/src/test/scala/org/clulab/timenorm/TimeNormScorerTest.scala b/src/test/scala/org/clulab/timenorm/TimeNormScorerTest.scala index fd907358..740d315c 100644 --- a/src/test/scala/org/clulab/timenorm/TimeNormScorerTest.scala +++ b/src/test/scala/org/clulab/timenorm/TimeNormScorerTest.scala @@ -93,13 +93,13 @@ class TimeNormScorerTest extends FunSuite with TypesSuite { val goldTimexes = Seq( Timex("G1", (0, 3), SimpleInterval.of(1980, 5)), Timex("G2", (5, 10), SimpleInterval.of(1985, 2, 1)), - Timex("G3", (11, 12), SimpleInterval.of(1985, 2, 2)), + Timex("G3", (11, 12), SimpleInterval.of(1985, 2, 2)) ) val systemTimexes = Seq( Timex("S1", (0, 1), SimpleInterval.of(1980, 5, 1)), Timex("S2", (2, 3), SimpleInterval.of(1980, 5, 31)), Timex("S3", (3, 5), SimpleInterval.of(1980, 5)), - Timex("S4", (9, 12), SimpleInterval.of(1985, 2)), + Timex("S4", (9, 12), SimpleInterval.of(1985, 2)) ) val (precisions, recalls) = intervalScores(goldTimexes, systemTimexes) assert(precisions === Seq(1.0, 1.0, 0.0, 2/28.0))