Skip to content

Instantly share code, notes, and snippets.

View marcelcaraciolo's full-sized avatar
💭
Coding !

Marcel Caraciolo marcelcaraciolo

💭
Coding !
View GitHub Profile
@marcelcaraciolo
marcelcaraciolo / models.py
Created February 13, 2012 19:28
models.py
# -*- coding: utf-8 -*-
from django.contrib import admin
from models import IesdeProduct, IesdeAccess
from forms import IesdeAddForm, IesdeAccessForm
from iesde import client
class IesdeAdminForm(admin.ModelAdmin):
@marcelcaraciolo
marcelcaraciolo / tf_idf_final.py
Created January 13, 2012 03:38
tf-idf example
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
@marcelcaraciolo
marcelcaraciolo / tf_idf.py
Created January 13, 2012 03:37
tf-idf example
#-*- coding: utf-8 -*-
import re
import nltk
from nltk.tokenize import RegexpTokenizer
from nltk import bigrams, trigrams
import math
stopwords = nltk.corpus.stopwords.words('portuguese')
@marcelcaraciolo
marcelcaraciolo / tf_idf.py
Created January 13, 2012 02:59
tf-idf example
auth = OAuthHandler(CLIENT_ID, CLIENT_SECRET, CALLBACK)
auth.set_access_token(ACCESS_TOKEN)
api = API(auth)
venue = api.venues(id='4bd47eeb5631c9b69672a230')
stopwords = nltk.corpus.stopwords.words('portuguese')
tokenizer = RegexpTokenizer("[\w’]+", flags=re.UNICODE)
@marcelcaraciolo
marcelcaraciolo / idf.py
Created January 13, 2012 02:18
inverse document frequencies
auth = OAuthHandler(CLIENT_ID, CLIENT_SECRET, CALLBACK)
auth.set_access_token(ACCESS_TOKEN)
api = API(auth)
venue = api.venues(id='4bd47eeb5631c9b69672a230')
stopwords = nltk.corpus.stopwords.words('portuguese')
tokenizer = RegexpTokenizer("[\w’]+", flags=re.UNICODE)
auth = OAuthHandler(CLIENT_ID, CLIENT_SECRET, CALLBACK)
auth.set_access_token(ACCESS_TOKEN)
api = API(auth)
venue = api.venues(id='4bd47eeb5631c9b69672a230')
stopwords = nltk.corpus.stopwords.words('portuguese')
tokenizer = RegexpTokenizer("[\w’]+", flags=re.UNICODE)
@marcelcaraciolo
marcelcaraciolo / term_frequency.py
Created January 12, 2012 19:39
term frequencies
auth = OAuthHandler(CLIENT_ID, CLIENT_SECRET, CALLBACK)
auth.set_access_token(ACCESS_TOKEN)
api = API(auth)
venue = api.venues(id='4bd47eeb5631c9b69672a230')
stopwords = nltk.corpus.stopwords.words('portuguese')
tokenizer = RegexpTokenizer("[\w’]+", flags=re.UNICODE)
@marcelcaraciolo
marcelcaraciolo / pyfoursquare.py
Created December 22, 2011 04:07
pyfoursquare API
#Now let's create an API
api = foursquare.API(auth)
#Now you can access the Foursquare API!
result = api.venues_search(query='Burburinho', ll='-8.063542,-34.872891')
#You can acess as a Model
print dir(result[0])
#Access all its attributes
@marcelcaraciolo
marcelcaraciolo / pyfoursquare.py
Created December 22, 2011 04:05
pyfoursquare Oauth
import foursquare
# == OAuth2 Authentication ==
#
# This mode of authentication is the required one for Foursquare
# The client id and client secret can be found on your application's Details
# page located at https://foursquare.com/oauth/
client_id = ""
client_secret = ""
@marcelcaraciolo
marcelcaraciolo / iesde.py
Created December 20, 2011 18:48
iesde.py
# -*- coding: utf-8 -*-
import urllib2
import datetime
from django.utils import simplejson as json
from django.conf import settings
from xml.dom import minidom
from celery.task import Task
from core.utils import get_send_mail