Added functionality to extract bag of words features and return feature matrix.