diff options
author | Ellen Spertus <ellen.spertus@gmail.com> | 2018-09-04 14:58:25 -0700 |
---|---|---|
committer | Ellen Spertus <ellen.spertus@gmail.com> | 2018-09-04 14:59:29 -0700 |
commit | 9eb2fca606e17c63406c136f58ed9a079748a4d7 (patch) | |
tree | 2b6920951ab3d14948deb59ffbc6d9516fd7c417 | |
parent | a905dc0c606710b12d33e1df2dc6b109812f7276 (diff) | |
download | sandcrawler-9eb2fca606e17c63406c136f58ed9a079748a4d7.tar.gz sandcrawler-9eb2fca606e17c63406c136f58ed9a079748a4d7.zip |
changed style of ScoreJobTest.bundle
-rw-r--r-- | scalding/src/test/scala/sandcrawler/ScoreJobTest.scala | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/scalding/src/test/scala/sandcrawler/ScoreJobTest.scala b/scalding/src/test/scala/sandcrawler/ScoreJobTest.scala index c3e4ff9..fbc0ee5 100644 --- a/scalding/src/test/scala/sandcrawler/ScoreJobTest.scala +++ b/scalding/src/test/scala/sandcrawler/ScoreJobTest.scala @@ -222,21 +222,17 @@ class ScoreJobTest extends FlatSpec with Matchers { } def bundle(slug : String, grobidIndex : Int, crossrefIndex : Int) : (String, Int, String, String) = { - GrobidScorable.jsonToMapFeatures( + val mfg : Option[MapFeatures] = GrobidScorable.jsonToMapFeatures( Sha1Strings(grobidIndex), - JsonStrings(grobidIndex)) match { - case None => fail() - case Some(mf1) => { - CrossrefScorable.jsonToMapFeatures(CrossrefStrings(crossrefIndex)) match { - case None => fail() - case Some(mf2) => { - val score = Scorable.computeSimilarity( - ReduceFeatures(mf1.json), - ReduceFeatures(mf2.json)) - (slug, score, mf1.json, mf2.json) - } - } - } + JsonStrings(grobidIndex)) + val mfc : Option[MapFeatures] = CrossrefScorable.jsonToMapFeatures(CrossrefStrings(crossrefIndex)) + if (mfg.isEmpty || mfc.isEmpty) { + fail() + } else { + val score = Scorable.computeSimilarity( + ReduceFeatures(mfg.get.json), + ReduceFeatures(mfc.get.json)) + (slug, score, mfg.get.json, mfc.get.json) } } |