-
-
Save xrrocha/3cf1b84a81394eadb131c34a9146a9ae 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
private List<String> edits1(String typo) { | |
// Generate all splits for the word so as to account for typos originating | |
// in the insertion of a space in the middle of the word | |
List<WordSplit> wordSplits = splits(typo); | |
// Generate and apply all 4 edits (in parallel) to each split. Packing removes | |
// duplicates, ensures result presence in dictionary and orders by rank | |
return pack(edits.parallelStream() | |
.flatMap(edit -> edit.apply(wordSplits))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment