Laboratory Walkthrough 7 - Ex7 Twitter Trends Submission...

This preview shows page 1 - 3 out of 7 pages.

Ex7: Twitter Trends Submission deadline - Monday, 16.12.2013, 20:55 What do people tweet? Draw their feelings on a map to discover trends . Introduction In this project, you will develop a geographic visualization of twitter data across the USA. You will need to use classes and different containers to create a modular program, and also implement few simple computational geometric algorithms. The map displayed above depicts how the people in different states feel about Texas. This image is generated by: 1. Collecting public Twitter posts (tweets) that have been tagged with geographic locations and filtering for those that contain the "texas" query term. 2. Assigning a sentiment (positive or negative) to each tweet, based on all of the words it contains. 3. Aggregating tweets by the state with the closest geographic center, and finally 4. Coloring each state according to the aggregate sentiment of its tweets. Red means positive sentiment; blue means negative. The details of how to conduct each of these steps is contained within the project description. By the end of this project, you will be able to map the sentiment of any word or phrase.
Image of page 1

Subscribe to view the full document.

A small version that contains all the starter code, but only a small subset of the data can be downloaded from here . You can complete the project in its entirety using this archive. Use this link to download the full list of tweets ( warning: 81 MB , unzip and place in the data directory) so you can play with more terms. The project uses several files that you are not allowed to change : trends.py - The main project file. geo.py - Geographic positions, 2-D projection equations, and geographic distance functions. maps.py - Functions for drawing maps. data.py - Functions for loading Twitter data from files. graphics.py - A simple Python graphics library. ucb.py - Utility functions. Other files for testing In addition, we provide you three files with starter code. All your coding will be in the following files : tweet.py A class to represent Tweets. geo_tweet_tools.py - Functions for finding where the tweets where tweeted from. nation_mood.py - Functions for summing the mood of the states. The data directory contains all the data files needed for the project. Phase 1: The Feelings in Tweets In this phase, you will create a class to represent tweets. Tweets Problem 1 . In the file tweet.py complete the implementation for the class Tweet. An instance of the type Tweet is initialized with the following parameters: text : a string, the text of the tweet. time : a datetime object, when the tweet was posted. latitude : a floating-point number, the latitude of the tweet's location. longitude : a floating-point number, the longitude of the tweet's location. Implement the following methods: get_text() - Returns the text of the tweet.
Image of page 2
Image of page 3
  • Spring '14
  • Avraham
  • U.S. state, tweets, python3 trends.py, file geo_tweet_tools.py implement

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern