Skip to content

Instantly share code, notes, and snippets.

@bry6891
bry6891 / tfpdf.py
Created July 12, 2017 17:16 — forked from bllchmbrs/tfpdf.py
TF IDF Explained in Python Along with Scikit-Learn Implementation
from __future__ import division
import string
import math
tokenize = lambda doc: doc.lower().split(" ")
document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy."
document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption."
document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people."
document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled."

Keybase proof

I hereby claim:

  • I am bry6891 on github.
  • I am bry6891 (https://keybase.io/bry6891) on keybase.
  • I have a public key whose fingerprint is 2E18 FB8C 59DC 1599 5E24 C931 0930 6C55 371A CB81

To claim this, I am signing this object: