Created
December 26, 2018 02:00
-
-
Save Thann/b9db8fde61c332906318cf595fc28156 to your computer and use it in GitHub Desktop.
really slow anagram algorithm
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
import enchant | |
import itertools | |
sample = "atlas shrugged" | |
d = enchant.Dict("en_US") | |
for s in itertools.permutations(sample, len(sample)): | |
s = ''.join(s) | |
if all(d.check(p) for p in s.split(' ') if len(p)): | |
print('--->', s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment