Include "a" character in a wordcloud

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

Greg
Greg on 28 Nov 2018
Edited: Greg on 28 Nov 2018
Can you be more specific? What is a "stopword?" What is Grade A? Do you mean specifically occurrences of the letter "A" disappear? This is not the behavior I'm seeing. What release are you using?
For me, I see nothing when the number of characters in a word is more than about 40. What result are you expecting to see?
Hello Mr. Greg, Thank you for the comment. Actually I was trying to plot a wordcloud of grades obtained by students of a class of size, say 59 students. I am using Matlab's in-built wordcloud function which I believ automatically removes few characters like prepositions: a, the, of etc. including special characters under a tag called "stopword". In fact, I used a simple command as mentioned above which gives the following output:
and at the command window:
ans =
WordCloudChart with properties:
WordData: ["B" "C" "F" "D" "E" "S"]
SizeData: [18 10 8 5 1 1]
MaxDisplayWords: 100
In the output, information of Grade A has been removed automatically by the function. I want it to be included.
Greg
Greg on 28 Nov 2018
Edited: Greg on 28 Nov 2018
What release are you using, and is this core MATLAB or Text Analytics Toolbox? I am not getting anything near that behavior.
jonas
jonas on 28 Nov 2018
Edited: jonas on 28 Nov 2018
I don't think the wordcloud function recognizes different characters like that. You probably did not provide the full code? If you add a space between each grade, then I can verify that the A goes missing, for unknown reason. Odd.
My guess would be that the function wordCloudCounts does not count 'a', as you would normally prefer to have single characters excluded from your wordcloud?
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.
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');
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

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!