Skip to content Skip to sidebar Skip to footer

Creating N-grams Word Cloud Using Python

I am trying to generate word cloud using bi-grams. I am able to generate the top 30 discriminative words but unable to display words together while plotting. My word cloud image st

Solution 1:

I think you need somehow to join your n-gramms in feature_names with any other symbol than space. I propose underscore, for example. For now, this part makes your n-gramms separate words again, I think:

' '.join(word_text)

I think you have to substitute space with underscore here:

word_text.append(feature_names[j])

changing to this:

word_text.append(feature_names[j].replace(' ', '_'))

Post a Comment for "Creating N-grams Word Cloud Using Python"