from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer from sklearn.pipeline import FeatureUnion, Pipeline pipeline = Pipeline([ ('features', FeatureUnion([ ('count', CountVectorizer()), ('tfidf', TfidfVectorizer()) ])) ]) X = ["This is some text to analyze", "And some more for good measure"] pipeline.fit_transform(X)In this example, we create a pipeline that first combines the output of CountVectorizer and TfidfVectorizer with a FeatureUnion. The pipeline then fits the combined features to the input data. The package library for this code example is scikit-learn (sklearn).