implemented bag of words