pycl/Code/freq6.py
def countWords(words, filename):
	"""Counts words in file and returns dictionary."""
	count = words.get(countername, 0)
	try:
		file = codecs.open(filename, "r", "utf8")
		tokens = [string.lower(i) for i in re.findall(ur"[A-Za-zčČćĆšŠžŽđĐ]+'?[A-Za-zčČćĆšŠžŽđĐ]?",file.read())]
		for i in tokens:
			if i not in functionWordsEN:
				words[i] = words.get(i, 0) + 1
				count += 1
		file.close()
	except IOError:
		print "Cannot read from file:", filename
	words[countername] = count
	return words
Counts words in file and returns dictionary.
Counts words in file and returns dictionary.
Counts words in file and returns dictionary .
def countWords(words, filename):
	count = words.get(countername, 0)
	try:
		file = codecs.open(filename, "r", "utf8")
		tokens = [string.lower(i) for i in re.findall(ur"[A-Za-zčČćĆšŠžŽđĐ]+'?[A-Za-zčČćĆšŠžŽđĐ]?",file.read())]
		for i in tokens:
			if i not in functionWordsEN:
				words[i] = words.get(i, 0) + 1
				count += 1
		file.close()
	except IOError:
		print "Cannot read from file:", filename
	words[countername] = count
	return words
def countWords ( words , filename ) : count = words . get ( countername , 0 ) try : file = codecs . open ( filename , "r" , "utf8" ) tokens = [ string . lower ( i ) for i in re . findall ( ur"[A-Za-zčČćĆšŠžŽđĐ]+'?[A-Za-zčČćĆšŠžŽđĐ]?",file.read())] for i in tokens : if i not in functionWordsEN : words [ i ] = words . get ( i , 0 ) + 1 count += 1 file . close ( ) except IOError : print "Cannot read from file:" , filename words [ countername ] = count return words
Counts words in file and returns dictionary.
Counts words in file and returns dictionary .
"""Counts words in file and returns dictionary."""
words
filename