Skip to content

Commit

Permalink
Revises SemEval2019Task12 to write model to resources directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bethard committed Jul 18, 2019
1 parent 94e53ac commit 48fd86d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/test/scala/org/clulab/geonorm/SemEval2019Task12.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 48fd86d

Please sign in to comment.