Created
August 15, 2015 12:26
-
-
Save jmaciasluque/7c747545e0c431d5fa6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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