Adding convenience function to BagOfWords