This repository contains the scripts can collect tweets from the Twitter Streaming API using Python, save data in the local MongoDB database and data pre-processing for building a Co-mention Emoji Network.
Twitter Emoji Co-mention Network.
This project begins to explore how the emoji network structure may compare to that of the accompanying text language network.
Process:
- Streamline Twitter API calls for tweets containing keyword “art”
- Save to MongoDB
- Extract and preprocess the data
- Open terminal/command prompt.
- Clone the repository to your local system in a dedicated folder.
- CD to the repo directory.
- Create and activate a virtual environment for this project.
- On macOS or Linux:
python3 -m venv env source env/bin/activate which python
- On Windows:
py -m venv env .\env\Scripts\activate where python
- On macOS or Linux:
- Install necessary packages
pip install -r requirements.txt
-
Set up your local database, run
python mongodb_setup.py
-
Remember to modify your own configure information at
config.py
. -
Run
python stream_twitter.py
to collect tweets from the Twitter Streaming API -
Run
python mongodb_df.py
to extract useful tweets and write in a csv file. Can take different filter statements.
Deactivate the venv to return to your terminal using deactivate
.
Fangfang Sheng