"added function to create bag of words representation"