diff options
author | Ellen Spertus <ellen.spertus@gmail.com> | 2018-08-20 14:32:28 -0700 |
---|---|---|
committer | Ellen Spertus <ellen.spertus@gmail.com> | 2018-08-20 14:32:28 -0700 |
commit | 4f4571bbc1717c5ad9740377fdb8297da6632639 (patch) | |
tree | 9aaa8365fb3facf5d88dabafdd61e70d7484f0ac /scalding | |
parent | 03663873fbc556f670cc695f90a2b74bd2bc72de (diff) | |
download | sandcrawler-4f4571bbc1717c5ad9740377fdb8297da6632639.tar.gz sandcrawler-4f4571bbc1717c5ad9740377fdb8297da6632639.zip |
Removed debugging code, fixed style warnings.
Diffstat (limited to 'scalding')
-rw-r--r-- | scalding/src/main/scala/sandcrawler/ScorableFeatures.scala | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/scalding/src/main/scala/sandcrawler/ScorableFeatures.scala b/scalding/src/main/scala/sandcrawler/ScorableFeatures.scala index d9461e7..e71abfa 100644 --- a/scalding/src/main/scala/sandcrawler/ScorableFeatures.scala +++ b/scalding/src/main/scala/sandcrawler/ScorableFeatures.scala @@ -3,6 +3,7 @@ package sandcrawler import scala.util.parsing.json.JSONObject object ScorableFeatures { + // Static factory method def create(title : String, year : Int = 0, doi : String = "", sha1 : String = "") : ScorableFeatures = { new ScorableFeatures( title=if (title == null) "" else title, @@ -24,16 +25,11 @@ class ScorableFeatures private(title : String, year: Int = 0, doi : String = "", "references", "results", "review", "reviewarticle", "summary", "title", "name") - def toMap() : Map[String, Any] = Map("title" -> title, "year" -> year, "doi" -> doi, "sha1" -> sha1) + def toMap() : Map[String, Any] = + Map("title" -> title, "year" -> year, "doi" -> doi, "sha1" -> sha1) - override def toString() : String = { - val myMap = toMap() - assert(myMap("title") != null) - assert(myMap("year") != null) - assert(myMap("doi") != null) - assert(myMap("sha1") != null) - JSONObject(myMap).toString - } + override def toString() : String = + JSONObject(toMap).toString def toSlug() : String = { if (title == null) { @@ -46,7 +42,6 @@ class ScorableFeatures private(title : String, year: Int = 0, doi : String = "", } } - def toMapFeatures : MapFeatures = { + def toMapFeatures : MapFeatures = MapFeatures(toSlug, toString) - } } |