Skip to content

Instantly share code, notes, and snippets.

@galvez
Created February 4, 2009 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galvez/57938 to your computer and use it in GitHub Desktop.
Save galvez/57938 to your computer and use it in GitHub Desktop.
# 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