https://github.com/stephenmcd/babbler/blob/master/babbler/ta...
If I recall, it simply extracts non-dictionary words from the outgoing tweet, then actually queries the Twitter API itself to gauge the popularity of each potential hashtag, only using the most popular.