<commit_before>#!/usr/bin/python
"""
Count Words in a String - Counts the number of individual words 
in a string. For added complexity read these strings 
in from a text file and generate a summary.
"""

#Currently has an issue where it's adding empty strings to the split list
#Has something to do with instances of '\n\n'
#look into dividing separate words in a better way

def main():
	indo = raw_input("Enter file path: ")
	c = count_words(indo)
	print "There are %d words in '%s'" %(c, indo)

def count_words(file):
	with open(file, 'r') as f:
		read_data = f.read()
		stripped = read_data.replace('\n',' ')
		words = stripped.split(' ')
		print words
		return len(words)

if __name__ == '__main__':main()<commit_msg>Finalized practice word_counter.py. This one is LAME<commit_after>#!/usr/bin/python
#THIS ONE IS OLD AND LAME
"""
Count Words in a String - Counts the number of individual words 
in a string. For added complexity read these strings 
in from a text file and generate a summary.
"""

#Currently has an issue where it's adding empty strings to the split list
#Has something to do with instances of '\n\n'
#look into dividing separate words in a better way

def main():
	indo = raw_input("Enter file path: ")
	c = count_words(indo)
	print "There are %d words in '%s'" %(c, indo)

def count_words(file):
	with open(file, 'r') as f:
		read_data = f.read()
		stripped = read_data.replace('-',' ')
		words = stripped.split()
		print words
		return len(words)

if __name__ == '__main__':main()
{'fraction_non_alphanumeric': 0.11347047113470471, 'fraction_numerical': 0.0, 'mean_word_length': 4.129251700680272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '310829', 'n_tokens_mistral': 498, 'n_tokens_neox': 475, 'n_words': 205}