aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllen Spertus <ellen.spertus@gmail.com>2018-09-04 14:58:25 -0700
committerEllen Spertus <ellen.spertus@gmail.com>2018-09-04 14:58:25 -0700
commitdb177cc517eea4badf11401b72e817b75babe7aa (patch)
tree0efa566de94a57cc2f937652b53be2b7b9015936
parentf41d8c48f4ce107db558b86a956fbdfd1e018a32 (diff)
downloadsandcrawler-db177cc517eea4badf11401b72e817b75babe7aa.tar.gz
sandcrawler-db177cc517eea4badf11401b72e817b75babe7aa.zip
changed style of ScoreJobTest.bundle
-rw-r--r--scalding/src/test/scala/sandcrawler/ScoreJobTest.scala24
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)
}
}