Hello. Please any one can help me with word frequency?
2 次查看(过去 30 天)
显示 更早的评论
I have a text, and after I arrange the text in a descending column, I want each frequency beside the word.
0 个评论
回答(1 个)
Walter Roberson
2017-2-20
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 个评论
Walter Roberson
2017-2-20
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Battery Pack Modeling 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!