From 48fd86d5848be2a5c1c832b957ac8f5312ed2b2c Mon Sep 17 00:00:00 2001 From: Steven Bethard Date: Thu, 18 Jul 2019 12:49:29 -0700 Subject: [PATCH] Revises SemEval2019Task12 to write model to resources directory --- .../scala/org/clulab/geonorm/SemEval2019Task12.scala | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/scala/org/clulab/geonorm/SemEval2019Task12.scala b/src/test/scala/org/clulab/geonorm/SemEval2019Task12.scala index 81883db..89dcf18 100644 --- a/src/test/scala/org/clulab/geonorm/SemEval2019Task12.scala +++ b/src/test/scala/org/clulab/geonorm/SemEval2019Task12.scala @@ -6,18 +6,19 @@ import scala.collection.JavaConverters._ object SemEval2019Task12 { + private val modelPath = Paths.get("src/main/resources/org/clulab/geonorm/geonames-reranker.model") + def main(args: Array[String]): Unit = args match { - case Array("train", geoNamesIndexDir, modelFile, annDir) => + case Array("train", geoNamesIndexDir, annDir) => val annFiles = Files.newDirectoryStream(Paths.get(annDir), "*.ann").iterator.asScala val geoNamesIndex = new GeoNamesIndex(Paths.get(geoNamesIndexDir)) val normalizer = GeoLocationNormalizer.train(geoNamesIndex, annFiles.map(readTextAndGeoIdSpans)) - normalizer.save(Paths.get(modelFile)) + normalizer.save(modelPath) - case Array("test", geoNamesIndexDir, modelFile, annDir) => + case Array("test", geoNamesIndexDir, annDir) => val k = 1 val geoNamesIndex = new GeoNamesIndex(Paths.get(geoNamesIndexDir)) - val model = GeoLocationNormalizer.loadModel(Paths.get(modelFile)) - val normalizer = new GeoLocationNormalizer(geoNamesIndex, Some(model)) + val normalizer = new GeoLocationNormalizer(geoNamesIndex) val results = for { annPath <- Files.newDirectoryStream(Paths.get(annDir), "*.ann").iterator.asScala