How to remove top phrases from a word cloud

5 ビュー (過去 30 日間)
Pat Canny
Pat Canny 2020 年 7 月 2 日
回答済み: Pat Canny 2020 年 7 月 2 日
I have created a set of word clouds, but want to remove some common two-word phrases that appear in each.
I tried using removeWords, but it did not appear to work!
Is there a way to see what the top phrases are so that I could check if there are any extra spaces, for instance?

採用された回答

Pat Canny
Pat Canny 2020 年 7 月 2 日
The removeWords function only removes specific words. It won't remove phrases like you might expect.
The word clouds are showing n-grams, therefore you are looking remove common n-grams. To do so, use the removeNgrams function. Each phrase should be a 1x2 string array (see the "thou art" and "thou dost" example in the removeNgrams Documentation)
If you are interested in the top n-grams in a bag-of-n-grams model (which you used to create the word cloud), you can use the topkngrams function.
Alternatively (and this is not the preferred approach), you can extract the WordData from a word cloud object:
wc = wordcloud(bag);
wordData = wc.WordData;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by