Skip to content

Instantly share code, notes, and snippets.

@knkumar
knkumar / tf_idf_final.py
Created June 26, 2012 18:21 — forked from anhpt379/tf_idf_final.py
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')
@knkumar
knkumar / loadtimes
Created May 17, 2012 20:08 — forked from sajith/loadtimes.m
silly function to show load times of .mat files under a directory
function loadtimes ( dirname )
if isempty ( dirname ), return, end
x = '$(NF)","$5';
cmd = sprintf ( 'find %s -iname *.mat | xargs -I {} sh -c "ls -lh {}" | awk ''{print $NF","$5}'' > loadtimes.csv', dirname );
system ( cmd );
fhandle = fopen('loadtimes.csv','rt');
csv_cell = textscan(fhandle,'%s %s','Delimiter',',');