Giter VIP home page Giter VIP logo

tweets-processing's Introduction

01_txt2csv.py

  • Function of calculating area of bounding box.

  • Columns: ['id', 'created_at', 'coordinates', 'co_lon', 'co_lat', 'geo', 'geo_lat', 'geo_lon', 'user_location', 'place_type', 'place_name', 'place_full_name', 'place_country', 'place_bounding_box', 'pb_avg_lon', 'pb_avg_lat', 'min_lon', 'min_lat', 'max_lon', 'max_lat', 'bb_area', 'lang', 'source', 'text'].

  • user->location: replace "\n" into " "; replace "\"" and "\'" into "". Since sometimes there exist commas, when saving text into csv, text should be wraped by double quotation marks.

  • text: the same to user->location.

02_data_cleaning.py

  • df = df.drop_duplicates(["id"]): delete duplicate tweets based on "id".

  • df.dtypes: get data types of all columns.

  • df = df.astype({"created_at":"datetime64[ns]"}): change data type to datetime.

  • df['co_lon'] = df['co_lon'].astype(float): if all values of 'co_lon' are numeric.

  • df.source.value_counts(): get total number of every source.

  • df.coordinates.value_counts(): get total number of tweets with goe-tags.

  • df = df[df['place_country'] == 'Australia']: get tweets from Aus.

  • df = df[df['lang'] == 'en']: get English tweets.

  • re.sub("[^a-zA-Z]", " ", name): change all the non-alphabet characters to single space.

  • re.sub(r"\s+", " ", name): eliminate duplicate whitespaces.

  • Convert all the characters into lower case.

  • Delete links like https://github.com/alexbnlee/Tweets-Processing/edit/master/README.md.

  • Extract flu related tweets.

03_read_Gazetteer.py

  • Get all results with name of Kingsford.

  • Get the suburb with name of Kingford.

04_tfidf.py

  • Get keywords from articles.

05_NER.py

  • Standford NER

  • spaCy

  • NTLK

  • get continuous words starting with a capital letter (2 methods)

  • delete stopwords

06_tweets_stats.py

  • weekly tweets

  • flu related tweets

  • user number

  • processing with progress bar

07_bounding_box_percentage.py

  • Calculate numbers of tweets based on different area.

08_modelling.py

  • Function of distance between two points.

  • Data processing.

  • Mean error distance.

  • Median error distance.

tweets-processing's People

Contributors

alexbnlee avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.