Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
co = CountVectorizer(ngram_range=(3,3))
counts = co.fit_transform(comments_titles)
important_trigrams_title = pd.DataFrame(counts.sum(axis=0),columns=co.get_feature_names()).T.sort_values(0,ascending=False).head(50)
important_trigrams_title=important_trigrams_title.reset_index()
important_trigrams_title.rename(columns={'index':'trigrams_title',0:'frequency'},inplace=True)
important_trigrams_title['english_translation'] = important_trigrams_title['trigrams_title'].apply(translator.translate)
important_trigrams_title
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment