pycl/Code/VectorSpace.py
def collectWords(document):
	"""Collect all words from document into dictionary data structures."""
	global documents, words
	file   = open(document)
	tokens = [string.lower(i) for i in re.findall(r"[A-Za-z]+'?[A-Za-z]?", file.read())]
	file.close()

	# get wordlist
	wordlist = {}
	for i in tokens:
		if i not in functionWordsEN:
			wordlist[i] = wordlist.get(i, 0) + 1
			value       = words.get(i, [])
			if document not in value:
				value.append(document)
				words[i] = value

	# store document specific dictionary
	documents[document] = wordlist
Collect all words from document into dictionary data structures.
Collect all words from document into dictionary data structures.
Collect all words from document into dictionary data structures .
def collectWords(document):
	global documents, words
	file   = open(document)
	tokens = [string.lower(i) for i in re.findall(r"[A-Za-z]+'?[A-Za-z]?", file.read())]
	file.close()
	wordlist = {}
	for i in tokens:
		if i not in functionWordsEN:
			wordlist[i] = wordlist.get(i, 0) + 1
			value       = words.get(i, [])
			if document not in value:
				value.append(document)
				words[i] = value
	documents[document] = wordlist
def collectWords ( document ) : global documents , words file = open ( document ) tokens = [ string . lower ( i ) for i in re . findall ( r"[A-Za-z]+'?[A-Za-z]?" , file . read ( ) ) ] file . close ( ) wordlist = { } for i in tokens : if i not in functionWordsEN : wordlist [ i ] = wordlist . get ( i , 0 ) + 1 value = words . get ( i , [ ] ) if document not in value : value . append ( document ) words [ i ] = value documents [ document ] = wordlist
Collect all words from document into dictionary data structures.
Collect all words from document into dictionary data structures .
"""Collect all words from document into dictionary data structures.""" # get wordlist # store document specific dictionary
document