Counting number of unique words in a file and also counting the frequency of each word in Python