Skip to content

Instantly share code, notes, and snippets.

View henriquefb's full-sized avatar

Henrique Fialho Barbosa henriquefb

View GitHub Profile
@henriquefb
henriquefb / hawkish.py
Last active May 12, 2017 21:49
This script breaks up documents in 10-word windows and compares them to "hawkish" and "dovish" to try and build a semantic polarity of sorts
# importing libraries
import string
import math
import nltk
import numpy as np
import gensim
import pandas as pd
import scipy.spatial
from nltk.corpus import stopwords
from scipy import stats
@henriquefb
henriquefb / delete_all_tweets.py
Created February 2, 2017 06:37 — forked from davej/delete_all_tweets.py
This script will delete all of the tweets in a specified account.
# -*- coding: utf-8 -*-
"""
This script will delete all of the tweets in the specified account.
You may need to hit the "more" button on the bottom of your twitter profile
page every now and then as the script runs, this is due to a bug in twitter.
You will need to get a consumer key and consumer secret token to use this
script, you can do so by registering a twitter application at https://dev.twitter.com/apps
@requirements: Python 2.5+, Tweepy (http://pypi.python.org/pypi/tweepy/1.7.1)
@henriquefb
henriquefb / stata_example.do
Last active May 31, 2017 02:51
This Gist is an example of Stata code that I have written in the past to illustrate some functions
* Getting started
capture log close
log using benin_ttests, text replace
set more off
clear
* cd "/Users/henrique/Desktop/Benin Project/Benin data"
use benin_data_modified
* The bulk of the work done by this program is coded in this first loop.
* There are four main objectives:
options(encoding="utf-8")
# Assigning the home directory
direc1 <- "/Users/henrique/Desktop"
setwd(direc1)
# Importing the relevant libraries
libs <- c("RCurl", "XML", "httr", "stringr", "mailR")
lapply(libs, library, character.only=TRUE)
direc <- "caminho completo da pasta em que você salvou os tweets"
setwd(direc)
# Importando os pacotes necessários
##############################################################################
libs <- c('devtools', 'twitteR', 'RCurl', 'XML', 'NLP', 'tm', 'plyr', 'ggplot2', 'xlsx', 'SnowballC', 'slam')
lapply(libs, require, character.only = TRUE)
# Lendo os dados da planilha de tweets