```python from sklearn.feature_extraction.text import TfidfVectorizer tfidf = TfidfVectorizer(max_features=5000, ngram_range=(1, 2), stop_words='english') X_train_tfidf = tfidf.fit_transform(X_train) X_test_tfidf = tfidf.transform(X_test) ```