Created
February 4, 2009 04:38
-
-
Save galvez/57938 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
# ok, let's filter artist names based on bigram occurrence | |
bigrams = ss_vector[:6] | |
if len(bigrams) == 6: | |
like1 = '%%s%%s%%%s%' % (bigrams[0], bigrams[2], bigrams[4]) | |
like2 = '%%s%%s%%%s%' % (bigrams[1], bigrams[3], bigrams[5]) | |
db.execute('select a.id as artist_id, a.name as artist_name from artists a where a.name like %s;', (like1,)) | |
likes1 = db.fetchall() | |
db.execute('select a.id as artist_id, a.name as artist_name from artists a where a.name like %s;', (like2,)) | |
likes2 = db.fetchall() | |
uniq_likes = uniq(likes1+likes2, 'artist_id') | |
res['artists'] = _artists |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment