MATLAB Answers

Include "a" character in a wordcloud

3 views (last 30 days)
I am just trying to plot a simple wordcloud of grades which has a grade string, say,
grade='DBBBDBEFBFFASBCBABCCSBCAABBCBACDBFDBAFDAACAFAACABBFABCBAACF'
when I plot it using,
>>wordcloud(grade)
the function removes all Grade A information. How do I include the grade A in the plot?

  7 Comments

Show 4 older comments
Lairenlakpam Joyprakash Singh
As far as I know, the wordcloud function normally does not count the prepositions. I believe since the alphabet A is a preposition, the count for this letter does not happen. Just guessing, else it should have counted all letters in the first place.
Hence, I am looking for a possible solution to count this letter or any specific letter or a word in general. It would solve the issue.
Greg
Greg on 29 Nov 2018
As in Guillaume's answer, the key missing piece in the original post is the transpose. Given:
grade='DBBBDBEFBFFASBCBABCCSBCAABBCBACDBFDBAFDAACAFAACABBFABCBAACF';
The following does not work:
wordcloud(grade);
But the transpose does ("work" meaning create a word cloud, but with "A" removed):
wordcloud(grade');
Lairenlakpam Joyprakash Singh
Function takes column matrix. That's why!

Sign in to comment.

Accepted Answer

Guillaume
Guillaume on 28 Nov 2018
Edited: Guillaume on 28 Nov 2018
Bear in mind that this is with base matlab. The text analytics toolbox, which I don't have, may have some better ways of doing what you want.
I'm simply converting your char array into a categorical array. It doesn't look like wordcloud does any filtering on categorical arrays:
grade='DBBBDBEFBFFASBCBABCCSBCAABBCBACDBFDBAFDAACAFAACABBFABCBAACF'
wordcloud(categorical(cellstr(grade')))
displays

  1 Comment

Lairenlakpam Joyprakash Singh
This is what I was looking for. Thanks.

Sign in to comment.

More Answers (0)

Sign in to answer this question.