Skip to content

Instantly share code, notes, and snippets.

@retorquere
Created March 22, 2018 21:47
Show Gist options
  • Save retorquere/b60e5b676563d2fa08e6ae0e88a9a4e7 to your computer and use it in GitHub Desktop.
Save retorquere/b60e5b676563d2fa08e6ae0e88a9a4e7 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import sys
import subprocess
from collections import Counter
chars = sys.argv[1]
length = len(chars) if len(sys.argv) == 2 else int(sys.argv[2])
if length > len(chars): length = len(chars)
chars = Counter(chars)
for line in subprocess.check_output('aspell -d en dump master | aspell -l en expand', shell=True).split('\n'):
if len(line) != length: continue
if (len(list((Counter(line) - chars).elements()))) != 0: continue
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment