Skip to content

Instantly share code, notes, and snippets.

View akoskadar's full-sized avatar

Ákos Kádár akoskadar

View GitHub Profile
@joshuaboy7
joshuaboy7 / WordCount
Last active December 27, 2015 16:59
This script imports a text returns unique words and their counts.
import string
import globe
import csv
"""
flist=glob.glob(r'C:\\Python27\\*.txt')
fil = open('C:\\Python27\\README.txt')
new_file = open('C:\Python27\\freq_list.txt', 'w')
"""
@vineetrok
vineetrok / tf_idf.py
Created November 24, 2011 18:13
Python program to determine Term-Frequencey and Inverse Document Frequency
import glob
import math
line=''
s=set()
flist=glob.glob(r'E:\PROGRAMMING\PYTHON\programs\corpus2\*.txt') #get all the files from the d`#open each file >> tokenize the content >> and store it in a set
for fname in flist:
tfile=open(fname,"r")
line=tfile.read() # read the content of file and store in "line"
tfile.close() # close the file
s=s.union(set(line.split(' '))) # union of common words