Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- scoredItems map { case (scoredItemId, scoredPaths) =>
- val initialGroup = ScoredItemGroup(0, 0)
- val finalGroup = queryOnts.foldLeft(initialGroup) { case (currentGroup, (queryOnt, queryOntWeight)) =>
- scoredPaths.get(queryOnt.id) match {
- case Some(value) if value.signum == queryOntWeight.signum =>
- ScoredItemGroup(currentGroup.positive + 1, currentGroup.negative)
- case Some(value) if value.signum != queryOntWeight.signum =>
- ScoredItemGroup(currentGroup.positive, currentGroup.negative + 1)
- case _ =>
- currentGroup
- }
- }
- //Adding scored item to group
- val ontsInGroup = scoredGroups.getOrElse(finalGroup, List.empty[ObjectId])
- scoredGroups.update(finalGroup, ontsInGroup :+ scoredItemId)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement