Question

I have found Apache's impelementation of Soundex and Metaphone in Java but I would prefer to keep the text comparison libraries I am using in Scala only if possible. Google searches have yielded me nothing useful in finding either of these algorithms in Scala.

Worst case scenario I can translate these algorithms into Scala but that is less than ideal.

http://commons.apache.org/codec/

Was it helpful?

OTHER TIPS

Not to answer my own question or anything but a viable option would be to utilize a Java library and create some companion objects in scala to help expose them more appropriately and to allow to code to document itself more effectively.

//Metaphone companion object for org.apache.commons.codec.language.Metaphone in /lib/commons-codec-1.7
object Metaphone {
  val metaphone = new Metaphone
  metaphone setMaxCodeLen 5

  def encode(str:String) : String = {
    metaphone encode str
  }
}

Implementation:

val str_meta = Metaphone encode "Starbucks"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top