Skip to content

Instantly share code, notes, and snippets.

@jmaciasluque
Created August 15, 2015 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmaciasluque/7c747545e0c431d5fa6c to your computer and use it in GitHub Desktop.
Save jmaciasluque/7c747545e0c431d5fa6c to your computer and use it in GitHub Desktop.
def computeLevenshtein(wordList: List[String], parallel: Boolean): Array[Array[Int]] = {
maybeParallel(parallel, wordList).map((a) =>
maybeParallel(parallel, wordList).map((b) =>
Levenshtein.lev(a, b)).toArray
).toArray
}
def maybeParallel(parallel: Boolean, wordList: List[String]): GenSeq[String] with Immutable = {
if(parallel)
wordList.par
else
wordList
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment