Skip to content

Instantly share code, notes, and snippets.

View ranjanmanish's full-sized avatar
🎯
Focusing

Manish ranjanmanish

🎯
Focusing
  • Tile, Moz, University Of Georgia
  • Bay Area, Seattle, Athens, Georgia , US
View GitHub Profile
@ranjanmanish
ranjanmanish / tfidf.py
Created February 27, 2016 03:17 — forked from sloria/tfidf.py
import math
from text.blob import TextBlob as tb
def tf(word, blob):
return blob.words.count(word) / len(blob.words)
def n_containing(word, bloblist):
return sum(1 for blob in bloblist if word in blob)
def idf(word, bloblist):