Tweet Stream Similarity

By: Jeff Clark    Date: Sat, 23 May 2009

In my recent Twitter Spam post I showed two Twitter accounts that had an almost identical set of tweets. Being able to detect this situation automatically might have obvious benefit in detecting invalid accounts that should be disabled. We can do this by calculating a text similarity measure between the set of tweets coming from the two accounts. A high degree of similarity (say > 80%) is suggestive of automated duplication. This, coupled with some other likely indicators of spam (lots of links to commercial websites, high rate of updates, very low followers/following ratio, lots of followers showing spam-like behaviour) should be good enough for Twitter to find lots of spam accounts automatically.

A tweet stream similarity metric has some other potential uses as well. Given a set of accounts, we could group them into clusters based on similarity of tweet content. Or we could help a twitter user find new people to follow that seem to have shared interests based on tweet content.

There are lots of different functions that can be used to calculate text similarity. The current one I have designed is based on word frequency and excludes standard stop words (the,of,and...) , ignores URLs, ignores some words extremely common in tweets (RT, via), and discounts some other words found often in tweets (like, good, day, thanks...) . This metric can be refined over time and is fairly crude. It completely ignores word order for example and does not consider the semantics of the text at all. I'm hoping it is useful for detecting similarities at a broad topical level.

I have used my metric to calculate the tweet stream similarity between all pairs of 9 fairly well known twitter personalities. I used the last 200 tweets from each account for the analysis with the exception of britneyspears who only has 144 at this time. The lowest similarity score was 2.8% for ev (the twitter ceo) vs nfl (news about the National Football League). The highest was 20.3% and was between cshirky (Clay Shirky - American writer, consultant and teacher on the social and economic effects of Internet technologies) and timoreilly (Tim O'Reilly - founder and CEO of O'Reilly media). The highest score for THE_REAL_SHAQ ( Shaquille O'Neal ) was with the nba twitter account. The highest score for MariahCarey was with britneyspears. The metric seems to be doing a reasonable job. Here is the complete list:

  1. Sim(cshirky, timoreilly) = 20.0%
  2. Sim(cshirky, techcrunch) = 16.6%
  3. Sim(timoreilly, techcrunch) = 15.8%
  4. Sim(timoreilly, ev) = 14.2%
  5. Sim(cshirky, ev) = 13.3%
  6. Sim(MariahCarey, britneyspears) = 12.9%
  7. Sim(THE_REAL_SHAQ, nba) = 11.8%
  8. Sim(MariahCarey, ev) = 11.6%
  9. Sim(ev, techcrunch) = 10.9%
  10. Sim(MariahCarey, nba) = 10.8%
  11. Sim(cshirky, MariahCarey) = 10.7%
  12. Sim(MariahCarey, timoreilly) = 9.6%
  13. Sim(ev, britneyspears) = 9.2%
  14. Sim(timoreilly, nba) = 9.1%
  15. Sim(cshirky, nba) = 9.1%
  16. Sim(THE_REAL_SHAQ, ev) = 9.0%
  17. Sim(ev, nba) = 9.0%
  18. Sim(THE_REAL_SHAQ, MariahCarey) = 8.2%
  19. Sim(britneyspears, techcrunch) = 8.1%
  20. Sim(nba, britneyspears) = 7.8%
  21. Sim(MariahCarey, techcrunch) = 7.7%
  22. Sim(cshirky, britneyspears) = 7.5%
  23. Sim(cshirky, THE_REAL_SHAQ) = 7.5%
  24. Sim(timoreilly, britneyspears) = 7.2%
  25. Sim(THE_REAL_SHAQ, timoreilly) = 6.5%
  26. Sim(THE_REAL_SHAQ, britneyspears) = 6.4%
  27. Sim(nba, techcrunch) = 6.4%
  28. Sim(nba, nfl) = 4.5%
  29. Sim(THE_REAL_SHAQ, techcrunch) = 3.9%
  30. Sim(timoreilly, nfl) = 3.9%
  31. Sim(nfl, techcrunch) = 3.7%
  32. Sim(MariahCarey, nfl) = 3.6%
  33. Sim(cshirky, nfl) = 3.6%
  34. Sim(THE_REAL_SHAQ, nfl) = 3.4%
  35. Sim(nfl, britneyspears) = 3.2%
  36. Sim(ev, nfl) = 2.8%

An obvious next step is to use a better way to visualize this information. I'm thinking of using a network layout with nodes positioned closely and connected for high similarity scores and positioned far apart for low similarity scores. I'm hoping that it would illustrate nicely any structure within the group.

 


American Idol Tweet Narrative
Blog
Tweet Stream Similarity Graph