Edited how to get the weights for each word