extract BagOfWords generation