EDIT 07/10/13: A new version of T2G for Python has been posted here–it has options to extract only retweets or only mentions, among other new features.
A few weeks ago I posted a spreadsheet that converted tweet mention data into Gephi format for social network analysis. A key limitation of that spreadsheet is that it only converts the first name mentioned in each tweet, discarding the rest. For example, for the following tweet:
@alexhanna @cfwells @kbculver Cool, thanks for the tip.
— Deen Freelon (@dfreelon) May 12, 2013
that spreadsheet would pull @alexhanna into the Gephi file as one of my mentions but not @cfwells or @kbculver.
To remedy this issue, I’ve created T2G, a solution that converts all Twitter mention data fed into it to Gephi format. T2G comes in two flavors, Python and PHP, each of which does the same thing. The PHP edition is more user-friendly, while the Python edition is faster and easier to set up. All you need to do is supply a CSV file containing two columns: the first (leftmost) filled with the tweet authors’ usernames, and the second filled with their corresponding tweets. You’ll find additional instructions in an extended comment at the top of each script. Please ensure that you have the appropriate interpreter installed (PHP or Python) before trying to use either of these scripts.
- T2G 0.1 (PHP edition) — rename “t2g.txt” to “t2g.php” to activate the script
- T2G 0.1 (Python edition)
Both of these scripts produce equivalent output, albeit in a slightly different order (you can rank the data in alphabetical order to check if you like).
You can test a “lite” version of the PHP edition below–it will convert only the first 100 tweets in your file. Feel free to test it using this sample file, which contains some of my own recent tweets formatted to the above specifications.
T2G Lite, PHP Edition 0.1
How hilarious I went searching for this and I have been digging your tweets all of this time. Thanks!
Hi Deen,
Seems I’m hitting a size limit
Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 141 bytes) in /home/jgroshek/jgroshek.com/T2G/t2g.php on line 22
Any ideas?
Thanks,
Jacob
Thank you.
This solved me a big problem.