Hello. Please any one can help me with word frequency?
2 views (last 30 days)
Show older comments
I have a text, and after I arrange the text in a descending column, I want each frequency beside the word.
0 Comments
Answers (1)
Walter Roberson
on 20 Feb 2017
Use the three output form of unique(). Use accumarray or histogram or histc to do the counting of the values from the third output of unique
2 Comments
Walter Roberson
on 20 Feb 2017
Sorry, you will need to be more specific in pointing out features of your text that make it difficult to use the procedure I outlined.
I am presuming that you have already worked out how to break the text up into "words" for your purpose, taking into account that in the string 'cold.' that the word is "cold" and "." is punctuation, but in 'E.g.,' that the word is "e.g." including "." as part of the word and "," is punctuation, but in '1,209,600' that the word is the entire string and "," is not punctuation there. But in '99.5%' is the word "99.5" and "%" is pseudo-punctuation, or is the "%" part of the word? And how about '-5%+20%', are the words "5" and "20" or "-5" and "+20" or "-5%" and "+20%" or is it all one word "-5%+20%" ?
Fortunately as you have already arranged the text in descending order, you have already worked that all out.
See Also
Categories
Find more on Battery Pack Modeling in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!