Created
February 11, 2015 17:38
-
-
Save lukealbao/692a87f6ca02279e86f7 to your computer and use it in GitHub Desktop.
Substrings contained in a string
This file contains hidden or 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 build_candidates(input_string, lexicon=LEXICON): | |
code = encode(''.join(re.findall('[a-z]+', input_string.lower()))) | |
d = {} | |
for word in lexicon: | |
_code = lexicon.encoded(word) | |
if code % _code == 0: | |
d[word] = lexicon[word] | |
return d.keys() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment