I just completed a new version of the Python version of T2G which adds a few new features. Most prominent among these is the ability to extract only retweets or only mentions for visualization in Gephi. Recent research has shown substantive differences between networks based on these behaviors, so it is important for researchers to be able to distinguish between them. The new version also fixes a bug that halted processing whenever two @s appeared adjacent to one another in a tweet (i.e. “@@”).
Download T2G 0.3 for Python (7/09/13)
T2G 0.3 features four extraction modes, each of which yields different sets of network edges:
- Extracts all edges, does not differentiate between retweets and mentions, and includes singletons (users who are mentioned by no one and mention no one)
- Extracts all edges, does not differentiate between retweets and mentions, and excludes singletons
- Extracts retweets only and excludes singletons
- Extracts mentions only (i.e. non-retweets) and excludes singletons
To try the different modes, change the value of the variable ‘extmode’ on line 16 to a number from 1 to 4 corresponding to the numbered modes above. Easy!
I have very little Python experience and am looking for some guidance. I’m not sure how to use a script editor, if that’s what I need. I’m also not sure how to format the name of my Excel file to post into this script. Please help. Your tool is exactly what I am looking for.
Not sure how I did it, but I figured it out!
Glad to hear it!
I’m back! Ok, so I had this working, but now I want to adjust the extraction in multiple ways. Can you explain the steps I would need to take to get this script to run? I thought I was supposed to copy the script into a script editor, but not sure what to do after that point. I have Python 2.7. Thanks!
Nevermind. I was able to figure out how to just save it from the script editor.
I’ve recently had success adjusting this code for Python 3. If anyone is having a hard time getting this code to run you can also email me at email@example.com