Skip to content

Commit

Permalink
Fixes classpath resource-loading issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
bethard committed Jul 18, 2019
1 parent ca83b9b commit 1b7d211
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/org/clulab/geonorm/GeoNorm.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.clulab.geonorm

import java.io.{BufferedReader, InputStream, InputStreamReader, Reader}
import java.io.{BufferedReader, InputStream, InputStreamReader}
import java.nio.file.{Files, Path}

import scala.collection.JavaConverters._
Expand Down Expand Up @@ -34,8 +34,8 @@ object GeoLocationExtractor {
}
}

class GeoLocationExtractor(taggerModel: Session = GeoLocationExtractor.loadNetwork(getClass.getResourceAsStream("/org/clulab/geonorm/model/geonorm_model.pb")),
wordToIndex: Map[String, Int] = GeoLocationExtractor.loadVocabulary(getClass.getResourceAsStream("/org/clulab/geonorm/en/geoloc-extractor-vocabulary.txt"))) {
class GeoLocationExtractor(taggerModel: Session = GeoLocationExtractor.loadNetwork(classOf[GeoLocationExtractor].getResourceAsStream("/org/clulab/geonorm/model/geonorm_model.pb")),
wordToIndex: Map[String, Int] = GeoLocationExtractor.loadVocabulary(classOf[GeoLocationExtractor].getResourceAsStream("/org/clulab/geonorm/en/geoloc-extractor-vocabulary.txt"))) {

lazy private val unknownInt = wordToIndex(GeoLocationExtractor.UNKNOWN_TOKEN)
lazy private val paddingInt = wordToIndex(GeoLocationExtractor.PADDING_TOKEN)
Expand Down Expand Up @@ -173,7 +173,7 @@ object GeoLocationNormalizer {


class GeoLocationNormalizer(geoNamesIndex: GeoNamesIndex,
linearModel: Option[Model] = Some(GeoLocationNormalizer.loadModel(getClass.getResourceAsStream("/org/clulab/geonorm/geonames-reranker.model")))) {
linearModel: Option[Model] = Some(GeoLocationNormalizer.loadModel(classOf[GeoLocationNormalizer].getResourceAsStream("/org/clulab/geonorm/geonames-reranker.model")))) {

def scoredEntries(text: String, span: (Int, Int)): Array[(GeoNamesEntry, Float)] = span match {
case (start, end) => geoNamesIndex.search(text.substring(start, end))
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/org/clulab/geonorm/GeoNormSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package org.clulab.geonorm

import java.nio.file.{Files, Paths}

import org.apache.commons.io.{FileUtils, IOUtils}
import org.apache.commons.io.FileUtils
import org.scalatest.{Matchers, WordSpec}

class GeoNormSpec extends WordSpec with Matchers {
Expand Down

0 comments on commit 1b7d211

Please sign in to comment.