How to add new features to tf-idf matrix

Viewed 61

I have added the data to tf-idf matrix:

tfidf_vectorizer = TfidfVectorizer(max_df=0.8,min_df=5, max_features=1600)
#TF-IDF feature matrix
tfidf = tfidf_vectorizer.fit_transform(data['text'])

I want to add more features like:

# count The word for each tweet 
word_count= data['text'].apply(lambda x : len(str(x).split(' ')))

# count the caharctaer for each word 
char_count = data['text'].str.len()

# number of stopwords
num_stopword = data['text'].apply(lambda x : len([x for x in str(x).split() if x in stop]))

Can I add these features to tf-idf matrix and how?

0 Answers
Related