Added getWeight that calculates the weight of a word in a given document