Skip to content

Instantly share code, notes, and snippets.

@ryanpitts
Created November 21, 2012 18:20
Show Gist options
  • Save ryanpitts/4126646 to your computer and use it in GitHub Desktop.
Save ryanpitts/4126646 to your computer and use it in GitHub Desktop.
A Python script using FuzzyWuzzy to find the recent @andymboyle tweet that most resembles random mashing on a keyboard.
#!/usr/bin/python
import random
import string
import twitter
from fuzzywuzzy import process
api = twitter.Api()
recent_tweets = api.GetUserTimeline('andymboyle')
tweet_list = [tweet.text for tweet in recent_tweets]
random_string = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for x in range(140))
best_match = process.extractOne(random_string, tweet_list)
print best_match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment