Skip to content

Instantly share code, notes, and snippets.

@TomLous TomLous/KvKRecord.scala
Last active Apr 25, 2017

What would you like to do?
import java.lang.Math._
case class KvKRecord(dossierNummer: String, vgNummer: String, naamShort: String, naamShortP1: String, naamShortP2: String, naamLong: String, adresV: String, postcodePlaatsV: String, adresC: String, postcodePlaatsC: String, wptf: Int, sbi: Int) {
def vectorValues: List[Any] = List(dossierNummer, vgNummer, naamShort, naamShortP1, naamShortP2, naamLong, adresV, postcodePlaatsV, adresC, postcodePlaatsC, wptf, sbi)
def distance(other: KvKRecord): List[Double] = {
val jw = new JaroWinkler
vectorValues zip other.vectorValues map {
case (a: String, b: String) => jw.distance(a, b)
case (a: Int, b: Int) => log10(abs(a - b) + 1) / 5
case _ => 0.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.