Created
February 21, 2012 21:03
-
-
Save jacobian/1878924 to your computer and use it in GitHub Desktop.
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
# stuff = {'term': (title, url)} | |
# e.g. {'RequestFactory',: ('django.test.client.RequestFactory/', 'http://...'), ...} | |
def find(term): | |
score, found = 0, None | |
for candidate in stuff: | |
cand_score = stringslipper.score(candidate.lower(), term) | |
if cand_score > score: | |
score = cand_score | |
found = (candidate, stuff[candidate]) | |
return score, found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment